dot-language-support 2.3.0 → 3.0.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 (109) hide show
  1. package/dist/index.d.ts +497 -0
  2. package/dist/index.js +3853 -0
  3. package/package.json +10 -11
  4. package/.github/dependabot.yml +0 -15
  5. package/.github/workflows/CD.yml +0 -37
  6. package/.github/workflows/CI.yml +0 -28
  7. package/.github/workflows/auto-merge.yaml +0 -26
  8. package/CITATION.cff +0 -14
  9. package/biome.json +0 -48
  10. package/lib/cjs/binder.d.ts +0 -2
  11. package/lib/cjs/binder.js +0 -297
  12. package/lib/cjs/checker.d.ts +0 -15
  13. package/lib/cjs/checker.js +0 -228
  14. package/lib/cjs/core.d.ts +0 -1
  15. package/lib/cjs/core.js +0 -13
  16. package/lib/cjs/error.d.ts +0 -3
  17. package/lib/cjs/error.js +0 -12
  18. package/lib/cjs/index.d.ts +0 -5
  19. package/lib/cjs/index.js +0 -22
  20. package/lib/cjs/parser.d.ts +0 -27
  21. package/lib/cjs/parser.js +0 -664
  22. package/lib/cjs/scanner.d.ts +0 -41
  23. package/lib/cjs/scanner.js +0 -578
  24. package/lib/cjs/service/codeAction.d.ts +0 -12
  25. package/lib/cjs/service/codeAction.js +0 -245
  26. package/lib/cjs/service/colorProvider.d.ts +0 -5
  27. package/lib/cjs/service/colorProvider.js +0 -91
  28. package/lib/cjs/service/command/ChangeAllOtherEdgeOpsAndFixGraphCommand.d.ts +0 -10
  29. package/lib/cjs/service/command/ChangeAllOtherEdgeOpsAndFixGraphCommand.js +0 -42
  30. package/lib/cjs/service/command/ChangeEdgeOpCommand.d.ts +0 -10
  31. package/lib/cjs/service/command/ChangeEdgeOpCommand.js +0 -67
  32. package/lib/cjs/service/command/ConsolidateDescendantsCommand.d.ts +0 -10
  33. package/lib/cjs/service/command/ConsolidateDescendantsCommand.js +0 -87
  34. package/lib/cjs/service/command/RemoveSemicolons.d.ts +0 -10
  35. package/lib/cjs/service/command/RemoveSemicolons.js +0 -39
  36. package/lib/cjs/service/command/common.d.ts +0 -31
  37. package/lib/cjs/service/command/common.js +0 -33
  38. package/lib/cjs/service/completion.d.ts +0 -4
  39. package/lib/cjs/service/completion.js +0 -173
  40. package/lib/cjs/service/hover.d.ts +0 -4
  41. package/lib/cjs/service/hover.js +0 -142
  42. package/lib/cjs/service/languageFacts.d.ts +0 -683
  43. package/lib/cjs/service/languageFacts.js +0 -996
  44. package/lib/cjs/service/reference.d.ts +0 -5
  45. package/lib/cjs/service/reference.js +0 -67
  46. package/lib/cjs/service/rename.d.ts +0 -4
  47. package/lib/cjs/service/rename.js +0 -51
  48. package/lib/cjs/service/service.d.ts +0 -28
  49. package/lib/cjs/service/service.js +0 -38
  50. package/lib/cjs/service/util.d.ts +0 -11
  51. package/lib/cjs/service/util.js +0 -49
  52. package/lib/cjs/service/validation.d.ts +0 -4
  53. package/lib/cjs/service/validation.js +0 -23
  54. package/lib/cjs/tester.d.ts +0 -1
  55. package/lib/cjs/tester.js +0 -23
  56. package/lib/cjs/types.d.ts +0 -397
  57. package/lib/cjs/types.js +0 -74
  58. package/lib/cjs/visitor.d.ts +0 -2
  59. package/lib/cjs/visitor.js +0 -76
  60. package/lib/esm/binder.d.ts +0 -2
  61. package/lib/esm/binder.js +0 -294
  62. package/lib/esm/checker.d.ts +0 -15
  63. package/lib/esm/checker.js +0 -212
  64. package/lib/esm/core.d.ts +0 -1
  65. package/lib/esm/core.js +0 -10
  66. package/lib/esm/error.d.ts +0 -3
  67. package/lib/esm/error.js +0 -8
  68. package/lib/esm/index.d.ts +0 -5
  69. package/lib/esm/index.js +0 -6
  70. package/lib/esm/parser.d.ts +0 -27
  71. package/lib/esm/parser.js +0 -714
  72. package/lib/esm/scanner.d.ts +0 -41
  73. package/lib/esm/scanner.js +0 -581
  74. package/lib/esm/service/codeAction.d.ts +0 -12
  75. package/lib/esm/service/codeAction.js +0 -207
  76. package/lib/esm/service/colorProvider.d.ts +0 -5
  77. package/lib/esm/service/colorProvider.js +0 -54
  78. package/lib/esm/service/command/ChangeAllOtherEdgeOpsAndFixGraphCommand.d.ts +0 -10
  79. package/lib/esm/service/command/ChangeAllOtherEdgeOpsAndFixGraphCommand.js +0 -38
  80. package/lib/esm/service/command/ChangeEdgeOpCommand.d.ts +0 -10
  81. package/lib/esm/service/command/ChangeEdgeOpCommand.js +0 -30
  82. package/lib/esm/service/command/ConsolidateDescendantsCommand.d.ts +0 -10
  83. package/lib/esm/service/command/ConsolidateDescendantsCommand.js +0 -83
  84. package/lib/esm/service/command/RemoveSemicolons.d.ts +0 -10
  85. package/lib/esm/service/command/RemoveSemicolons.js +0 -35
  86. package/lib/esm/service/command/common.d.ts +0 -31
  87. package/lib/esm/service/command/common.js +0 -25
  88. package/lib/esm/service/completion.d.ts +0 -4
  89. package/lib/esm/service/completion.js +0 -137
  90. package/lib/esm/service/hover.d.ts +0 -4
  91. package/lib/esm/service/hover.js +0 -135
  92. package/lib/esm/service/languageFacts.d.ts +0 -683
  93. package/lib/esm/service/languageFacts.js +0 -993
  94. package/lib/esm/service/reference.d.ts +0 -5
  95. package/lib/esm/service/reference.js +0 -63
  96. package/lib/esm/service/rename.d.ts +0 -4
  97. package/lib/esm/service/rename.js +0 -48
  98. package/lib/esm/service/service.d.ts +0 -28
  99. package/lib/esm/service/service.js +0 -35
  100. package/lib/esm/service/util.d.ts +0 -11
  101. package/lib/esm/service/util.js +0 -42
  102. package/lib/esm/service/validation.d.ts +0 -4
  103. package/lib/esm/service/validation.js +0 -20
  104. package/lib/esm/tester.d.ts +0 -1
  105. package/lib/esm/tester.js +0 -21
  106. package/lib/esm/types.d.ts +0 -397
  107. package/lib/esm/types.js +0 -71
  108. package/lib/esm/visitor.d.ts +0 -2
  109. package/lib/esm/visitor.js +0 -73
