Skip to content

Commit cb81126

Browse files
committed
更新 luadoc 的语法高亮
1 parent 0c53431 commit cb81126

File tree

1 file changed

+203
-79
lines changed

1 file changed

+203
-79
lines changed

syntaxes/lua.tmLanguage.json

Lines changed: 203 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -73,85 +73,7 @@
7373
"name": "constant.numeric.integer.lua"
7474
},
7575
{
76-
"begin": "'",
77-
"beginCaptures": {
78-
"0": {
79-
"name": "punctuation.definition.string.begin.lua"
80-
}
81-
},
82-
"end": "'",
83-
"endCaptures": {
84-
"0": {
85-
"name": "punctuation.definition.string.end.lua"
86-
}
87-
},
88-
"name": "string.quoted.single.lua",
89-
"patterns": [
90-
{
91-
"include": "#escaped_char"
92-
}
93-
]
94-
},
95-
{
96-
"begin": "\"",
97-
"beginCaptures": {
98-
"0": {
99-
"name": "punctuation.definition.string.begin.lua"
100-
}
101-
},
102-
"end": "\"",
103-
"endCaptures": {
104-
"0": {
105-
"name": "punctuation.definition.string.end.lua"
106-
}
107-
},
108-
"name": "string.quoted.double.lua",
109-
"patterns": [
110-
{
111-
"include": "#escaped_char"
112-
}
113-
]
114-
},
115-
{
116-
"begin": "(?<=\\.cdef)\\s*(\\[(=*)\\[)",
117-
"beginCaptures": {
118-
"0": {
119-
"name": "string.quoted.other.multiline.lua"
120-
},
121-
"1": {
122-
"name": "punctuation.definition.string.begin.lua"
123-
}
124-
},
125-
"contentName": "meta.embedded.lua",
126-
"end": "(\\]\\2\\])",
127-
"endCaptures": {
128-
"0": {
129-
"name": "string.quoted.other.multiline.lua"
130-
},
131-
"1": {
132-
"name": "punctuation.definition.string.end.lua"
133-
}
134-
},
135-
"patterns": [
136-
{
137-
"include": "source.c"
138-
}
139-
]
140-
},
141-
{
142-
"begin": "(?<!--)\\[(=*)\\[",
143-
"beginCaptures": {
144-
"0": {
145-
"name": "punctuation.definition.string.begin.lua"
146-
}
147-
},
148-
"end": "\\]\\1\\]",
149-
"endCaptures": {
150-
"0": {
151-
"name": "punctuation.definition.string.end.lua"
152-
}
153-
},
154-
"name": "string.quoted.other.multiline.lua"
76+
"include": "#string"
15577
},
15678
{
15779
"captures": {
@@ -270,6 +192,91 @@
270192
}
271193
]
272194
},
195+
"string": {
196+
"patterns": [
197+
{
198+
"begin": "'",
199+
"beginCaptures": {
200+
"0": {
201+
"name": "punctuation.definition.string.begin.lua"
202+
}
203+
},
204+
"end": "'",
205+
"endCaptures": {
206+
"0": {
207+
"name": "punctuation.definition.string.end.lua"
208+
}
209+
},
210+
"name": "string.quoted.single.lua",
211+
"patterns": [
212+
{
213+
"include": "#escaped_char"
214+
}
215+
]
216+
},
217+
{
218+
"begin": "\"",
219+
"beginCaptures": {
220+
"0": {
221+
"name": "punctuation.definition.string.begin.lua"
222+
}
223+
},
224+
"end": "\"",
225+
"endCaptures": {
226+
"0": {
227+
"name": "punctuation.definition.string.end.lua"
228+
}
229+
},
230+
"name": "string.quoted.double.lua",
231+
"patterns": [
232+
{
233+
"include": "#escaped_char"
234+
}
235+
]
236+
},
237+
{
238+
"begin": "(?<=\\.cdef)\\s*(\\[(=*)\\[)",
239+
"beginCaptures": {
240+
"0": {
241+
"name": "string.quoted.other.multiline.lua"
242+
},
243+
"1": {
244+
"name": "punctuation.definition.string.begin.lua"
245+
}
246+
},
247+
"contentName": "meta.embedded.lua",
248+
"end": "(\\]\\2\\])",
249+
"endCaptures": {
250+
"0": {
251+
"name": "string.quoted.other.multiline.lua"
252+
},
253+
"1": {
254+
"name": "punctuation.definition.string.end.lua"
255+
}
256+
},
257+
"patterns": [
258+
{
259+
"include": "source.c"
260+
}
261+
]
262+
},
263+
{
264+
"begin": "(?<!--)\\[(=*)\\[",
265+
"beginCaptures": {
266+
"0": {
267+
"name": "punctuation.definition.string.begin.lua"
268+
}
269+
},
270+
"end": "\\]\\1\\]",
271+
"endCaptures": {
272+
"0": {
273+
"name": "punctuation.definition.string.end.lua"
274+
}
275+
},
276+
"name": "string.quoted.other.multiline.lua"
277+
}
278+
]
279+
},
273280
"comment": {
274281
"patterns": [
275282
{
@@ -301,6 +308,21 @@
301308
},
302309
"name": "comment.block.lua"
303310
},
311+
{
312+
"begin": "---",
313+
"beginCaptures": {
314+
"0": {
315+
"name": "punctuation.definition.comment.lua"
316+
}
317+
},
318+
"end": "\\n",
319+
"name": "comment.line.double-dash.lua",
320+
"patterns": [
321+
{
322+
"include": "#luadoc"
323+
}
324+
]
325+
},
304326
{
305327
"begin": "--",
306328
"beginCaptures": {
@@ -314,6 +336,108 @@
314336
]
315337
}
316338
]
339+
},
340+
"luadoc": {
341+
"patterns": [
342+
{
343+
"begin": "@class",
344+
"beginCaptures": {
345+
"0": {
346+
"name": "storage.type.annotation.lua"
347+
}
348+
},
349+
"end": "(?=\\n)",
350+
"patterns": [
351+
{
352+
"match": "\\b([a-zA-Z_][a-zA-Z0-9_\\.]*)\\b",
353+
"name": "support.class.lua"
354+
},
355+
{
356+
"match": ":",
357+
"name": "keyword.operator.lua"
358+
}
359+
]
360+
},
361+
{
362+
"begin": "@type",
363+
"beginCaptures": {
364+
"0": {
365+
"name": "storage.type.annotation.lua"
366+
}
367+
},
368+
"end": "(?=\\n)",
369+
"patterns": [
370+
{
371+
"include": "#luadoc.type"
372+
}
373+
]
374+
},
375+
{
376+
"begin": "@alias",
377+
"beginCaptures": {
378+
"0": {
379+
"name": "storage.type.annotation.lua"
380+
}
381+
},
382+
"end": "(?=\\n)",
383+
"patterns": [
384+
{
385+
"begin": "\\b([a-zA-Z_][a-zA-Z0-9_\\.]*)\\b",
386+
"beginCaptures": {
387+
"0": {
388+
"name": "variable.lua"
389+
}
390+
},
391+
"end": "(?=\\n)",
392+
"patterns": [
393+
{
394+
"include": "#luadoc.type"
395+
}
396+
]
397+
}
398+
]
399+
},
400+
{
401+
"begin": "@param",
402+
"beginCaptures": {
403+
"0": {
404+
"name": "storage.type.annotation.lua"
405+
}
406+
},
407+
"end": "(?=\\n)",
408+
"patterns": [
409+
{
410+
"begin": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b",
411+
"beginCaptures": {
412+
"0": {
413+
"name": "variable.lua"
414+
}
415+
},
416+
"end": "(?=\\n)",
417+
"patterns": [
418+
{
419+
"include": "#luadoc.type"
420+
}
421+
]
422+
}
423+
]
424+
}
425+
]
426+
},
427+
"luadoc.type": {
428+
"patterns": [
429+
{
430+
"match": "\\b([a-zA-Z_][a-zA-Z0-9_\\.]*)\\b",
431+
"name": "support.type.lua"
432+
},
433+
{
434+
"match": "\\|",
435+
"name": "keyword.operator.lua"
436+
},
437+
{
438+
"include": "#string"
439+
}
440+
]
317441
}
318442
}
319443
}

0 commit comments

Comments
 (0)