PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.1.0
Code Block Pro – Beautiful Syntax Highlighting v1.1.0
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / build / shiki / languages / lua.tmLanguage.json

lua.tmLanguage.json in Code Block Pro – Beautiful Syntax Highlighting 1.1.0, at build/shiki/languages/lua.tmLanguage.json

802 lines 21.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 {
2 "information_for_contributors": [
3 "This file has been converted from https://github.com/sumneko/lua.tmbundle/blob/master/Syntaxes/Lua.plist",
4 "If you want to provide a fix or improvement, please create a pull request against the original repository.",
5 "Once accepted there, we are happy to receive an update request."
6 ],
7 "version": "https://github.com/sumneko/lua.tmbundle/commit/bc74f9230c3f07c0ecc1bc1727ad98d9e70aff5b",
8 "name": "lua",
9 "scopeName": "source.lua",
10 "patterns": [
11 {
12 "begin": "\\b(?:(local)\\s+)?(function)\\b(?![,:])",
13 "beginCaptures": {
14 "1": {
15 "name": "keyword.local.lua"
16 },
17 "2": {
18 "name": "keyword.control.lua"
19 }
20 },
21 "end": "(?<=[\\)\\-{}\\[\\]\"'])",
22 "name": "meta.function.lua",
23 "patterns": [
24 {
25 "include": "#comment"
26 },
27 {
28 "begin": "(\\()",
29 "beginCaptures": {
30 "1": {
31 "name": "punctuation.definition.parameters.begin.lua"
32 }
33 },
34 "end": "(\\))|(?=[\\-\\.{}\\[\\]\"'])",
35 "endCaptures": {
36 "1": {
37 "name": "punctuation.definition.parameters.finish.lua"
38 }
39 },
40 "name": "meta.parameter.lua",
41 "patterns": [
42 {
43 "include": "#comment"
44 },
45 {
46 "match": "[a-zA-Z_][a-zA-Z0-9_]*",
47 "name": "variable.parameter.function.lua"
48 },
49 {
50 "match": ",",
51 "name": "punctuation.separator.arguments.lua"
52 },
53 {
54 "begin": ":",
55 "beginCaptures": {
56 "0": {
57 "name": "punctuation.separator.arguments.lua"
58 }
59 },
60 "end": "(?=[\\),])",
61 "patterns": [
62 {
63 "include": "#luadoc.type"
64 }
65 ]
66 }
67 ]
68 },
69 {
70 "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b\\s*(?=:)",
71 "name": "entity.name.class.lua"
72 },
73 {
74 "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b",
75 "name": "entity.name.function.lua"
76 }
77 ]
78 },
79 {
80 "match": "(?<![\\w\\d.])0[xX][0-9A-Fa-f]+(\\.[0-9A-Fa-f]+)?([eE]-?\\d*)?([pP][-+]\\d+)?",
81 "name": "constant.numeric.float.hexadecimal.lua"
82 },
83 {
84 "match": "(?<![\\w\\d.])0[xX][0-9A-Fa-f]+(?![pPeE.0-9])",
85 "name": "constant.numeric.integer.hexadecimal.lua"
86 },
87 {
88 "match": "(?<![\\w\\d.])\\d+(\\.\\d+)?([eE]-?\\d*)?",
89 "name": "constant.numeric.float.lua"
90 },
91 {
92 "match": "(?<![\\w\\d.])\\d+(?![pPeE.0-9])",
93 "name": "constant.numeric.integer.lua"
94 },
95 {
96 "include": "#string"
97 },
98 {
99 "captures": {
100 "1": {
101 "name": "punctuation.definition.comment.lua"
102 }
103 },
104 "match": "\\A(#!).*$\\n?",
105 "name": "comment.line.shebang.lua"
106 },
107 {
108 "include": "#comment"
109 },
110 {
111 "captures": {
112 "1": {
113 "name": "keyword.control.goto.lua"
114 },
115 "2": {
116 "name": "string.tag.lua"
117 }
118 },
119 "match": "\\b(goto)\\s+([a-zA-Z_][a-zA-Z0-9_]*)"
120 },
121 {
122 "captures": {
123 "1": {
124 "name": "punctuation.section.embedded.begin.lua"
125 },
126 "2": {
127 "name": "punctuation.section.embedded.end.lua"
128 }
129 },
130 "match": "(::)\\s*[a-zA-Z_][a-zA-Z0-9_]*\\s*(::)",
131 "name": "string.tag.lua"
132 },
133 {
134 "match": "<\\s*(const|close)\\s*>",
135 "captures": {
136 "1": {
137 "name": "string.tag.lua"
138 }
139 }
140 },
141 {
142 "match": "\\<[a-zA-Z_\\*][a-zA-Z0-9_\\.\\*\\-]*\\>",
143 "name": "storage.type.generic.lua"
144 },
145 {
146 "match": "\\b(break|do|else|for|if|elseif|goto|return|then|repeat|while|until|end|in)\\b",
147 "name": "keyword.control.lua"
148 },
149 {
150 "match": "\\b(local|global)\\b",
151 "name": "keyword.local.lua"
152 },
153 {
154 "match": "\\b(function)\\b(?![,:])",
155 "name": "keyword.control.lua"
156 },
157 {
158 "match": "(?<![^.]\\.|:)\\b(false|nil(?!:)|true|_ENV|_G|_VERSION|math\\.(pi|huge|maxinteger|mininteger)|utf8\\.charpattern|io\\.(stdin|stdout|stderr)|package\\.(config|cpath|loaded|loaders|path|preload|searchers))\\b|(?<![.])\\.{3}(?!\\.)",
159 "name": "constant.language.lua"
160 },
161 {
162 "match": "(?<![^.]\\.|:)\\b(self)\\b",
163 "name": "variable.language.self.lua"
164 },
165 {
166 "match": "(?<![^.]\\.|:)\\b(assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|loadstring|module|next|pairs|pcall|print|rawequal|rawget|rawlen|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\\b(?!\\s*=(?!=))",
167 "name": "support.function.lua"
168 },
169 {
170 "match": "(?<![^.]\\.|:)\\b(async)\\b(?!\\s*=(?!=))",
171 "name": "entity.name.tag.lua"
172 },
173 {
174 "match": "(?<![^.]\\.|:)\\b(coroutine\\.(create|isyieldable|close|resume|running|status|wrap|yield)|string\\.(byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)|table\\.(concat|insert|maxn|move|pack|remove|sort|unpack)|math\\.(abs|acos|asin|atan2?|ceil|cosh?|deg|exp|floor|fmod|frexp|ldexp|log|log10|max|min|modf|pow|rad|random|randomseed|sinh?|sqrt|tanh?|tointeger|type)|io\\.(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)|os\\.(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)|package\\.(loadlib|seeall|searchpath)|debug\\.(debug|[gs]etfenv|[gs]ethook|getinfo|[gs]etlocal|[gs]etmetatable|getregistry|[gs]etupvalue|[gs]etuservalue|set[Cc]stacklimit|traceback|upvalueid|upvaluejoin)|bit32\\.(arshift|band|bnot|bor|btest|bxor|extract|replace|lrotate|lshift|rrotate|rshift)|utf8\\.(char|codes|codepoint|len|offset))\\b(?!\\s*=(?!=))",
175 "name": "support.function.library.lua"
176 },
177 {
178 "match": "\\b(and|or|not|\\|\\||\\&\\&|\\!)\\b",
179 "name": "keyword.operator.lua"
180 },
181 {
182 "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b(?=\\s*(?:[({\"']|\\[\\[))",
183 "name": "support.function.any-method.lua"
184 },
185 {
186 "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b(?=\\s*\\??:)",
187 "name": "entity.name.class.lua"
188 },
189 {
190 "match": "(?<=[^.]\\.|:)\\b([a-zA-Z_][a-zA-Z0-9_]*)",
191 "name": "entity.other.attribute.lua"
192 },
193 {
194 "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b",
195 "name": "variable.other.lua"
196 },
197 {
198 "match": "\\+|-|%|#|\\*|\\/|\\^|==?|~=|!=|<=?|>=?|(?<!\\.)\\.{2}(?!\\.)",
199 "name": "keyword.operator.lua"
200 }
201 ],
202 "repository": {
203 "escaped_char": {
204 "patterns": [
205 {
206 "match": "\\\\[abfnrtv\\\\\"'\\n]",
207 "name": "constant.character.escape.lua"
208 },
209 {
210 "match": "\\\\z[\\n\\t ]*",
211 "name": "constant.character.escape.lua"
212 },
213 {
214 "match": "\\\\\\d{1,3}",
215 "name": "constant.character.escape.byte.lua"
216 },
217 {
218 "match": "\\\\x[0-9A-Fa-f][0-9A-Fa-f]",
219 "name": "constant.character.escape.byte.lua"
220 },
221 {
222 "match": "\\\\u\\{[0-9A-Fa-f]+\\}",
223 "name": "constant.character.escape.unicode.lua"
224 },
225 {
226 "match": "\\\\.",
227 "name": "invalid.illegal.character.escape.lua"
228 }
229 ]
230 },
231 "string": {
232 "patterns": [
233 {
234 "begin": "'",
235 "beginCaptures": {
236 "0": {
237 "name": "punctuation.definition.string.begin.lua"
238 }
239 },
240 "end": "'[ \\t]*|(?=\\n)",
241 "endCaptures": {
242 "0": {
243 "name": "punctuation.definition.string.end.lua"
244 }
245 },
246 "name": "string.quoted.single.lua",
247 "patterns": [
248 {
249 "include": "#escaped_char"
250 }
251 ]
252 },
253 {
254 "begin": "\"",
255 "beginCaptures": {
256 "0": {
257 "name": "punctuation.definition.string.begin.lua"
258 }
259 },
260 "end": "\"[ \\t]*|(?=\\n)",
261 "endCaptures": {
262 "0": {
263 "name": "punctuation.definition.string.end.lua"
264 }
265 },
266 "name": "string.quoted.double.lua",
267 "patterns": [
268 {
269 "include": "#escaped_char"
270 }
271 ]
272 },
273 {
274 "begin": "`",
275 "beginCaptures": {
276 "0": {
277 "name": "punctuation.definition.string.begin.lua"
278 }
279 },
280 "end": "`[ \\t]*|(?=\\n)",
281 "endCaptures": {
282 "0": {
283 "name": "punctuation.definition.string.end.lua"
284 }
285 },
286 "name": "string.quoted.double.lua"
287 },
288 {
289 "begin": "(?<=\\.cdef)\\s*(\\[(=*)\\[)",
290 "beginCaptures": {
291 "0": {
292 "name": "string.quoted.other.multiline.lua"
293 },
294 "1": {
295 "name": "punctuation.definition.string.begin.lua"
296 }
297 },
298 "contentName": "meta.embedded.lua",
299 "end": "(\\]\\2\\])[ \\t]*",
300 "endCaptures": {
301 "0": {
302 "name": "string.quoted.other.multiline.lua"
303 },
304 "1": {
305 "name": "punctuation.definition.string.end.lua"
306 }
307 },
308 "patterns": [
309 {
310 "include": "source.c"
311 }
312 ]
313 },
314 {
315 "begin": "(?<!--)\\[(=*)\\[",
316 "beginCaptures": {
317 "0": {
318 "name": "punctuation.definition.string.begin.lua"
319 }
320 },
321 "end": "\\]\\1\\][ \\t]*",
322 "endCaptures": {
323 "0": {
324 "name": "punctuation.definition.string.end.lua"
325 }
326 },
327 "name": "string.quoted.other.multiline.lua"
328 }
329 ]
330 },
331 "comment": {
332 "patterns": [
333 {
334 "begin": "(^[ \\t]+)?(?=--)",
335 "beginCaptures": {
336 "1": {
337 "name": "punctuation.whitespace.comment.leading.lua"
338 }
339 },
340 "end": "(?!\\G)((?!^)[ \\t]+\\n)?",
341 "endCaptures": {
342 "1": {
343 "name": "punctuation.whitespace.comment.trailing.lua"
344 }
345 },
346 "patterns": [
347 {
348 "begin": "--\\[(=*)\\[",
349 "beginCaptures": {
350 "0": {
351 "name": "punctuation.definition.comment.begin.lua"
352 }
353 },
354 "end": "\\]\\1\\]",
355 "endCaptures": {
356 "0": {
357 "name": "punctuation.definition.comment.end.lua"
358 }
359 },
360 "name": "comment.block.lua"
361 },
362 {
363 "begin": "----",
364 "beginCaptures": {
365 "0": {
366 "name": "punctuation.definition.comment.lua"
367 }
368 },
369 "end": "\\n",
370 "name": "comment.line.double-dash.lua"
371 },
372 {
373 "begin": "---",
374 "beginCaptures": {
375 "0": {
376 "name": "punctuation.definition.comment.lua"
377 }
378 },
379 "end": "\\n",
380 "name": "comment.line.double-dash.doc.lua",
381 "patterns": [
382 {
383 "include": "#luadoc"
384 }
385 ]
386 },
387 {
388 "begin": "--",
389 "beginCaptures": {
390 "0": {
391 "name": "punctuation.definition.comment.lua"
392 }
393 },
394 "end": "\\n",
395 "name": "comment.line.double-dash.lua"
396 }
397 ]
398 },
399 {
400 "begin": "\\/\\*",
401 "beginCaptures": {
402 "0": {
403 "name": "punctuation.definition.comment.begin.lua"
404 }
405 },
406 "end": "\\*\\/",
407 "endCaptures": {
408 "0": {
409 "name": "punctuation.definition.comment.end.lua"
410 }
411 },
412 "name": "comment.block.lua"
413 }
414 ]
415 },
416 "luadoc": {
417 "patterns": [
418 {
419 "begin": "(?<=---\\s*)@class",
420 "beginCaptures": {
421 "0": {
422 "name": "storage.type.annotation.lua"
423 }
424 },
425 "end": "(?=[\\n@#])",
426 "patterns": [
427 {
428 "match": "\\b([a-zA-Z_\\*][a-zA-Z0-9_\\.\\*\\-]*)",
429 "name": "support.class.lua"
430 },
431 {
432 "match": ":|,",
433 "name": "keyword.operator.lua"
434 }
435 ]
436 },
437 {
438 "begin": "(?<=---\\s*)@type",
439 "beginCaptures": {
440 "0": {
441 "name": "storage.type.annotation.lua"
442 }
443 },
444 "end": "(?=[\\n@#])",
445 "patterns": [
446 {
447 "include": "#luadoc.type"
448 }
449 ]
450 },
451 {
452 "begin": "(?<=---\\s*)@alias",
453 "beginCaptures": {
454 "0": {
455 "name": "storage.type.annotation.lua"
456 }
457 },
458 "end": "(?=[\\n@#])",
459 "patterns": [
460 {
461 "begin": "\\b([a-zA-Z_\\*][a-zA-Z0-9_\\.\\*\\-]*)",
462 "beginCaptures": {
463 "0": {
464 "name": "variable.lua"
465 }
466 },
467 "end": "(?=\\n)",
468 "patterns": [
469 {
470 "include": "#luadoc.type"
471 }
472 ]
473 }
474 ]
475 },
476 {
477 "begin": "(?<=---\\s*)@param",
478 "beginCaptures": {
479 "0": {
480 "name": "storage.type.annotation.lua"
481 }
482 },
483 "end": "(?=[\\n@#])",
484 "patterns": [
485 {
486 "begin": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b(\\??)",
487 "beginCaptures": {
488 "1": {
489 "name": "entity.name.variable.lua"
490 },
491 "2": {
492 "name": "keyword.operator.lua"
493 }
494 },
495 "end": "(?=\\n)",
496 "patterns": [
497 {
498 "include": "#luadoc.type"
499 }
500 ]
501 }
502 ]
503 },
504 {
505 "begin": "(?<=---\\s*)@return",
506 "beginCaptures": {
507 "0": {
508 "name": "storage.type.annotation.lua"
509 }
510 },
511 "end": "(?=[\\n@#])",
512 "patterns": [
513 {
514 "match": "\\?",
515 "name": "keyword.operator.lua"
516 },
517 {
518 "include": "#luadoc.type"
519 }
520 ]
521 },
522 {
523 "begin": "(?<=---\\s*)@field",
524 "beginCaptures": {
525 "0": {
526 "name": "storage.type.annotation.lua"
527 }
528 },
529 "end": "(?=[\\n@#])",
530 "patterns": [
531 {
532 "begin": "(\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b|(\\[))(\\??)",
533 "beginCaptures": {
534 "2": {
535 "name": "entity.name.variable.lua"
536 },
537 "3": {
538 "name": "keyword.operator.lua"
539 }
540 },
541 "end": "(?=\\n)",
542 "patterns": [
543 {
544 "include": "#string"
545 },
546 {
547 "include": "#luadoc.type"
548 },
549 {
550 "match": "\\]",
551 "name": "keyword.operator.lua"
552 }
553 ]
554 }
555 ]
556 },
557 {
558 "begin": "(?<=---\\s*)@generic",
559 "beginCaptures": {
560 "0": {
561 "name": "storage.type.annotation.lua"
562 }
563 },
564 "end": "(?=[\\n@#])",
565 "patterns": [
566 {
567 "begin": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b",
568 "beginCaptures": {
569 "0": {
570 "name": "storage.type.generic.lua"
571 }
572 },
573 "end": "(?=\\n)|(,)",
574 "endCaptures": {
575 "0": {
576 "name": "keyword.operator.lua"
577 }
578 },
579 "patterns": [
580 {
581 "match": ":",
582 "name": "keyword.operator.lua"
583 },
584 {
585 "include": "#luadoc.type"
586 }
587 ]
588 }
589 ]
590 },
591 {
592 "begin": "(?<=---\\s*)@vararg",
593 "beginCaptures": {
594 "0": {
595 "name": "storage.type.annotation.lua"
596 }
597 },
598 "end": "(?=[\\n@#])",
599 "patterns": [
600 {
601 "include": "#luadoc.type"
602 }
603 ]
604 },
605 {
606 "begin": "(?<=---\\s*)@overload",
607 "beginCaptures": {
608 "0": {
609 "name": "storage.type.annotation.lua"
610 }
611 },
612 "end": "(?=[\\n@#])",
613 "patterns": [
614 {
615 "include": "#luadoc.type"
616 }
617 ]
618 },
619 {
620 "begin": "(?<=---\\s*)@deprecated",
621 "beginCaptures": {
622 "0": {
623 "name": "storage.type.annotation.lua"
624 }
625 },
626 "end": "(?=[\\n@#])"
627 },
628 {
629 "begin": "(?<=---\\s*)@meta",
630 "beginCaptures": {
631 "0": {
632 "name": "storage.type.annotation.lua"
633 }
634 },
635 "end": "(?=[\\n@#])"
636 },
637 {
638 "begin": "(?<=---\\s*)@version",
639 "beginCaptures": {
640 "0": {
641 "name": "storage.type.annotation.lua"
642 }
643 },
644 "end": "(?=[\\n@#])",
645 "patterns": [
646 {
647 "match": "\\b(5\\.1|5\\.2|5\\.3|5\\.4|JIT)\\b",
648 "name": "support.class.lua"
649 },
650 {
651 "match": ",|\\>|\\<",
652 "name": "keyword.operator.lua"
653 }
654 ]
655 },
656 {
657 "begin": "(?<=---\\s*)@see",
658 "beginCaptures": {
659 "0": {
660 "name": "storage.type.annotation.lua"
661 }
662 },
663 "end": "(?=[\\n@#])",
664 "patterns": [
665 {
666 "match": "\\b([a-zA-Z_\\*][a-zA-Z0-9_\\.\\*\\-]*)",
667 "name": "support.class.lua"
668 },
669 {
670 "match": "#",
671 "name": "keyword.operator.lua"
672 }
673 ]
674 },
675 {
676 "begin": "(?<=---\\s*)@diagnostic",
677 "beginCaptures": {
678 "0": {
679 "name": "storage.type.annotation.lua"
680 }
681 },
682 "end": "(?=[\\n@#])",
683 "patterns": [
684 {
685 "begin": "([a-zA-Z_\\-0-9]+)[ \\t]*(:)?",
686 "beginCaptures": {
687 "1": {
688 "name": "keyword.other.unit"
689 },
690 "2": {
691 "name": "keyword.operator.unit"
692 }
693 },
694 "end": "(?=\\n)",
695 "patterns": [
696 {
697 "match": "\\b([a-zA-Z_\\*][a-zA-Z0-9_\\-]*)",
698 "name": "support.class.lua"
699 },
700 {
701 "match": ",",
702 "name": "keyword.operator.lua"
703 }
704 ]
705 }
706 ]
707 },
708 {
709 "begin": "(?<=---\\s*)@module",
710 "beginCaptures": {
711 "0": {
712 "name": "storage.type.annotation.lua"
713 }
714 },
715 "end": "(?=[\\n@#])",
716 "patterns": [
717 {
718 "include": "#string"
719 }
720 ]
721 },
722 {
723 "match": "(?<=---\\s*)@(async|nodiscard)",
724 "name": "storage.type.annotation.lua"
725 },
726 {
727 "begin": "(?<=---)\\|\\s*[\\>\\+]?",
728 "beginCaptures": {
729 "0": {
730 "name": "storage.type.annotation.lua"
731 }
732 },
733 "end": "(?=[\\n@#])",
734 "patterns": [
735 {
736 "include": "#string"
737 }
738 ]
739 }
740 ]
741 },
742 "luadoc.type": {
743 "patterns": [
744 {
745 "begin": "\\bfun\\b",
746 "beginCaptures": {
747 "0": {
748 "name": "keyword.control.lua"
749 }
750 },
751 "end": "(?=\\s)",
752 "patterns": [
753 {
754 "match": "[\\(\\),:\\?][ \\t]*",
755 "name": "keyword.operator.lua"
756 },
757 {
758 "match": "([a-zA-Z_][a-zA-Z0-9_\\.\\*\\[\\]\\<\\>\\,\\-]*)(?<!,)[ \\t]*(?=\\??:)",
759 "name": "entity.name.variable.lua"
760 },
761 {
762 "include": "#luadoc.type"
763 },
764 {
765 "include": "#string"
766 }
767 ]
768 },
769 {
770 "match": "\\<[a-zA-Z_\\*][a-zA-Z0-9_\\.\\*\\-]*\\>",
771 "name": "storage.type.generic.lua"
772 },
773 {
774 "match": "\\basync\\b",
775 "name": "entity.name.tag.lua"
776 },
777 {
778 "match": "[\\{\\}\\:\\,\\?\\|\\`][ \\t]*",
779 "name": "keyword.operator.lua"
780 },
781 {
782 "begin": "(?=[a-zA-Z_\\.\\*\"'\\[])",
783 "end": "(?=[\\s\\)\\,\\?\\:\\}\\|])",
784 "patterns": [
785 {
786 "match": "([a-zA-Z0-9_\\.\\*\\[\\]\\<\\>\\,\\-]+)(?<!,)[ \\t]*",
787 "name": "support.type.lua"
788 },
789 {
790 "match": "(\\.\\.\\.)[ \\t]*",
791 "name": "constant.language.lua"
792 },
793 {
794 "include": "#string"
795 }
796 ]
797 }
798 ]
799 }
800 }
801 }
802