File: jsonnet.yaml

package info (click to toggle)
micro 2.0.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,828 kB
  • sloc: sh: 247; makefile: 77; xml: 53
file content (92 lines) | stat: -rw-r--r-- 3,261 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
filetype: jsonnet

detect:
    filename: "\\.jsonnet$"

# Spec: https://jsonnet.org/ref/spec.html

rules:
    # built-in objects
    # FIXME: $ won't match
    - constant: "\\b(self|\\$|super)\\b"
    # boolean constants
    - constant.bool: "\\b(null|true|false)\\b"
    # the standard library
    - identifier: "\\bstd\\.(extVar|thisFile|type|length|objectHas|objectFields|objectHasAll|objectFieldsAll|prune|mapWithKey|abs|sign|max|min|pow|exp|log|exponent|mantissa|floor|ceil|sqrt|sin|cos|tan|asin|acos|atan|mod|assertEqual|toString|codepoint|char|substr|findSubstr|startsWith|endsWith|split|splitLimit|strReplace|asciiUpper|asciiLower|stringChars|format|escapeStringDollars|escapeStringPython|parseInt|parseOctal|parseHex|parseJson|encodeUTF8|decodeUTF8|manifestIni|manifestPython|manifestPythonVars|manifestJsonEx|manifestYamlDoc|manifestYamlStream|manifestXmlJsonml|makeArray|count|find|map|mapWithIndex|filterMap|filter|foldl|foldr|range|join|lines|flattenArrays|sort|uniq|set|setInter|setUnion|setDiff|setMember|base64|base64DecodeBytes|base64Decode|md5|mergePatch|trace)\\b"
    # unquoted object keys
    - type: "[_a-zA-Z][_a-zA-Z0-9]*\\s*:"
    # object key separator
    - statement: ":"
    # keywords
    - statement: "\\b(assert|else|error|for|function|if|import|importstr|in|local|tailstrict|then)\\b"
    # operators
    - symbol.operator: "([.;,+*|=!\\%]|<|>|/|-|&)"
    # parentheses
    - symbol.brackets: "([(){}]|\\[|\\])"
    # numbers
    - constant.number: "\\b(0|([1-9][0-9]*))(\\.[0-9]+)?([eE][\\+-]?[0-9]+)?\\b"

    # double-quoted string
    - constant.string:
        start: "\""
        end: "\""
        skip: "\\\\\""
        rules:
            - constant.specialChar: "\\\\u[0-9a-fA-F]{4}|\\\\[bfnrt'\"/\\\\]"

    # single-quoted string
    - constant.string:
        start: "'"
        end: "'"
        skip: "\\\\'"
        rules:
            - constant.specialChar: "\\\\u[0-9a-fA-F]{4}|\\\\[bfnrt'\"/\\\\]"

    # double-quoted verbatim string
    - constant.string:
        start: "@\""
        end: "\""
        skip: "\\\\\""
        rules:
            - constant.specialChar: "\\\\\""

    # single-quoted verbatim string
    - constant.string:
        start: "@'"
        end: "'"
        skip: "\\\\'"
        rules:
            - constant.specialChar: "\\\\'"

    # block string
    - constant.string:
        # FIXME:
        # This isn't quite right.
        # The spec says this:

        # beginning with |||, followed by optional whitespace and a new-line.
        # The next non-blank line must be prefixed with some non-zero length
        # whitespace W. The block ends at the first subsequent line that does
        # not begin with W, and it is an error if this line does not contain
        # some optional whitespace followed by |||.

        # We need to match ^(\s+) on the first non-blank line after |||
        # Then we need to skip ^\1.*$

        start: "\\|\\|\\| *$"
        end: "^ *\\|\\|\\|"
        rules: []

    # multi-line comment
    - comment:
        start: "/\\*"
        end: "\\*/"
        rules:
            - todo: "(TODO|XXX|FIXME):?"

    # single-line comment
    - comment:
        start: "#|(//)"
        end: "$"
        rules:
            - todo: "(TODO|XXX|FIXME):?"