package tm-grammars

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file tm_grammar_jsonnet.ml

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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
let lang_id = "jsonnet"
let json = {json|{
  "displayName": "Jsonnet",
  "name": "jsonnet",
  "patterns": [
    {
      "include": "#expression"
    },
    {
      "include": "#keywords"
    }
  ],
  "repository": {
    "builtin-functions": {
      "patterns": [
        {
          "match": "\\bstd\\.(acos|asin|atan|ceil|char|codepoint|cos|exp|exponent)\\b",
          "name": "support.function.jsonnet"
        },
        {
          "match": "\\bstd\\.(filter|floor|force|length|log|makeArray|mantissa)\\b",
          "name": "support.function.jsonnet"
        },
        {
          "match": "\\bstd\\.(objectFields|objectHas|pow|sin|sqrt|tan|type|thisFile)\\b",
          "name": "support.function.jsonnet"
        },
        {
          "match": "\\bstd\\.(acos|asin|atan|ceil|char|codepoint|cos|exp|exponent)\\b",
          "name": "support.function.jsonnet"
        },
        {
          "match": "\\bstd\\.(abs|assertEqual|escapeString(Bash|Dollars|Json|Python))\\b",
          "name": "support.function.jsonnet"
        },
        {
          "match": "\\bstd\\.(filterMap|flattenArrays|foldl|foldr|format|join)\\b",
          "name": "support.function.jsonnet"
        },
        {
          "match": "\\bstd\\.(lines|manifest(Ini|Python(Vars)?)|map|max|min|mod)\\b",
          "name": "support.function.jsonnet"
        },
        {
          "match": "\\bstd\\.(s(?:et(Diff|Inter|Member|Union)??|ort))\\b",
          "name": "support.function.jsonnet"
        },
        {
          "match": "\\bstd\\.(range|split|stringChars|substr|toString|uniq)\\b",
          "name": "support.function.jsonnet"
        }
      ]
    },
    "comment": {
      "patterns": [
        {
          "begin": "/\\*",
          "end": "\\*/",
          "name": "comment.block.jsonnet"
        },
        {
          "match": "//.*$",
          "name": "comment.line.jsonnet"
        },
        {
          "match": "#.*$",
          "name": "comment.block.jsonnet"
        }
      ]
    },
    "double-quoted-strings": {
      "begin": "\"",
      "end": "\"",
      "name": "string.quoted.double.jsonnet",
      "patterns": [
        {
          "match": "\\\\([\"/\\\\bfnrt]|(u\\h{4}))",
          "name": "constant.character.escape.jsonnet"
        },
        {
          "match": "\\\\[^\"/\\\\bfnrtu]",
          "name": "invalid.illegal.jsonnet"
        }
      ]
    },
    "expression": {
      "patterns": [
        {
          "include": "#literals"
        },
        {
          "include": "#comment"
        },
        {
          "include": "#single-quoted-strings"
        },
        {
          "include": "#double-quoted-strings"
        },
        {
          "include": "#triple-quoted-strings"
        },
        {
          "include": "#builtin-functions"
        },
        {
          "include": "#functions"
        }
      ]
    },
    "functions": {
      "patterns": [
        {
          "begin": "\\b([A-Z_a-z][0-9A-Z_a-z]*)\\s*\\(",
          "beginCaptures": {
            "1": {
              "name": "entity.name.function.jsonnet"
            }
          },
          "end": "\\)",
          "name": "meta.function",
          "patterns": [
            {
              "include": "#expression"
            }
          ]
        }
      ]
    },
    "keywords": {
      "patterns": [
        {
          "match": "[-!%\\&*+/:<=>^|~]",
          "name": "keyword.operator.jsonnet"
        },
        {
          "match": "\\$",
          "name": "keyword.other.jsonnet"
        },
        {
          "match": "\\b(self|super|import|importstr|local|tailstrict)\\b",
          "name": "keyword.other.jsonnet"
        },
        {
          "match": "\\b(if|then|else|for|in|error|assert)\\b",
          "name": "keyword.control.jsonnet"
        },
        {
          "match": "\\b(function)\\b",
          "name": "storage.type.jsonnet"
        },
        {
          "match": "[A-Z_a-z][0-9A-Z_a-z]*\\s*(\\+??:::)",
          "name": "variable.parameter.jsonnet"
        },
        {
          "match": "[A-Z_a-z][0-9A-Z_a-z]*\\s*(\\+??::)",
          "name": "entity.name.type"
        },
        {
          "match": "[A-Z_a-z][0-9A-Z_a-z]*\\s*(\\+??:)",
          "name": "variable.parameter.jsonnet"
        }
      ]
    },
    "literals": {
      "patterns": [
        {
          "match": "\\b(true|false|null)\\b",
          "name": "constant.language.jsonnet"
        },
        {
          "match": "\\b(\\d+([Ee][-+]?\\d+)?)\\b",
          "name": "constant.numeric.jsonnet"
        },
        {
          "match": "\\b\\d+\\.\\d*([Ee][-+]?\\d+)?\\b",
          "name": "constant.numeric.jsonnet"
        },
        {
          "match": "\\b\\.\\d+([Ee][-+]?\\d+)?\\b",
          "name": "constant.numeric.jsonnet"
        }
      ]
    },
    "single-quoted-strings": {
      "begin": "'",
      "end": "'",
      "name": "string.quoted.double.jsonnet",
      "patterns": [
        {
          "match": "\\\\(['/\\\\bfnrt]|(u\\h{4}))",
          "name": "constant.character.escape.jsonnet"
        },
        {
          "match": "\\\\[^'/\\\\bfnrtu]",
          "name": "invalid.illegal.jsonnet"
        }
      ]
    },
    "triple-quoted-strings": {
      "patterns": [
        {
          "begin": "\\|\\|\\|",
          "end": "\\|\\|\\|",
          "name": "string.quoted.triple.jsonnet"
        }
      ]
    }
  },
  "scopeName": "source.jsonnet"
}|json}