@lowgular/code-graph 0.1.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.
Files changed (44) hide show
  1. package/bin/cli.js +2458 -5
  2. package/lib.js +2430 -0
  3. package/package.json +3 -2
  4. package/code-graph-v2/code.graph.js +0 -37
  5. package/code-graph-v2/config-from-query.js +0 -131
  6. package/code-graph-v2/extractors/extractor.js +0 -27
  7. package/code-graph-v2/extractors/index.js +0 -1
  8. package/code-graph-v2/graph-builder/code-graph.builder.js +0 -49
  9. package/code-graph-v2/graph-builder/index.js +0 -1
  10. package/code-graph-v2/graph-builder/node.processor.js +0 -22
  11. package/code-graph-v2/graph-builder/relationship.processor.js +0 -55
  12. package/code-graph-v2/graph-builder/type.processor.js +0 -21
  13. package/code-graph-v2/index.js +0 -4
  14. package/code-graph-v2/tools/build-code-graph.tool.js +0 -19
  15. package/code-graph-v2/utils.js +0 -34
  16. package/codegular/index.js +0 -5
  17. package/codegular/node.js +0 -71
  18. package/codegular/program.js +0 -100
  19. package/codegular/string.js +0 -121
  20. package/codegular/type-checker.js +0 -133
  21. package/codegular/type.js +0 -356
  22. package/codegular/utils.js +0 -335
  23. package/cypher/index.js +0 -1
  24. package/cypher/lib/executor/condition-evaluator.js +0 -135
  25. package/cypher/lib/executor/executor.js +0 -60
  26. package/cypher/lib/executor/graph.js +0 -0
  27. package/cypher/lib/executor/match-engine.js +0 -130
  28. package/cypher/lib/executor/pattern-matcher.js +0 -86
  29. package/cypher/lib/executor/relationship-navigator.js +0 -41
  30. package/cypher/lib/executor/result-formatter.js +0 -149
  31. package/cypher/lib/executor/traverse-engine.js +0 -141
  32. package/cypher/lib/executor/utils.js +0 -14
  33. package/cypher/lib/graph.stub.js +0 -38
  34. package/cypher/lib/index.js +0 -32
  35. package/cypher/lib/lexer.js +0 -376
  36. package/cypher/lib/parser.js +0 -586
  37. package/cypher/lib/validator/query-validator.js +0 -75
  38. package/cypher/lib/validator/supported-features.config.js +0 -83
  39. package/cypher/lib/validator/unsupported-features.config.js +0 -124
  40. package/cypher-cli.js +0 -41
  41. package/infra/code-graph.js +0 -147
  42. package/main.js +0 -0
  43. package/resources-cli.js +0 -75
  44. package/run-cli.js +0 -43
