yini-parser 1.0.2-beta → 1.2.0-beta
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/CHANGELOG.md +50 -0
- package/README.md +83 -98
- package/dist/YINI.d.ts +162 -23
- package/dist/YINI.js +183 -99
- package/dist/YINI.js.map +1 -0
- package/dist/config/env.js +1 -0
- package/dist/config/env.js.map +1 -0
- package/dist/core/astBuilder.d.ts +191 -0
- package/dist/core/astBuilder.js +840 -0
- package/dist/core/astBuilder.js.map +1 -0
- package/dist/core/{ErrorDataHandler.d.ts → errorDataHandler.d.ts} +21 -19
- package/dist/core/errorDataHandler.js +271 -0
- package/dist/core/errorDataHandler.js.map +1 -0
- package/dist/core/internalTypes.d.ts +121 -0
- package/dist/core/internalTypes.js +16 -0
- package/dist/core/internalTypes.js.map +1 -0
- package/dist/core/objectBuilder.d.ts +10 -4
- package/dist/core/objectBuilder.js +127 -163
- package/dist/core/objectBuilder.js.map +1 -0
- package/dist/core/options/failLevel.d.ts +3 -0
- package/dist/core/options/failLevel.js +27 -0
- package/dist/core/options/failLevel.js.map +1 -0
- package/dist/core/options/normalizeOptions.d.ts +5 -0
- package/dist/core/options/normalizeOptions.js +53 -0
- package/dist/core/options/normalizeOptions.js.map +1 -0
- package/dist/core/options/parserOptionsConstants.d.ts +7 -0
- package/dist/core/options/parserOptionsConstants.js +37 -0
- package/dist/core/options/parserOptionsConstants.js.map +1 -0
- package/dist/core/pipeline.d.ts +18 -0
- package/dist/core/pipeline.js +323 -0
- package/dist/core/pipeline.js.map +1 -0
- package/dist/core/resultMetadataBuilder.d.ts +19 -0
- package/dist/core/resultMetadataBuilder.js +166 -0
- package/dist/core/resultMetadataBuilder.js.map +1 -0
- package/dist/core/runtime.d.ts +17 -0
- package/dist/core/runtime.js +189 -0
- package/dist/core/runtime.js.map +1 -0
- package/dist/dev/main.d.ts +1 -0
- package/dist/dev/main.js +374 -0
- package/dist/dev/main.js.map +1 -0
- package/dist/grammar/generated/YiniLexer.d.ts +74 -0
- package/dist/grammar/generated/YiniLexer.js +415 -0
- package/dist/grammar/generated/YiniLexer.js.map +1 -0
- package/dist/grammar/{YiniParser.d.ts → generated/YiniParser.d.ts} +167 -150
- package/dist/grammar/{YiniParser.js → generated/YiniParser.js} +1242 -1202
- package/dist/grammar/generated/YiniParser.js.map +1 -0
- package/dist/grammar/{YiniParserVisitor.d.ts → generated/YiniParserVisitor.d.ts} +59 -45
- package/dist/grammar/{YiniParserVisitor.js → generated/YiniParserVisitor.js} +2 -1
- package/dist/grammar/generated/YiniParserVisitor.js.map +1 -0
- package/dist/index.d.ts +43 -2
- package/dist/index.js +62 -101
- package/dist/index.js.map +1 -0
- package/dist/parsers/extractHeaderParts.d.ts +4 -3
- package/dist/parsers/extractHeaderParts.js +3 -1
- package/dist/parsers/extractHeaderParts.js.map +1 -0
- package/dist/parsers/extractSignificantYiniLine.js +2 -1
- package/dist/parsers/extractSignificantYiniLine.js.map +1 -0
- package/dist/parsers/parseBoolean.d.ts +1 -1
- package/dist/parsers/parseBoolean.js +3 -1
- package/dist/parsers/parseBoolean.js.map +1 -0
- package/dist/parsers/parseNull.js +1 -0
- package/dist/parsers/parseNull.js.map +1 -0
- package/dist/parsers/parseNumber.d.ts +8 -3
- package/dist/parsers/parseNumber.js +22 -7
- package/dist/parsers/parseNumber.js.map +1 -0
- package/dist/parsers/parseSectionHeader.d.ts +5 -4
- package/dist/parsers/parseSectionHeader.js +3 -1
- package/dist/parsers/parseSectionHeader.js.map +1 -0
- package/dist/parsers/parseString.js +3 -3
- package/dist/parsers/parseString.js.map +1 -0
- package/dist/types/index.d.ts +198 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/number.d.ts +3 -0
- package/dist/utils/number.js +19 -0
- package/dist/utils/number.js.map +1 -0
- package/dist/utils/object.d.ts +67 -0
- package/dist/utils/object.js +125 -0
- package/dist/utils/object.js.map +1 -0
- package/dist/utils/pathAndFileName.js +1 -0
- package/dist/utils/pathAndFileName.js.map +1 -0
- package/dist/utils/print.d.ts +2 -2
- package/dist/utils/print.js +11 -6
- package/dist/utils/print.js.map +1 -0
- package/dist/utils/string.d.ts +26 -1
- package/dist/utils/string.js +48 -4
- package/dist/utils/string.js.map +1 -0
- package/dist/utils/system.d.ts +15 -0
- package/dist/utils/system.js +22 -0
- package/dist/utils/system.js.map +1 -0
- package/dist/{yiniHelpers.d.ts → utils/yiniHelpers.d.ts} +3 -0
- package/dist/{yiniHelpers.js → utils/yiniHelpers.js} +46 -9
- package/dist/utils/yiniHelpers.js.map +1 -0
- package/package.json +7 -5
- package/dist/core/ErrorDataHandler.js +0 -203
- package/dist/core/YINIVisitor.d.ts +0 -158
- package/dist/core/YINIVisitor.js +0 -1008
- package/dist/core/types.d.ts +0 -59
- package/dist/core/types.js +0 -36
- package/dist/grammar/YiniLexer.d.ts +0 -68
- package/dist/grammar/YiniLexer.js +0 -379
- package/dist/parseEntry.d.ts +0 -2
- package/dist/parseEntry.js +0 -185
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
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");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
var _YiniRuntime_runtime;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.YiniRuntime = void 0;
|
|
19
|
+
const fs_1 = __importDefault(require("fs"));
|
|
20
|
+
const env_1 = require("../config/env");
|
|
21
|
+
const pathAndFileName_1 = require("../utils/pathAndFileName");
|
|
22
|
+
const print_1 = require("../utils/print");
|
|
23
|
+
const string_1 = require("../utils/string");
|
|
24
|
+
const failLevel_1 = require("./options/failLevel");
|
|
25
|
+
const normalizeOptions_1 = require("./options/normalizeOptions");
|
|
26
|
+
const parserOptionsConstants_1 = require("./options/parserOptionsConstants");
|
|
27
|
+
const pipeline_1 = require("./pipeline");
|
|
28
|
+
/**
|
|
29
|
+
* Private class representing a runtime context for a single parse call.
|
|
30
|
+
*
|
|
31
|
+
* @note This design prevents race conditions: each call gets its own
|
|
32
|
+
* runtimeInfo and related state. Without this, multiple calls
|
|
33
|
+
* (especially in parallel) could overwrite each other's data.
|
|
34
|
+
*/
|
|
35
|
+
class YiniRuntime {
|
|
36
|
+
// constructor(sourceType: 'Inline' | 'File', seed?: Partial<IRuntimeInfo>) {
|
|
37
|
+
constructor(sourceType) {
|
|
38
|
+
/**
|
|
39
|
+
* @note Leading # makes the property "truly private" at runtime.
|
|
40
|
+
*/
|
|
41
|
+
_YiniRuntime_runtime.set(this, void 0);
|
|
42
|
+
// this.#runtime = { sourceType, fileName: undefined, ...seed }
|
|
43
|
+
__classPrivateFieldSet(this, _YiniRuntime_runtime, this.makeRuntimeInfo(), "f");
|
|
44
|
+
__classPrivateFieldGet(this, _YiniRuntime_runtime, "f").sourceType = sourceType;
|
|
45
|
+
}
|
|
46
|
+
makeRuntimeInfo() {
|
|
47
|
+
return {
|
|
48
|
+
sourceType: 'Inline',
|
|
49
|
+
fileName: undefined,
|
|
50
|
+
fileByteSize: null,
|
|
51
|
+
lineCount: null,
|
|
52
|
+
timeIoMs: null,
|
|
53
|
+
preferredBailSensitivity: null,
|
|
54
|
+
sha256: null,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
// --- Single implementation --------------------------------------------
|
|
58
|
+
// Implementation method (not declared with arrow function) for both method overload signatures.
|
|
59
|
+
// NOTE: Must be method declaration with NO =, arrow functions not (currently) supported for this type of method overloading.
|
|
60
|
+
doParse(yiniContent, arg2, // strictMode | options
|
|
61
|
+
failLevel = 'auto', includeMetadata = false) {
|
|
62
|
+
(0, print_1.debugPrint)('-> Entered doParse(..) in YiniRuntime class\n');
|
|
63
|
+
// Runtime guard to catch illegal/ambiguous calls coming from JS or any-cast code
|
|
64
|
+
if ((0, normalizeOptions_1.isOptionsObjectForm)(arg2) &&
|
|
65
|
+
(failLevel !== 'auto' || includeMetadata !== false)) {
|
|
66
|
+
throw new TypeError('Invalid call: when providing an options object, do not also pass positional parameters.');
|
|
67
|
+
}
|
|
68
|
+
const mode = (0, normalizeOptions_1.inferModeFromArgs)(arg2);
|
|
69
|
+
const defaultOptions = (0, parserOptionsConstants_1.getDefaultOptions)(mode);
|
|
70
|
+
// Normalize to a fully-required options object.
|
|
71
|
+
let userOpts;
|
|
72
|
+
// Required, makes all properties in T required, no undefined.
|
|
73
|
+
if ((0, normalizeOptions_1.isOptionsObjectForm)(arg2)) {
|
|
74
|
+
userOpts = {
|
|
75
|
+
...defaultOptions, // Sets the default options.
|
|
76
|
+
...arg2,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
// Positional form.
|
|
81
|
+
userOpts = {
|
|
82
|
+
...defaultOptions, // Sets the default options.
|
|
83
|
+
strictMode: arg2 ?? defaultOptions.strictMode,
|
|
84
|
+
failLevel,
|
|
85
|
+
includeMetadata,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (userOpts.includeMetadata && __classPrivateFieldGet(this, _YiniRuntime_runtime, "f").sourceType === 'Inline') {
|
|
89
|
+
const lineCount = yiniContent.split(/\r?\n/).length; // Counts the lines.
|
|
90
|
+
const sha256 = (0, string_1.computeSha256)(yiniContent); // NOTE: Compute BEFORE any possible tampering of content.
|
|
91
|
+
__classPrivateFieldGet(this, _YiniRuntime_runtime, "f").lineCount = lineCount;
|
|
92
|
+
__classPrivateFieldGet(this, _YiniRuntime_runtime, "f").preferredBailSensitivity = userOpts.failLevel;
|
|
93
|
+
__classPrivateFieldGet(this, _YiniRuntime_runtime, "f").sha256 = sha256;
|
|
94
|
+
}
|
|
95
|
+
// NOTE: Important: Do not trim or mutate the yiniContent here, due
|
|
96
|
+
// to it will mess up the line numbers in error reporting.
|
|
97
|
+
if (!yiniContent) {
|
|
98
|
+
throw new Error('Syntax-Error: Unexpected blank YINI input');
|
|
99
|
+
}
|
|
100
|
+
if (!yiniContent.endsWith('\n')) {
|
|
101
|
+
yiniContent += '\n';
|
|
102
|
+
}
|
|
103
|
+
let level = (0, failLevel_1.mapFailLevelToBail)(userOpts.strictMode, userOpts.failLevel);
|
|
104
|
+
const coreOpts = (0, normalizeOptions_1.toCoreOptions)(level, userOpts);
|
|
105
|
+
(0, print_1.debugPrint)();
|
|
106
|
+
(0, print_1.debugPrint)('==== Call runPipeline(..) ==========================');
|
|
107
|
+
const result = (0, pipeline_1.runPipeline)(yiniContent, coreOpts, __classPrivateFieldGet(this, _YiniRuntime_runtime, "f"), userOpts);
|
|
108
|
+
(0, print_1.debugPrint)('==== End call runPipeline ==========================\n');
|
|
109
|
+
if ((0, env_1.isDev)()) {
|
|
110
|
+
console.log();
|
|
111
|
+
(0, print_1.devPrint)('YINI.parse(..): result:');
|
|
112
|
+
console.log(result);
|
|
113
|
+
(0, print_1.devPrint)('Complete result:');
|
|
114
|
+
(0, print_1.printObject)(result);
|
|
115
|
+
}
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
// --- Single implementation --------------------------------------------
|
|
119
|
+
// Implementation method (not declared with arrow function) for both method overload signatures.
|
|
120
|
+
// NOTE: Must be method declaration with NO =, arrow functions not (currently) supported for this type of method overloading.
|
|
121
|
+
doParseFile(filePath, arg2, // strictMode | options
|
|
122
|
+
failLevel = 'auto', includeMetadata = false) {
|
|
123
|
+
(0, print_1.debugPrint)('-> Entered doParseFile(..) in YiniRuntime class\n');
|
|
124
|
+
(0, print_1.debugPrint)('Current directory = ' + process.cwd());
|
|
125
|
+
// Runtime guard to catch illegal/ambiguous calls coming from JS or any-cast code
|
|
126
|
+
if ((0, normalizeOptions_1.isOptionsObjectForm)(arg2) &&
|
|
127
|
+
(failLevel !== 'auto' || includeMetadata !== false)) {
|
|
128
|
+
throw new TypeError('Invalid call: when providing an options object, do not also pass positional parameters.');
|
|
129
|
+
}
|
|
130
|
+
const mode = (0, normalizeOptions_1.inferModeFromArgs)(arg2);
|
|
131
|
+
const defaultOptions = (0, parserOptionsConstants_1.getDefaultOptions)(mode);
|
|
132
|
+
// Normalize to a fully-required options object.
|
|
133
|
+
let userOpts;
|
|
134
|
+
// Required, makes all properties in T required, no undefined.
|
|
135
|
+
if ((0, normalizeOptions_1.isOptionsObjectForm)(arg2)) {
|
|
136
|
+
// Options-object Form.
|
|
137
|
+
userOpts = {
|
|
138
|
+
...defaultOptions, // Sets the default options.
|
|
139
|
+
...arg2,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
// Positional form.
|
|
144
|
+
userOpts = {
|
|
145
|
+
...defaultOptions, // Sets the default options.
|
|
146
|
+
strictMode: arg2 ?? defaultOptions.strictMode,
|
|
147
|
+
failLevel,
|
|
148
|
+
includeMetadata,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
if ((0, pathAndFileName_1.getFileNameExtension)(filePath).toLowerCase() !== '.yini') {
|
|
152
|
+
console.error('Invalid file extension for YINI file:');
|
|
153
|
+
console.error(`"${filePath}"`);
|
|
154
|
+
console.log('File does not have a valid ".yini" extension (case-insensitive).');
|
|
155
|
+
throw new Error('Error: Unexpected file extension for YINI file');
|
|
156
|
+
}
|
|
157
|
+
// ---- Phase 0: I/O ----
|
|
158
|
+
const timeStartMs = performance.now();
|
|
159
|
+
// let content = fs.readFileSync(filePath, 'utf8')
|
|
160
|
+
const rawBuffer = fs_1.default.readFileSync(filePath); // Raw buffer for size.
|
|
161
|
+
const fileByteSize = rawBuffer.byteLength; // Byte size in UTF-8.
|
|
162
|
+
let content = rawBuffer.toString('utf8');
|
|
163
|
+
const timeEndMs = performance.now();
|
|
164
|
+
// this.#runtime.sourceType = 'File'
|
|
165
|
+
__classPrivateFieldGet(this, _YiniRuntime_runtime, "f").fileName = filePath;
|
|
166
|
+
if (userOpts.includeMetadata) {
|
|
167
|
+
__classPrivateFieldGet(this, _YiniRuntime_runtime, "f").lineCount = content.split(/\r?\n/).length; // Counts the lines.
|
|
168
|
+
__classPrivateFieldGet(this, _YiniRuntime_runtime, "f").fileByteSize = fileByteSize;
|
|
169
|
+
__classPrivateFieldGet(this, _YiniRuntime_runtime, "f").timeIoMs = +(timeEndMs - timeStartMs).toFixed(3);
|
|
170
|
+
__classPrivateFieldGet(this, _YiniRuntime_runtime, "f").preferredBailSensitivity = userOpts.failLevel;
|
|
171
|
+
__classPrivateFieldGet(this, _YiniRuntime_runtime, "f").sha256 = (0, string_1.computeSha256)(content); // NOTE: Compute BEFORE any possible tampering of content.
|
|
172
|
+
}
|
|
173
|
+
let hasNoNewlineAtEOF = false;
|
|
174
|
+
if (!content.endsWith('\n')) {
|
|
175
|
+
content += '\n';
|
|
176
|
+
hasNoNewlineAtEOF = true;
|
|
177
|
+
}
|
|
178
|
+
const result = this.doParse(content, {
|
|
179
|
+
...userOpts,
|
|
180
|
+
});
|
|
181
|
+
if (hasNoNewlineAtEOF && !userOpts.suppressWarnings) {
|
|
182
|
+
console.warn(`No newline at end of file, it's recommended to end a file with a newline. File:\n"${filePath}"`);
|
|
183
|
+
}
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
exports.YiniRuntime = YiniRuntime;
|
|
188
|
+
_YiniRuntime_runtime = new WeakMap();
|
|
189
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/core/runtime.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,4CAAmB;AACnB,uCAAqC;AAErC,8DAA+D;AAC/D,0CAAkE;AAClE,4CAA+C;AAO/C,mDAAwD;AACxD,iEAImC;AACnC,6EAAoE;AACpE,yCAAwC;AAExC;;;;;;GAMG;AACH,MAAa,WAAW;IAMpB,6EAA6E;IAC7E,YAAY,UAA6B;QANzC;;WAEG;QACH,uCAAsB;QAIlB,+DAA+D;QAC/D,uBAAA,IAAI,wBAAY,IAAI,CAAC,eAAe,EAAE,MAAA,CAAA;QACtC,uBAAA,IAAI,4BAAS,CAAC,UAAU,GAAG,UAAU,CAAA;IACzC,CAAC;IAEO,eAAe;QACnB,OAAO;YACH,UAAU,EAAE,QAAQ;YACpB,QAAQ,EAAE,SAAS;YACnB,YAAY,EAAE,IAAI;YAClB,SAAS,EAAE,IAAI;YACf,QAAQ,EAAE,IAAI;YACd,wBAAwB,EAAE,IAAI;YAC9B,MAAM,EAAE,IAAI;SACf,CAAA;IACL,CAAC;IAmBD,yEAAyE;IACzE,gGAAgG;IAChG,6HAA6H;IACtH,OAAO,CACV,WAAmB,EACnB,IAA+B,EAAE,uBAAuB;IACxD,YAAgC,MAAM,EACtC,eAAe,GAAG,KAAK;QAEvB,IAAA,kBAAU,EAAC,+CAA+C,CAAC,CAAA;QAE3D,iFAAiF;QACjF,IACI,IAAA,sCAAmB,EAAC,IAAI,CAAC;YACzB,CAAC,SAAS,KAAK,MAAM,IAAI,eAAe,KAAK,KAAK,CAAC,EACrD,CAAC;YACC,MAAM,IAAI,SAAS,CAC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AQ,CAAC,eAAe,EAAE,CAAC;YAC3B,uBAAA,IAAI,4BAAS,CAAC,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAA,CAAC,oBAAoB;YAC5E,uBAAA,IAAI,4BAAS,CAAC,YAAY,GAAG,YAAY,CAAA;YACzC,uBAAA,IAAI,4BAAS,CAAC,QAAQ,GAAG,CAAC,CAAC,SAAS,GAAG,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;YAC9D,uBAAA,IAAI,4BAAS,CAAC,wBAAwB,GAAG,QAAQ,CAAC,SAAS,CAAA;YAC3D,uBAAA,IAAI,4BAAS,CAAC,MAAM,GAAG,IAAA,sBAAa,EAAC,OAAO,CAAC,CAAA,CAAC,0DAA0D;QAC5G,CAAC;QAED,IAAI,iBAAiB,GAAG,KAAK,CAAA;QAC7B,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,OAAO,IAAI,IAAI,CAAA;YACf,iBAAiB,GAAG,IAAI,CAAA;QAC5B,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACjC,GAAG,QAAQ;SACd,CAAC,CAAA;QACF,IAAI,iBAAiB,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;YAClD,OAAO,CAAC,IAAI,CACR,qFAAqF,QAAQ,GAAG,CACnG,CAAA;QACL,CAAC;QAED,OAAO,MAAM,CAAA;IACjB,CAAC;CACJ;AApPD,kCAoPC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/dev/main.js
ADDED
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This includes of dev / debug / demo / custom-tesing code.
|
|
4
|
+
*
|
|
5
|
+
* https://github.com/YINI-lang/yini-parser-typescript/blob/main/docs/Project-Setup.md
|
|
6
|
+
*
|
|
7
|
+
* Run this code with the following commands:
|
|
8
|
+
* npm run start:dev
|
|
9
|
+
* or
|
|
10
|
+
* npm run start:dev:debug
|
|
11
|
+
*/
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
const env_1 = require("../config/env");
|
|
17
|
+
const print_1 = require("../utils/print");
|
|
18
|
+
const YINI_1 = __importDefault(require("../YINI"));
|
|
19
|
+
(0, print_1.debugPrint)();
|
|
20
|
+
(0, print_1.debugPrint)('-> Entered dev/main.ts');
|
|
21
|
+
(0, print_1.debugPrint)();
|
|
22
|
+
if ((0, env_1.isDev)() || (0, env_1.isDebug)()) {
|
|
23
|
+
console.log(`process.env?.NODE_ENV = '${process.env?.NODE_ENV}'`);
|
|
24
|
+
console.log(`process.env?.APP_ENV = '${process.env?.APP_ENV}'`);
|
|
25
|
+
console.log(`process.env?.IS_DEBUG = '${process.env?.IS_DEBUG}'`);
|
|
26
|
+
(0, print_1.debugPrint)();
|
|
27
|
+
console.log(`localNodeEnv = '${env_1.localNodeEnv}'`);
|
|
28
|
+
console.log(` localAppEnv = '${env_1.localAppEnv}'`);
|
|
29
|
+
console.log(' isProdEnv() = ' + (0, env_1.isProdEnv)());
|
|
30
|
+
console.log(' isDevEnv() = ' + (0, env_1.isDevEnv)());
|
|
31
|
+
console.log(' isTestEnv() = ' + (0, env_1.isTestEnv)());
|
|
32
|
+
console.log();
|
|
33
|
+
console.log(' isDev() = ' + (0, env_1.isDev)());
|
|
34
|
+
console.log(' isDebug() = ' + (0, env_1.isDebug)());
|
|
35
|
+
console.log();
|
|
36
|
+
}
|
|
37
|
+
const debugTestObj = {
|
|
38
|
+
name: 'e_test',
|
|
39
|
+
lang: 'TypeScript',
|
|
40
|
+
};
|
|
41
|
+
(0, print_1.debugPrint)('debugTestObj:');
|
|
42
|
+
(0, print_1.debugPrint)(debugTestObj);
|
|
43
|
+
(0, print_1.debugPrint)();
|
|
44
|
+
if ((0, env_1.isProdEnv)()) {
|
|
45
|
+
// Do nothing, and exit.
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
if (env_1.localAppEnv === 'local' && env_1.localNodeEnv !== 'test') {
|
|
49
|
+
// parseUntilError(`^1 SectionName`, false, 2)
|
|
50
|
+
// const validYini = `
|
|
51
|
+
// < user
|
|
52
|
+
// username = 'tester two'
|
|
53
|
+
// isSysOp = YES
|
|
54
|
+
// << prefs
|
|
55
|
+
// theme = "light"
|
|
56
|
+
// notifications = OFF
|
|
57
|
+
// ^1 user2
|
|
58
|
+
// ^2 prefs
|
|
59
|
+
// ^3 deepSection
|
|
60
|
+
// ^4 deeperSection
|
|
61
|
+
// key = "Level 4 section"
|
|
62
|
+
// ^5 yetDeeperSection
|
|
63
|
+
// key = "Level 5 section"
|
|
64
|
+
// item = 77
|
|
65
|
+
// <1 user3
|
|
66
|
+
// username = 'tester three'
|
|
67
|
+
// isSysOp = NO
|
|
68
|
+
// <<2 prefs
|
|
69
|
+
// theme = "special-dark"
|
|
70
|
+
// notifications = ON
|
|
71
|
+
// `
|
|
72
|
+
// // Act.
|
|
73
|
+
// const result = parseUntilError(validYini)
|
|
74
|
+
// debugPrint(result)
|
|
75
|
+
// const validYini = `^ App
|
|
76
|
+
// id = 32403 # The correct app id.
|
|
77
|
+
// title = "My Program"
|
|
78
|
+
// `
|
|
79
|
+
/*
|
|
80
|
+
const yini = `
|
|
81
|
+
@yini
|
|
82
|
+
|
|
83
|
+
^ NumberFormats
|
|
84
|
+
|
|
85
|
+
^^ HexFormat // Hexadecimal (base-16)
|
|
86
|
+
hex = #FF0066 // Default notation
|
|
87
|
+
altHex = 0xFF0066 // Alternative notation
|
|
88
|
+
^^ BinFormat // Binary (base-2)
|
|
89
|
+
bin = %10101111 // Default notation
|
|
90
|
+
altBin = 0b10101111 // Alternative notation
|
|
91
|
+
^^ OctFormat // Octal (base-8)
|
|
92
|
+
oct = 0o755 // ( = decimal 493)
|
|
93
|
+
^^ DozFormat // Duodecimal (base-12)
|
|
94
|
+
doz = 0z10XE // Default notation: X=10, E=11
|
|
95
|
+
altDoz = 0z10AB // Alternative notation: A=10, B=11
|
|
96
|
+
` // End.
|
|
97
|
+
*/
|
|
98
|
+
/*
|
|
99
|
+
const yini = `
|
|
100
|
+
@yini
|
|
101
|
+
@YINI ///dfsf
|
|
102
|
+
|
|
103
|
+
< User
|
|
104
|
+
nullKey =
|
|
105
|
+
nullKey2 = NULL
|
|
106
|
+
username = 'tester two'
|
|
107
|
+
userId = 234
|
|
108
|
+
userColor = #ffaa99
|
|
109
|
+
userPerm = 0O733
|
|
110
|
+
userFearues = %01101
|
|
111
|
+
isSysOp = YES
|
|
112
|
+
|
|
113
|
+
map = {
|
|
114
|
+
a: 3,
|
|
115
|
+
b: 4,
|
|
116
|
+
cc: 5,
|
|
117
|
+
\`d d\`: 3453
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
listValueB: 3, 4, 5
|
|
121
|
+
listValue2 = ["a", "b"]
|
|
122
|
+
listValue3 = [434]
|
|
123
|
+
listValue4 = []
|
|
124
|
+
listValue5 = [1, ["a", "b", "c", [null, TRUE]], 3]
|
|
125
|
+
|
|
126
|
+
--listObject = { a: 1, b: 2}
|
|
127
|
+
|
|
128
|
+
colonList:
|
|
129
|
+
1,
|
|
130
|
+
2,
|
|
131
|
+
3,
|
|
132
|
+
|
|
133
|
+
<< Prefs
|
|
134
|
+
theme = "light"
|
|
135
|
+
notifications = OFF
|
|
136
|
+
nullValue = NULL
|
|
137
|
+
|
|
138
|
+
^1 User2
|
|
139
|
+
^2 PrefsOfUser2
|
|
140
|
+
^3 DeepSection
|
|
141
|
+
^4 DeeperSection
|
|
142
|
+
key = "Level 4 section"
|
|
143
|
+
^5 YetDeeperSection
|
|
144
|
+
key = "Level 5 section"
|
|
145
|
+
item = 77
|
|
146
|
+
|
|
147
|
+
<1 User3
|
|
148
|
+
username = 'tester three'
|
|
149
|
+
isSysOp = NO
|
|
150
|
+
|
|
151
|
+
<2 Prefs2
|
|
152
|
+
theme = "special-dark"
|
|
153
|
+
notifications = ON
|
|
154
|
+
|
|
155
|
+
<2 Special
|
|
156
|
+
value = 123
|
|
157
|
+
`
|
|
158
|
+
*/
|
|
159
|
+
// npm run start:dev
|
|
160
|
+
// "timing": {
|
|
161
|
+
// "totalMs": 158.421,
|
|
162
|
+
// "phase1Ms": 151.36,
|
|
163
|
+
// "phase2Ms": 6.92,
|
|
164
|
+
// "phase3Ms": 0.14
|
|
165
|
+
// }
|
|
166
|
+
//console.log(toPrettyJSON(YINI.parse(yini, false, 'auto', true)))
|
|
167
|
+
// const yini = `
|
|
168
|
+
// < SubTitle
|
|
169
|
+
// theme = "special-dark"
|
|
170
|
+
// notifications = ON
|
|
171
|
+
// < SubTitle // NOT OK, SubTitle already exists
|
|
172
|
+
// theme2 = "special-dark"
|
|
173
|
+
// `
|
|
174
|
+
// Arrange.
|
|
175
|
+
/*
|
|
176
|
+
const yini = `
|
|
177
|
+
@yini
|
|
178
|
+
// Example: Strict-friendly YINI document (no trailing commas, explicit /END)
|
|
179
|
+
|
|
180
|
+
^ App
|
|
181
|
+
name = 'YINI Demo Service'
|
|
182
|
+
version = '1.4.0'
|
|
183
|
+
description = 'Demo service for showcasing the YINI format'
|
|
184
|
+
owners = ['dev-team', 'ops-team']
|
|
185
|
+
|
|
186
|
+
// String concatenation (the '+' joins adjacent STRING tokens)
|
|
187
|
+
-- longNote = 'This text is split across ' +
|
|
188
|
+
-- 'two strings and then concatenated.'
|
|
189
|
+
|
|
190
|
+
// Case-insensitive booleans
|
|
191
|
+
enabled = YES
|
|
192
|
+
experimentalMode = off
|
|
193
|
+
|
|
194
|
+
// Numbers (ints, floats, scientific)
|
|
195
|
+
retries = 3
|
|
196
|
+
requestTimeoutMs = 2500
|
|
197
|
+
backoffFactor = 1.25
|
|
198
|
+
maxPayloadMB = 1.0e2
|
|
199
|
+
|
|
200
|
+
^ Server
|
|
201
|
+
host = '127.0.0.1'
|
|
202
|
+
port = 8080
|
|
203
|
+
useTLS = false
|
|
204
|
+
|
|
205
|
+
^^ CORS
|
|
206
|
+
allowedOrigins: 'https://example.com', 'https://admin.example.com'
|
|
207
|
+
allowCredentials = true
|
|
208
|
+
|
|
209
|
+
^^ Headers
|
|
210
|
+
// Object literal with key:value pairs
|
|
211
|
+
defaults = {
|
|
212
|
+
\`X-Frame-Options\`: 'DENY',
|
|
213
|
+
\`X-Content-Type-Options\`: 'nosniff'
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
^ Database
|
|
217
|
+
engine = 'postgres'
|
|
218
|
+
host = 'db.internal'
|
|
219
|
+
port = 5432
|
|
220
|
+
username = 'app_user'
|
|
221
|
+
password = 'change_me'
|
|
222
|
+
pool = {
|
|
223
|
+
min: 2,
|
|
224
|
+
max: 16
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
^^ Replicas
|
|
228
|
+
// Colon-form list (values only)
|
|
229
|
+
endpoints: 'db-replica-1.internal', 'db-replica-2.internal'
|
|
230
|
+
readPreference = 'nearest'
|
|
231
|
+
|
|
232
|
+
^ Features
|
|
233
|
+
// Mixed data types
|
|
234
|
+
betaFlags = ['new-ui', 'fast-path']
|
|
235
|
+
darkLaunch = NO
|
|
236
|
+
uploadLimitMB = 128
|
|
237
|
+
|
|
238
|
+
^ Integrations
|
|
239
|
+
// List of objects
|
|
240
|
+
webhooks = [
|
|
241
|
+
{ name: 'audit', url: 'https://hooks.example.com/audit', active: true },
|
|
242
|
+
{ name: 'metrics', url: 'https://hooks.example.com/metric', active: true }
|
|
243
|
+
]
|
|
244
|
+
|
|
245
|
+
^ Users
|
|
246
|
+
// Simple table-ish list using colon form
|
|
247
|
+
admins: 'alice', 'bob', 'carol'
|
|
248
|
+
reviewers: 'dave', 'erin'
|
|
249
|
+
|
|
250
|
+
^^ Profiles
|
|
251
|
+
// Object-of-objects
|
|
252
|
+
alice = {
|
|
253
|
+
email: 'alice@example.com',
|
|
254
|
+
roles: ['admin', 'dev'],
|
|
255
|
+
mfa: true
|
|
256
|
+
}
|
|
257
|
+
bob = {
|
|
258
|
+
email: 'bob@example.com',
|
|
259
|
+
roles: ['admin'],
|
|
260
|
+
mfa: false
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
^ Paths
|
|
264
|
+
logs = '/var/log/yini-demo/'
|
|
265
|
+
data = '/srv/yini-demo/data'
|
|
266
|
+
|
|
267
|
+
^^ \`Backups\`
|
|
268
|
+
// Empty value -> null in lenient mode; in strict mode, supply explicit null:
|
|
269
|
+
lastFull = null
|
|
270
|
+
targets: '/mnt/backup1', '/mnt/backup2'
|
|
271
|
+
^^^ Backups2
|
|
272
|
+
value = 23
|
|
273
|
+
|
|
274
|
+
^ Security
|
|
275
|
+
allowedIPs: '10.0.0.0/24', '10.1.0.0/24'
|
|
276
|
+
|
|
277
|
+
^ Logging
|
|
278
|
+
level = 'info'
|
|
279
|
+
format = 'json'
|
|
280
|
+
sinks = ['stdout']
|
|
281
|
+
|
|
282
|
+
/END
|
|
283
|
+
`*/
|
|
284
|
+
// const yini = `
|
|
285
|
+
// /*sdfsdf*/
|
|
286
|
+
// @yini
|
|
287
|
+
// @include 'sdf'
|
|
288
|
+
// --@invalid
|
|
289
|
+
// @deprecated
|
|
290
|
+
// ^ window
|
|
291
|
+
// --^^ window2
|
|
292
|
+
// title = 'Sample Window' // Strings can be enclosed in either ' or ".
|
|
293
|
+
// @deprecated
|
|
294
|
+
// id = 'window_main'
|
|
295
|
+
// // @bla
|
|
296
|
+
// --@include 'wrongplace'
|
|
297
|
+
// --@yini // This is an error should be catched in the parser.
|
|
298
|
+
// /end
|
|
299
|
+
// `
|
|
300
|
+
// YINI.setTabSize(2)
|
|
301
|
+
// debugPrint('tab size = ' + YINI.getTabSize())
|
|
302
|
+
// const yini = ` @yini
|
|
303
|
+
// --@yini
|
|
304
|
+
// ^ Header // INVALID: Must start with atleast one 1-level section.
|
|
305
|
+
// key = 33254
|
|
306
|
+
// /END
|
|
307
|
+
// --/END
|
|
308
|
+
// `
|
|
309
|
+
// console.log(
|
|
310
|
+
// toPrettyJSON(
|
|
311
|
+
// YINI.parse(yini, {
|
|
312
|
+
// strictMode: false,
|
|
313
|
+
// failLevel: 'errors',
|
|
314
|
+
// includeMetadata: false,
|
|
315
|
+
// requireDocTerminator: 'optional',
|
|
316
|
+
// }),
|
|
317
|
+
// ),
|
|
318
|
+
// )
|
|
319
|
+
// const yini = `
|
|
320
|
+
// ^ Booleans
|
|
321
|
+
// bool1 = true
|
|
322
|
+
// bool2 = false
|
|
323
|
+
// bool3 = on
|
|
324
|
+
// bool4 = off
|
|
325
|
+
// bool5 = yes
|
|
326
|
+
// bool6 = no
|
|
327
|
+
// `
|
|
328
|
+
// console.log(
|
|
329
|
+
// toPrettyJSON(
|
|
330
|
+
// YINI.parse(yini, {
|
|
331
|
+
// strictMode: true,
|
|
332
|
+
// failLevel: 'auto',
|
|
333
|
+
// includeMetadata: false,
|
|
334
|
+
// requireDocTerminator: 'optional',
|
|
335
|
+
// }),
|
|
336
|
+
// ),
|
|
337
|
+
// )
|
|
338
|
+
// console.log(
|
|
339
|
+
// toPrettyJSON(
|
|
340
|
+
// YINI.parseFile(
|
|
341
|
+
// 'comprehensive-example.yini',
|
|
342
|
+
// false,
|
|
343
|
+
// 'auto',
|
|
344
|
+
// true,
|
|
345
|
+
// ),
|
|
346
|
+
// ),
|
|
347
|
+
// )
|
|
348
|
+
const result = YINI_1.default.parseFile('comprehensive-example.yini', { includeMetadata: true });
|
|
349
|
+
console.log((0, print_1.toPrettyJSON)('' + result.meta));
|
|
350
|
+
// console.log(
|
|
351
|
+
// toPrettyJSON(
|
|
352
|
+
// YINI.parseFile('comprehensive-example.yini', {
|
|
353
|
+
// strictMode: false,
|
|
354
|
+
// failLevel: 'auto',
|
|
355
|
+
// includeMetadata: true,
|
|
356
|
+
// }),
|
|
357
|
+
// ),
|
|
358
|
+
// )
|
|
359
|
+
// const fileName = './tests/fixtures/valid/common/common-config-2.yini'
|
|
360
|
+
// YINI.parseFile(fileName, {
|
|
361
|
+
// strictMode: false,
|
|
362
|
+
// failLevel: 'auto',
|
|
363
|
+
// includeMetadata: true,
|
|
364
|
+
// })
|
|
365
|
+
// const fileName =
|
|
366
|
+
// './tests/fixtures/invalid/bad-user-profile-config-2.yini'
|
|
367
|
+
// YINI.parseFile(fileName, {
|
|
368
|
+
// strictMode: true,
|
|
369
|
+
// failLevel: 'auto',
|
|
370
|
+
// includeMetadata: true,
|
|
371
|
+
// })
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/dev/main.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;AAEH,uCAQsB;AAEtB,0CAAyD;AACzD,mDAA0B;AAE1B,IAAA,kBAAU,GAAE,CAAA;AACZ,IAAA,kBAAU,EAAC,wBAAwB,CAAC,CAAA;AACpC,IAAA,kBAAU,GAAE,CAAA;AAEZ,IAAI,IAAA,WAAK,GAAE,IAAI,IAAA,aAAO,GAAE,EAAE,CAAC;IACvB,OAAO,CAAC,GAAG,CAAC,4BAA4B,OAAO,CAAC,GAAG,EAAE,QAAQ,GAAG,CAAC,CAAA;IACjE,OAAO,CAAC,GAAG,CAAC,4BAA4B,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,CAAC,CAAA;IAChE,OAAO,CAAC,GAAG,CAAC,4BAA4B,OAAO,CAAC,GAAG,EAAE,QAAQ,GAAG,CAAC,CAAA;IAEjE,IAAA,kBAAU,GAAE,CAAA;IACZ,OAAO,CAAC,GAAG,CAAC,mBAAmB,kBAAY,GAAG,CAAC,CAAA;IAC/C,OAAO,CAAC,GAAG,CAAC,mBAAmB,iBAAW,GAAG,CAAC,CAAA;IAC9C,OAAO,CAAC,GAAG,CAAC,iBAAiB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rB,sBAAsB;QACtB,oBAAoB;QACpB,aAAa;QACb,SAAS;QACT,IAAI;QAEJ,MAAM,MAAM,GAAoB,cAAI,CAAC,SAAS,CAC1C,4BAA4B,EAC5B,EAAE,eAAe,EAAE,IAAI,EAAE,CAC5B,CAAA;QAED,OAAO,CAAC,GAAG,CAAC,IAAA,oBAAY,EAAC,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;QAE3C,eAAe;QACf,oBAAoB;QACpB,yDAAyD;QACzD,iCAAiC;QACjC,iCAAiC;QACjC,qCAAqC;QACrC,cAAc;QACd,SAAS;QACT,IAAI;QACJ,wEAAwE;QACxE,6BAA6B;QAC7B,yBAAyB;QACzB,yBAAyB;QACzB,6BAA6B;QAC7B,KAAK;QACL,mBAAmB;QACnB,gEAAgE;QAChE,6BAA6B;QAC7B,wBAAwB;QACxB,yBAAyB;QACzB,6BAA6B;QAC7B,KAAK;IACT,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ATN, CharStream, DFA, Lexer, RuleContext } from "antlr4";
|
|
2
|
+
export default class YiniLexer extends Lexer {
|
|
3
|
+
static readonly YINI_TOKEN = 1;
|
|
4
|
+
static readonly INCLUDE_TOKEN = 2;
|
|
5
|
+
static readonly DEPRECATED_TOKEN = 3;
|
|
6
|
+
static readonly SECTION_HEAD = 4;
|
|
7
|
+
static readonly TERMINAL_TOKEN = 5;
|
|
8
|
+
static readonly SS = 6;
|
|
9
|
+
static readonly EUR = 7;
|
|
10
|
+
static readonly CARET = 8;
|
|
11
|
+
static readonly GT = 9;
|
|
12
|
+
static readonly LT = 10;
|
|
13
|
+
static readonly EQ = 11;
|
|
14
|
+
static readonly HASH = 12;
|
|
15
|
+
static readonly COMMA = 13;
|
|
16
|
+
static readonly COLON = 14;
|
|
17
|
+
static readonly OB = 15;
|
|
18
|
+
static readonly CB = 16;
|
|
19
|
+
static readonly OC = 17;
|
|
20
|
+
static readonly CC = 18;
|
|
21
|
+
static readonly PLUS = 19;
|
|
22
|
+
static readonly DOLLAR = 20;
|
|
23
|
+
static readonly PC = 21;
|
|
24
|
+
static readonly AT = 22;
|
|
25
|
+
static readonly SEMICOLON = 23;
|
|
26
|
+
static readonly BOOLEAN_FALSE = 24;
|
|
27
|
+
static readonly BOOLEAN_TRUE = 25;
|
|
28
|
+
static readonly NULL = 26;
|
|
29
|
+
static readonly EMPTY_OBJECT = 27;
|
|
30
|
+
static readonly EMPTY_LIST = 28;
|
|
31
|
+
static readonly SHEBANG = 29;
|
|
32
|
+
static readonly NUMBER = 30;
|
|
33
|
+
static readonly KEY = 31;
|
|
34
|
+
static readonly IDENT = 32;
|
|
35
|
+
static readonly IDENT_BACKTICKED = 33;
|
|
36
|
+
static readonly STRING = 34;
|
|
37
|
+
static readonly TRIPLE_QUOTED_STRING = 35;
|
|
38
|
+
static readonly SINGLE_OR_DOUBLE = 36;
|
|
39
|
+
static readonly R_AND_C_STRING = 37;
|
|
40
|
+
static readonly HYPER_STRING = 38;
|
|
41
|
+
static readonly ESC_SEQ = 39;
|
|
42
|
+
static readonly ESC_SEQ_BASE = 40;
|
|
43
|
+
static readonly NL = 41;
|
|
44
|
+
static readonly SINGLE_NL = 42;
|
|
45
|
+
static readonly WS = 43;
|
|
46
|
+
static readonly BLOCK_COMMENT = 44;
|
|
47
|
+
static readonly COMMENT = 45;
|
|
48
|
+
static readonly LINE_COMMENT = 46;
|
|
49
|
+
static readonly INLINE_COMMENT = 47;
|
|
50
|
+
static readonly IDENT_INVALID = 48;
|
|
51
|
+
static readonly REST = 49;
|
|
52
|
+
static readonly META_INVALID = 50;
|
|
53
|
+
static readonly EOF: number;
|
|
54
|
+
static readonly channelNames: string[];
|
|
55
|
+
static readonly literalNames: (string | null)[];
|
|
56
|
+
static readonly symbolicNames: (string | null)[];
|
|
57
|
+
static readonly modeNames: string[];
|
|
58
|
+
static readonly ruleNames: string[];
|
|
59
|
+
atLineStart(): boolean;
|
|
60
|
+
constructor(input: CharStream);
|
|
61
|
+
get grammarFileName(): string;
|
|
62
|
+
get literalNames(): (string | null)[];
|
|
63
|
+
get symbolicNames(): (string | null)[];
|
|
64
|
+
get ruleNames(): string[];
|
|
65
|
+
get serializedATN(): number[];
|
|
66
|
+
get channelNames(): string[];
|
|
67
|
+
get modeNames(): string[];
|
|
68
|
+
sempred(localctx: RuleContext, ruleIndex: number, predIndex: number): boolean;
|
|
69
|
+
private LINE_COMMENT_sempred;
|
|
70
|
+
static readonly _serializedATN: number[];
|
|
71
|
+
private static __ATN;
|
|
72
|
+
static get _ATN(): ATN;
|
|
73
|
+
static DecisionsToDFA: DFA[];
|
|
74
|
+
}
|