limn-hl 0.1.1 → 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/README.md +105 -174
- package/dist/detect.d.ts +7 -1
- package/dist/detect.js +592 -502
- package/dist/engine.js +45 -1
- package/dist/generated/detect.d.ts +11 -0
- package/dist/generated/detect.js +2434 -0
- package/dist/generated/grammars.d.ts +119 -0
- package/dist/generated/grammars.js +613 -0
- package/dist/generated/lang.d.ts +6 -0
- package/dist/{lang/index.js → generated/lang.js} +82 -56
- package/dist/{theme/generated.d.ts → generated/themes.d.ts} +1 -1
- package/dist/lang.d.ts +1 -0
- package/dist/lang.js +1 -0
- package/dist/render/ansi.d.ts +1 -1
- package/dist/render/html.d.ts +1 -1
- package/dist/{theme/index.d.ts → theme.d.ts} +1 -1
- package/dist/theme.js +1 -0
- package/dist/vm/compile.d.ts +4 -0
- package/dist/vm/compile.js +390 -0
- package/dist/vm/exec.d.ts +3 -0
- package/dist/vm/exec.js +218 -0
- package/dist/vm/format.d.ts +255 -0
- package/dist/vm/format.js +248 -0
- package/dist/vm/index.d.ts +2 -0
- package/dist/vm/index.js +2 -0
- package/dist/vm/pat.d.ts +4 -0
- package/dist/vm/pat.js +701 -0
- package/dist/vm/quoted.d.ts +8 -0
- package/dist/vm/quoted.js +190 -0
- package/dist/vm/scan.d.ts +3 -0
- package/dist/vm/scan.js +499 -0
- package/dist/wordtable.d.ts +8 -4
- package/dist/wordtable.js +107 -30
- package/package.json +6 -6
- package/dist/lang/clike.d.ts +0 -15
- package/dist/lang/clike.js +0 -35
- package/dist/lang/clike_helpers.d.ts +0 -8
- package/dist/lang/clike_helpers.js +0 -220
- package/dist/lang/code.d.ts +0 -45
- package/dist/lang/code.js +0 -779
- package/dist/lang/config.d.ts +0 -5
- package/dist/lang/config.js +0 -164
- package/dist/lang/css.d.ts +0 -5
- package/dist/lang/css.js +0 -125
- package/dist/lang/docs.d.ts +0 -12
- package/dist/lang/docs.js +0 -462
- package/dist/lang/formats.d.ts +0 -10
- package/dist/lang/formats.js +0 -295
- package/dist/lang/html.d.ts +0 -11
- package/dist/lang/html.js +0 -298
- package/dist/lang/index.d.ts +0 -20
- package/dist/lang/js.d.ts +0 -9
- package/dist/lang/js.js +0 -532
- package/dist/lang/js_helpers.d.ts +0 -7
- package/dist/lang/js_helpers.js +0 -308
- package/dist/lang/json.d.ts +0 -3
- package/dist/lang/json.js +0 -136
- package/dist/lang/markdown.d.ts +0 -3
- package/dist/lang/markdown.js +0 -249
- package/dist/lang/python.d.ts +0 -3
- package/dist/lang/python.js +0 -335
- package/dist/lang/scripting.d.ts +0 -7
- package/dist/lang/scripting.js +0 -216
- package/dist/lang/shell.d.ts +0 -7
- package/dist/lang/shell.js +0 -404
- package/dist/lang/specs_gen.d.ts +0 -66
- package/dist/lang/specs_gen.js +0 -381
- package/dist/lang/terminal.d.ts +0 -9
- package/dist/lang/terminal.js +0 -550
- package/dist/lang/yaml.d.ts +0 -4
- package/dist/lang/yaml.js +0 -176
- package/dist/theme/index.js +0 -1
- /package/dist/{theme/generated.js → generated/themes.js} +0 -0
package/dist/lang/yaml.js
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { Cursor, emitCommentWithTodo, isDigit } from "../cursor.js";
|
|
2
|
-
import { Grammar } from "../engine.js";
|
|
3
|
-
import { TokenKind } from "../token.js";
|
|
4
|
-
import { onceGrammar } from "./code.js";
|
|
5
|
-
export function looksLikeNumber(w) {
|
|
6
|
-
if (w === "")
|
|
7
|
-
return false;
|
|
8
|
-
let i = 0;
|
|
9
|
-
const first = w.charCodeAt(0);
|
|
10
|
-
if (first === 45 || first === 43) {
|
|
11
|
-
i++;
|
|
12
|
-
if (i >= w.length)
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
if (!isDigit(w.charCodeAt(i)))
|
|
16
|
-
return false;
|
|
17
|
-
for (;i < w.length; i++) {
|
|
18
|
-
const c = w.charCodeAt(i);
|
|
19
|
-
if (isDigit(c) || c === 46 || c === 95 || c === 120 || c === 88 || c === 101 || c === 69 || c === 43 || c === 45 || c >= 97 && c <= 102 || c >= 65 && c <= 70) {
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
function findYAMLKeyColon(src, start, end) {
|
|
27
|
-
for (let i = start;i < end; i++) {
|
|
28
|
-
const ch = src.charCodeAt(i);
|
|
29
|
-
if (ch === 35 && i > start && src.charCodeAt(i - 1) === 32) {
|
|
30
|
-
return -1;
|
|
31
|
-
}
|
|
32
|
-
if (ch === 58 && (i + 1 === end || src.charCodeAt(i + 1) === 32 || src.charCodeAt(i + 1) === 9)) {
|
|
33
|
-
return i;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return -1;
|
|
37
|
-
}
|
|
38
|
-
function scanYAMLValue(src, start, end, e) {
|
|
39
|
-
let i = start;
|
|
40
|
-
while (i < end && !e.stopped()) {
|
|
41
|
-
const ch = src.charCodeAt(i);
|
|
42
|
-
if (ch === 32 || ch === 9) {
|
|
43
|
-
i++;
|
|
44
|
-
} else if (ch === 35 && (i === start || src.charCodeAt(i - 1) === 32 || src.charCodeAt(i - 1) === 9)) {
|
|
45
|
-
emitCommentWithTodo(src, i, end, e);
|
|
46
|
-
return;
|
|
47
|
-
} else if (ch === 34 || ch === 39) {
|
|
48
|
-
const cur = new Cursor(src.slice(0, end), i);
|
|
49
|
-
cur.scanQuoted(ch, false, ch === 39);
|
|
50
|
-
let k = cur.pos;
|
|
51
|
-
while (k < end && (src.charCodeAt(k) === 32 || src.charCodeAt(k) === 9))
|
|
52
|
-
k++;
|
|
53
|
-
if (k < end && src.charCodeAt(k) === 58 && (k + 1 === end || src.charCodeAt(k + 1) === 32)) {
|
|
54
|
-
e.emit(i, cur.pos, TokenKind.Property);
|
|
55
|
-
} else {
|
|
56
|
-
e.emit(i, cur.pos, TokenKind.String);
|
|
57
|
-
}
|
|
58
|
-
i = cur.pos;
|
|
59
|
-
} else if (ch === 38 || ch === 42) {
|
|
60
|
-
const s = i;
|
|
61
|
-
i++;
|
|
62
|
-
while (i < end) {
|
|
63
|
-
const b = src.charCodeAt(i);
|
|
64
|
-
if (b !== 32 && b !== 9 && b !== 44 && b !== 93 && b !== 125)
|
|
65
|
-
i++;
|
|
66
|
-
else
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
e.emit(s, i, TokenKind.Variable);
|
|
70
|
-
} else if (ch === 33 && i + 1 < end) {
|
|
71
|
-
const s = i;
|
|
72
|
-
i++;
|
|
73
|
-
while (i < end && src.charCodeAt(i) !== 32 && src.charCodeAt(i) !== 9)
|
|
74
|
-
i++;
|
|
75
|
-
e.emit(s, i, TokenKind.Type);
|
|
76
|
-
} else if (ch === 91 || ch === 93 || ch === 123 || ch === 125 || ch === 44 || ch === 58) {
|
|
77
|
-
e.emit(i, i + 1, TokenKind.Punctuation);
|
|
78
|
-
i++;
|
|
79
|
-
} else if (ch === 124 || ch === 62) {
|
|
80
|
-
if (i === start || src.charCodeAt(i - 1) === 32) {
|
|
81
|
-
e.emit(i, i + 1, TokenKind.Operator);
|
|
82
|
-
}
|
|
83
|
-
i++;
|
|
84
|
-
} else {
|
|
85
|
-
const s = i;
|
|
86
|
-
while (i < end) {
|
|
87
|
-
const b = src.charCodeAt(i);
|
|
88
|
-
if (b === 32 || b === 9 || b === 44 || b === 93 || b === 125)
|
|
89
|
-
break;
|
|
90
|
-
if (b === 35 && src.charCodeAt(i - 1) === 32)
|
|
91
|
-
break;
|
|
92
|
-
i++;
|
|
93
|
-
}
|
|
94
|
-
const w = src.slice(s, i);
|
|
95
|
-
switch (w) {
|
|
96
|
-
case "true":
|
|
97
|
-
case "false":
|
|
98
|
-
case "yes":
|
|
99
|
-
case "no":
|
|
100
|
-
case "on":
|
|
101
|
-
case "off":
|
|
102
|
-
case "null":
|
|
103
|
-
case "~":
|
|
104
|
-
case "True":
|
|
105
|
-
case "False":
|
|
106
|
-
case "Null":
|
|
107
|
-
case "TRUE":
|
|
108
|
-
case "FALSE":
|
|
109
|
-
case "NULL":
|
|
110
|
-
e.emit(s, i, TokenKind.Constant);
|
|
111
|
-
break;
|
|
112
|
-
default:
|
|
113
|
-
e.emit(s, i, looksLikeNumber(w) ? TokenKind.Number : TokenKind.String);
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
function scanYAMLLine(src, start, end, e) {
|
|
120
|
-
let i = start;
|
|
121
|
-
while (i < end && (src.charCodeAt(i) === 32 || src.charCodeAt(i) === 9))
|
|
122
|
-
i++;
|
|
123
|
-
if (i >= end)
|
|
124
|
-
return;
|
|
125
|
-
if (src.charCodeAt(i) === 35) {
|
|
126
|
-
emitCommentWithTodo(src, i, end, e);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
if (i === start && end - i >= 3 && (src.startsWith("---", i) || src.startsWith("...", i))) {
|
|
130
|
-
const rest = i + 3;
|
|
131
|
-
if (rest === end || src.charCodeAt(rest) === 32) {
|
|
132
|
-
e.emit(i, rest, TokenKind.Section);
|
|
133
|
-
if (rest < end)
|
|
134
|
-
scanYAMLValue(src, rest, end, e);
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
if (src.charCodeAt(i) === 45 && (i + 1 === end || src.charCodeAt(i + 1) === 32)) {
|
|
139
|
-
e.emit(i, i + 1, TokenKind.Operator);
|
|
140
|
-
i++;
|
|
141
|
-
while (i < end && (src.charCodeAt(i) === 32 || src.charCodeAt(i) === 9))
|
|
142
|
-
i++;
|
|
143
|
-
if (i >= end)
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
const ch = src.charCodeAt(i);
|
|
147
|
-
if (ch !== 34 && ch !== 39 && ch !== 91 && ch !== 123) {
|
|
148
|
-
const colon = findYAMLKeyColon(src, i, end);
|
|
149
|
-
if (colon >= 0) {
|
|
150
|
-
let keyEnd = colon;
|
|
151
|
-
while (keyEnd > i && (src.charCodeAt(keyEnd - 1) === 32 || src.charCodeAt(keyEnd - 1) === 9)) {
|
|
152
|
-
keyEnd--;
|
|
153
|
-
}
|
|
154
|
-
if (keyEnd > i)
|
|
155
|
-
e.emit(i, keyEnd, TokenKind.Property);
|
|
156
|
-
e.emit(colon, colon + 1, TokenKind.Punctuation);
|
|
157
|
-
scanYAMLValue(src, colon + 1, end, e);
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
scanYAMLValue(src, i, end, e);
|
|
162
|
-
}
|
|
163
|
-
function scanYAML(src, e) {
|
|
164
|
-
const n = src.length;
|
|
165
|
-
let pos = 0;
|
|
166
|
-
while (pos < n && !e.stopped()) {
|
|
167
|
-
const nl = src.indexOf(`
|
|
168
|
-
`, pos);
|
|
169
|
-
const lineEnd = nl >= 0 ? nl : n;
|
|
170
|
-
scanYAMLLine(src, pos, lineEnd, e);
|
|
171
|
-
if (nl < 0)
|
|
172
|
-
break;
|
|
173
|
-
pos = lineEnd + 1;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
export const yaml = /* @__PURE__ */ onceGrammar(() => new Grammar("yaml", scanYAML, "yml"));
|
package/dist/theme/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./generated.js";
|
|
File without changes
|