@@ -1,376 +0,0 @@
1
- var TokenType = /* @__PURE__ */ ((TokenType2) => {
2
- TokenType2["MATCH"] = "MATCH";
3
- TokenType2["OPTIONAL"] = "OPTIONAL";
4
- TokenType2["RETURN"] = "RETURN";
5
- TokenType2["DISTINCT"] = "DISTINCT";
6
- TokenType2["WHERE"] = "WHERE";
7
- TokenType2["AND"] = "AND";
8
- TokenType2["OR"] = "OR";
9
- TokenType2["AS"] = "AS";
10
- TokenType2["IN"] = "IN";
11
- TokenType2["NOT"] = "NOT";
12
- TokenType2["IS"] = "IS";
13
- TokenType2["NULL"] = "NULL";
14
- TokenType2["TRUE"] = "TRUE";
15
- TokenType2["FALSE"] = "FALSE";
16
- TokenType2["STARTS"] = "STARTS";
17
- TokenType2["ENDS"] = "ENDS";
18
- TokenType2["CONTAINS"] = "CONTAINS";
19
- TokenType2["WITH"] = "WITH";
20
- TokenType2["LIMIT"] = "LIMIT";
21
- TokenType2["ORDER"] = "ORDER";
22
- TokenType2["BY"] = "BY";
23
- TokenType2["ASC"] = "ASC";
24
- TokenType2["DESC"] = "DESC";
25
- TokenType2["IDENTIFIER"] = "IDENTIFIER";
26
- TokenType2["LABEL"] = "LABEL";
27
- TokenType2["LPAREN"] = "LPAREN";
28
- TokenType2["RPAREN"] = "RPAREN";
29
- TokenType2["LBRACKET"] = "LBRACKET";
30
- TokenType2["RBRACKET"] = "RBRACKET";
31
- TokenType2["LBRACE"] = "LBRACE";
32
- TokenType2["RBRACE"] = "RBRACE";
33
- TokenType2["DASH"] = "DASH";
34
- TokenType2["ARROW"] = "ARROW";
35
- TokenType2["EQUALS"] = "EQUALS";
36
- TokenType2["NOT_EQUALS"] = "NOT_EQUALS";
37
- TokenType2["GT"] = "GT";
38
- TokenType2["LT"] = "LT";
39
- TokenType2["GTE"] = "GTE";
40
- TokenType2["LTE"] = "LTE";
41
- TokenType2["COMMA"] = "COMMA";
42
- TokenType2["DOT"] = "DOT";
43
- TokenType2["PIPE"] = "PIPE";
44
- TokenType2["ASTERISK"] = "ASTERISK";
45
- TokenType2["REGEX_MATCH"] = "REGEX_MATCH";
46
- TokenType2["STRING"] = "STRING";
47
- TokenType2["NUMBER"] = "NUMBER";
48
- TokenType2["EOF"] = "EOF";
49
- return TokenType2;
50
- })(TokenType || {});
51
- class Lexer {
52
- constructor(input) {
53
- this.input = input;
54
- this.position = 0;
55
- this.currentChar = input.length > 0 ? input[0] : null;
56
- }
57
- advance() {
58
- this.position++;
59
- this.currentChar = this.position >= this.input.length ? null : this.input[this.position];
60
- }
61
- skipWhitespace() {
62
- while (this.currentChar && /\s/.test(this.currentChar)) {
63
- this.advance();
64
- }
65
- }
66
- readIdentifier() {
67
- let result = "";
68
- while (this.currentChar && /[a-zA-Z0-9_]/.test(this.currentChar)) {
69
- result += this.currentChar;
70
- this.advance();
71
- }
72
- return result;
73
- }
74
- readString() {
75
- const quote = this.currentChar;
76
- this.advance();
77
- let result = "";
78
- while (this.currentChar && this.currentChar !== quote) {
79
- if (this.currentChar === "\\") {
80
- this.advance();
81
- if (this.currentChar === "n") {
82
- result += "\n";
83
- } else if (this.currentChar === "t") {
84
- result += " ";
85
- } else {
86
- result += this.currentChar;
87
- }
88
- this.advance();
89
- } else {
90
- result += this.currentChar;
91
- this.advance();
92
- }
93
- }
94
- if (this.currentChar === quote) {
95
- this.advance();
96
- }
97
- return result;
98
- }
99
- readNumber() {
100
- let result = "";
101
- while (this.currentChar && /[0-9.]/.test(this.currentChar)) {
102
- result += this.currentChar;
103
- this.advance();
104
- }
105
- return result;
106
- }
107
- peekKeyword() {
108
- const savedPos = this.position;
109
- const savedChar = this.currentChar;
110
- const keyword = this.readIdentifier();
111
- this.position = savedPos;
112
- this.currentChar = savedChar;
113
- return keyword.length > 0 ? keyword.toUpperCase() : null;
114
- }
115
- tokenize() {
116
- const tokens = [];
117
- this.position = 0;
118
- this.currentChar = this.input.length > 0 ? this.input[0] : null;
119
- while (this.currentChar !== null) {
120
- this.skipWhitespace();
121
- if (!this.currentChar)
122
- break;
123
- const startPos = this.position;
124
- const keyword = this.peekKeyword();
125
- const keywordMap = {
126
- MATCH: "MATCH" /* MATCH */,
127
- OPTIONAL: "OPTIONAL" /* OPTIONAL */,
128
- RETURN: "RETURN" /* RETURN */,
129
- DISTINCT: "DISTINCT" /* DISTINCT */,
130
- WHERE: "WHERE" /* WHERE */,
131
- AND: "AND" /* AND */,
132
- OR: "OR" /* OR */,
133
- AS: "AS" /* AS */,
134
- IN: "IN" /* IN */,
135
- NOT: "NOT" /* NOT */,
136
- IS: "IS" /* IS */,
137
- NULL: "NULL" /* NULL */,
138
- TRUE: "TRUE" /* TRUE */,
139
- FALSE: "FALSE" /* FALSE */,
140
- STARTS: "STARTS" /* STARTS */,
141
- ENDS: "ENDS" /* ENDS */,
142
- CONTAINS: "CONTAINS" /* CONTAINS */,
143
- WITH: "WITH" /* WITH */,
144
- LIMIT: "LIMIT" /* LIMIT */,
145
- ORDER: "ORDER" /* ORDER */,
146
- BY: "BY" /* BY */,
147
- ASC: "ASC" /* ASC */,
148
- DESC: "DESC" /* DESC */
149
- };
150
- if (keyword && keywordMap[keyword]) {
151
- tokens.push({
152
- type: keywordMap[keyword],
153
- value: keyword,
154
- position: startPos
155
- });
156
- this.readIdentifier();
157
- continue;
158
- }
159
- switch (this.currentChar) {
160
- case "(":
161
- tokens.push({
162
- type: "LPAREN" /* LPAREN */,
163
- value: "(",
164
- position: startPos
165
- });
166
- this.advance();
167
- break;
168
- case ")":
169
- tokens.push({
170
- type: "RPAREN" /* RPAREN */,
171
- value: ")",
172
- position: startPos
173
- });
174
- this.advance();
175
- break;
176
- case "[":
177
- tokens.push({
178
- type: "LBRACKET" /* LBRACKET */,
179
- value: "[",
180
- position: startPos
181
- });
182
- this.advance();
183
- break;
184
- case "]":
185
- tokens.push({
186
- type: "RBRACKET" /* RBRACKET */,
187
- value: "]",
188
- position: startPos
189
- });
190
- this.advance();
191
- break;
192
- case "{":
193
- tokens.push({
194
- type: "LBRACE" /* LBRACE */,
195
- value: "{",
196
- position: startPos
197
- });
198
- this.advance();
199
- break;
200
- case "}":
201
- tokens.push({
202
- type: "RBRACE" /* RBRACE */,
203
- value: "}",
204
- position: startPos
205
- });
206
- this.advance();
207
- break;
208
- case "<":
209
- if (this.position + 1 < this.input.length && this.input[this.position + 1] === "-") {
210
- tokens.push({
211
- type: "ARROW" /* ARROW */,
212
- value: "<-",
213
- position: startPos
214
- });
215
- this.advance();
216
- this.advance();
217
- } else if (this.position + 1 < this.input.length && this.input[this.position + 1] === "=") {
218
- tokens.push({
219
- type: "LTE" /* LTE */,
220
- value: "<=",
221
- position: startPos
222
- });
223
- this.advance();
224
- this.advance();
225
- } else {
226
- tokens.push({
227
- type: "LT" /* LT */,
228
- value: "<",
229
- position: startPos
230
- });
231
- this.advance();
232
- }
233
- break;
234
- case "-":
235
- if (this.position + 1 < this.input.length && this.input[this.position + 1] === ">") {
236
- tokens.push({
237
- type: "ARROW" /* ARROW */,
238
- value: "->",
239
- position: startPos
240
- });
241
- this.advance();
242
- this.advance();
243
- } else {
244
- tokens.push({
245
- type: "DASH" /* DASH */,
246
- value: "-",
247
- position: startPos
248
- });
249
- this.advance();
250
- }
251
- break;
252
- case "=":
253
- if (this.position + 1 < this.input.length && this.input[this.position + 1] === "~") {
254
- tokens.push({
255
- type: "REGEX_MATCH" /* REGEX_MATCH */,
256
- value: "=~",
257
- position: startPos
258
- });
259
- this.advance();
260
- this.advance();
261
- } else {
262
- tokens.push({
263
- type: "EQUALS" /* EQUALS */,
264
- value: "=",
265
- position: startPos
266
- });
267
- this.advance();
268
- }
269
- break;
270
- case "!":
271
- if (this.position + 1 < this.input.length && this.input[this.position + 1] === "=") {
272
- tokens.push({
273
- type: "NOT_EQUALS" /* NOT_EQUALS */,
274
- value: "!=",
275
- position: startPos
276
- });
277
- this.advance();
278
- this.advance();
279
- } else {
280
- throw new Error(`Unexpected character: ! at position ${startPos}`);
281
- }
282
- break;
283
- case ">":
284
- if (this.position + 1 < this.input.length && this.input[this.position + 1] === "=") {
285
- tokens.push({
286
- type: "GTE" /* GTE */,
287
- value: ">=",
288
- position: startPos
289
- });
290
- this.advance();
291
- this.advance();
292
- } else {
293
- tokens.push({
294
- type: "GT" /* GT */,
295
- value: ">",
296
- position: startPos
297
- });
298
- this.advance();
299
- }
300
- break;
301
- case ",":
302
- tokens.push({
303
- type: "COMMA" /* COMMA */,
304
- value: ",",
305
- position: startPos
306
- });
307
- this.advance();
308
- break;
309
- case ".":
310
- tokens.push({
311
- type: "DOT" /* DOT */,
312
- value: ".",
313
- position: startPos
314
- });
315
- this.advance();
316
- break;
317
- case "|":
318
- tokens.push({
319
- type: "PIPE" /* PIPE */,
320
- value: "|",
321
- position: startPos
322
- });
323
- this.advance();
324
- break;
325
- case "*":
326
- tokens.push({
327
- type: "ASTERISK" /* ASTERISK */,
328
- value: "*",
329
- position: startPos
330
- });
331
- this.advance();
332
- break;
333
- case ":":
334
- tokens.push({
335
- type: "LABEL" /* LABEL */,
336
- value: ":",
337
- position: startPos
338
- });
339
- this.advance();
340
- break;
341
- case '"':
342
- case "'":
343
- tokens.push({
344
- type: "STRING" /* STRING */,
345
- value: this.readString(),
346
- position: startPos
347
- });
348
- break;
349
- default:
350
- if (/[0-9]/.test(this.currentChar)) {
351
- tokens.push({
352
- type: "NUMBER" /* NUMBER */,
353
- value: this.readNumber(),
354
- position: startPos
355
- });
356
- } else if (/[a-zA-Z_]/.test(this.currentChar)) {
357
- tokens.push({
358
- type: "IDENTIFIER" /* IDENTIFIER */,
359
- value: this.readIdentifier(),
360
- position: startPos
361
- });
362
- } else {
363
- throw new Error(
364
- `Unexpected character: ${this.currentChar} at position ${startPos}`
365
- );
366
- }
367
- }
368
- }
369
- tokens.push({ type: "EOF" /* EOF */, value: "", position: this.position });
370
- return tokens;
371
- }
372
- }
373
- export {
374
- Lexer,
375
- TokenType
376
- };