limn-hl 0.1.0 → 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.
Files changed (73) hide show
  1. package/README.md +109 -148
  2. package/dist/detect.d.ts +7 -1
  3. package/dist/detect.js +592 -502
  4. package/dist/engine.js +45 -1
  5. package/dist/generated/detect.d.ts +11 -0
  6. package/dist/generated/detect.js +2434 -0
  7. package/dist/generated/grammars.d.ts +119 -0
  8. package/dist/generated/grammars.js +613 -0
  9. package/dist/generated/lang.d.ts +6 -0
  10. package/dist/{lang/index.js → generated/lang.js} +82 -56
  11. package/dist/{theme/generated.d.ts → generated/themes.d.ts} +3 -1
  12. package/dist/{theme/generated.js → generated/themes.js} +29 -0
  13. package/dist/lang.d.ts +1 -0
  14. package/dist/lang.js +1 -0
  15. package/dist/render/ansi.d.ts +1 -1
  16. package/dist/render/html.d.ts +1 -1
  17. package/dist/{theme/index.d.ts → theme.d.ts} +1 -1
  18. package/dist/theme.js +1 -0
  19. package/dist/vm/compile.d.ts +4 -0
  20. package/dist/vm/compile.js +390 -0
  21. package/dist/vm/exec.d.ts +3 -0
  22. package/dist/vm/exec.js +218 -0
  23. package/dist/vm/format.d.ts +255 -0
  24. package/dist/vm/format.js +248 -0
  25. package/dist/vm/index.d.ts +2 -0
  26. package/dist/vm/index.js +2 -0
  27. package/dist/vm/pat.d.ts +4 -0
  28. package/dist/vm/pat.js +701 -0
  29. package/dist/vm/quoted.d.ts +8 -0
  30. package/dist/vm/quoted.js +190 -0
  31. package/dist/vm/scan.d.ts +3 -0
  32. package/dist/vm/scan.js +499 -0
  33. package/dist/wordtable.d.ts +8 -4
  34. package/dist/wordtable.js +107 -30
  35. package/package.json +6 -6
  36. package/dist/lang/clike.d.ts +0 -15
  37. package/dist/lang/clike.js +0 -35
  38. package/dist/lang/clike_helpers.d.ts +0 -8
  39. package/dist/lang/clike_helpers.js +0 -220
  40. package/dist/lang/code.d.ts +0 -45
  41. package/dist/lang/code.js +0 -779
  42. package/dist/lang/config.d.ts +0 -5
  43. package/dist/lang/config.js +0 -164
  44. package/dist/lang/css.d.ts +0 -5
  45. package/dist/lang/css.js +0 -125
  46. package/dist/lang/docs.d.ts +0 -12
  47. package/dist/lang/docs.js +0 -462
  48. package/dist/lang/formats.d.ts +0 -10
  49. package/dist/lang/formats.js +0 -295
  50. package/dist/lang/html.d.ts +0 -11
  51. package/dist/lang/html.js +0 -298
  52. package/dist/lang/index.d.ts +0 -20
  53. package/dist/lang/js.d.ts +0 -9
  54. package/dist/lang/js.js +0 -532
  55. package/dist/lang/js_helpers.d.ts +0 -7
  56. package/dist/lang/js_helpers.js +0 -308
  57. package/dist/lang/json.d.ts +0 -3
  58. package/dist/lang/json.js +0 -136
  59. package/dist/lang/markdown.d.ts +0 -3
  60. package/dist/lang/markdown.js +0 -249
  61. package/dist/lang/python.d.ts +0 -3
  62. package/dist/lang/python.js +0 -335
  63. package/dist/lang/scripting.d.ts +0 -7
  64. package/dist/lang/scripting.js +0 -216
  65. package/dist/lang/shell.d.ts +0 -7
  66. package/dist/lang/shell.js +0 -278
  67. package/dist/lang/specs_gen.d.ts +0 -66
  68. package/dist/lang/specs_gen.js +0 -381
  69. package/dist/lang/terminal.d.ts +0 -9
  70. package/dist/lang/terminal.js +0 -550
  71. package/dist/lang/yaml.d.ts +0 -4
  72. package/dist/lang/yaml.js +0 -176
  73. package/dist/theme/index.js +0 -1
