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.
- package/README.md +330 -324
- package/ada/ada2012/AdaLexer.js +486 -316
- package/ada/ada2012/AdaLexerBase.js +25 -0
- package/ada/ada2012/AdaParser.js +4547 -3823
- package/ada/ada2012/AdaParserBase.js +682 -0
- package/ada/ada2012/AdaParserListener.js +36 -0
- package/ada/ada2012/AdaParserVisitor.js +24 -0
- package/ada/ada2012/Symbol.js +20 -0
- package/ada/ada2012/SymbolTable.js +144 -0
- package/ada/ada2012/TypeClassification.js +15 -0
- package/ada/ada2022/AdaLexer.js +699 -0
- package/ada/ada2022/AdaLexerBase.js +25 -0
- package/ada/ada2022/AdaParser.js +37818 -0
- package/ada/ada2022/AdaParserBase.js +686 -0
- package/ada/ada2022/AdaParserListener.js +3024 -0
- package/ada/ada2022/AdaParserVisitor.js +2020 -0
- package/ada/ada2022/Symbol.js +20 -0
- package/ada/ada2022/SymbolTable.js +144 -0
- package/ada/ada2022/TypeClassification.js +15 -0
- package/c/CLexer.js +846 -603
- package/c/CLexerBase.js +96 -0
- package/c/CParser.js +8798 -4776
- package/c/CParserBase.js +591 -0
- package/c/{CListener.js → CParserListener.js} +382 -112
- package/c/{CVisitor.js → CParserVisitor.js} +252 -72
- package/c/ErrorListener.js +50 -0
- package/c/Symbol.js +28 -0
- package/c/SymbolTable.js +215 -0
- package/c/TypeClassification.js +21 -0
- package/cpp/CPP14Parser.js +215 -215
- package/cpp/CPP14ParserListener.js +56 -56
- package/cpp/CPP14ParserVisitor.js +28 -28
- package/cql3/CqlLexer.js +708 -692
- package/cql3/CqlParser.js +3356 -2802
- package/cql3/CqlParserListener.js +36 -0
- package/cql3/CqlParserVisitor.js +24 -0
- package/csharp/v7/CSharpLexer.js +1339 -0
- package/csharp/v7/CSharpLexerBase.js +332 -0
- package/csharp/v7/CSharpParser.js +29239 -0
- package/csharp/v7/CSharpParserBase.js +48 -0
- package/csharp/v7/CSharpParserListener.js +2304 -0
- package/csharp/v7/CSharpParserVisitor.js +1540 -0
- package/csharp/v8-spec/CSharpLexer.js +1549 -0
- package/csharp/v8-spec/CSharpLexerBase.js +296 -0
- package/csharp/v8-spec/CSharpParser.js +45044 -0
- package/csharp/v8-spec/CSharpParserBase.js +569 -0
- package/csharp/v8-spec/CSharpParserListener.js +3582 -0
- package/csharp/v8-spec/CSharpParserVisitor.js +2392 -0
- package/geekcode/geekcodeLexer.js +232 -0
- package/geekcode/geekcodeListener.js +81 -0
- package/geekcode/geekcodeParser.js +1516 -0
- package/geekcode/geekcodeVisitor.js +58 -0
- package/kotlin/kotlin/KotlinLexer.js +1257 -1247
- package/kotlin/kotlin/KotlinParser.js +3991 -3425
- package/kotlin/kotlin/KotlinParserListener.js +36 -0
- package/kotlin/kotlin/KotlinParserVisitor.js +24 -0
- package/package.json +1 -1
- package/plantUML/PlantUMLLexer.js +215 -316
- package/plantUML/PlantUMLParser.js +1045 -2393
- package/plantUML/PlantUMLParserListener.js +171 -0
- package/plantUML/PlantUMLParserVisitor.js +118 -0
- package/sql/cockroachdb/CockroachDBLexer.js +3865 -0
- package/sql/cockroachdb/CockroachDBParser.js +123259 -0
- package/sql/cockroachdb/CockroachDBParserListener.js +7281 -0
- package/sql/cockroachdb/CockroachDBParserVisitor.js +4858 -0
- package/sql/plsql/PlSqlParser.js +27187 -42911
- package/sql/plsql/PlSqlParserBase.js +30 -0
- package/sql/plsql/PlSqlParserListener.js +0 -9
- package/sql/plsql/PlSqlParserVisitor.js +0 -6
- package/sql/snowflake/SnowflakeLexer.js +5675 -5497
- package/sql/snowflake/SnowflakeParser.js +27230 -22653
- package/sql/snowflake/SnowflakeParserListener.js +278 -8
- package/sql/snowflake/SnowflakeParserVisitor.js +184 -4
- package/sql/sqlite/SQLiteParser.js +1115 -1115
- package/sql/sqlite/SQLiteParserListener.js +9 -9
- package/sql/sqlite/SQLiteParserVisitor.js +6 -6
- package/sysml-v2/SysMLv2Lexer.js +1047 -0
- package/sysml-v2/SysMLv2Parser.js +51339 -0
- package/sysml-v2/SysMLv2ParserListener.js +4464 -0
- package/sysml-v2/SysMLv2ParserVisitor.js +2980 -0
- package/plantUML/PlantUMLListener.js +0 -279
- package/plantUML/PlantUMLVisitor.js +0 -190
package/c/CLexerBase.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import antlr4 from 'antlr4';
|
|
2
|
+
import { execSync } from 'child_process';
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
|
|
5
|
+
export default class CLexerBase extends antlr4.Lexer {
|
|
6
|
+
constructor(input) {
|
|
7
|
+
super(CLexerBase.runGccAndMakeStream(input));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static runGccAndMakeStream(input) {
|
|
11
|
+
const isWindows = process.platform === "win32";
|
|
12
|
+
|
|
13
|
+
const args = process.argv;
|
|
14
|
+
|
|
15
|
+
const vsc = args.some(a => a.toLowerCase().includes("--vsc"));
|
|
16
|
+
let gcc = args.some(a => a.toLowerCase().includes("--gcc"));
|
|
17
|
+
const clang = args.some(a => a.toLowerCase().includes("--clang"));
|
|
18
|
+
const nopp = args.some(a => a.toLowerCase().includes("--nopp"));
|
|
19
|
+
|
|
20
|
+
if (!(vsc || gcc || clang)) {
|
|
21
|
+
gcc = true;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const ppOptions = CLexerBase.extractPreprocessorOptions(args);
|
|
25
|
+
|
|
26
|
+
let sourceName = input.name;
|
|
27
|
+
const inputText = input.getText(0, input.size - 1);
|
|
28
|
+
|
|
29
|
+
if (!sourceName || sourceName === "" || !sourceName.endsWith(".c")) {
|
|
30
|
+
sourceName = "stdin.c";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const outputName = sourceName + ".p";
|
|
34
|
+
|
|
35
|
+
if (nopp) {
|
|
36
|
+
try {
|
|
37
|
+
fs.writeFileSync(outputName, inputText);
|
|
38
|
+
} catch (e) {
|
|
39
|
+
// Ignore
|
|
40
|
+
}
|
|
41
|
+
return antlr4.CharStreams.fromString(inputText);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (sourceName === "stdin.c") {
|
|
45
|
+
fs.writeFileSync(sourceName, inputText);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (gcc) {
|
|
49
|
+
let output = "";
|
|
50
|
+
try {
|
|
51
|
+
const gccCommand = isWindows ? "gcc.exe" : "gcc";
|
|
52
|
+
const ppOptsStr = ppOptions.map(o => `"${o}"`).join(" ");
|
|
53
|
+
output = execSync(`${gccCommand} -std=c2x -E -C ${ppOptsStr} "${sourceName}"`, {
|
|
54
|
+
encoding: "utf-8",
|
|
55
|
+
maxBuffer: 50 * 1024 * 1024,
|
|
56
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
57
|
+
});
|
|
58
|
+
} catch (e) {
|
|
59
|
+
// Ignore
|
|
60
|
+
}
|
|
61
|
+
fs.writeFileSync(outputName, output);
|
|
62
|
+
return antlr4.CharStreams.fromString(output);
|
|
63
|
+
}
|
|
64
|
+
if (clang) {
|
|
65
|
+
let output = "";
|
|
66
|
+
try {
|
|
67
|
+
const clangCommand = isWindows ? "clang.exe" : "clang";
|
|
68
|
+
const ppOptsStr = ppOptions.map(o => `"${o}"`).join(" ");
|
|
69
|
+
output = execSync(`${clangCommand} -std=c2x -E -C ${ppOptsStr} "${sourceName}"`, {
|
|
70
|
+
encoding: "utf-8",
|
|
71
|
+
maxBuffer: 50 * 1024 * 1024,
|
|
72
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
73
|
+
});
|
|
74
|
+
} catch (e) {
|
|
75
|
+
// Ignore
|
|
76
|
+
}
|
|
77
|
+
fs.writeFileSync(outputName, output);
|
|
78
|
+
return antlr4.CharStreams.fromString(output);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
throw new Error("No preprocessor specified.");
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static extractPreprocessorOptions(args) {
|
|
85
|
+
const options = [];
|
|
86
|
+
for (const arg of args) {
|
|
87
|
+
if (arg.startsWith("--D")) {
|
|
88
|
+
options.push("-D" + arg.substring(3));
|
|
89
|
+
}
|
|
90
|
+
else if (arg.startsWith("--I")) {
|
|
91
|
+
options.push("-I" + arg.substring(3));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return options;
|
|
95
|
+
}
|
|
96
|
+
}
|