cariboujs 2.0.3 → 2.0.5

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 (82) hide show
  1. package/README.md +330 -324
  2. package/ada/ada2012/AdaLexer.js +486 -316
  3. package/ada/ada2012/AdaLexerBase.js +25 -0
  4. package/ada/ada2012/AdaParser.js +4547 -3823
  5. package/ada/ada2012/AdaParserBase.js +682 -0
  6. package/ada/ada2012/AdaParserListener.js +36 -0
  7. package/ada/ada2012/AdaParserVisitor.js +24 -0
  8. package/ada/ada2012/Symbol.js +20 -0
  9. package/ada/ada2012/SymbolTable.js +144 -0
  10. package/ada/ada2012/TypeClassification.js +15 -0
  11. package/ada/ada2022/AdaLexer.js +699 -0
  12. package/ada/ada2022/AdaLexerBase.js +25 -0
  13. package/ada/ada2022/AdaParser.js +37818 -0
  14. package/ada/ada2022/AdaParserBase.js +686 -0
  15. package/ada/ada2022/AdaParserListener.js +3024 -0
  16. package/ada/ada2022/AdaParserVisitor.js +2020 -0
  17. package/ada/ada2022/Symbol.js +20 -0
  18. package/ada/ada2022/SymbolTable.js +144 -0
  19. package/ada/ada2022/TypeClassification.js +15 -0
  20. package/c/CLexer.js +846 -603
  21. package/c/CLexerBase.js +96 -0
  22. package/c/CParser.js +8798 -4776
  23. package/c/CParserBase.js +591 -0
  24. package/c/{CListener.js → CParserListener.js} +382 -112
  25. package/c/{CVisitor.js → CParserVisitor.js} +252 -72
  26. package/c/ErrorListener.js +50 -0
  27. package/c/Symbol.js +28 -0
  28. package/c/SymbolTable.js +215 -0
  29. package/c/TypeClassification.js +21 -0
  30. package/cpp/CPP14Parser.js +215 -215
  31. package/cpp/CPP14ParserListener.js +56 -56
  32. package/cpp/CPP14ParserVisitor.js +28 -28
  33. package/cql3/CqlLexer.js +708 -692
  34. package/cql3/CqlParser.js +3356 -2802
  35. package/cql3/CqlParserListener.js +36 -0
  36. package/cql3/CqlParserVisitor.js +24 -0
  37. package/csharp/v7/CSharpLexer.js +1339 -0
  38. package/csharp/v7/CSharpLexerBase.js +332 -0
  39. package/csharp/v7/CSharpParser.js +29239 -0
  40. package/csharp/v7/CSharpParserBase.js +48 -0
  41. package/csharp/v7/CSharpParserListener.js +2304 -0
  42. package/csharp/v7/CSharpParserVisitor.js +1540 -0
  43. package/csharp/v8-spec/CSharpLexer.js +1549 -0
  44. package/csharp/v8-spec/CSharpLexerBase.js +296 -0
  45. package/csharp/v8-spec/CSharpParser.js +45044 -0
  46. package/csharp/v8-spec/CSharpParserBase.js +569 -0
  47. package/csharp/v8-spec/CSharpParserListener.js +3582 -0
  48. package/csharp/v8-spec/CSharpParserVisitor.js +2392 -0
  49. package/geekcode/geekcodeLexer.js +232 -0
  50. package/geekcode/geekcodeListener.js +81 -0
  51. package/geekcode/geekcodeParser.js +1516 -0
  52. package/geekcode/geekcodeVisitor.js +58 -0
  53. package/kotlin/kotlin/KotlinLexer.js +1257 -1247
  54. package/kotlin/kotlin/KotlinParser.js +3991 -3425
  55. package/kotlin/kotlin/KotlinParserListener.js +36 -0
  56. package/kotlin/kotlin/KotlinParserVisitor.js +24 -0
  57. package/package.json +1 -1
  58. package/plantUML/PlantUMLLexer.js +215 -316
  59. package/plantUML/PlantUMLParser.js +1045 -2393
  60. package/plantUML/PlantUMLParserListener.js +171 -0
  61. package/plantUML/PlantUMLParserVisitor.js +118 -0
  62. package/sql/cockroachdb/CockroachDBLexer.js +3865 -0
  63. package/sql/cockroachdb/CockroachDBParser.js +123259 -0
  64. package/sql/cockroachdb/CockroachDBParserListener.js +7281 -0
  65. package/sql/cockroachdb/CockroachDBParserVisitor.js +4858 -0
  66. package/sql/plsql/PlSqlParser.js +27187 -42911
  67. package/sql/plsql/PlSqlParserBase.js +30 -0
  68. package/sql/plsql/PlSqlParserListener.js +0 -9
  69. package/sql/plsql/PlSqlParserVisitor.js +0 -6
  70. package/sql/snowflake/SnowflakeLexer.js +5675 -5497
  71. package/sql/snowflake/SnowflakeParser.js +27230 -22653
  72. package/sql/snowflake/SnowflakeParserListener.js +278 -8
  73. package/sql/snowflake/SnowflakeParserVisitor.js +184 -4
  74. package/sql/sqlite/SQLiteParser.js +1115 -1115
  75. package/sql/sqlite/SQLiteParserListener.js +9 -9
  76. package/sql/sqlite/SQLiteParserVisitor.js +6 -6
  77. package/sysml-v2/SysMLv2Lexer.js +1047 -0
  78. package/sysml-v2/SysMLv2Parser.js +51339 -0
  79. package/sysml-v2/SysMLv2ParserListener.js +4464 -0
  80. package/sysml-v2/SysMLv2ParserVisitor.js +2980 -0
  81. package/plantUML/PlantUMLListener.js +0 -279
  82. package/plantUML/PlantUMLVisitor.js +0 -190