@@ -0,0 +1,218 @@
1
+ import {
2
+ Cursor,
3
+ emitCommentWithTodo,
4
+ hasCallParen,
5
+ isDigit,
6
+ scanNumber
7
+ } from "../cursor.js";
8
+ import { TokenKind } from "../token.js";
9
+ import {
10
+ CF_BLOCK,
11
+ CF_EMIT_TODO,
12
+ CF_NESTED,
13
+ charCC,
14
+ execRes,
15
+ hasMask,
16
+ HDR_AT_LINE_START,
17
+ HDR_BOUNDARY,
18
+ HDR_PREV_NOT,
19
+ isWordSpace,
20
+ LF_CASE_INSENSITIVE,
21
+ LF_HAS_NEXT_MASK,
22
+ LF_REQUIRE_SPACE_AFTER,
23
+ lookupWordTransSpan,
24
+ matchPrefixFold,
25
+ NF_DOT_LEADING,
26
+ OP_COMMENT,
27
+ OP_LIT,
28
+ OP_NUMBER,
29
+ OP_PAT,
30
+ OP_QUOTED,
31
+ OP_WORD,
32
+ skipHSpace,
33
+ TR_STAY,
34
+ WF_BANG_MACRO,
35
+ WF_CALL_PAREN,
36
+ WF_HAS_AFTER_PAT,
37
+ WF_HAS_EXTRA_CONT,
38
+ WF_HAS_KWD_CALL_PAT,
39
+ WF_HAS_PRE_PAT,
40
+ WF_REQUIRE_TABLE_HIT
41
+ } from "./format.js";
42
+ import { execPatMatch, runPat } from "./pat.js";
43
+ import { execQuoted } from "./quoted.js";
44
+ export function execRule(src, pos, lineStart, r, cm, e) {
45
+ const n = src.length;
46
+ const byteCC = cm.byteCC;
47
+ const hdr = r.hdr;
48
+ if (hdr & HDR_AT_LINE_START && !lineStart)
49
+ return false;
50
+ if (hdr & HDR_PREV_NOT && pos > 0 && (charCC(byteCC, src.charCodeAt(pos - 1)) & r.prevNot) !== 0) {
51
+ return false;
52
+ }
53
+ if (hdr & HDR_BOUNDARY && pos > 0 && !hasMask(r.boundaryMask, src.charCodeAt(pos - 1))) {
54
+ return false;
55
+ }
56
+ switch (r.op) {
57
+ case OP_LIT: {
58
+ const fold = (r.sub8 & LF_CASE_INSENSITIVE) !== 0;
59
+ const reqSpace = (r.sub8 & LF_REQUIRE_SPACE_AFTER) !== 0;
60
+ const hasNext = (r.sub8 & LF_HAS_NEXT_MASK) !== 0;
61
+ for (let i = 0;i < r.lits.length; i++) {
62
+ const lit = r.lits[i];
63
+ const ok = fold ? matchPrefixFold(src, pos, r.litsLower[i]) : src.startsWith(lit, pos);
64
+ if (!ok)
65
+ continue;
66
+ const end = pos + lit.length;
67
+ if (reqSpace && end < n && !isWordSpace(src.charCodeAt(end)))
68
+ continue;
69
+ if (hasNext && (end >= n || !hasMask(r.nextMask, src.charCodeAt(end))))
70
+ continue;
71
+ if (r.emit !== TokenKind.Plain)
72
+ e.emit(pos, end, r.emit);
73
+ execRes.end = end;
74
+ execRes.tr = r.trans;
75
+ return true;
76
+ }
77
+ return false;
78
+ }
79
+ case OP_WORD: {
80
+ const sub = r.sub16;
81
+ let end = pos + 1;
82
+ if (sub & WF_HAS_EXTRA_CONT) {
83
+ while (end < n) {
84
+ const c = src.charCodeAt(end);
85
+ if ((charCC(byteCC, c) & r.contCC) === 0 && !hasMask(r.extraCont, c))
86
+ break;
87
+ end++;
88
+ }
89
+ } else {
90
+ while (end < n && (charCC(byteCC, src.charCodeAt(end)) & r.contCC) !== 0)
91
+ end++;
92
+ }
93
+ if (sub & WF_BANG_MACRO && end < n && src.charCodeAt(end) === 33) {
94
+ e.emit(pos, end + 1, TokenKind.Func);
95
+ execRes.end = end + 1;
96
+ execRes.tr = r.trans;
97
+ return true;
98
+ }
99
+ let tr = r.trans;
100
+ let kind = TokenKind.Plain;
101
+ if (sub & WF_HAS_PRE_PAT) {
102
+ const p = skipHSpace(src, end);
103
+ if (p < n && hasMask(r.preGuard, src.charCodeAt(p)) && execPatMatch(src, p, cm, r.prePatOff)) {
104
+ execRes.end = end;
105
+ execRes.tr = tr;
106
+ return true;
107
+ }
108
+ }
109
+ if (r.tableIdx >= 0) {
110
+ const k = cm.tables[r.tableIdx].lookupSpan(src, pos, end);
111
+ if (k !== TokenKind.Plain) {
112
+ if (sub & WF_HAS_KWD_CALL_PAT) {
113
+ const p = skipHSpace(src, end);
114
+ if (p < n && hasMask(r.kwdCallGuard, src.charCodeAt(p)) && (r.kwdCallSkipTable < 0 || cm.tables[r.kwdCallSkipTable].lookupSpan(src, pos, end) === TokenKind.Plain) && execPatMatch(src, p, cm, r.kwdCallPatOff)) {
115
+ e.emit(pos, end, TokenKind.Func);
116
+ execRes.end = end;
117
+ execRes.tr = tr;
118
+ return true;
119
+ }
120
+ }
121
+ if (k === TokenKind.Keyword && r.kwdTrans.op !== TR_STAY)
122
+ tr = r.kwdTrans;
123
+ if (r.wordTrans.length > 0) {
124
+ const wt = lookupWordTransSpan(src, pos, end, r.wordTrans);
125
+ if (wt !== undefined)
126
+ tr = wt.trans;
127
+ }
128
+ e.emit(pos, end, k);
129
+ execRes.end = end;
130
+ execRes.tr = tr;
131
+ return true;
132
+ }
133
+ }
134
+ if (sub & WF_REQUIRE_TABLE_HIT)
135
+ return false;
136
+ if (r.wordTrans.length > 0) {
137
+ const wt = lookupWordTransSpan(src, pos, end, r.wordTrans);
138
+ if (wt !== undefined)
139
+ tr = wt.trans;
140
+ }
141
+ if (sub & WF_HAS_AFTER_PAT) {
142
+ const p = skipHSpace(src, end);
143
+ if (p < n && hasMask(r.afterGuard, src.charCodeAt(p)) && execPatMatch(src, p, cm, r.afterPatOff)) {
144
+ kind = r.afterKind;
145
+ }
146
+ }
147
+ if (kind === TokenKind.Plain && sub & WF_CALL_PAREN && hasCallParen(src, end)) {
148
+ kind = TokenKind.Func;
149
+ }
150
+ if (kind === TokenKind.Plain)
151
+ kind = r.fallbackKind;
152
+ if (kind !== TokenKind.Plain)
153
+ e.emit(pos, end, kind);
154
+ execRes.end = end;
155
+ execRes.tr = tr;
156
+ return true;
157
+ }
158
+ case OP_NUMBER: {
159
+ if (r.sub8 & NF_DOT_LEADING && (pos + 1 >= n || !isDigit(src.charCodeAt(pos + 1)))) {
160
+ return false;
161
+ }
162
+ const end = scanNumber(src, pos);
163
+ e.emit(pos, end, TokenKind.Number);
164
+ execRes.end = end;
165
+ execRes.tr = r.trans;
166
+ return true;
167
+ }
168
+ case OP_QUOTED:
169
+ return execQuoted(src, pos, r, e);
170
+ case OP_COMMENT: {
171
+ if (r.sub8 & CF_BLOCK) {
172
+ if (!src.startsWith(r.open, pos))
173
+ return false;
174
+ let end;
175
+ if (r.sub8 & CF_NESTED) {
176
+ const cur = new Cursor(src, pos + r.open.length);
177
+ cur.scanNestedComment(r.open, r.closeStr);
178
+ end = cur.pos;
179
+ } else {
180
+ const idx = src.indexOf(r.closeStr, pos + r.open.length);
181
+ end = idx >= 0 ? idx + r.closeStr.length : n;
182
+ }
183
+ if (r.sub8 & CF_EMIT_TODO)
184
+ emitCommentWithTodo(src, pos, end, e);
185
+ else
186
+ e.emit(pos, end, TokenKind.Comment);
187
+ execRes.end = end;
188
+ execRes.tr = r.trans;
189
+ return true;
190
+ }
191
+ for (let i = 0;i < r.lits.length; i++) {
192
+ const lit = r.lits[i];
193
+ if (!src.startsWith(lit, pos))
194
+ continue;
195
+ const nl = src.indexOf(`
196
+ `, pos + lit.length);
197
+ const end = nl >= 0 ? nl : n;
198
+ if (r.sub8 & CF_EMIT_TODO)
199
+ emitCommentWithTodo(src, pos, end, e);
200
+ else
201
+ e.emit(pos, end, TokenKind.Comment);
202
+ execRes.end = end;
203
+ execRes.tr = r.trans;
204
+ return true;
205
+ }
206
+ return false;
207
+ }
208
+ case OP_PAT: {
209
+ const end = runPat(src, pos, n, 0, 0, r.patOff, cm, e);
210
+ if (end < 0)
211
+ return false;
212
+ execRes.end = end;
213
+ execRes.tr = r.trans;
214
+ return true;
215
+ }
216
+ }
217
+ return false;
218
+ }
@@ -0,0 +1,255 @@
1
+ import type { Grammar } from "../engine.js";
2
+ import { TokenKind } from "../token.js";
3
+ import type { WordTable } from "../wordtable.js";
4
+ /** Lazily initializes and caches a Grammar singleton. */
5
+ export declare function onceGrammar(build: () => Grammar): () => Grammar;
6
+ /** Word table specification embedded in a compiled VM language spec. */
7
+ export interface VMWordTableSpec {
8
+ readonly foldCase?: boolean;
9
+ readonly groups: ReadonlyArray<{
10
+ readonly kind: number;
11
+ readonly words: string;
12
+ }>;
13
+ }
14
+ /** Precompiled bytecode and pool specification for a VM-driven language grammar. */
15
+ export interface VMSpec {
16
+ readonly name: string;
17
+ readonly aliases?: readonly string[];
18
+ readonly tables?: readonly VMWordTableSpec[];
19
+ readonly strings?: readonly string[];
20
+ readonly masks?: readonly string[];
21
+ readonly embeds?: ReadonlyArray<() => Grammar>;
22
+ readonly patCode?: readonly number[];
23
+ readonly code: readonly number[];
24
+ }
25
+ export declare const OP_LIT = 0;
26
+ export declare const OP_WORD = 1;
27
+ export declare const OP_NUMBER = 2;
28
+ export declare const OP_QUOTED = 3;
29
+ export declare const OP_COMMENT = 4;
30
+ export declare const OP_PAT = 5;
31
+ export declare const PAT_OP_RET = 0;
32
+ export declare const PAT_OP_LIT = 1;
33
+ export declare const PAT_OP_LIT_FOLD = 2;
34
+ export declare const PAT_OP_CLASS = 3;
35
+ export declare const PAT_OP_NOT_CLASS = 4;
36
+ export declare const PAT_OP_SPAN = 5;
37
+ export declare const PAT_OP_SPAN_NOT = 6;
38
+ export declare const PAT_OP_ANY_UTF8 = 7;
39
+ export declare const PAT_OP_ASSERT = 8;
40
+ export declare const PAT_OP_CHOICE = 9;
41
+ export declare const PAT_OP_COMMIT = 10;
42
+ export declare const PAT_OP_JUMP = 11;
43
+ export declare const PAT_OP_LOOK = 12;
44
+ export declare const PAT_OP_MARK = 13;
45
+ export declare const PAT_OP_EMIT = 14;
46
+ export declare const PAT_OP_EMBED = 15;
47
+ export declare const PAT_OP_BALANCED = 16;
48
+ export declare const PAT_OP_UNTIL = 17;
49
+ export declare const PAT_OP_CAP_RUN = 18;
50
+ export declare const PAT_OP_SCAN_CAP_CLOSE = 19;
51
+ export declare const PAT_OP_LINE_CONT_LIMIT = 20;
52
+ export declare const PAT_OP_SET_LIMIT = 21;
53
+ export declare const PAT_OP_TABLE_BRANCH = 22;
54
+ export declare const PAT_OP_STD_NUM = 23;
55
+ export declare const PAT_OP_NOT_IN_LINE = 24;
56
+ export declare const PAT_OP_SKIP_TO_LIMIT = 25;
57
+ export declare const PAT_OP_SCAN_ESCAPE = 26;
58
+ export declare const PAT_OP_EMIT_TABLE = 27;
59
+ export declare const CC_ALPHA: number;
60
+ export declare const CC_DIGIT: number;
61
+ export declare const CC_UNDER: number;
62
+ export declare const CC_NONASCII: number;
63
+ export declare const CC_HYPHEN: number;
64
+ export declare const CC_DOT: number;
65
+ export declare const CC_COLON: number;
66
+ export declare const CC_NONSPACE: number;
67
+ export declare const CC_NONASCII_VAL: number;
68
+ export declare const HDR_AT_LINE_START: number;
69
+ export declare const HDR_PREV_NOT: number;
70
+ export declare const HDR_BOUNDARY: number;
71
+ export declare const HDR_TRANS: number;
72
+ export declare const LF_CASE_INSENSITIVE: number;
73
+ export declare const LF_REQUIRE_SPACE_AFTER: number;
74
+ export declare const LF_HAS_NEXT_MASK: number;
75
+ export declare const WF_REQUIRE_TABLE_HIT: number;
76
+ export declare const WF_CALL_PAREN: number;
77
+ export declare const WF_BANG_MACRO: number;
78
+ export declare const WF_HAS_EXTRA_CONT: number;
79
+ export declare const WF_HAS_FALLBACK: number;
80
+ export declare const WF_HAS_WORD_TRANS: number;
81
+ export declare const WF_HAS_PRE_PAT: number;
82
+ export declare const WF_HAS_AFTER_PAT: number;
83
+ export declare const WF_HAS_KWD_CALL_PAT: number;
84
+ export declare const NF_DOT_LEADING: number;
85
+ export declare const QF_MULTILINE: number;
86
+ export declare const QF_RAW: number;
87
+ export declare const QF_ESCAPES: number;
88
+ export declare const QF_TRIPLE: number;
89
+ export declare const QF_HAS_PREFIX: number;
90
+ export declare const QF_COLON_KEY: number;
91
+ export declare const CF_BLOCK: number;
92
+ export declare const CF_NESTED: number;
93
+ export declare const CF_EMIT_TODO: number;
94
+ export declare const MF_HAS_LIT_GUARD: number;
95
+ export declare const MF_HAS_DEFAULT_KIND: number;
96
+ export declare const MF_HAS_NEWLINE_TRANS: number;
97
+ export declare const MF_HAS_DEFAULT_TRANS: number;
98
+ export declare const MF_HAS_FAST_IDENT: number;
99
+ export declare const MF_HAS_IDENT_GUARD: number;
100
+ export declare const MF_HAS_FAST_QUOTED: number;
101
+ export declare const MF_HAS_NUM_TRANS: number;
102
+ export declare const TR_STAY = 0;
103
+ export declare const TR_SET = 1;
104
+ export declare const TR_PUSH = 2;
105
+ export declare const TR_POP = 3;
106
+ export declare const TR_RESET = 4;
107
+ export declare const TR_RESET_IF_EMPTY = 5;
108
+ export declare const TR_POP_RECONSUME = 6;
109
+ export declare const TR_PUSH_RET = 7;
110
+ export declare const TR_SET_RECONSUME = 8;
111
+ export declare const ACT_SKIP_WS = 0;
112
+ export declare const ACT_SKIP_WS_NL = 1;
113
+ export declare const ACT_DEFAULT_RUN = 2;
114
+ export declare const ACT_NEWLINE = 3;
115
+ export declare const ACT_IDENT_SIMPLE = 4;
116
+ export declare const ACT_IDENT_FAST = 5;
117
+ export declare const ACT_IDENT_GUARD = 6;
118
+ export declare const ACT_NUMBER_FAST = 7;
119
+ export declare const ACT_POP_RECONSUME = 8;
120
+ export declare const ACT_QUOTED_FAST0 = 9;
121
+ export declare const ACT_QUOTED_FAST1 = 10;
122
+ export declare const ACT_LIT_GUARD = 11;
123
+ export declare const ACT_EMIT_SINGLE_BASE = 12;
124
+ export declare const ACT_EMIT_TRANS_BASE = 29;
125
+ export declare const ACT_DIRECT_BASE = 45;
126
+ export declare const ACT_CHAIN_BASE = 160;
127
+ export declare const MAX_EMIT_TRANS_SLOTS = 16;
128
+ export declare function ensureByteCC(): Uint8Array;
129
+ export declare function charCC(byteCC: Uint8Array, ch: number): number;
130
+ export declare const EMPTY_MASK: Uint8Array<ArrayBuffer>;
131
+ export declare function makeMask(s: string): Uint8Array;
132
+ export declare function hasMask(m: Uint8Array, ch: number): boolean;
133
+ export interface VMTrans {
134
+ readonly op: number;
135
+ readonly mode: number;
136
+ readonly retMode: number;
137
+ }
138
+ export declare const STAY_TRANS: VMTrans;
139
+ export interface VMWordTrans {
140
+ readonly word: string;
141
+ readonly trans: VMTrans;
142
+ }
143
+ export interface VMRule {
144
+ readonly op: number;
145
+ readonly hdr: number;
146
+ readonly prevNot: number;
147
+ readonly boundaryMask: Uint8Array;
148
+ readonly trans: VMTrans;
149
+ readonly emit: TokenKind;
150
+ readonly sub8: number;
151
+ readonly sub16: number;
152
+ readonly lits: readonly string[];
153
+ readonly litsLower: readonly string[];
154
+ readonly nextMask: Uint8Array;
155
+ readonly contCC: number;
156
+ readonly tableIdx: number;
157
+ readonly extraCont: Uint8Array;
158
+ readonly fallbackKind: TokenKind;
159
+ readonly wordTrans: readonly VMWordTrans[];
160
+ readonly kwdTrans: VMTrans;
161
+ readonly quoteByte: number;
162
+ readonly open: string;
163
+ readonly closeStr: string;
164
+ readonly patOff: number;
165
+ readonly preGuard: Uint8Array;
166
+ readonly afterGuard: Uint8Array;
167
+ readonly afterKind: TokenKind;
168
+ readonly kwdCallGuard: Uint8Array;
169
+ readonly prePatOff: number;
170
+ readonly afterPatOff: number;
171
+ readonly kwdCallPatOff: number;
172
+ readonly kwdCallSkipTable: number;
173
+ }
174
+ export interface FastIdentInfo {
175
+ readonly cont: Uint8Array;
176
+ readonly tableIdx: number;
177
+ readonly simple: boolean;
178
+ readonly bangMacro: boolean;
179
+ readonly callParen: boolean;
180
+ readonly hasPrePat: boolean;
181
+ readonly hasAfterPat: boolean;
182
+ readonly hasKwdCallPat: boolean;
183
+ readonly preGuard: Uint8Array;
184
+ readonly afterGuard: Uint8Array;
185
+ readonly afterKind: TokenKind;
186
+ readonly kwdCallGuard: Uint8Array;
187
+ readonly prePatOff: number;
188
+ readonly afterPatOff: number;
189
+ readonly kwdCallPatOff: number;
190
+ readonly kwdCallSkipTable: number;
191
+ readonly fallbackKind: TokenKind;
192
+ readonly wtFirstMask: Uint8Array;
193
+ readonly wordTrans: readonly VMWordTrans[];
194
+ readonly nonTableWtMask: Uint8Array;
195
+ readonly nonTableWordTrans: readonly VMWordTrans[];
196
+ readonly kwdTrans: VMTrans;
197
+ readonly trans: VMTrans;
198
+ }
199
+ export declare const DISABLED_FAST_IDENT: FastIdentInfo;
200
+ export interface FastQuotedInfo {
201
+ readonly stop: Uint8Array;
202
+ readonly quoteByte: number;
203
+ readonly emit: TokenKind;
204
+ readonly multiline: boolean;
205
+ readonly raw: boolean;
206
+ readonly escapes: boolean;
207
+ readonly colonKey: boolean;
208
+ readonly trans: VMTrans;
209
+ }
210
+ export declare const DISABLED_FAST_QUOTED: FastQuotedInfo;
211
+ export interface FastSingleLit {
212
+ readonly emit: TokenKind;
213
+ readonly trans: VMTrans;
214
+ }
215
+ export interface FastLitGuard {
216
+ readonly mask: Uint8Array;
217
+ readonly chainIdx: number;
218
+ readonly emit: TokenKind;
219
+ readonly trans: VMTrans;
220
+ }
221
+ export interface CompiledMode {
222
+ readonly action: Uint8Array;
223
+ readonly guardChain: Uint8Array;
224
+ readonly identGuardMask: Uint8Array;
225
+ readonly litGuards: readonly FastLitGuard[];
226
+ readonly chains: readonly Uint8Array[];
227
+ readonly defaultKind: TokenKind;
228
+ readonly newlineTr: VMTrans;
229
+ readonly defaultTr: VMTrans;
230
+ readonly numTrans: VMTrans;
231
+ readonly fastIdent: FastIdentInfo;
232
+ readonly fastQuoted: readonly [FastQuotedInfo, FastQuotedInfo];
233
+ readonly fastSingle: readonly FastSingleLit[];
234
+ }
235
+ export interface CompiledVM {
236
+ readonly byteCC: Uint8Array;
237
+ readonly tables: readonly WordTable[];
238
+ readonly strings: readonly string[];
239
+ readonly stringsLower: readonly string[];
240
+ readonly masks: readonly Uint8Array[];
241
+ readonly patCode: Uint8Array;
242
+ readonly rules: readonly VMRule[];
243
+ readonly modes: readonly CompiledMode[];
244
+ readonly embeds: ReadonlyArray<() => Grammar>;
245
+ }
246
+ export interface ExecResult {
247
+ end: number;
248
+ tr: VMTrans;
249
+ }
250
+ export declare const execRes: ExecResult;
251
+ export declare function isWordSpace(c: number): boolean;
252
+ export declare function skipHSpace(src: string, pos: number): number;
253
+ export declare function matchPrefixFold(src: string, pos: number, lowerPat: string): boolean;
254
+ export declare function skipCodePoint(src: string, pos: number): number;
255
+ export declare function lookupWordTransSpan(src: string, start: number, end: number, list: readonly VMWordTrans[]): VMWordTrans | undefined;