@lowgular/code-graph 0.0.1 → 0.1.2
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/bin/cli.js +2463 -0
- package/lib.js +2430 -0
- package/package.json +26 -7
- package/apps/code-graph/src/main.js +0 -50
- package/libs/cli/code-graph/src/index.js +0 -39
- package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.js +0 -72
- package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.stateful.js +0 -68
- package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.doc.js +0 -147
- package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.graph.js +0 -55
- package/libs/cli/code-graph/src/lib/class-declarations/index.js +0 -27
- package/libs/cli/code-graph/src/lib/code.graph.factory.js +0 -63
- package/libs/cli/code-graph/src/lib/code.graph.js +0 -62
- package/libs/cli/code-graph/src/lib/core/core.js +0 -58
- package/libs/cli/code-graph/src/lib/core.js +0 -85
- package/libs/cli/code-graph/src/lib/decorators/index.js +0 -36
- package/libs/cli/code-graph/src/lib/docs/index.js +0 -21
- package/libs/cli/code-graph/src/lib/docs/specs.js +0 -36
- package/libs/cli/code-graph/src/lib/expressions/call-expressions.graph.js +0 -28
- package/libs/cli/code-graph/src/lib/fixtures/reactive-event-bus/src/app/examples.event-bus.js +0 -53
- package/libs/cli/code-graph/src/lib/method-declarations/index.js +0 -23
- package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.doc.js +0 -106
- package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.graph.js +0 -56
- package/libs/cli/code-graph/src/lib/parameters/index.js +0 -42
- package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.evals.js +0 -139
- package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.js +0 -104
- package/libs/cli/code-graph/src/lib/property-declarations/index.js +0 -25
- package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.doc.js +0 -74
- package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.graph.js +0 -43
- package/libs/cli/code-graph/src/lib/tools/index.js +0 -34
- package/libs/cli/code-graph/src/lib/tools/match-code-graph.tool.js +0 -64
- package/libs/cli/code-graph/src/lib/types/index.js +0 -99
- package/libs/cli/code-graph/src/lib/v2/extractors/extractor.doc.js +0 -345
- package/libs/cli/code-graph/src/lib/v2/extractors/extractor.js +0 -52
- package/libs/cli/code-graph/src/lib/v2/extractors/index.js +0 -23
- package/libs/cli/code-graph/src/lib/v2/graph-builder/code-graph.builder.js +0 -76
- package/libs/cli/code-graph/src/lib/v2/graph-builder/index.js +0 -21
- package/libs/cli/code-graph/src/lib/v2/graph-builder/node.processor.js +0 -48
- package/libs/cli/code-graph/src/lib/v2/graph-builder/relationship.processor.js +0 -79
- package/libs/cli/code-graph/src/lib/v2/graph-builder/type.processor.js +0 -45
- package/libs/cli/code-graph/src/lib/v2/index.js +0 -37
- package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.doc.js +0 -220
- package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.tool.js +0 -42
- package/libs/cli/cypher/src/index.js +0 -25
- package/libs/cli/cypher/src/lib/docs/features/advanced-optional-match.feature.js +0 -277
- package/libs/cli/cypher/src/lib/docs/features/anonymous-relationship.feature.js +0 -69
- package/libs/cli/cypher/src/lib/docs/features/anonymous-variable-length.feature.js +0 -105
- package/libs/cli/cypher/src/lib/docs/features/basic-filtering.feature.js +0 -70
- package/libs/cli/cypher/src/lib/docs/features/basic-optional-match.feature.js +0 -99
- package/libs/cli/cypher/src/lib/docs/features/basic-relationship.feature.js +0 -125
- package/libs/cli/cypher/src/lib/docs/features/index.js +0 -51
- package/libs/cli/cypher/src/lib/docs/features/limit.feature.js +0 -50
- package/libs/cli/cypher/src/lib/docs/features/match-nodes.feature.js +0 -106
- package/libs/cli/cypher/src/lib/docs/features/multiple-relationship-types.feature.js +0 -105
- package/libs/cli/cypher/src/lib/docs/features/order-by.feature.js +0 -143
- package/libs/cli/cypher/src/lib/docs/features/property-matching.feature.js +0 -152
- package/libs/cli/cypher/src/lib/docs/features/relationship-without-variable.feature.js +0 -48
- package/libs/cli/cypher/src/lib/docs/features/return-statement.feature.js +0 -65
- package/libs/cli/cypher/src/lib/docs/features/unidirected-relationship.feature.js +0 -82
- package/libs/cli/cypher/src/lib/docs/features/variable-length-path.feature.js +0 -136
- package/libs/cli/cypher/src/lib/docs/features/where-conditional.feature.js +0 -187
- package/libs/cli/cypher/src/lib/docs/features/where-operators.feature.js +0 -302
- package/libs/cli/cypher/src/lib/docs/prompts.js +0 -36
- package/libs/cli/cypher/src/lib/docs/specs.js +0 -181
- package/libs/cli/cypher/src/lib/executor/condition-evaluator.js +0 -158
- package/libs/cli/cypher/src/lib/executor/executor.js +0 -83
- package/libs/cli/cypher/src/lib/executor/graph.js +0 -15
- package/libs/cli/cypher/src/lib/executor/match-engine.js +0 -153
- package/libs/cli/cypher/src/lib/executor/pattern-matcher.js +0 -109
- package/libs/cli/cypher/src/lib/executor/relationship-navigator.js +0 -64
- package/libs/cli/cypher/src/lib/executor/result-formatter.js +0 -143
- package/libs/cli/cypher/src/lib/executor/traverse-engine.js +0 -164
- package/libs/cli/cypher/src/lib/executor/utils.js +0 -37
- package/libs/cli/cypher/src/lib/graph.stub.js +0 -63
- package/libs/cli/cypher/src/lib/index.js +0 -74
- package/libs/cli/cypher/src/lib/lexer.js +0 -398
- package/libs/cli/cypher/src/lib/parser.js +0 -602
- package/libs/cli/cypher/src/lib/validator/query-validator.js +0 -95
- package/libs/cli/cypher/src/lib/validator/supported-features.config.js +0 -111
- package/libs/cli/cypher/src/lib/validator/unsupported-features.config.js +0 -150
- package/libs/cli/shared/src/index.js +0 -53
- package/libs/cli/shared/src/lib/admin-token.js +0 -121
- package/libs/cli/shared/src/lib/config.js +0 -49
- package/libs/cli/shared/src/lib/consts.js +0 -57
- package/libs/cli/shared/src/lib/core.js +0 -46
- package/libs/cli/shared/src/lib/infrastructure/cli.js +0 -47
- package/libs/cli/shared/src/lib/infrastructure/config.js +0 -47
- package/libs/cli/shared/src/lib/infrastructure/config.reporitory.js +0 -51
- package/libs/cli/shared/src/lib/infrastructure/formatters/console-formatter.js +0 -96
- package/libs/cli/shared/src/lib/infrastructure/formatters/index.js +0 -41
- package/libs/cli/shared/src/lib/infrastructure/formatters/json-formatter.js +0 -64
- package/libs/cli/shared/src/lib/infrastructure/formatters/markdown-formatter.js +0 -120
- package/libs/cli/shared/src/lib/infrastructure/formatters/types.js +0 -15
- package/libs/cli/shared/src/lib/infrastructure/formatters/utils.js +0 -72
- package/libs/cli/shared/src/lib/infrastructure/git.js +0 -147
- package/libs/cli/shared/src/lib/infrastructure/http.js +0 -257
- package/libs/cli/shared/src/lib/infrastructure/markdown.js +0 -95
- package/libs/cli/shared/src/lib/infrastructure/transformers/embeddings.js +0 -88
- package/libs/cli/shared/src/lib/infrastructure/transformers/index.js +0 -25
- package/libs/cli/shared/src/lib/infrastructure/transformers/rag-eval.js +0 -154
- package/libs/cli/shared/src/lib/infrastructure/transformers/similarity.js +0 -210
- package/libs/cli/shared/src/lib/infrastructure/workspace.js +0 -297
- package/libs/cli/shared/src/lib/infrastructure/yaml.js +0 -237
- package/libs/cli/shared/src/lib/lowgular.config.js +0 -120
- package/libs/cli/shared/src/lib/token.js +0 -135
- package/libs/cli/shared/src/lib/utils/solution.util.js +0 -35
- package/libs/cli/shared/src/lib/utils/utils.js +0 -89
- package/libs/cli/typescript/src/index.js +0 -21
- package/libs/cli/typescript/src/lib/base/index.js +0 -23
- package/libs/cli/typescript/src/lib/base/nameable.js +0 -34
- package/libs/cli/typescript/src/lib/base/nodeable.js +0 -36
- package/libs/cli/typescript/src/lib/class.implementation.js +0 -52
- package/libs/cli/typescript/src/lib/core/declaration.registry.js +0 -107
- package/libs/cli/typescript/src/lib/core/design-pattern.js +0 -55
- package/libs/cli/typescript/src/lib/core/index.js +0 -35
- package/libs/cli/typescript/src/lib/core/navigable-declaration.js +0 -69
- package/libs/cli/typescript/src/lib/core/program-context.js +0 -71
- package/libs/cli/typescript/src/lib/core/syntax-kind.utils.js +0 -40
- package/libs/cli/typescript/src/lib/core/type.js +0 -374
- package/libs/cli/typescript/src/lib/declaration.abstraction.js +0 -90
- package/libs/cli/typescript/src/lib/decorator.implementation.js +0 -35
- package/libs/cli/typescript/src/lib/enum.implementation.js +0 -35
- package/libs/cli/typescript/src/lib/function-declaration.implementation.js +0 -35
- package/libs/cli/typescript/src/lib/index.js +0 -57
- package/libs/cli/typescript/src/lib/interface.implementation.js +0 -51
- package/libs/cli/typescript/src/lib/members/method-abstraction.resolver.js +0 -90
- package/libs/cli/typescript/src/lib/members/method-declaration.implementation.js +0 -44
- package/libs/cli/typescript/src/lib/members/method-signature.implementation.js +0 -46
- package/libs/cli/typescript/src/lib/members/method.util.js +0 -32
- package/libs/cli/typescript/src/lib/members/parameter.implementation.js +0 -38
- package/libs/cli/typescript/src/lib/members/property-declaration.implementation.js +0 -64
- package/libs/cli/typescript/src/lib/members/property-signature.implementation.js +0 -34
- package/libs/cli/typescript/src/lib/members/property.util.js +0 -61
- package/libs/cli/typescript/src/lib/members/statements/expressions/binary-expression.implementation.js +0 -42
- package/libs/cli/typescript/src/lib/members/statements/expressions/call-expression.implementation.js +0 -114
- package/libs/cli/typescript/src/lib/members/statements/expressions/expression.abstraction.js +0 -188
- package/libs/cli/typescript/src/lib/members/statements/expressions/property-access-expression.implementation.js +0 -35
- package/libs/cli/typescript/src/lib/members/statements/expressions/unary-expression.implementation.js +0 -51
- package/libs/cli/typescript/src/lib/members/statements/statement.implementation.js +0 -49
- package/libs/cli/typescript/src/lib/members/statements/utils.js +0 -51
- package/libs/cli/typescript/src/lib/plugins/built-in.plugin.js +0 -258
- package/libs/cli/typescript/src/lib/plugins/plugin.interface.js +0 -15
- package/libs/cli/typescript/src/lib/plugins/rxjs.plugin.js +0 -228
- package/libs/cli/typescript/src/lib/plugins/signal.plugin.js +0 -126
- package/libs/cli/typescript/src/lib/plugins/stubs.js +0 -66
- package/libs/cli/typescript/src/lib/type-alias.implementation.js +0 -72
- package/libs/cli/typescript/src/lib/utils.js +0 -39
- package/libs/cli/typescript/src/lib/variable-declaration.implementation.js +0 -35
- package/libs/core/codegular/src/index.js +0 -21
- package/libs/core/codegular/src/lib/index.js +0 -29
- package/libs/core/codegular/src/lib/node.js +0 -112
- package/libs/core/codegular/src/lib/program.js +0 -92
- package/libs/core/codegular/src/lib/string.js +0 -168
- package/libs/core/codegular/src/lib/type-checker.js +0 -170
- package/libs/core/codegular/src/lib/utils.js +0 -347
- package/main.js +0 -43
|
@@ -1,398 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var lexer_exports = {};
|
|
19
|
-
__export(lexer_exports, {
|
|
20
|
-
Lexer: () => Lexer,
|
|
21
|
-
TokenType: () => TokenType
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(lexer_exports);
|
|
24
|
-
var TokenType = /* @__PURE__ */ ((TokenType2) => {
|
|
25
|
-
TokenType2["MATCH"] = "MATCH";
|
|
26
|
-
TokenType2["OPTIONAL"] = "OPTIONAL";
|
|
27
|
-
TokenType2["RETURN"] = "RETURN";
|
|
28
|
-
TokenType2["WHERE"] = "WHERE";
|
|
29
|
-
TokenType2["AND"] = "AND";
|
|
30
|
-
TokenType2["OR"] = "OR";
|
|
31
|
-
TokenType2["AS"] = "AS";
|
|
32
|
-
TokenType2["IN"] = "IN";
|
|
33
|
-
TokenType2["NOT"] = "NOT";
|
|
34
|
-
TokenType2["IS"] = "IS";
|
|
35
|
-
TokenType2["NULL"] = "NULL";
|
|
36
|
-
TokenType2["TRUE"] = "TRUE";
|
|
37
|
-
TokenType2["FALSE"] = "FALSE";
|
|
38
|
-
TokenType2["STARTS"] = "STARTS";
|
|
39
|
-
TokenType2["ENDS"] = "ENDS";
|
|
40
|
-
TokenType2["CONTAINS"] = "CONTAINS";
|
|
41
|
-
TokenType2["WITH"] = "WITH";
|
|
42
|
-
TokenType2["LIMIT"] = "LIMIT";
|
|
43
|
-
TokenType2["ORDER"] = "ORDER";
|
|
44
|
-
TokenType2["BY"] = "BY";
|
|
45
|
-
TokenType2["ASC"] = "ASC";
|
|
46
|
-
TokenType2["DESC"] = "DESC";
|
|
47
|
-
TokenType2["IDENTIFIER"] = "IDENTIFIER";
|
|
48
|
-
TokenType2["LABEL"] = "LABEL";
|
|
49
|
-
TokenType2["LPAREN"] = "LPAREN";
|
|
50
|
-
TokenType2["RPAREN"] = "RPAREN";
|
|
51
|
-
TokenType2["LBRACKET"] = "LBRACKET";
|
|
52
|
-
TokenType2["RBRACKET"] = "RBRACKET";
|
|
53
|
-
TokenType2["LBRACE"] = "LBRACE";
|
|
54
|
-
TokenType2["RBRACE"] = "RBRACE";
|
|
55
|
-
TokenType2["DASH"] = "DASH";
|
|
56
|
-
TokenType2["ARROW"] = "ARROW";
|
|
57
|
-
TokenType2["EQUALS"] = "EQUALS";
|
|
58
|
-
TokenType2["NOT_EQUALS"] = "NOT_EQUALS";
|
|
59
|
-
TokenType2["GT"] = "GT";
|
|
60
|
-
TokenType2["LT"] = "LT";
|
|
61
|
-
TokenType2["GTE"] = "GTE";
|
|
62
|
-
TokenType2["LTE"] = "LTE";
|
|
63
|
-
TokenType2["COMMA"] = "COMMA";
|
|
64
|
-
TokenType2["DOT"] = "DOT";
|
|
65
|
-
TokenType2["PIPE"] = "PIPE";
|
|
66
|
-
TokenType2["ASTERISK"] = "ASTERISK";
|
|
67
|
-
TokenType2["REGEX_MATCH"] = "REGEX_MATCH";
|
|
68
|
-
TokenType2["STRING"] = "STRING";
|
|
69
|
-
TokenType2["NUMBER"] = "NUMBER";
|
|
70
|
-
TokenType2["EOF"] = "EOF";
|
|
71
|
-
return TokenType2;
|
|
72
|
-
})(TokenType || {});
|
|
73
|
-
class Lexer {
|
|
74
|
-
constructor(input) {
|
|
75
|
-
this.input = input;
|
|
76
|
-
this.position = 0;
|
|
77
|
-
this.currentChar = input.length > 0 ? input[0] : null;
|
|
78
|
-
}
|
|
79
|
-
advance() {
|
|
80
|
-
this.position++;
|
|
81
|
-
this.currentChar = this.position >= this.input.length ? null : this.input[this.position];
|
|
82
|
-
}
|
|
83
|
-
skipWhitespace() {
|
|
84
|
-
while (this.currentChar && /\s/.test(this.currentChar)) {
|
|
85
|
-
this.advance();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
readIdentifier() {
|
|
89
|
-
let result = "";
|
|
90
|
-
while (this.currentChar && /[a-zA-Z0-9_]/.test(this.currentChar)) {
|
|
91
|
-
result += this.currentChar;
|
|
92
|
-
this.advance();
|
|
93
|
-
}
|
|
94
|
-
return result;
|
|
95
|
-
}
|
|
96
|
-
readString() {
|
|
97
|
-
const quote = this.currentChar;
|
|
98
|
-
this.advance();
|
|
99
|
-
let result = "";
|
|
100
|
-
while (this.currentChar && this.currentChar !== quote) {
|
|
101
|
-
if (this.currentChar === "\\") {
|
|
102
|
-
this.advance();
|
|
103
|
-
if (this.currentChar === "n") {
|
|
104
|
-
result += "\n";
|
|
105
|
-
} else if (this.currentChar === "t") {
|
|
106
|
-
result += " ";
|
|
107
|
-
} else {
|
|
108
|
-
result += this.currentChar;
|
|
109
|
-
}
|
|
110
|
-
this.advance();
|
|
111
|
-
} else {
|
|
112
|
-
result += this.currentChar;
|
|
113
|
-
this.advance();
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
if (this.currentChar === quote) {
|
|
117
|
-
this.advance();
|
|
118
|
-
}
|
|
119
|
-
return result;
|
|
120
|
-
}
|
|
121
|
-
readNumber() {
|
|
122
|
-
let result = "";
|
|
123
|
-
while (this.currentChar && /[0-9.]/.test(this.currentChar)) {
|
|
124
|
-
result += this.currentChar;
|
|
125
|
-
this.advance();
|
|
126
|
-
}
|
|
127
|
-
return result;
|
|
128
|
-
}
|
|
129
|
-
peekKeyword() {
|
|
130
|
-
const savedPos = this.position;
|
|
131
|
-
const savedChar = this.currentChar;
|
|
132
|
-
const keyword = this.readIdentifier();
|
|
133
|
-
this.position = savedPos;
|
|
134
|
-
this.currentChar = savedChar;
|
|
135
|
-
return keyword.length > 0 ? keyword.toUpperCase() : null;
|
|
136
|
-
}
|
|
137
|
-
tokenize() {
|
|
138
|
-
const tokens = [];
|
|
139
|
-
this.position = 0;
|
|
140
|
-
this.currentChar = this.input.length > 0 ? this.input[0] : null;
|
|
141
|
-
while (this.currentChar !== null) {
|
|
142
|
-
this.skipWhitespace();
|
|
143
|
-
if (!this.currentChar)
|
|
144
|
-
break;
|
|
145
|
-
const startPos = this.position;
|
|
146
|
-
const keyword = this.peekKeyword();
|
|
147
|
-
const keywordMap = {
|
|
148
|
-
MATCH: "MATCH" /* MATCH */,
|
|
149
|
-
OPTIONAL: "OPTIONAL" /* OPTIONAL */,
|
|
150
|
-
RETURN: "RETURN" /* RETURN */,
|
|
151
|
-
WHERE: "WHERE" /* WHERE */,
|
|
152
|
-
AND: "AND" /* AND */,
|
|
153
|
-
OR: "OR" /* OR */,
|
|
154
|
-
AS: "AS" /* AS */,
|
|
155
|
-
IN: "IN" /* IN */,
|
|
156
|
-
NOT: "NOT" /* NOT */,
|
|
157
|
-
IS: "IS" /* IS */,
|
|
158
|
-
NULL: "NULL" /* NULL */,
|
|
159
|
-
TRUE: "TRUE" /* TRUE */,
|
|
160
|
-
FALSE: "FALSE" /* FALSE */,
|
|
161
|
-
STARTS: "STARTS" /* STARTS */,
|
|
162
|
-
ENDS: "ENDS" /* ENDS */,
|
|
163
|
-
CONTAINS: "CONTAINS" /* CONTAINS */,
|
|
164
|
-
WITH: "WITH" /* WITH */,
|
|
165
|
-
LIMIT: "LIMIT" /* LIMIT */,
|
|
166
|
-
ORDER: "ORDER" /* ORDER */,
|
|
167
|
-
BY: "BY" /* BY */,
|
|
168
|
-
ASC: "ASC" /* ASC */,
|
|
169
|
-
DESC: "DESC" /* DESC */
|
|
170
|
-
};
|
|
171
|
-
if (keyword && keywordMap[keyword]) {
|
|
172
|
-
tokens.push({
|
|
173
|
-
type: keywordMap[keyword],
|
|
174
|
-
value: keyword,
|
|
175
|
-
position: startPos
|
|
176
|
-
});
|
|
177
|
-
this.readIdentifier();
|
|
178
|
-
continue;
|
|
179
|
-
}
|
|
180
|
-
switch (this.currentChar) {
|
|
181
|
-
case "(":
|
|
182
|
-
tokens.push({
|
|
183
|
-
type: "LPAREN" /* LPAREN */,
|
|
184
|
-
value: "(",
|
|
185
|
-
position: startPos
|
|
186
|
-
});
|
|
187
|
-
this.advance();
|
|
188
|
-
break;
|
|
189
|
-
case ")":
|
|
190
|
-
tokens.push({
|
|
191
|
-
type: "RPAREN" /* RPAREN */,
|
|
192
|
-
value: ")",
|
|
193
|
-
position: startPos
|
|
194
|
-
});
|
|
195
|
-
this.advance();
|
|
196
|
-
break;
|
|
197
|
-
case "[":
|
|
198
|
-
tokens.push({
|
|
199
|
-
type: "LBRACKET" /* LBRACKET */,
|
|
200
|
-
value: "[",
|
|
201
|
-
position: startPos
|
|
202
|
-
});
|
|
203
|
-
this.advance();
|
|
204
|
-
break;
|
|
205
|
-
case "]":
|
|
206
|
-
tokens.push({
|
|
207
|
-
type: "RBRACKET" /* RBRACKET */,
|
|
208
|
-
value: "]",
|
|
209
|
-
position: startPos
|
|
210
|
-
});
|
|
211
|
-
this.advance();
|
|
212
|
-
break;
|
|
213
|
-
case "{":
|
|
214
|
-
tokens.push({
|
|
215
|
-
type: "LBRACE" /* LBRACE */,
|
|
216
|
-
value: "{",
|
|
217
|
-
position: startPos
|
|
218
|
-
});
|
|
219
|
-
this.advance();
|
|
220
|
-
break;
|
|
221
|
-
case "}":
|
|
222
|
-
tokens.push({
|
|
223
|
-
type: "RBRACE" /* RBRACE */,
|
|
224
|
-
value: "}",
|
|
225
|
-
position: startPos
|
|
226
|
-
});
|
|
227
|
-
this.advance();
|
|
228
|
-
break;
|
|
229
|
-
case "<":
|
|
230
|
-
if (this.position + 1 < this.input.length && this.input[this.position + 1] === "-") {
|
|
231
|
-
tokens.push({
|
|
232
|
-
type: "ARROW" /* ARROW */,
|
|
233
|
-
value: "<-",
|
|
234
|
-
position: startPos
|
|
235
|
-
});
|
|
236
|
-
this.advance();
|
|
237
|
-
this.advance();
|
|
238
|
-
} else if (this.position + 1 < this.input.length && this.input[this.position + 1] === "=") {
|
|
239
|
-
tokens.push({
|
|
240
|
-
type: "LTE" /* LTE */,
|
|
241
|
-
value: "<=",
|
|
242
|
-
position: startPos
|
|
243
|
-
});
|
|
244
|
-
this.advance();
|
|
245
|
-
this.advance();
|
|
246
|
-
} else {
|
|
247
|
-
tokens.push({
|
|
248
|
-
type: "LT" /* LT */,
|
|
249
|
-
value: "<",
|
|
250
|
-
position: startPos
|
|
251
|
-
});
|
|
252
|
-
this.advance();
|
|
253
|
-
}
|
|
254
|
-
break;
|
|
255
|
-
case "-":
|
|
256
|
-
if (this.position + 1 < this.input.length && this.input[this.position + 1] === ">") {
|
|
257
|
-
tokens.push({
|
|
258
|
-
type: "ARROW" /* ARROW */,
|
|
259
|
-
value: "->",
|
|
260
|
-
position: startPos
|
|
261
|
-
});
|
|
262
|
-
this.advance();
|
|
263
|
-
this.advance();
|
|
264
|
-
} else {
|
|
265
|
-
tokens.push({
|
|
266
|
-
type: "DASH" /* DASH */,
|
|
267
|
-
value: "-",
|
|
268
|
-
position: startPos
|
|
269
|
-
});
|
|
270
|
-
this.advance();
|
|
271
|
-
}
|
|
272
|
-
break;
|
|
273
|
-
case "=":
|
|
274
|
-
if (this.position + 1 < this.input.length && this.input[this.position + 1] === "~") {
|
|
275
|
-
tokens.push({
|
|
276
|
-
type: "REGEX_MATCH" /* REGEX_MATCH */,
|
|
277
|
-
value: "=~",
|
|
278
|
-
position: startPos
|
|
279
|
-
});
|
|
280
|
-
this.advance();
|
|
281
|
-
this.advance();
|
|
282
|
-
} else {
|
|
283
|
-
tokens.push({
|
|
284
|
-
type: "EQUALS" /* EQUALS */,
|
|
285
|
-
value: "=",
|
|
286
|
-
position: startPos
|
|
287
|
-
});
|
|
288
|
-
this.advance();
|
|
289
|
-
}
|
|
290
|
-
break;
|
|
291
|
-
case "!":
|
|
292
|
-
if (this.position + 1 < this.input.length && this.input[this.position + 1] === "=") {
|
|
293
|
-
tokens.push({
|
|
294
|
-
type: "NOT_EQUALS" /* NOT_EQUALS */,
|
|
295
|
-
value: "!=",
|
|
296
|
-
position: startPos
|
|
297
|
-
});
|
|
298
|
-
this.advance();
|
|
299
|
-
this.advance();
|
|
300
|
-
} else {
|
|
301
|
-
throw new Error(`Unexpected character: ! at position ${startPos}`);
|
|
302
|
-
}
|
|
303
|
-
break;
|
|
304
|
-
case ">":
|
|
305
|
-
if (this.position + 1 < this.input.length && this.input[this.position + 1] === "=") {
|
|
306
|
-
tokens.push({
|
|
307
|
-
type: "GTE" /* GTE */,
|
|
308
|
-
value: ">=",
|
|
309
|
-
position: startPos
|
|
310
|
-
});
|
|
311
|
-
this.advance();
|
|
312
|
-
this.advance();
|
|
313
|
-
} else {
|
|
314
|
-
tokens.push({
|
|
315
|
-
type: "GT" /* GT */,
|
|
316
|
-
value: ">",
|
|
317
|
-
position: startPos
|
|
318
|
-
});
|
|
319
|
-
this.advance();
|
|
320
|
-
}
|
|
321
|
-
break;
|
|
322
|
-
case ",":
|
|
323
|
-
tokens.push({
|
|
324
|
-
type: "COMMA" /* COMMA */,
|
|
325
|
-
value: ",",
|
|
326
|
-
position: startPos
|
|
327
|
-
});
|
|
328
|
-
this.advance();
|
|
329
|
-
break;
|
|
330
|
-
case ".":
|
|
331
|
-
tokens.push({
|
|
332
|
-
type: "DOT" /* DOT */,
|
|
333
|
-
value: ".",
|
|
334
|
-
position: startPos
|
|
335
|
-
});
|
|
336
|
-
this.advance();
|
|
337
|
-
break;
|
|
338
|
-
case "|":
|
|
339
|
-
tokens.push({
|
|
340
|
-
type: "PIPE" /* PIPE */,
|
|
341
|
-
value: "|",
|
|
342
|
-
position: startPos
|
|
343
|
-
});
|
|
344
|
-
this.advance();
|
|
345
|
-
break;
|
|
346
|
-
case "*":
|
|
347
|
-
tokens.push({
|
|
348
|
-
type: "ASTERISK" /* ASTERISK */,
|
|
349
|
-
value: "*",
|
|
350
|
-
position: startPos
|
|
351
|
-
});
|
|
352
|
-
this.advance();
|
|
353
|
-
break;
|
|
354
|
-
case ":":
|
|
355
|
-
tokens.push({
|
|
356
|
-
type: "LABEL" /* LABEL */,
|
|
357
|
-
value: ":",
|
|
358
|
-
position: startPos
|
|
359
|
-
});
|
|
360
|
-
this.advance();
|
|
361
|
-
break;
|
|
362
|
-
case '"':
|
|
363
|
-
case "'":
|
|
364
|
-
tokens.push({
|
|
365
|
-
type: "STRING" /* STRING */,
|
|
366
|
-
value: this.readString(),
|
|
367
|
-
position: startPos
|
|
368
|
-
});
|
|
369
|
-
break;
|
|
370
|
-
default:
|
|
371
|
-
if (/[0-9]/.test(this.currentChar)) {
|
|
372
|
-
tokens.push({
|
|
373
|
-
type: "NUMBER" /* NUMBER */,
|
|
374
|
-
value: this.readNumber(),
|
|
375
|
-
position: startPos
|
|
376
|
-
});
|
|
377
|
-
} else if (/[a-zA-Z_]/.test(this.currentChar)) {
|
|
378
|
-
tokens.push({
|
|
379
|
-
type: "IDENTIFIER" /* IDENTIFIER */,
|
|
380
|
-
value: this.readIdentifier(),
|
|
381
|
-
position: startPos
|
|
382
|
-
});
|
|
383
|
-
} else {
|
|
384
|
-
throw new Error(
|
|
385
|
-
`Unexpected character: ${this.currentChar} at position ${startPos}`
|
|
386
|
-
);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
tokens.push({ type: "EOF" /* EOF */, value: "", position: this.position });
|
|
391
|
-
return tokens;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
395
|
-
0 && (module.exports = {
|
|
396
|
-
Lexer,
|
|
397
|
-
TokenType
|
|
398
|
-
});
|