Source file tm_grammar_kdl.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
213
214
let lang_id = "kdl"
let json = {json|{
  "displayName": "KDL",
  "name": "kdl",
  "patterns": [
    {
      "include": "#forbidden_ident"
    },
    {
      "include": "#null"
    },
    {
      "include": "#boolean"
    },
    {
      "include": "#float_keyword"
    },
    {
      "include": "#float_fraction"
    },
    {
      "include": "#float_exp"
    },
    {
      "include": "#decimal"
    },
    {
      "include": "#hexadecimal"
    },
    {
      "include": "#octal"
    },
    {
      "include": "#binary"
    },
    {
      "include": "#raw-string"
    },
    {
      "include": "#string_multi_line"
    },
    {
      "include": "#string_single_line"
    },
    {
      "include": "#block_comment"
    },
    {
      "include": "#block_doc_comment"
    },
    {
      "include": "#slashdash_block_comment"
    },
    {
      "include": "#slashdash_comment"
    },
    {
      "include": "#slashdash_node_comment"
    },
    {
      "include": "#slashdash_node_with_children_comment"
    },
    {
      "include": "#line_comment"
    },
    {
      "include": "#attribute"
    },
    {
      "include": "#node_name"
    },
    {
      "include": "#ident_string"
    }
  ],
  "repository": {
    "attribute": {
      "captures": {
        "1": {
          "name": "punctuation.separator.key-value.kdl"
        }
      },
      "match": "(?![]#/;=\\[\\\\{}])[!$-.:<>?@^_`|~\\w]+\\d*[!$-.:<>?@^_`|~\\w]*(=)",
      "name": "entity.other.attribute-name.kdl"
    },
    "binary": {
      "match": "\\b0b[01][01_]*\\b",
      "name": "constant.numeric.integer.binary.rust"
    },
    "block_comment": {
      "begin": "/\\*",
      "end": "\\*/",
      "name": "comment.block.kdl",
      "patterns": [
        {
          "include": "#block_doc_comment"
        },
        {
          "include": "#block_comment"
        }
      ]
    },
    "block_doc_comment": {
      "begin": "/\\*[!*](?![*/])",
      "end": "\\*/",
      "name": "comment.block.documentation.kdl",
      "patterns": [
        {
          "include": "#block_doc_comment"
        },
        {
          "include": "#block_comment"
        }
      ]
    },
    "boolean": {
      "match": "#(?:true|false)",
      "name": "constant.language.boolean.kdl"
    },
    "decimal": {
      "match": "\\b[-+0-9][0-9_]*\\b",
      "name": "constant.numeric.integer.decimal.rust"
    },
    "float_exp": {
      "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?[Ee][-+]?[0-9_]+\\b",
      "name": "constant.numeric.float.rust"
    },
    "float_fraction": {
      "match": "\\b([-+0-9])[0-9_]*\\.[0-9][0-9_]*([Ee][-+]?[0-9_]+)?\\b",
      "name": "constant.numeric.float.rust"
    },
    "float_keyword": {
      "match": "#(?:nan|inf|-inf)",
      "name": "constant.language.other.kdl"
    },
    "forbidden_ident": {
      "match": "(?<!#)(?:true|false|null|nan|-?inf)",
      "name": "invalid.illegal.kdl.bad-ident"
    },
    "hexadecimal": {
      "match": "\\b0x\\h[_\\h]*\\b",
      "name": "constant.numeric.integer.hexadecimal.rust"
    },
    "ident_string": {
      "match": "(?![]#/;=\\[\\\\{}])[!$-.:<>?@^_`|~\\w]+\\d*[!$-.:<>?@^_`|~\\w]*",
      "name": "string.unquoted"
    },
    "line_comment": {
      "begin": "//",
      "end": "$",
      "name": "comment.line.double-slash.kdl"
    },
    "node_name": {
      "match": "((?<=[;{])|^)\\s*(?![]#/;=\\[\\\\{}])[!$-.:<>?@^_`|~\\w]+\\d*[!$-.:<>?@^_`|~\\w]*",
      "name": "entity.name.tag"
    },
    "null": {
      "match": "#null",
      "name": "constant.language.null.kdl"
    },
    "octal": {
      "match": "\\b0o[0-7][0-7_]*\\b",
      "name": "constant.numeric.integer.octal.rust"
    },
    "raw-string": {
      "begin": "(#+)(\"(?:\"\"|))",
      "end": "\\2\\1",
      "name": "string.quoted.other.raw.kdl"
    },
    "slashdash_block_comment": {
      "begin": "/-\\s*\\{",
      "end": "}",
      "name": "comment.block.slashdash.kdl"
    },
    "slashdash_comment": {
      "begin": "(?<!^)\\s*/-\\s*",
      "end": "\\s",
      "name": "comment.block.slashdash.kdl"
    },
    "slashdash_node_comment": {
      "begin": "(?<=^)\\s*/-[^{]+$",
      "end": ";|(?<!\\\\)$",
      "name": "comment.block.slashdash.kdl"
    },
    "slashdash_node_with_children_comment": {
      "begin": "(?<=^)\\s*/-[^{]+\\{",
      "end": "}",
      "name": "comment.block.slashdash.kdl"
    },
    "string_multi_line": {
      "begin": "\"\"\"",
      "end": "\"\"\"",
      "name": "string.quoted.triple.kdl",
      "patterns": [
        {
          "match": "\\\\(:?[\"\\\\bfnrst]|u\\{\\h{1,6}})",
          "name": "constant.character.escape.kdl"
        }
      ]
    },
    "string_single_line": {
      "begin": "\"",
      "end": "\"",
      "name": "string.quoted.double.kdl",
      "patterns": [
        {
          "match": "\\\\(:?[\"\\\\bfnrst]|u\\{\\h{1,6}})",
          "name": "constant.character.escape.kdl"
        }
      ]
    }
  },
  "scopeName": "source.kdl"
}|json}