@scalar/highlight 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +324 -0
- package/dist/all.d.ts +28 -0
- package/dist/all.d.ts.map +1 -0
- package/dist/all.js +105 -0
- package/dist/compat/hljs.d.ts +24 -0
- package/dist/compat/hljs.d.ts.map +1 -0
- package/dist/compat/hljs.js +95 -0
- package/dist/compat/index.d.ts +24 -0
- package/dist/compat/index.d.ts.map +1 -0
- package/dist/compat/index.js +21 -0
- package/dist/compat/languages.d.ts +46 -0
- package/dist/compat/languages.d.ts.map +1 -0
- package/dist/compat/languages.js +236 -0
- package/dist/compat/syntax-highlight.d.ts +37 -0
- package/dist/compat/syntax-highlight.d.ts.map +1 -0
- package/dist/compat/syntax-highlight.js +133 -0
- package/dist/core/compile.d.ts +3 -0
- package/dist/core/compile.d.ts.map +1 -0
- package/dist/core/compile.js +142 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +5 -0
- package/dist/core/registry.d.ts +14 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/registry.js +77 -0
- package/dist/core/render.d.ts +67 -0
- package/dist/core/render.d.ts.map +1 -0
- package/dist/core/render.js +216 -0
- package/dist/core/scopes.d.ts +94 -0
- package/dist/core/scopes.d.ts.map +1 -0
- package/dist/core/scopes.js +113 -0
- package/dist/core/tokenize.d.ts +18 -0
- package/dist/core/tokenize.d.ts.map +1 -0
- package/dist/core/tokenize.js +131 -0
- package/dist/core/types.d.ts +99 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +10 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/langs/bash.d.ts +4 -0
- package/dist/langs/bash.d.ts.map +1 -0
- package/dist/langs/bash.js +123 -0
- package/dist/langs/c.d.ts +4 -0
- package/dist/langs/c.d.ts.map +1 -0
- package/dist/langs/c.js +196 -0
- package/dist/langs/clojure.d.ts +4 -0
- package/dist/langs/clojure.d.ts.map +1 -0
- package/dist/langs/clojure.js +213 -0
- package/dist/langs/cpp.d.ts +4 -0
- package/dist/langs/cpp.d.ts.map +1 -0
- package/dist/langs/cpp.js +391 -0
- package/dist/langs/csharp.d.ts +4 -0
- package/dist/langs/csharp.d.ts.map +1 -0
- package/dist/langs/csharp.js +307 -0
- package/dist/langs/css.d.ts +4 -0
- package/dist/langs/css.d.ts.map +1 -0
- package/dist/langs/css.js +94 -0
- package/dist/langs/dart.d.ts +4 -0
- package/dist/langs/dart.d.ts.map +1 -0
- package/dist/langs/dart.js +262 -0
- package/dist/langs/diff.d.ts +10 -0
- package/dist/langs/diff.d.ts.map +1 -0
- package/dist/langs/diff.js +26 -0
- package/dist/langs/dockerfile.d.ts +4 -0
- package/dist/langs/dockerfile.d.ts.map +1 -0
- package/dist/langs/dockerfile.js +308 -0
- package/dist/langs/elixir.d.ts +4 -0
- package/dist/langs/elixir.d.ts.map +1 -0
- package/dist/langs/elixir.js +343 -0
- package/dist/langs/fsharp.d.ts +4 -0
- package/dist/langs/fsharp.d.ts.map +1 -0
- package/dist/langs/fsharp.js +330 -0
- package/dist/langs/go.d.ts +5 -0
- package/dist/langs/go.d.ts.map +1 -0
- package/dist/langs/go.js +90 -0
- package/dist/langs/graphql.d.ts +4 -0
- package/dist/langs/graphql.d.ts.map +1 -0
- package/dist/langs/graphql.js +185 -0
- package/dist/langs/haskell.d.ts +4 -0
- package/dist/langs/haskell.d.ts.map +1 -0
- package/dist/langs/haskell.js +375 -0
- package/dist/langs/html.d.ts +14 -0
- package/dist/langs/html.d.ts.map +1 -0
- package/dist/langs/html.js +71 -0
- package/dist/langs/http.d.ts +4 -0
- package/dist/langs/http.d.ts.map +1 -0
- package/dist/langs/http.js +185 -0
- package/dist/langs/ini.d.ts +4 -0
- package/dist/langs/ini.d.ts.map +1 -0
- package/dist/langs/ini.js +227 -0
- package/dist/langs/java.d.ts +4 -0
- package/dist/langs/java.d.ts.map +1 -0
- package/dist/langs/java.js +178 -0
- package/dist/langs/javascript.d.ts +4 -0
- package/dist/langs/javascript.d.ts.map +1 -0
- package/dist/langs/javascript.js +226 -0
- package/dist/langs/json.d.ts +10 -0
- package/dist/langs/json.d.ts.map +1 -0
- package/dist/langs/json.js +46 -0
- package/dist/langs/kotlin.d.ts +4 -0
- package/dist/langs/kotlin.d.ts.map +1 -0
- package/dist/langs/kotlin.js +220 -0
- package/dist/langs/lua.d.ts +4 -0
- package/dist/langs/lua.d.ts.map +1 -0
- package/dist/langs/lua.js +330 -0
- package/dist/langs/makefile.d.ts +4 -0
- package/dist/langs/makefile.d.ts.map +1 -0
- package/dist/langs/makefile.js +266 -0
- package/dist/langs/markdown.d.ts +11 -0
- package/dist/langs/markdown.d.ts.map +1 -0
- package/dist/langs/markdown.js +71 -0
- package/dist/langs/matlab.d.ts +4 -0
- package/dist/langs/matlab.d.ts.map +1 -0
- package/dist/langs/matlab.js +352 -0
- package/dist/langs/mojo.d.ts +4 -0
- package/dist/langs/mojo.d.ts.map +1 -0
- package/dist/langs/mojo.js +337 -0
- package/dist/langs/nginx.d.ts +4 -0
- package/dist/langs/nginx.d.ts.map +1 -0
- package/dist/langs/nginx.js +168 -0
- package/dist/langs/objectivec.d.ts +4 -0
- package/dist/langs/objectivec.d.ts.map +1 -0
- package/dist/langs/objectivec.js +287 -0
- package/dist/langs/ocaml.d.ts +4 -0
- package/dist/langs/ocaml.d.ts.map +1 -0
- package/dist/langs/ocaml.js +309 -0
- package/dist/langs/perl.d.ts +4 -0
- package/dist/langs/perl.d.ts.map +1 -0
- package/dist/langs/perl.js +435 -0
- package/dist/langs/php.d.ts +4 -0
- package/dist/langs/php.d.ts.map +1 -0
- package/dist/langs/php.js +325 -0
- package/dist/langs/powershell.d.ts +4 -0
- package/dist/langs/powershell.d.ts.map +1 -0
- package/dist/langs/powershell.js +308 -0
- package/dist/langs/python.d.ts +4 -0
- package/dist/langs/python.d.ts.map +1 -0
- package/dist/langs/python.js +350 -0
- package/dist/langs/r.d.ts +4 -0
- package/dist/langs/r.d.ts.map +1 -0
- package/dist/langs/r.js +265 -0
- package/dist/langs/ruby.d.ts +4 -0
- package/dist/langs/ruby.d.ts.map +1 -0
- package/dist/langs/ruby.js +365 -0
- package/dist/langs/rust.d.ts +10 -0
- package/dist/langs/rust.d.ts.map +1 -0
- package/dist/langs/rust.js +116 -0
- package/dist/langs/scala.d.ts +4 -0
- package/dist/langs/scala.d.ts.map +1 -0
- package/dist/langs/scala.js +308 -0
- package/dist/langs/sql.d.ts +5 -0
- package/dist/langs/sql.d.ts.map +1 -0
- package/dist/langs/sql.js +57 -0
- package/dist/langs/swift.d.ts +33 -0
- package/dist/langs/swift.d.ts.map +1 -0
- package/dist/langs/swift.js +256 -0
- package/dist/langs/yaml.d.ts +11 -0
- package/dist/langs/yaml.d.ts.map +1 -0
- package/dist/langs/yaml.js +123 -0
- package/dist/lazy.d.ts +69 -0
- package/dist/lazy.d.ts.map +1 -0
- package/dist/lazy.js +200 -0
- package/dist/style.css +308 -0
- package/package.json +86 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/langs/json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAE5C;;;;;GAKG;AACH,QAAA,MAAM,IAAI,EAAE,OAwCX,CAAA;AAED,eAAe,IAAI,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON, with JSONC comments and trailing-comma tolerance.
|
|
3
|
+
*
|
|
4
|
+
* Keys and string values get different scopes — the single change that does
|
|
5
|
+
* the most for a config file's readability.
|
|
6
|
+
*/
|
|
7
|
+
const json = {
|
|
8
|
+
name: 'json',
|
|
9
|
+
aliases: ['jsonc', 'json5'],
|
|
10
|
+
states: {
|
|
11
|
+
root: {
|
|
12
|
+
rules: [
|
|
13
|
+
{ match: '//[^\\n]*', scope: 'comment' },
|
|
14
|
+
{ match: '/\\*[\\s\\S]*?\\*/', scope: 'comment' },
|
|
15
|
+
// A string followed by `:` is a key, whatever nesting it sits in.
|
|
16
|
+
{
|
|
17
|
+
match: '("(?:[^"\\\\\\n]|\\\\.)*")(\\s*)(:)',
|
|
18
|
+
scope: ['property', null, 'punctuation.delimiter'],
|
|
19
|
+
},
|
|
20
|
+
{ match: '"', scope: 'string', push: 'string' },
|
|
21
|
+
{ match: '\\b(?:true|false)\\b', scope: 'boolean' },
|
|
22
|
+
{ match: '\\bnull\\b', scope: 'constant.builtin' },
|
|
23
|
+
{
|
|
24
|
+
match: '-?\\b\\d+(?:\\.\\d+)?(?:[eE][-+]?\\d+)?\\b',
|
|
25
|
+
scope: 'number',
|
|
26
|
+
},
|
|
27
|
+
{ match: '[{}\\[\\]]', scope: 'punctuation.bracket' },
|
|
28
|
+
{ match: '[,:]', scope: 'punctuation.delimiter' },
|
|
29
|
+
// Anything else in a JSON document is a syntax error; showing it as
|
|
30
|
+
// one beats rendering it as ordinary text.
|
|
31
|
+
{ match: '[^\\s{}\\[\\],:"]+', scope: 'invalid' },
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
string: {
|
|
35
|
+
default: 'string',
|
|
36
|
+
rules: [
|
|
37
|
+
{
|
|
38
|
+
match: '\\\\(?:u[0-9a-fA-F]{4}|["\\\\/bfnrt])',
|
|
39
|
+
scope: 'string.escape',
|
|
40
|
+
},
|
|
41
|
+
{ match: '"', scope: 'string', pop: true },
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
export default json;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kotlin.d.ts","sourceRoot":"","sources":["../../src/langs/kotlin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAiC5C,QAAA,MAAM,MAAM,EAAE,OAiNb,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kotlin.
|
|
3
|
+
*
|
|
4
|
+
* Four things here are worth knowing about:
|
|
5
|
+
*
|
|
6
|
+
* - String templates are expressions. `$name` and `${…}` are scoped as
|
|
7
|
+
* interpolations rather than string content, and the braced form tracks brace
|
|
8
|
+
* depth so a lambda inside it cannot end the literal early.
|
|
9
|
+
* - Block comments nest in Kotlin, so they get a state instead of a lazy
|
|
10
|
+
* `[\s\S]*?` scan, which would stop at the first inner terminator.
|
|
11
|
+
* - `@` is annotations, label definitions and label references at once. What
|
|
12
|
+
* sits in front of the `@` is what tells them apart.
|
|
13
|
+
* - Backtick identifiers hold anything, spaces and keywords included, which is
|
|
14
|
+
* how most Kotlin test suites name their functions.
|
|
15
|
+
*
|
|
16
|
+
* The known wrong answer: soft keywords (`by`, `data`, `get`, `set`, `out`,
|
|
17
|
+
* `where`) are scoped as keywords wherever they appear, so a parameter named
|
|
18
|
+
* `by` reads as one. Telling the two apart needs to know where a declaration
|
|
19
|
+
* begins and ends, which is a parser, not a state machine — and the reading is
|
|
20
|
+
* right on ordinary code, where these words are used as keywords.
|
|
21
|
+
*/
|
|
22
|
+
// Kotlin identifiers permit unicode letters. An ASCII-only class splits
|
|
23
|
+
// `fun naïve()` into three runs and scopes the tail `function.call` — a call
|
|
24
|
+
// scope emitted at a definition site. The tail is capped for the same reason
|
|
25
|
+
// java.ts caps its own: a name rule with a lookahead must not rescan the line.
|
|
26
|
+
const ID = '[A-Za-z_\\u0080-\\uFFFF][A-Za-z0-9_\\u0080-\\uFFFF]{0,128}';
|
|
27
|
+
/** An identifier as it may be written at a declaration site, backticks and all. */
|
|
28
|
+
const NAME = `(?:\`[^\`\\n]*\`|${ID})`;
|
|
29
|
+
const kotlin = {
|
|
30
|
+
name: 'kotlin',
|
|
31
|
+
aliases: ['kt', 'kts'],
|
|
32
|
+
states: {
|
|
33
|
+
root: {
|
|
34
|
+
rules: [
|
|
35
|
+
{ match: '//[^\\n]*', scope: 'comment' },
|
|
36
|
+
// `/**` only opens KDoc when something follows it, so the empty comment
|
|
37
|
+
// `/**` + `/` still reads as an ordinary block comment and closes.
|
|
38
|
+
{ match: '/\\*\\*(?![/*])', scope: 'comment.doc', push: 'doc-comment' },
|
|
39
|
+
{ match: '/\\*', scope: 'comment', push: 'block-comment' },
|
|
40
|
+
{ match: '"""', scope: 'string', push: 'raw-string' },
|
|
41
|
+
{ match: '"', scope: 'string', push: 'string' },
|
|
42
|
+
{
|
|
43
|
+
match: "'(?:[^'\\\\\\n]|\\\\(?:u[0-9a-fA-F]{4}|.))'",
|
|
44
|
+
scope: 'string',
|
|
45
|
+
},
|
|
46
|
+
// Only these five words can precede a label reference, and matching the
|
|
47
|
+
// word here is what separates `return@loop` from the annotation `@loop`
|
|
48
|
+
// — the same trick `javascript.ts` uses to avoid a lookbehind.
|
|
49
|
+
{
|
|
50
|
+
match: `(\\b(?:return|break|continue))(@)(${ID})`,
|
|
51
|
+
scope: ['keyword.control', 'operator', 'variable.special'],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
match: `(\\b(?:this|super))(@)(${ID})`,
|
|
55
|
+
scope: ['variable.builtin', 'operator', 'variable.special'],
|
|
56
|
+
},
|
|
57
|
+
{ match: `@${ID}(?::${ID})?`, scope: 'decorator' },
|
|
58
|
+
// A label definition (`outer@ for`) — the `@` is followed by the thing
|
|
59
|
+
// being labelled, never by the label's own name.
|
|
60
|
+
{
|
|
61
|
+
match: `\\b(${ID})(@)(?=[\\s{])`,
|
|
62
|
+
scope: ['variable.special', 'operator'],
|
|
63
|
+
},
|
|
64
|
+
// Declaration sites, before the bare keywords so `fun` claims the name
|
|
65
|
+
// after it. The receiver of an extension function is scoped as a type;
|
|
66
|
+
// a generic receiver (`fun List<T>.foo()`) falls through to the flat
|
|
67
|
+
// rules instead, which still reads correctly, just without `foo` as a
|
|
68
|
+
// definition.
|
|
69
|
+
{
|
|
70
|
+
match: `(fun)(\\s+)(?:<[^<>\\n]{0,80}>\\s*)?(?:(${ID})(\\.))?(${NAME})`,
|
|
71
|
+
scope: ['keyword.declaration', null, 'type', 'punctuation', 'function'],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
match: `(\\b(?:class|interface|object))(\\s+)(${ID})`,
|
|
75
|
+
scope: ['keyword.declaration', null, 'class'],
|
|
76
|
+
},
|
|
77
|
+
// Binding a name: this is also what keeps `val count: Int` out of the
|
|
78
|
+
// parameter rule below, which would otherwise claim every annotated
|
|
79
|
+
// name. A SCREAMING_CASE name is left out on purpose so `const val
|
|
80
|
+
// MAX = 1` still reads as a constant.
|
|
81
|
+
{
|
|
82
|
+
match: '(\\b(?:val|var))(\\s+)(`[^`\\n]*`|[a-z_]\\w*)',
|
|
83
|
+
scope: ['keyword.declaration', null, 'variable'],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
match: '\\b(?:if|else|when|while|do|for|return|break|continue|throw|try|catch|finally)\\b',
|
|
87
|
+
scope: 'keyword.control',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
match: '\\b(?:fun|val|var|class|interface|object|typealias|const(?:ructor)?|init|companion|enum|data|sealed|annotation|inner|open|override|abstract|final|private|protected|public|internal|lateinit|(?:no|cross)?inline|reified|vararg|suspend|operator|infix|actual|expect|by|where|get|set|out)\\b',
|
|
91
|
+
scope: 'keyword.declaration',
|
|
92
|
+
},
|
|
93
|
+
{ match: '\\b(?:package|import)\\b', scope: 'keyword.import' },
|
|
94
|
+
// `as?` cannot use a trailing `\b`: the boundary after `?` needs a word
|
|
95
|
+
// character next, and a cast is followed by a space.
|
|
96
|
+
{ match: '\\bas\\?|\\b(?:as|in|is)\\b', scope: 'keyword.operator' },
|
|
97
|
+
{ match: '\\b(?:true|false)\\b', scope: 'boolean' },
|
|
98
|
+
{ match: '\\bnull\\b', scope: 'constant.builtin' },
|
|
99
|
+
{ match: '\\b(?:this|super|it)\\b', scope: 'variable.builtin' },
|
|
100
|
+
{
|
|
101
|
+
match: '\\b(?:Int|Long|Short|Byte|Double|Float|Char|Boolean|String|Unit|Any|Nothing|Array|Pair|(?:Mutable)?(?:List|Map|Set)|Sequence)\\b',
|
|
102
|
+
scope: 'type.builtin',
|
|
103
|
+
},
|
|
104
|
+
// Scope functions keep their identity through the dot; the member rule
|
|
105
|
+
// below would otherwise call them methods of whatever they are chained to.
|
|
106
|
+
{
|
|
107
|
+
match: '(\\?\\.|\\.)(let|run|apply|also|takeIf|takeUnless|use)\\b',
|
|
108
|
+
scope: ['punctuation', 'function.builtin'],
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
match: '\\b(?:print(?:ln)?|readLine|arrayOf|(?:mutableL|l)istOf|(?:mutableM|m)apOf|(?:mutableS|s)etOf|emptyList|buildString|require|check|error|TODO|repeat|lazy|with)\\b(?=\\s*[({<])',
|
|
112
|
+
scope: 'function.builtin',
|
|
113
|
+
},
|
|
114
|
+
// A capitalised member is an enum entry, a nested type or a companion
|
|
115
|
+
// constant — never a method, since Kotlin methods are lowercase.
|
|
116
|
+
{
|
|
117
|
+
match: '(\\?\\.|\\.)([A-Z][A-Z0-9_]+)\\b',
|
|
118
|
+
scope: ['punctuation', 'constant'],
|
|
119
|
+
},
|
|
120
|
+
{ match: '(\\?\\.|\\.)([A-Z]\\w*)', scope: ['punctuation', 'type'] },
|
|
121
|
+
// A trailing lambda is a call too, so `list.map { … }` scopes `map` the
|
|
122
|
+
// same way `list.map(f)` does.
|
|
123
|
+
{
|
|
124
|
+
match: `(\\?\\.|\\.)(${ID})(?=\\s*[({])`,
|
|
125
|
+
scope: ['punctuation', 'function.method'],
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
match: `(\\?\\.|\\.)(${ID})`,
|
|
129
|
+
scope: ['punctuation', 'variable.member'],
|
|
130
|
+
},
|
|
131
|
+
{ match: '\\b[A-Z][A-Z0-9_]+\\b', scope: 'constant' },
|
|
132
|
+
{ match: '\\b[A-Z][A-Za-z0-9_]*\\b', scope: 'type' },
|
|
133
|
+
// A name glued to a `:` is being annotated. In a signature that is a
|
|
134
|
+
// parameter, which is the common case; a local `val x: Int` is caught by
|
|
135
|
+
// the `val`/`var` rule first, but a property in an interface body still
|
|
136
|
+
// reads as a parameter.
|
|
137
|
+
{ match: `\\b${ID}(?=:)`, scope: 'variable.parameter' },
|
|
138
|
+
{ match: '\\b[a-z_]\\w*(?=\\s*[({])', scope: 'function.call' },
|
|
139
|
+
{ match: '`[^`\\n]*`', scope: 'variable' },
|
|
140
|
+
// Kotlin has no octal literals, and `_` may separate any digits.
|
|
141
|
+
{ match: '\\b0[xX][0-9a-fA-F_]+[uU]?[lL]?\\b', scope: 'number' },
|
|
142
|
+
{ match: '\\b0[bB][01_]+[uU]?[lL]?\\b', scope: 'number' },
|
|
143
|
+
{
|
|
144
|
+
match: '\\b\\d[\\d_]*(?:\\.\\d[\\d_]*)?(?:[eE][-+]?\\d+)?[uU]?[lLfF]?\\b',
|
|
145
|
+
scope: 'number',
|
|
146
|
+
},
|
|
147
|
+
// Longest first: `!!` before `!=`, `?.` before `?`, `->` before `-`.
|
|
148
|
+
{
|
|
149
|
+
match: '\\?[.:]|!!|\\+\\+|--|->|::|\\.\\.<?|&&|\\|\\||[!=]==?|[-+*/%<>]=?|[?=!&|]',
|
|
150
|
+
scope: 'operator',
|
|
151
|
+
},
|
|
152
|
+
{ match: '[()\\[\\]{}]', scope: 'punctuation.bracket' },
|
|
153
|
+
{ match: '[,;:]', scope: 'punctuation.delimiter' },
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
// ---- comments ----------------------------------------------------------
|
|
157
|
+
// Two states rather than one, because the nesting has to preserve whether
|
|
158
|
+
// the outermost comment was documentation.
|
|
159
|
+
'block-comment': {
|
|
160
|
+
default: 'comment',
|
|
161
|
+
rules: [
|
|
162
|
+
{ match: '/\\*', push: 'block-comment' },
|
|
163
|
+
{ match: '\\*/', pop: true },
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
'doc-comment': {
|
|
167
|
+
default: 'comment.doc',
|
|
168
|
+
rules: [
|
|
169
|
+
{ match: '/\\*', push: 'doc-comment' },
|
|
170
|
+
{ match: '\\*/', pop: true },
|
|
171
|
+
],
|
|
172
|
+
},
|
|
173
|
+
// ---- strings -----------------------------------------------------------
|
|
174
|
+
/** The template syntax both string forms share. */
|
|
175
|
+
template: {
|
|
176
|
+
rules: [
|
|
177
|
+
// Only a bare identifier may follow `$`, so `"$item.sku"` interpolates
|
|
178
|
+
// `item` and leaves `.sku` as text — which is what Kotlin does too.
|
|
179
|
+
{ match: `(\\$)(${ID})`, scope: ['interpolation', 'variable'] },
|
|
180
|
+
{ match: '\\$\\{', scope: 'interpolation', push: 'interpolation' },
|
|
181
|
+
],
|
|
182
|
+
},
|
|
183
|
+
string: {
|
|
184
|
+
default: 'string',
|
|
185
|
+
rules: [
|
|
186
|
+
{ match: '\\\\(?:u[0-9a-fA-F]{4}|.)', scope: 'string.escape' },
|
|
187
|
+
{ include: 'template' },
|
|
188
|
+
{ match: '"', scope: 'string', pop: true },
|
|
189
|
+
// An unterminated string ends at the line break instead of swallowing
|
|
190
|
+
// the rest of the file.
|
|
191
|
+
{ match: '$', pop: true },
|
|
192
|
+
],
|
|
193
|
+
},
|
|
194
|
+
/**
|
|
195
|
+
* A raw string has no escapes, so a lone `"` or `""` is content. A run of
|
|
196
|
+
* four or more quotes closes at the first three rather than the last, which
|
|
197
|
+
* is the one case Kotlin's lexer reads the other way.
|
|
198
|
+
*/
|
|
199
|
+
'raw-string': {
|
|
200
|
+
default: 'string',
|
|
201
|
+
rules: [{ include: 'template' }, { match: '"""', scope: 'string', pop: true }],
|
|
202
|
+
},
|
|
203
|
+
interpolation: {
|
|
204
|
+
rules: [
|
|
205
|
+
{ match: '\\}', scope: 'interpolation', pop: true },
|
|
206
|
+
{ match: '\\{', scope: 'punctuation.bracket', push: 'brace' },
|
|
207
|
+
{ include: 'root' },
|
|
208
|
+
],
|
|
209
|
+
},
|
|
210
|
+
/** Brace depth, so a lambda or an object literal cannot close a template. */
|
|
211
|
+
brace: {
|
|
212
|
+
rules: [
|
|
213
|
+
{ match: '\\}', scope: 'punctuation.bracket', pop: true },
|
|
214
|
+
{ match: '\\{', scope: 'punctuation.bracket', push: 'brace' },
|
|
215
|
+
{ include: 'root' },
|
|
216
|
+
],
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
export default kotlin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lua.d.ts","sourceRoot":"","sources":["../../src/langs/lua.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AA+C5C,QAAA,MAAM,GAAG,EAAE,OAuTV,CAAA;AAED,eAAe,GAAG,CAAA"}
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lua.
|
|
3
|
+
*
|
|
4
|
+
* Three things make Lua awkward for a regex tokenizer, and each is answered by
|
|
5
|
+
* the state machine rather than by a cleverer pattern:
|
|
6
|
+
*
|
|
7
|
+
* - Long brackets are level-matched. `[==[ … ]==]` ends only at a closer with
|
|
8
|
+
* the same number of `=`, so a `]=]` inside it is content. That is exactly
|
|
9
|
+
* what a backreference is for, and backreferences are rejected here, so
|
|
10
|
+
* levels 0 to 2 get one state each and everything deeper shares a state.
|
|
11
|
+
* - `--`, `--[[` and `---` all start from the same two characters. The regex
|
|
12
|
+
* engine takes the leftmost match, so `---[[` reads as the doc comment it is
|
|
13
|
+
* rather than as a long comment starting one character in.
|
|
14
|
+
* - `{` is always a table constructor in Lua — blocks use `do … end` — so a
|
|
15
|
+
* state can tell the key in `{ mode = "fast" }` from the plain local in
|
|
16
|
+
* `local a, mode = 1, "fast"`.
|
|
17
|
+
*
|
|
18
|
+
* Ordinary locals deliberately match no rule and inherit the block foreground,
|
|
19
|
+
* which keeps both the markup and the visual noise down.
|
|
20
|
+
*/
|
|
21
|
+
const ID = '[A-Za-z_]\\w*';
|
|
22
|
+
/**
|
|
23
|
+
* What has to follow a name for it to be a call.
|
|
24
|
+
*
|
|
25
|
+
* A single string or table argument may drop the parentheses, so `require "x"`,
|
|
26
|
+
* `setup{…}` and `f[[…]]` are calls as much as `f(x)` is. The bracket form needs
|
|
27
|
+
* a second `[` because `t[1]` is an index, not a call.
|
|
28
|
+
*/
|
|
29
|
+
const CALL = '(?=[ \\t]*(?:[({"\']|\\[=*\\[))';
|
|
30
|
+
/** Standard library tables. Their members are builtins; `mymod.insert` is not. */
|
|
31
|
+
const LIB = '(?:coroutine|debug|io|math|os|package|string|table|utf8)';
|
|
32
|
+
/**
|
|
33
|
+
* `\65`, `\x41`, `\u{1F6B2}`, `\z` (skip the following whitespace, newlines
|
|
34
|
+
* included) and a `\` line continuation.
|
|
35
|
+
*
|
|
36
|
+
* `\z` and the continuation have to consume their trailing whitespace here, or
|
|
37
|
+
* the `$` rule that closes an unterminated string would fire on the newline
|
|
38
|
+
* they are explicitly there to swallow.
|
|
39
|
+
*/
|
|
40
|
+
const ESCAPE = '\\\\(?:x[0-9a-fA-F]{2}|u\\{[0-9a-fA-F]+\\}|z\\s*|\\d{1,3}|\\r?\\n|[abfnrtv\\\\"\'])';
|
|
41
|
+
const lua = {
|
|
42
|
+
name: 'lua',
|
|
43
|
+
states: {
|
|
44
|
+
root: {
|
|
45
|
+
rules: [
|
|
46
|
+
{ match: '^#![^\\n]*', scope: 'comment' },
|
|
47
|
+
// ---- comments ------------------------------------------------------
|
|
48
|
+
// LDoc and EmmyLua both open with three dashes. `(?!-)` keeps a rule of
|
|
49
|
+
// `-----` separators out of the documentation colour, and the tag is
|
|
50
|
+
// pulled out of the line so `---@param` reads as an annotation.
|
|
51
|
+
{
|
|
52
|
+
match: '(---(?!-)[ \\t]*)(@\\w+)([^\\n]*)',
|
|
53
|
+
scope: ['comment.doc', 'decorator', 'comment.doc'],
|
|
54
|
+
},
|
|
55
|
+
{ match: '---(?!-)[^\\n]*', scope: 'comment.doc' },
|
|
56
|
+
// Long comments, most specific level first. `--[=[` also matches the
|
|
57
|
+
// deep pattern, so the exact levels have to be tried before it.
|
|
58
|
+
{ match: '--\\[\\[', scope: 'comment', push: 'long-comment-0' },
|
|
59
|
+
{ match: '--\\[=\\[', scope: 'comment', push: 'long-comment-1' },
|
|
60
|
+
{ match: '--\\[==\\[', scope: 'comment', push: 'long-comment-2' },
|
|
61
|
+
{ match: '--\\[={3,}\\[', scope: 'comment', push: 'long-comment-n' },
|
|
62
|
+
{ match: '--[^\\n]*', scope: 'comment' },
|
|
63
|
+
// ---- strings -------------------------------------------------------
|
|
64
|
+
{ match: '\\[\\[', scope: 'string', push: 'long-string-0' },
|
|
65
|
+
{ match: '\\[=\\[', scope: 'string', push: 'long-string-1' },
|
|
66
|
+
{ match: '\\[==\\[', scope: 'string', push: 'long-string-2' },
|
|
67
|
+
{ match: '\\[={3,}\\[', scope: 'string', push: 'long-string-n' },
|
|
68
|
+
{ match: '"', scope: 'string', push: 'string-double' },
|
|
69
|
+
{ match: "'", scope: 'string', push: 'string-single' },
|
|
70
|
+
// ---- numbers -------------------------------------------------------
|
|
71
|
+
// Hex first: `0x10` would otherwise read as `0` followed by a name. The
|
|
72
|
+
// exponent of a hex float is `p`, not `e`, and it is decimal.
|
|
73
|
+
{
|
|
74
|
+
match: '\\b0[xX](?:[0-9a-fA-F]+(?:\\.[0-9a-fA-F]*)?|\\.[0-9a-fA-F]+)(?:[pP][-+]?\\d+)?',
|
|
75
|
+
scope: 'number',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
match: '(?:\\b\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][-+]?\\d+)?',
|
|
79
|
+
scope: 'number',
|
|
80
|
+
},
|
|
81
|
+
// ---- names and keywords --------------------------------------------
|
|
82
|
+
// Varargs, ahead of the `..` operator that would claim the first two dots.
|
|
83
|
+
{ match: '\\.\\.\\.', scope: 'variable.builtin' },
|
|
84
|
+
// Labels live in their own namespace, so they are neither a variable
|
|
85
|
+
// nor a constant; `variable.special` is the closest thing the
|
|
86
|
+
// vocabulary has to "a name that is not an ordinary name".
|
|
87
|
+
{
|
|
88
|
+
match: `(::)(${ID})(::)`,
|
|
89
|
+
scope: ['punctuation.delimiter', 'variable.special', 'punctuation.delimiter'],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
match: `\\b(goto)([ \\t]+)(${ID})`,
|
|
93
|
+
scope: ['keyword.control', null, 'variable.special'],
|
|
94
|
+
},
|
|
95
|
+
// A named definition hands the name to its own state. Consuming the
|
|
96
|
+
// whole `function a.b:c` here instead would have to scope the receiver
|
|
97
|
+
// too, and it cannot: `a` is an ordinary expression and deserves
|
|
98
|
+
// whatever colour it has everywhere else in the file.
|
|
99
|
+
{
|
|
100
|
+
match: '\\bfunction(?=[ \\t]+[A-Za-z_])',
|
|
101
|
+
scope: 'keyword.declaration',
|
|
102
|
+
push: 'definition',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
match: '\\b(?:if|elseif|else|then|end|do|while|repeat|until|for|in|break|goto|return)\\b',
|
|
106
|
+
scope: 'keyword.control',
|
|
107
|
+
},
|
|
108
|
+
{ match: '\\b(?:function|local)\\b', scope: 'keyword.declaration' },
|
|
109
|
+
{ match: '\\b(?:and|or|not)\\b', scope: 'keyword.operator' },
|
|
110
|
+
{ match: '\\b(?:true|false)\\b', scope: 'boolean' },
|
|
111
|
+
{ match: '\\bnil\\b', scope: 'constant.builtin' },
|
|
112
|
+
// Lua 5.4 attribs. The chained comparison `a <const> b` is read as one
|
|
113
|
+
// of these instead, which is the wrong answer to a question nobody asks.
|
|
114
|
+
{ match: '<(?:const|close)>', scope: 'decorator' },
|
|
115
|
+
// `self` is a plain local that the `:` call syntax happens to declare.
|
|
116
|
+
// A local named `self` outside a method gets the same colour, which is
|
|
117
|
+
// the reading that is right on ordinary code.
|
|
118
|
+
{ match: '\\b(?:self|_G|_ENV|_VERSION)\\b', scope: 'variable.builtin' },
|
|
119
|
+
// `table.insert` is a builtin, `obj.table.insert` is not: the member
|
|
120
|
+
// rules below match at the leading `.`, which is further left, and the
|
|
121
|
+
// engine prefers the leftmost match.
|
|
122
|
+
{
|
|
123
|
+
match: `\\b(${LIB})(\\.)(${ID})${CALL}`,
|
|
124
|
+
scope: ['namespace', 'punctuation', 'function.builtin'],
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
match: `\\b(${LIB})(\\.)(${ID})`,
|
|
128
|
+
scope: ['namespace', 'punctuation', 'variable.builtin'],
|
|
129
|
+
},
|
|
130
|
+
// `:` only ever introduces a method, so no call lookahead is needed.
|
|
131
|
+
{ match: `(:)(${ID})`, scope: ['punctuation', 'function.method'] },
|
|
132
|
+
{
|
|
133
|
+
match: `(\\.)(${ID})${CALL}`,
|
|
134
|
+
scope: ['punctuation', 'function.method'],
|
|
135
|
+
},
|
|
136
|
+
{ match: `(\\.)(${ID})`, scope: ['punctuation', 'variable.member'] },
|
|
137
|
+
{
|
|
138
|
+
match: '\\b(?:assert|collectgarbage|dofile|error|getmetatable|ipairs|load|loadfile|loadstring|next|pairs|pcall|print|rawequal|rawget|rawlen|rawset|require|select|setmetatable|tonumber|tostring|type|unpack|xpcall)\\b',
|
|
139
|
+
scope: 'function.builtin',
|
|
140
|
+
},
|
|
141
|
+
// SCREAMING_CASE reads as a constant and CapWords as a type, which is
|
|
142
|
+
// how Lua spells module constants and the tables it uses as classes.
|
|
143
|
+
{ match: '\\b[A-Z][A-Z0-9_]+\\b', scope: 'constant' },
|
|
144
|
+
{ match: '\\b[A-Z][A-Za-z0-9_]*\\b', scope: 'type' },
|
|
145
|
+
{ match: `\\b${ID}${CALL}`, scope: 'function.call' },
|
|
146
|
+
// ---- syntax --------------------------------------------------------
|
|
147
|
+
{ match: '\\.\\.|//|<<|>>|[=~<>]=|[-+*/%^#&|~<>=]', scope: 'operator' },
|
|
148
|
+
// The opening brace is matched together with the first key, which is
|
|
149
|
+
// both how the key is recognised and why every alternative in the
|
|
150
|
+
// constructor state still starts with a literal character — a rule
|
|
151
|
+
// beginning with a lookbehind costs the engine its first-character
|
|
152
|
+
// scan, and measured 15x on a constructor full of whitespace.
|
|
153
|
+
{
|
|
154
|
+
match: `(\\{)([ \\t\\r\\n]*)(${ID})(?=[ \\t]*=(?!=))`,
|
|
155
|
+
scope: ['punctuation.bracket', null, 'property'],
|
|
156
|
+
push: 'table-constructor',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
match: '\\{',
|
|
160
|
+
scope: 'punctuation.bracket',
|
|
161
|
+
push: 'table-constructor',
|
|
162
|
+
},
|
|
163
|
+
{ match: '[()\\[\\]}]', scope: 'punctuation.bracket' },
|
|
164
|
+
{ match: '[,;:]', scope: 'punctuation.delimiter' },
|
|
165
|
+
{ match: '\\.', scope: 'punctuation' },
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
/**
|
|
169
|
+
* The name of a `function` definition, up to and including its last
|
|
170
|
+
* segment. `function a.b.c:d()` is a receiver, two fields and a method, and
|
|
171
|
+
* the receiver falls through to `root` so it keeps the colour it has at
|
|
172
|
+
* every other mention.
|
|
173
|
+
*
|
|
174
|
+
* A definition never spans a line, so `$` pops rather than letting a
|
|
175
|
+
* malformed one leak into the rest of the file.
|
|
176
|
+
*/
|
|
177
|
+
definition: {
|
|
178
|
+
rules: [
|
|
179
|
+
// The `:` form takes an implicit `self`, so it is a method and the `.`
|
|
180
|
+
// form is a plain function that happens to live in a table.
|
|
181
|
+
{
|
|
182
|
+
match: `(:)([ \\t]*)(${ID})`,
|
|
183
|
+
scope: ['punctuation', null, 'function.method'],
|
|
184
|
+
pop: true,
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
match: `(\\.)([ \\t]*)(${ID})(?=[ \\t]*[.:])`,
|
|
188
|
+
scope: ['punctuation', null, 'variable.member'],
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
match: `(\\.)([ \\t]*)(${ID})`,
|
|
192
|
+
scope: ['punctuation', null, 'function'],
|
|
193
|
+
pop: true,
|
|
194
|
+
},
|
|
195
|
+
// Both `\b`s are load-bearing. The trailing one stops `Trips.new` from
|
|
196
|
+
// matching the shorter `Trip`, since backtracking is happy to give up
|
|
197
|
+
// the `s` to make the negative lookahead succeed. The leading one stops
|
|
198
|
+
// the rule being retried at every column of a name it just rejected,
|
|
199
|
+
// which is quadratic in the length of the name.
|
|
200
|
+
{ match: `\\b${ID}\\b(?![ \\t]*[.:])`, scope: 'function', pop: true },
|
|
201
|
+
{ match: '$', pop: true },
|
|
202
|
+
{ include: 'root' },
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
/**
|
|
206
|
+
* A table constructor, entered at `{`. It exists only so that a name that
|
|
207
|
+
* opens an entry can be scoped as a key; everything else is ordinary code.
|
|
208
|
+
*
|
|
209
|
+
* Requiring the comma is what keeps a bare `{ a b }` from reading as a key,
|
|
210
|
+
* and the cost is that `b` in `{ a; b = 1 }` renders unscoped: the semicolon
|
|
211
|
+
* separator is legal Lua and almost never written.
|
|
212
|
+
*
|
|
213
|
+
* A comma is not enough on its own, because a module table of functions
|
|
214
|
+
* puts whole statements inside the constructor and `local ok, err = f()` in
|
|
215
|
+
* one of those bodies has the same shape as two keys. The `local-list` state
|
|
216
|
+
* below eats the commas of a declaration list so they are never offered as
|
|
217
|
+
* key separators.
|
|
218
|
+
*/
|
|
219
|
+
'table-constructor': {
|
|
220
|
+
rules: [
|
|
221
|
+
{ match: '\\}', scope: 'punctuation.bracket', pop: true },
|
|
222
|
+
// `local` cannot appear at constructor level, so a `local` here is
|
|
223
|
+
// always inside a nested function body and its names are locals rather
|
|
224
|
+
// than keys. Only the commas need handling, so the names are left to
|
|
225
|
+
// `root` and colour the same in here as they do anywhere else.
|
|
226
|
+
//
|
|
227
|
+
// A comma has to follow the first name, so the far more common
|
|
228
|
+
// `local x = 1` never enters the state and `local` keeps falling through
|
|
229
|
+
// to `root`. That lookahead is also what guarantees the state pops: the
|
|
230
|
+
// comma it promises can only be consumed by `local-list` itself.
|
|
231
|
+
// `function` is excluded so `local function f` reaches the definition
|
|
232
|
+
// rule; a variable named `functions` still gets in, since `\b` fails.
|
|
233
|
+
{
|
|
234
|
+
match: `\\blocal\\b(?=[ \\t]+(?!function\\b)${ID}[ \\t]*,)`,
|
|
235
|
+
scope: 'keyword.declaration',
|
|
236
|
+
push: 'local-list',
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
match: `(,)([ \\t\\r\\n]*)(${ID})(?=[ \\t]*=(?!=))`,
|
|
240
|
+
scope: ['punctuation.delimiter', null, 'property'],
|
|
241
|
+
},
|
|
242
|
+
{ include: 'root' },
|
|
243
|
+
],
|
|
244
|
+
},
|
|
245
|
+
/**
|
|
246
|
+
* The commas of a `local` declaration list inside a table constructor.
|
|
247
|
+
*
|
|
248
|
+
* Hiding a comma from the key rule is the whole job, so this state claims
|
|
249
|
+
* commas and nothing else: the names fall through to `root` and keep the
|
|
250
|
+
* colours they have at top level. Scoping them from here instead would make
|
|
251
|
+
* `local Foo, Bar` inside `{ }` a different colour from the same line
|
|
252
|
+
* outside it, which is the bug this state replaces.
|
|
253
|
+
*/
|
|
254
|
+
'local-list': {
|
|
255
|
+
rules: [
|
|
256
|
+
// Another comma-terminated name follows, so the list continues.
|
|
257
|
+
{
|
|
258
|
+
match: `,(?=[ \\t\\r\\n]*${ID}[ \\t\\r\\n]*,)`,
|
|
259
|
+
scope: 'punctuation.delimiter',
|
|
260
|
+
},
|
|
261
|
+
// The last comma of the list. Popping here rather than at the end of the
|
|
262
|
+
// statement is deliberate: the key rule needs to match this comma to fire,
|
|
263
|
+
// so consuming it is enough, and everything after the final name — `end`,
|
|
264
|
+
// a later `, key =`, the closing `}` — stays the constructor's business.
|
|
265
|
+
{ match: ',', scope: 'punctuation.delimiter', pop: true },
|
|
266
|
+
{ include: 'root' },
|
|
267
|
+
],
|
|
268
|
+
},
|
|
269
|
+
// ---- short strings -------------------------------------------------------
|
|
270
|
+
// A short string cannot span a line break of its own accord, so `$` pops
|
|
271
|
+
// rather than letting one bad quote swallow the rest of the file.
|
|
272
|
+
'string-double': {
|
|
273
|
+
default: 'string',
|
|
274
|
+
rules: [
|
|
275
|
+
{ match: ESCAPE, scope: 'string.escape' },
|
|
276
|
+
{ match: '"', scope: 'string', pop: true },
|
|
277
|
+
{ match: '$', pop: true },
|
|
278
|
+
],
|
|
279
|
+
},
|
|
280
|
+
'string-single': {
|
|
281
|
+
default: 'string',
|
|
282
|
+
rules: [
|
|
283
|
+
{ match: ESCAPE, scope: 'string.escape' },
|
|
284
|
+
{ match: "'", scope: 'string', pop: true },
|
|
285
|
+
{ match: '$', pop: true },
|
|
286
|
+
],
|
|
287
|
+
},
|
|
288
|
+
// ---- long brackets -------------------------------------------------------
|
|
289
|
+
// One state per level, because the closer has to count the `=` the opener
|
|
290
|
+
// used and a backreference cannot survive the rule merge. Levels past two
|
|
291
|
+
// share a state that closes on any run of three or more, so
|
|
292
|
+
// `[===[ a ]====] b ]===]` ends at the wrong closer. A level that deep is
|
|
293
|
+
// chosen precisely to hold text containing other closers, so that is the
|
|
294
|
+
// corner where this stops working — and it is a corner: levels 0 and 1 are
|
|
295
|
+
// what real code writes.
|
|
296
|
+
'long-string-0': {
|
|
297
|
+
default: 'string',
|
|
298
|
+
rules: [{ match: '\\]\\]', pop: true }],
|
|
299
|
+
},
|
|
300
|
+
'long-string-1': {
|
|
301
|
+
default: 'string',
|
|
302
|
+
rules: [{ match: '\\]=\\]', pop: true }],
|
|
303
|
+
},
|
|
304
|
+
'long-string-2': {
|
|
305
|
+
default: 'string',
|
|
306
|
+
rules: [{ match: '\\]==\\]', pop: true }],
|
|
307
|
+
},
|
|
308
|
+
'long-string-n': {
|
|
309
|
+
default: 'string',
|
|
310
|
+
rules: [{ match: '\\]={3,}\\]', pop: true }],
|
|
311
|
+
},
|
|
312
|
+
'long-comment-0': {
|
|
313
|
+
default: 'comment',
|
|
314
|
+
rules: [{ match: '\\]\\]', pop: true }],
|
|
315
|
+
},
|
|
316
|
+
'long-comment-1': {
|
|
317
|
+
default: 'comment',
|
|
318
|
+
rules: [{ match: '\\]=\\]', pop: true }],
|
|
319
|
+
},
|
|
320
|
+
'long-comment-2': {
|
|
321
|
+
default: 'comment',
|
|
322
|
+
rules: [{ match: '\\]==\\]', pop: true }],
|
|
323
|
+
},
|
|
324
|
+
'long-comment-n': {
|
|
325
|
+
default: 'comment',
|
|
326
|
+
rules: [{ match: '\\]={3,}\\]', pop: true }],
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
};
|
|
330
|
+
export default lua;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makefile.d.ts","sourceRoot":"","sources":["../../src/langs/makefile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAmD5C,QAAA,MAAM,QAAQ,EAAE,OA+Of,CAAA;AAED,eAAe,QAAQ,CAAA"}
|