@@ -1,41 +0,0 @@
1
- import { DiagnosticCategory, ScanError, SyntaxKind, TokenFlags } from "./types.js";
2
- export interface Scanner {
3
- readonly end: number;
4
- readonly pos: number;
5
- readonly startPos: number;
6
- readonly tokenPos: number;
7
- readonly token: SyntaxKind;
8
- readonly tokenValue: string | undefined;
9
- readonly isUnterminated: boolean;
10
- readonly text: string;
11
- readonly onError: ErrorCallback | null;
12
- setText(newText?: string, start?: number, length?: number): void;
13
- setErrorCallback(cb: ErrorCallback): void;
14
- scan(skipTrivia: boolean): SyntaxKind;
15
- lookAhead(callback: () => SyntaxKind | boolean): SyntaxKind | boolean;
16
- tryScan(callback: () => SyntaxKind | boolean): SyntaxKind | boolean;
17
- }
18
- export declare function getTokenAsText(token: SyntaxKind): string | undefined;
19
- export declare function getTextAsToken(token: string): SyntaxKind | undefined;
20
- export type ErrorCallback = (message: string, category: DiagnosticCategory, sub: ScanError, length: number) => void;
21
- export declare class DefaultScanner implements Scanner {
22
- #private;
23
- end: number;
24
- pos: number;
25
- startPos: number;
26
- tokenPos: number;
27
- token: SyntaxKind;
28
- tokenValue: string | undefined;
29
- tokenFlags: TokenFlags;
30
- isUnterminated: boolean;
31
- text: string;
32
- onError: ErrorCallback | null;
33
- setText(newText?: string, start?: number, length?: number): void;
34
- setErrorCallback(cb: ErrorCallback | null): void;
35
- scan(skipTrivia?: boolean): SyntaxKind;
36
- lookAhead<T extends SyntaxKind>(callback: () => T): T;
37
- tryScan<T extends SyntaxKind>(callback: () => T): T;
38
- }
39
- export declare function isIdentifierStart(ch: number): boolean;
40
- export declare function skipTrivia(text: string, pos: number): number;
41
- export declare function isLineBreak(ch: number): boolean;
@@ -1,578 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
- };
7
- var _DefaultScanner_instances, _DefaultScanner_setTextPos, _DefaultScanner_error, _DefaultScanner_isWhiteSpaceSingleLine, _DefaultScanner_isAtMultiLineCommentEnd, _DefaultScanner_scanHashCommentTrivia, _DefaultScanner_scanSingleLineCommentTrivia, _DefaultScanner_scanMultiLineCommentTrivia, _DefaultScanner_scanHtml, _DefaultScanner_scanString, _DefaultScanner_scanNumber, _DefaultScanner_getIdentifierToken, _DefaultScanner_speculationHelper;
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.DefaultScanner = void 0;
10
- exports.getTokenAsText = getTokenAsText;
11
- exports.getTextAsToken = getTextAsToken;
12
- exports.isIdentifierStart = isIdentifierStart;
13
- exports.skipTrivia = skipTrivia;
14
- exports.isLineBreak = isLineBreak;
15
- const core_js_1 = require("./core.js");
16
- const util_js_1 = require("./service/util.js");
17
- const types_js_1 = require("./types.js");
18
- const textToToken = (0, core_js_1.createMapFromTemplate)({
19
- digraph: types_js_1.SyntaxKind.DigraphKeyword,
20
- graph: types_js_1.SyntaxKind.GraphKeyword,
21
- edge: types_js_1.SyntaxKind.EdgeKeyword,
22
- node: types_js_1.SyntaxKind.NodeKeyword,
23
- strict: types_js_1.SyntaxKind.StrictKeyword,
24
- subgraph: types_js_1.SyntaxKind.SubgraphKeyword,
25
- n: types_js_1.SyntaxKind.CompassNorthToken,
26
- ne: types_js_1.SyntaxKind.CompassNorthEastToken,
27
- e: types_js_1.SyntaxKind.CompassEastToken,
28
- se: types_js_1.SyntaxKind.CompassSouthEastToken,
29
- s: types_js_1.SyntaxKind.CompassSouthToken,
30
- sw: types_js_1.SyntaxKind.CompassSouthWestToken,
31
- w: types_js_1.SyntaxKind.CompassWestToken,
32
- nw: types_js_1.SyntaxKind.CompassNorthWestToken,
33
- c: types_js_1.SyntaxKind.CompassCenterToken,
34
- "+": types_js_1.SyntaxKind.PlusToken,
35
- "=": types_js_1.SyntaxKind.EqualsToken,
36
- "->": types_js_1.SyntaxKind.DirectedEdgeOp,
37
- "--": types_js_1.SyntaxKind.UndirectedEdgeOp,
38
- "{": types_js_1.SyntaxKind.OpenBraceToken,
39
- "}": types_js_1.SyntaxKind.CloseBraceToken,
40
- "[": types_js_1.SyntaxKind.OpenBracketToken,
41
- "]": types_js_1.SyntaxKind.CloseBracketToken,
42
- ";": types_js_1.SyntaxKind.SemicolonToken,
43
- ":": types_js_1.SyntaxKind.ColonToken,
44
- _: types_js_1.SyntaxKind.UnderscoreToken,
45
- ",": types_js_1.SyntaxKind.CommaToken,
46
- "<": types_js_1.SyntaxKind.LessThan,
47
- ">": types_js_1.SyntaxKind.GreaterThan,
48
- });
49
- function makeReverseMap(source) {
50
- const result = new Map();
51
- source.forEach((value, key) => {
52
- result.set(value, key);
53
- });
54
- return result;
55
- }
56
- const tokenToText = makeReverseMap(textToToken);
57
- function getTokenAsText(token) {
58
- return tokenToText.get(token);
59
- }
60
- function getTextAsToken(token) {
61
- return textToToken.get(token);
62
- }
63
- class DefaultScanner {
64
- constructor() {
65
- _DefaultScanner_instances.add(this);
66
- }
67
- setText(newText, start = 0, length) {
68
- this.text = newText || "";
69
- this.end = length === undefined ? this.text.length : start + length;
70
- __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_setTextPos).call(this, start || 0);
71
- }
72
- setErrorCallback(cb) {
73
- this.onError = cb;
74
- }
75
- scan(skipTrivia = true) {
76
- this.startPos = this.pos;
77
- this.tokenFlags = 0;
78
- this.isUnterminated = false;
79
- while (true) {
80
- this.tokenPos = this.pos;
81
- if (this.pos >= this.end) {
82
- return (this.token = types_js_1.SyntaxKind.EndOfFileToken);
83
- }
84
- let ch = this.text.charCodeAt(this.pos);
85
- switch (ch) {
86
- case 10:
87
- case 13:
88
- this.tokenFlags |= 4;
89
- if (skipTrivia) {
90
- this.pos++;
91
- continue;
92
- }
93
- if (ch === 13 &&
94
- this.pos + 1 < this.end &&
95
- this.text.charCodeAt(this.pos + 1) === 10) {
96
- this.pos += 2;
97
- }
98
- else {
99
- this.pos++;
100
- }
101
- return (this.token = types_js_1.SyntaxKind.NewLineTrivia);
102
- case 9:
103
- case 11:
104
- case 12:
105
- case 32:
106
- if (skipTrivia) {
107
- this.pos++;
108
- continue;
109
- }
110
- while (this.pos < this.end &&
111
- __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_isWhiteSpaceSingleLine).call(this, this.text.charCodeAt(this.pos)))
112
- this.pos++;
113
- return (this.token = types_js_1.SyntaxKind.WhitespaceTrivia);
114
- case 35: {
115
- const content = __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_scanHashCommentTrivia).call(this, skipTrivia);
116
- if (skipTrivia)
117
- continue;
118
- this.tokenValue = content;
119
- return (this.token = types_js_1.SyntaxKind.HashCommentTrivia);
120
- }
121
- case 47: {
122
- if (this.pos + 1 < this.end) {
123
- const nextChar = this.text.charCodeAt(this.pos + 1);
124
- switch (nextChar) {
125
- case 47: {
126
- const commentContent = __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_scanSingleLineCommentTrivia).call(this, skipTrivia);
127
- if (skipTrivia)
128
- continue;
129
- this.tokenValue = commentContent;
130
- return (this.token = types_js_1.SyntaxKind.SingleLineCommentTrivia);
131
- }
132
- case 42: {
133
- const commentContent = __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_scanMultiLineCommentTrivia).call(this, skipTrivia);
134
- if (skipTrivia)
135
- continue;
136
- this.tokenValue = commentContent;
137
- return (this.token = types_js_1.SyntaxKind.MultiLineCommentTrivia);
138
- }
139
- }
140
- }
141
- __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_error).call(this, 'Unexpected "/". Did you mean to start a comment like "/*" or "//"? If you wanted to use it as an identifier, put it in double quotes.', 0);
142
- ++this.pos;
143
- break;
144
- }
145
- case 123:
146
- this.pos++;
147
- return (this.token = types_js_1.SyntaxKind.OpenBraceToken);
148
- case 125:
149
- this.pos++;
150
- return (this.token = types_js_1.SyntaxKind.CloseBraceToken);
151
- case 91:
152
- this.pos++;
153
- return (this.token = types_js_1.SyntaxKind.OpenBracketToken);
154
- case 93:
155
- this.pos++;
156
- return (this.token = types_js_1.SyntaxKind.CloseBracketToken);
157
- case 43:
158
- this.pos++;
159
- return (this.token = types_js_1.SyntaxKind.PlusToken);
160
- case 61:
161
- this.pos++;
162
- return (this.token = types_js_1.SyntaxKind.EqualsToken);
163
- case 48:
164
- case 49:
165
- case 50:
166
- case 51:
167
- case 52:
168
- case 53:
169
- case 54:
170
- case 55:
171
- case 56:
172
- case 57:
173
- case 46:
174
- this.tokenValue = __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_scanNumber).call(this);
175
- return (this.token = types_js_1.SyntaxKind.NumericIdentifier);
176
- case 45: {
177
- const nextChar = this.text.charCodeAt(this.pos + 1);
178
- switch (nextChar) {
179
- case 45:
180
- this.pos += 2;
181
- return (this.token = types_js_1.SyntaxKind.UndirectedEdgeOp);
182
- case 62:
183
- this.pos += 2;
184
- return (this.token = types_js_1.SyntaxKind.DirectedEdgeOp);
185
- case 48:
186
- case 49:
187
- case 50:
188
- case 51:
189
- case 52:
190
- case 53:
191
- case 54:
192
- case 55:
193
- case 56:
194
- case 57:
195
- case 46:
196
- this.tokenValue = __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_scanNumber).call(this);
197
- return (this.token = types_js_1.SyntaxKind.NumericIdentifier);
198
- default: {
199
- const chr = this.text.charAt(this.pos + 1);
200
- __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_error).call(this, `Unexpected "${chr}". Did you mean to define an edge? Depending on the type of graph you are defining, use "->" or "--".`, 0);
201
- break;
202
- }
203
- }
204
- this.pos++;
205
- break;
206
- }
207
- case 95:
208
- this.pos++;
209
- return (this.token = types_js_1.SyntaxKind.UnderscoreToken);
210
- case 59:
211
- this.pos++;
212
- return (this.token = types_js_1.SyntaxKind.SemicolonToken);
213
- case 58:
214
- this.pos++;
215
- return (this.token = types_js_1.SyntaxKind.ColonToken);
216
- case 44:
217
- this.pos++;
218
- return (this.token = types_js_1.SyntaxKind.CommaToken);
219
- case 60:
220
- this.tokenValue = __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_scanHtml).call(this);
221
- return (this.token = types_js_1.SyntaxKind.HtmlIdentifier);
222
- case 34:
223
- this.tokenValue = __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_scanString).call(this);
224
- return (this.token = types_js_1.SyntaxKind.StringLiteral);
225
- default: {
226
- if (isIdentifierStart(ch)) {
227
- this.pos++;
228
- while (this.pos < this.end &&
229
- isIdentifierPart((ch = this.text.charCodeAt(this.pos))))
230
- this.pos++;
231
- const value = this.text.substring(this.tokenPos, this.pos);
232
- this.tokenValue = value;
233
- return (this.token = __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_getIdentifierToken).call(this, value));
234
- }
235
- if (__classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_isWhiteSpaceSingleLine).call(this, ch)) {
236
- this.pos++;
237
- continue;
238
- }
239
- const chr = this.text.charAt(this.pos);
240
- __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_error).call(this, `Unexpected "${chr}". Did you mean to start an identifier? Node names cannot start with "${chr}".`, 0);
241
- this.pos++;
242
- break;
243
- }
244
- }
245
- }
246
- }
247
- lookAhead(callback) {
248
- return __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_speculationHelper).call(this, callback, true);
249
- }
250
- tryScan(callback) {
251
- return __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_speculationHelper).call(this, callback, false);
252
- }
253
- }
254
- exports.DefaultScanner = DefaultScanner;
255
- _DefaultScanner_instances = new WeakSet(), _DefaultScanner_setTextPos = function _DefaultScanner_setTextPos(textPos) {
256
- console.assert(textPos >= 0);
257
- this.pos = textPos;
258
- this.startPos = textPos;
259
- this.tokenPos = textPos;
260
- this.token = types_js_1.SyntaxKind.Unknown;
261
- this.tokenValue = undefined;
262
- this.tokenFlags = 0;
263
- }, _DefaultScanner_error = function _DefaultScanner_error(message, sub, category = types_js_1.DiagnosticCategory.Error, errPos = this.pos, length = 0) {
264
- const cb = this.onError;
265
- if (cb) {
266
- const posSave = this.pos;
267
- this.pos = errPos;
268
- cb(message, category, sub, length);
269
- this.pos = posSave;
270
- }
271
- }, _DefaultScanner_isWhiteSpaceSingleLine = function _DefaultScanner_isWhiteSpaceSingleLine(ch) {
272
- return (ch === 32 ||
273
- ch === 9 ||
274
- ch === 11 ||
275
- ch === 12 ||
276
- ch === 160 ||
277
- ch === 133 ||
278
- ch === 5760 ||
279
- (ch >= 8192 && ch <= 8203) ||
280
- ch === 8239 ||
281
- ch === 8287 ||
282
- ch === 12288 ||
283
- ch === 65279);
284
- }, _DefaultScanner_isAtMultiLineCommentEnd = function _DefaultScanner_isAtMultiLineCommentEnd(pos) {
285
- return (pos + 1 < this.end &&
286
- this.text.charCodeAt(pos) === 42 &&
287
- this.text.charCodeAt(pos + 1) === 47);
288
- }, _DefaultScanner_scanHashCommentTrivia = function _DefaultScanner_scanHashCommentTrivia(skip) {
289
- ++this.pos;
290
- const start = this.pos;
291
- while (this.pos < this.end && !isLineBreak(this.text.charCodeAt(this.pos)))
292
- this.pos++;
293
- return skip ? undefined : this.text.substring(start, this.pos);
294
- }, _DefaultScanner_scanSingleLineCommentTrivia = function _DefaultScanner_scanSingleLineCommentTrivia(skip) {
295
- this.pos += 2;
296
- const start = this.pos;
297
- while (this.pos < this.end && !isLineBreak(this.text.charCodeAt(this.pos)))
298
- this.pos++;
299
- return skip ? undefined : this.text.substring(start, this.pos);
300
- }, _DefaultScanner_scanMultiLineCommentTrivia = function _DefaultScanner_scanMultiLineCommentTrivia(skip) {
301
- this.pos += 2;
302
- const start = this.pos;
303
- while (this.pos < this.end && !__classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_isAtMultiLineCommentEnd).call(this, this.pos))
304
- this.pos++;
305
- const commentEnd = this.pos;
306
- if (__classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_isAtMultiLineCommentEnd).call(this, this.pos)) {
307
- this.pos += 2;
308
- }
309
- return skip ? undefined : this.text.substring(start, commentEnd);
310
- }, _DefaultScanner_scanHtml = function _DefaultScanner_scanHtml() {
311
- this.pos++;
312
- let result = "";
313
- const start = this.pos;
314
- let subTagsLevel = 0;
315
- while (true) {
316
- if (this.pos >= this.end) {
317
- result += this.text.substring(start, this.pos);
318
- this.tokenFlags |= 2;
319
- this.isUnterminated = true;
320
- __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_error).call(this, "Unterminated html literal", 1);
321
- break;
322
- }
323
- const ch = this.text.charCodeAt(this.pos);
324
- if (ch === 60) {
325
- ++subTagsLevel;
326
- this.pos++;
327
- continue;
328
- }
329
- if (ch === 62) {
330
- this.pos++;
331
- console.assert(subTagsLevel >= 0);
332
- if (subTagsLevel === 0) {
333
- result += this.text.substring(start, this.pos);
334
- break;
335
- }
336
- --subTagsLevel;
337
- continue;
338
- }
339
- this.pos++;
340
- }
341
- return result;
342
- }, _DefaultScanner_scanString = function _DefaultScanner_scanString(allowEscapes = true) {
343
- const quote = this.text.charCodeAt(this.pos);
344
- this.pos++;
345
- let result = "";
346
- const start = this.pos;
347
- let hasBackslash = false;
348
- while (true) {
349
- if (this.pos >= this.end) {
350
- result += this.text.substring(start, this.pos);
351
- this.tokenFlags |= 2;
352
- this.isUnterminated = true;
353
- __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_error).call(this, "Unterminated string", 1);
354
- break;
355
- }
356
- const ch = this.text.charCodeAt(this.pos);
357
- if (ch === 92) {
358
- hasBackslash = true;
359
- }
360
- else {
361
- if (hasBackslash) {
362
- hasBackslash = false;
363
- }
364
- else {
365
- if (ch === quote) {
366
- result += this.text.substring(start, this.pos);
367
- this.pos++;
368
- break;
369
- }
370
- if (isLineBreak(ch)) {
371
- result += this.text.substring(start, this.pos);
372
- this.tokenFlags |= 2;
373
- this.isUnterminated = true;
374
- __classPrivateFieldGet(this, _DefaultScanner_instances, "m", _DefaultScanner_error).call(this, "Unterminated string", 1);
375
- break;
376
- }
377
- }
378
- }
379
- this.pos++;
380
- }
381
- const removedEscapes = result.replace(/\\"/g, '"').replace(/\\(\r?\n)/g, "$1");
382
- return removedEscapes;
383
- }, _DefaultScanner_scanNumber = function _DefaultScanner_scanNumber() {
384
- let result = "";
385
- let hadDot = false;
386
- let hadMinus = false;
387
- const start = this.pos;
388
- while (true) {
389
- const ch = this.text.charCodeAt(this.pos);
390
- switch (ch) {
391
- case 48:
392
- case 49:
393
- case 50:
394
- case 51:
395
- case 52:
396
- case 53:
397
- case 54:
398
- case 55:
399
- case 56:
400
- case 57:
401
- break;
402
- case 46:
403
- if (hadDot) {
404
- result += this.text.substring(start, this.pos);
405
- return result;
406
- }
407
- hadDot = true;
408
- hadMinus = true;
409
- break;
410
- case 45:
411
- if (this.pos !== start || hadMinus) {
412
- result += this.text.substring(start, this.pos);
413
- return result;
414
- }
415
- hadMinus = true;
416
- break;
417
- default:
418
- result += this.text.substring(start, this.pos);
419
- return result;
420
- }
421
- ++this.pos;
422
- }
423
- }, _DefaultScanner_getIdentifierToken = function _DefaultScanner_getIdentifierToken(tokenValue) {
424
- const len = tokenValue.length;
425
- if (len >= 4 && len <= 8) {
426
- const ch = tokenValue.charCodeAt(0);
427
- if ((ch >= 97 && ch <= 122) ||
428
- (ch >= 65 && ch <= 90)) {
429
- const lowerCaseToken = tokenValue.toLowerCase();
430
- const t = textToToken.get(lowerCaseToken);
431
- if (t !== undefined) {
432
- this.token = t;
433
- return t;
434
- }
435
- }
436
- }
437
- return (this.token = types_js_1.SyntaxKind.TextIdentifier);
438
- }, _DefaultScanner_speculationHelper = function _DefaultScanner_speculationHelper(callback, isLookahead) {
439
- const savePos = this.pos;
440
- const saveStartPos = this.startPos;
441
- const saveTokenPos = this.tokenPos;
442
- const saveToken = this.token;
443
- const saveTokenValue = this.tokenValue;
444
- const saveTokenFlags = this.tokenFlags;
445
- const result = callback();
446
- if (!result || isLookahead) {
447
- this.pos = savePos;
448
- this.startPos = saveStartPos;
449
- this.tokenPos = saveTokenPos;
450
- this.token = saveToken;
451
- this.tokenValue = saveTokenValue;
452
- this.tokenFlags = saveTokenFlags;
453
- }
454
- return result;
455
- };
456
- function isIdentifierPartOf(ch, idType) {
457
- switch (idType) {
458
- case types_js_1.SyntaxKind.TextIdentifier:
459
- return (ch === 95 ||
460
- (65 <= ch && ch <= 90) ||
461
- (97 <= ch && ch <= 122) ||
462
- (48 <= ch && ch <= 57));
463
- case types_js_1.SyntaxKind.HtmlIdentifier:
464
- return (ch === 95 ||
465
- ch === 60 ||
466
- ch === 61 ||
467
- ch === 34 ||
468
- (65 <= ch && ch <= 90) ||
469
- (97 <= ch && ch <= 122) ||
470
- (48 <= ch && ch <= 57));
471
- case types_js_1.SyntaxKind.StringLiteral:
472
- return (ch === 95 ||
473
- ch === 92 ||
474
- ch === 60 ||
475
- ch === 61 ||
476
- ch === 34 ||
477
- (65 <= ch && ch <= 90) ||
478
- (97 <= ch && ch <= 122) ||
479
- (48 <= ch && ch <= 57));
480
- case types_js_1.SyntaxKind.NumericIdentifier:
481
- return (ch === 45 ||
482
- ch === 46 ||
483
- (48 <= ch && ch <= 57));
484
- default:
485
- return (0, util_js_1.assertNever)(idType);
486
- }
487
- }
488
- function getIdentifierStart(ch) {
489
- if (ch === 60)
490
- return types_js_1.SyntaxKind.HtmlIdentifier;
491
- if (ch === 34)
492
- return types_js_1.SyntaxKind.StringLiteral;
493
- if (ch === 95 ||
494
- (65 <= ch && ch <= 90) ||
495
- (97 <= ch && ch <= 122))
496
- return types_js_1.SyntaxKind.TextIdentifier;
497
- if (ch === 45 ||
498
- ch === 46 ||
499
- (48 <= ch && ch <= 57))
500
- return types_js_1.SyntaxKind.NumericIdentifier;
501
- return undefined;
502
- }
503
- function isIdentifierStart(ch) {
504
- return ((ch >= 65 && ch <= 90) ||
505
- (ch >= 97 && ch <= 122) ||
506
- (ch >= 48 && ch <= 57) ||
507
- ch === 95 ||
508
- ch === 60 ||
509
- ch === 34);
510
- }
511
- function isIdentifierPart(ch) {
512
- return ((ch >= 65 && ch <= 90) ||
513
- (ch >= 97 && ch <= 122) ||
514
- (ch >= 48 && ch <= 57) ||
515
- ch === 36 ||
516
- ch === 95 ||
517
- ch > 127);
518
- }
519
- function skipTrivia(text, pos) {
520
- while (true) {
521
- const ch = text.charCodeAt(pos);
522
- switch (ch) {
523
- case 13:
524
- if (text.charCodeAt(pos + 1) === 10)
525
- ++pos;
526
- continue;
527
- case 10:
528
- case 9:
529
- case 11:
530
- case 12:
531
- case 32:
532
- ++pos;
533
- continue;
534
- case 35: {
535
- ++pos;
536
- while (pos < text.length) {
537
- if (isLineBreak(text.charCodeAt(pos)))
538
- break;
539
- ++pos;
540
- }
541
- continue;
542
- }
543
- case 47:
544
- if (pos + 1 < text.length) {
545
- const nextChar = text.charCodeAt(pos + 1);
546
- switch (nextChar) {
547
- case 47: {
548
- pos += 2;
549
- while (pos < text.length) {
550
- if (isLineBreak(text.charCodeAt(pos)))
551
- break;
552
- ++pos;
553
- }
554
- continue;
555
- }
556
- case 42: {
557
- pos += 2;
558
- while (pos < text.length) {
559
- if (text.charCodeAt(pos) === 42 &&
560
- text.charCodeAt(pos + 1) === 47) {
561
- pos += 2;
562
- break;
563
- }
564
- ++pos;
565
- }
566
- continue;
567
- }
568
- }
569
- }
570
- break;
571
- }
572
- return pos;
573
- }
574
- }
575
- function isLineBreak(ch) {
576
- return ch === 10 || ch === 13;
577
- }
578
- //# sourceMappingURL=scanner.js.map
@@ -1,12 +0,0 @@
1
- import type * as lst from "vscode-languageserver-types";
2
- import { type CommandApplication, type DocumentLike, type SourceFile } from "../index.js";
3
- import { type ExecutableCommand } from "./command/common.js";
4
- export declare function getCodeActions(doc: DocumentLike, sourceFile: SourceFile, range: lst.Range, _context?: lst.CodeActionContext): lst.Command[] | undefined;
5
- export declare const enum CommandIds {
6
- ChangeEdgeOp = "DOT.changeEdgeOp",
7
- ConvertGraphType = "DOT.convertGraphType",
8
- ConsolidateDescendants = "DOT.consolidateDescendants",
9
- RemoveSemicolons = "DOT.removeSemicolons"
10
- }
11
- export declare function getAvailableCommands(): string[];
12
- export declare function executeCommand(doc: DocumentLike, sourceFile: SourceFile, cmd: ExecutableCommand<unknown[]>): CommandApplication | undefined;