@@ -1,10 +1,34 @@
1
- // Generated from C.g4 by ANTLR 4.13.2
1
+ // Generated from CParser.g4 by ANTLR 4.13.2
2
2
  // jshint ignore: start
3
3
  import antlr4 from 'antlr4';
4
4
 
5
5
  // This class defines a complete generic visitor for a parse tree produced by CParser.
6
6
 
7
- export default class CVisitor extends antlr4.tree.ParseTreeVisitor {
7
+ export default class CParserVisitor extends antlr4.tree.ParseTreeVisitor {
8
+
9
+ // Visit a parse tree produced by CParser#compilationUnit.
10
+ visitCompilationUnit(ctx) {
11
+ return this.visitChildren(ctx);
12
+ }
13
+
14
+
15
+ // Visit a parse tree produced by CParser#constant.
16
+ visitConstant(ctx) {
17
+ return this.visitChildren(ctx);
18
+ }
19
+
20
+
21
+ // Visit a parse tree produced by CParser#enumerationConstant.
22
+ visitEnumerationConstant(ctx) {
23
+ return this.visitChildren(ctx);
24
+ }
25
+
26
+
27
+ // Visit a parse tree produced by CParser#predefinedConstant.
28
+ visitPredefinedConstant(ctx) {
29
+ return this.visitChildren(ctx);
30
+ }
31
+
8
32
 
9
33
  // Visit a parse tree produced by CParser#primaryExpression.
10
34
  visitPrimaryExpression(ctx) {
@@ -12,6 +36,12 @@ export default class CVisitor extends antlr4.tree.ParseTreeVisitor {
12
36
  }
13
37
 
14
38
 
39
+ // Visit a parse tree produced by CParser#exprList.
40
+ visitExprList(ctx) {
41
+ return this.visitChildren(ctx);
42
+ }
43
+
44
+
15
45
  // Visit a parse tree produced by CParser#genericSelection.
16
46
  visitGenericSelection(ctx) {
17
47
  return this.visitChildren(ctx);
@@ -48,12 +78,6 @@ export default class CVisitor extends antlr4.tree.ParseTreeVisitor {
48
78
  }
49
79
 
50
80
 
51
- // Visit a parse tree produced by CParser#unaryOperator.
52
- visitUnaryOperator(ctx) {
53
- return this.visitChildren(ctx);
54
- }
55
-
56
-
57
81
  // Visit a parse tree produced by CParser#castExpression.
58
82
  visitCastExpression(ctx) {
59
83
  return this.visitChildren(ctx);
@@ -132,12 +156,6 @@ export default class CVisitor extends antlr4.tree.ParseTreeVisitor {
132
156
  }
133
157
 
134
158
 
135
- // Visit a parse tree produced by CParser#assignmentOperator.
136
- visitAssignmentOperator(ctx) {
137
- return this.visitChildren(ctx);
138
- }
139
-
140
-
141
159
  // Visit a parse tree produced by CParser#expression.
142
160
  visitExpression(ctx) {
143
161
  return this.visitChildren(ctx);
@@ -162,12 +180,6 @@ export default class CVisitor extends antlr4.tree.ParseTreeVisitor {
162
180
  }
163
181
 
164
182
 
165
- // Visit a parse tree produced by CParser#declarationSpecifiers2.
166
- visitDeclarationSpecifiers2(ctx) {
167
- return this.visitChildren(ctx);
168
- }
169
-
170
-
171
183
  // Visit a parse tree produced by CParser#declarationSpecifier.
172
184
  visitDeclarationSpecifier(ctx) {
173
185
  return this.visitChildren(ctx);
@@ -186,6 +198,12 @@ export default class CVisitor extends antlr4.tree.ParseTreeVisitor {
186
198
  }
187
199
 
188
200
 
201
+ // Visit a parse tree produced by CParser#attributeDeclaration.
202
+ visitAttributeDeclaration(ctx) {
203
+ return this.visitChildren(ctx);
204
+ }
205
+
206
+
189
207
  // Visit a parse tree produced by CParser#storageClassSpecifier.
190
208
  visitStorageClassSpecifier(ctx) {
191
209
  return this.visitChildren(ctx);
@@ -210,14 +228,14 @@ export default class CVisitor extends antlr4.tree.ParseTreeVisitor {
210
228
  }
211
229
 
212
230
 
213
- // Visit a parse tree produced by CParser#structDeclarationList.
214
- visitStructDeclarationList(ctx) {
231
+ // Visit a parse tree produced by CParser#memberDeclarationList.
232
+ visitMemberDeclarationList(ctx) {
215
233
  return this.visitChildren(ctx);
216
234
  }
217
235
 
218
236
 
219
- // Visit a parse tree produced by CParser#structDeclaration.
220
- visitStructDeclaration(ctx) {
237
+ // Visit a parse tree produced by CParser#memberDeclaration.
238
+ visitMemberDeclaration(ctx) {
221
239
  return this.visitChildren(ctx);
222
240
  }
223
241
 
@@ -228,14 +246,20 @@ export default class CVisitor extends antlr4.tree.ParseTreeVisitor {
228
246
  }
229
247
 
230
248
 
231
- // Visit a parse tree produced by CParser#structDeclaratorList.
232
- visitStructDeclaratorList(ctx) {
249
+ // Visit a parse tree produced by CParser#typeSpecifierQualifier.
250
+ visitTypeSpecifierQualifier(ctx) {
233
251
  return this.visitChildren(ctx);
234
252
  }
235
253
 
236
254
 
237
- // Visit a parse tree produced by CParser#structDeclarator.
238
- visitStructDeclarator(ctx) {
255
+ // Visit a parse tree produced by CParser#memberDeclaratorList.
256
+ visitMemberDeclaratorList(ctx) {
257
+ return this.visitChildren(ctx);
258
+ }
259
+
260
+
261
+ // Visit a parse tree produced by CParser#memberDeclarator.
262
+ visitMemberDeclarator(ctx) {
239
263
  return this.visitChildren(ctx);
240
264
  }
241
265
 
@@ -258,8 +282,8 @@ export default class CVisitor extends antlr4.tree.ParseTreeVisitor {
258
282
  }
259
283
 
260
284
 
261
- // Visit a parse tree produced by CParser#enumerationConstant.
262
- visitEnumerationConstant(ctx) {
285
+ // Visit a parse tree produced by CParser#enumTypeSpecifier.
286
+ visitEnumTypeSpecifier(ctx) {
263
287
  return this.visitChildren(ctx);
264
288
  }
265
289
 
@@ -270,6 +294,18 @@ export default class CVisitor extends antlr4.tree.ParseTreeVisitor {
270
294
  }
271
295
 
272
296
 
297
+ // Visit a parse tree produced by CParser#typeofSpecifier.
298
+ visitTypeofSpecifier(ctx) {
299
+ return this.visitChildren(ctx);
300
+ }
301
+
302
+
303
+ // Visit a parse tree produced by CParser#typeofSpecifierArgument.
304
+ visitTypeofSpecifierArgument(ctx) {
305
+ return this.visitChildren(ctx);
306
+ }
307
+
308
+
273
309
  // Visit a parse tree produced by CParser#typeQualifier.
274
310
  visitTypeQualifier(ctx) {
275
311
  return this.visitChildren(ctx);
@@ -300,36 +336,6 @@ export default class CVisitor extends antlr4.tree.ParseTreeVisitor {
300
336
  }
301
337
 
302
338
 
303
- // Visit a parse tree produced by CParser#vcSpecificModifer.
304
- visitVcSpecificModifer(ctx) {
305
- return this.visitChildren(ctx);
306
- }
307
-
308
-
309
- // Visit a parse tree produced by CParser#gccDeclaratorExtension.
310
- visitGccDeclaratorExtension(ctx) {
311
- return this.visitChildren(ctx);
312
- }
313
-
314
-
315
- // Visit a parse tree produced by CParser#gccAttributeSpecifier.
316
- visitGccAttributeSpecifier(ctx) {
317
- return this.visitChildren(ctx);
318
- }
319
-
320
-
321
- // Visit a parse tree produced by CParser#gccAttributeList.
322
- visitGccAttributeList(ctx) {
323
- return this.visitChildren(ctx);
324
- }
325
-
326
-
327
- // Visit a parse tree produced by CParser#gccAttribute.
328
- visitGccAttribute(ctx) {
329
- return this.visitChildren(ctx);
330
- }
331
-
332
-
333
339
  // Visit a parse tree produced by CParser#pointer.
334
340
  visitPointer(ctx) {
335
341
  return this.visitChildren(ctx);
@@ -360,12 +366,6 @@ export default class CVisitor extends antlr4.tree.ParseTreeVisitor {
360
366
  }
361
367
 
362
368
 
363
- // Visit a parse tree produced by CParser#identifierList.
364
- visitIdentifierList(ctx) {
365
- return this.visitChildren(ctx);
366
- }
367
-
368
-
369
369
  // Visit a parse tree produced by CParser#typeName.
370
370
  visitTypeName(ctx) {
371
371
  return this.visitChildren(ctx);
@@ -426,6 +426,54 @@ export default class CVisitor extends antlr4.tree.ParseTreeVisitor {
426
426
  }
427
427
 
428
428
 
429
+ // Visit a parse tree produced by CParser#attributeSpecifierSequence.
430
+ visitAttributeSpecifierSequence(ctx) {
431
+ return this.visitChildren(ctx);
432
+ }
433
+
434
+
435
+ // Visit a parse tree produced by CParser#attributeSpecifier.
436
+ visitAttributeSpecifier(ctx) {
437
+ return this.visitChildren(ctx);
438
+ }
439
+
440
+
441
+ // Visit a parse tree produced by CParser#attributeList.
442
+ visitAttributeList(ctx) {
443
+ return this.visitChildren(ctx);
444
+ }
445
+
446
+
447
+ // Visit a parse tree produced by CParser#attribute.
448
+ visitAttribute(ctx) {
449
+ return this.visitChildren(ctx);
450
+ }
451
+
452
+
453
+ // Visit a parse tree produced by CParser#attributeToken.
454
+ visitAttributeToken(ctx) {
455
+ return this.visitChildren(ctx);
456
+ }
457
+
458
+
459
+ // Visit a parse tree produced by CParser#attributeArgumentClause.
460
+ visitAttributeArgumentClause(ctx) {
461
+ return this.visitChildren(ctx);
462
+ }
463
+
464
+
465
+ // Visit a parse tree produced by CParser#balancedTokenSequence.
466
+ visitBalancedTokenSequence(ctx) {
467
+ return this.visitChildren(ctx);
468
+ }
469
+
470
+
471
+ // Visit a parse tree produced by CParser#balancedToken.
472
+ visitBalancedToken(ctx) {
473
+ return this.visitChildren(ctx);
474
+ }
475
+
476
+
429
477
  // Visit a parse tree produced by CParser#statement.
430
478
  visitStatement(ctx) {
431
479
  return this.visitChildren(ctx);
@@ -498,12 +546,6 @@ export default class CVisitor extends antlr4.tree.ParseTreeVisitor {
498
546
  }
499
547
 
500
548
 
501
- // Visit a parse tree produced by CParser#compilationUnit.
502
- visitCompilationUnit(ctx) {
503
- return this.visitChildren(ctx);
504
- }
505
-
506
-
507
549
  // Visit a parse tree produced by CParser#translationUnit.
508
550
  visitTranslationUnit(ctx) {
509
551
  return this.visitChildren(ctx);
@@ -528,5 +570,143 @@ export default class CVisitor extends antlr4.tree.ParseTreeVisitor {
528
570
  }
529
571
 
530
572
 
573
+ // Visit a parse tree produced by CParser#functionBody.
574
+ visitFunctionBody(ctx) {
575
+ return this.visitChildren(ctx);
576
+ }
577
+
578
+
579
+ // Visit a parse tree produced by CParser#identifierList.
580
+ visitIdentifierList(ctx) {
581
+ return this.visitChildren(ctx);
582
+ }
583
+
584
+
585
+ // Visit a parse tree produced by CParser#gnuArrayDesignator.
586
+ visitGnuArrayDesignator(ctx) {
587
+ return this.visitChildren(ctx);
588
+ }
589
+
590
+
591
+ // Visit a parse tree produced by CParser#gnuIdentifier.
592
+ visitGnuIdentifier(ctx) {
593
+ return this.visitChildren(ctx);
594
+ }
595
+
596
+
597
+ // Visit a parse tree produced by CParser#asmArgument.
598
+ visitAsmArgument(ctx) {
599
+ return this.visitChildren(ctx);
600
+ }
601
+
602
+
603
+ // Visit a parse tree produced by CParser#asmClobbers.
604
+ visitAsmClobbers(ctx) {
605
+ return this.visitChildren(ctx);
606
+ }
607
+
608
+
609
+ // Visit a parse tree produced by CParser#asmDefinition.
610
+ visitAsmDefinition(ctx) {
611
+ return this.visitChildren(ctx);
612
+ }
613
+
614
+
615
+ // Visit a parse tree produced by CParser#asm_.
616
+ visitAsm_(ctx) {
617
+ return this.visitChildren(ctx);
618
+ }
619
+
620
+
621
+ // Visit a parse tree produced by CParser#toplevelAsmArgument.
622
+ visitToplevelAsmArgument(ctx) {
623
+ return this.visitChildren(ctx);
624
+ }
625
+
626
+
627
+ // Visit a parse tree produced by CParser#asmOperand.
628
+ visitAsmOperand(ctx) {
629
+ return this.visitChildren(ctx);
630
+ }
631
+
632
+
633
+ // Visit a parse tree produced by CParser#asmOperands.
634
+ visitAsmOperands(ctx) {
635
+ return this.visitChildren(ctx);
636
+ }
637
+
638
+
639
+ // Visit a parse tree produced by CParser#asmQualifier.
640
+ visitAsmQualifier(ctx) {
641
+ return this.visitChildren(ctx);
642
+ }
643
+
644
+
645
+ // Visit a parse tree produced by CParser#volatile_.
646
+ visitVolatile_(ctx) {
647
+ return this.visitChildren(ctx);
648
+ }
649
+
650
+
651
+ // Visit a parse tree produced by CParser#asmQualifierList.
652
+ visitAsmQualifierList(ctx) {
653
+ return this.visitChildren(ctx);
654
+ }
655
+
656
+
657
+ // Visit a parse tree produced by CParser#asmStatement.
658
+ visitAsmStatement(ctx) {
659
+ return this.visitChildren(ctx);
660
+ }
661
+
662
+
663
+ // Visit a parse tree produced by CParser#asmStringLiteral.
664
+ visitAsmStringLiteral(ctx) {
665
+ return this.visitChildren(ctx);
666
+ }
667
+
668
+
669
+ // Visit a parse tree produced by CParser#gccDeclaratorExtension.
670
+ visitGccDeclaratorExtension(ctx) {
671
+ return this.visitChildren(ctx);
672
+ }
673
+
674
+
675
+ // Visit a parse tree produced by CParser#gnuAttribute.
676
+ visitGnuAttribute(ctx) {
677
+ return this.visitChildren(ctx);
678
+ }
679
+
680
+
681
+ // Visit a parse tree produced by CParser#gnuAttributeList.
682
+ visitGnuAttributeList(ctx) {
683
+ return this.visitChildren(ctx);
684
+ }
685
+
686
+
687
+ // Visit a parse tree produced by CParser#gnuAttributes.
688
+ visitGnuAttributes(ctx) {
689
+ return this.visitChildren(ctx);
690
+ }
691
+
692
+
693
+ // Visit a parse tree produced by CParser#gnuSingleAttribute.
694
+ visitGnuSingleAttribute(ctx) {
695
+ return this.visitChildren(ctx);
696
+ }
697
+
698
+
699
+ // Visit a parse tree produced by CParser#simpleAsmExpr.
700
+ visitSimpleAsmExpr(ctx) {
701
+ return this.visitChildren(ctx);
702
+ }
703
+
704
+
705
+ // Visit a parse tree produced by CParser#vcSpecificModifer.
706
+ visitVcSpecificModifer(ctx) {
707
+ return this.visitChildren(ctx);
708
+ }
709
+
710
+
531
711
 
532
712
  }
@@ -0,0 +1,50 @@
1
+ import antlr4 from 'antlr4';
2
+ import CLexer from './CLexer.js';
3
+ import * as fs from 'fs';
4
+
5
+ export class ErrorListener extends antlr4.error.ErrorListener {
6
+ constructor(quiet, tee, out) {
7
+ super();
8
+ this.had_error = false;
9
+ this._quiet = quiet;
10
+ this._tee = tee;
11
+ this._out = out;
12
+ }
13
+
14
+ syntaxError(recognizer, offendingSymbol, line, column, msg, e) {
15
+ let fileName = "<unknown>";
16
+ let lineAdjusted = line;
17
+
18
+ if (recognizer instanceof antlr4.Parser) {
19
+ const ts2 = recognizer._input;
20
+ const ind = offendingSymbol.tokenIndex;
21
+ for (let j = ind; j >= 0; j--) {
22
+ const t = ts2.get(j);
23
+ if (t === null) break;
24
+ if (t.type === CLexer.LineDirective) {
25
+ const txt = t.text;
26
+ const parts = txt.split(/\s+/);
27
+ if (parts.length >= 3) {
28
+ const dirLine = parseInt(parts[1], 10);
29
+ if (!isNaN(dirLine)) {
30
+ const lineDirective = t.line;
31
+ const lineDiff = line - lineDirective;
32
+ lineAdjusted = lineDiff + dirLine - 1;
33
+ fileName = parts[2].trim();
34
+ }
35
+ }
36
+ break;
37
+ }
38
+ }
39
+ }
40
+ this.had_error = true;
41
+ if (this._tee && this._out !== null) {
42
+ fs.writeSync(this._out, fileName + " line " + lineAdjusted + ", .p " + line + ":" + column + " " + msg + "\n");
43
+ }
44
+ if (!this._quiet) {
45
+ console.error(fileName + " line " + lineAdjusted + ", .p " + line + ":" + column + " " + msg);
46
+ }
47
+ }
48
+ }
49
+
50
+ export default ErrorListener;
package/c/Symbol.js ADDED
@@ -0,0 +1,28 @@
1
+ import { TypeClassification, TypeClassificationNames } from "./TypeClassification.js";
2
+
3
+ export class Symbol {
4
+ constructor() {
5
+ this.name = "";
6
+ this.classification = new Set();
7
+ this.members = new Map();
8
+ this.parent = null;
9
+ this.predefined = false;
10
+ this.definedFile = "";
11
+ this.definedLine = 0;
12
+ this.definedColumn = 0;
13
+ }
14
+
15
+ toString() {
16
+ let result = this.name;
17
+ const classificationStr = Array.from(this.classification)
18
+ .map(c => TypeClassificationNames[c] || String(c))
19
+ .join(", ");
20
+ result += " (with classification " + classificationStr + ")";
21
+ if (this.definedFile && this.definedFile.length > 0) {
22
+ result += " defined at " + this.definedFile + ":" + this.definedLine + ":" + this.definedColumn;
23
+ }
24
+ return result;
25
+ }
26
+ }
27
+
28
+ export default Symbol;