yini-parser 1.2.0-beta → 1.3.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 +27 -1
- package/README.md +2 -2
- package/dist/YINI.d.ts +35 -23
- package/dist/YINI.js +6 -6
- package/dist/YINI.js.map +1 -1
- package/dist/core/astBuilder.js +9 -9
- package/dist/core/astBuilder.js.map +1 -1
- package/dist/core/errorDataHandler.d.ts +9 -5
- package/dist/core/errorDataHandler.js +99 -53
- package/dist/core/errorDataHandler.js.map +1 -1
- package/dist/core/internalTypes.d.ts +12 -6
- package/dist/core/options/defaultParserOptions.d.ts +17 -0
- package/dist/core/options/defaultParserOptions.js +46 -0
- package/dist/core/options/defaultParserOptions.js.map +1 -0
- package/dist/core/options/optionsFunctions.d.ts +8 -0
- package/dist/core/options/{normalizeOptions.js → optionsFunctions.js} +21 -12
- package/dist/core/options/optionsFunctions.js.map +1 -0
- package/dist/core/parsingRules/modeFromRulesMatcher.d.ts +8 -0
- package/dist/core/parsingRules/modeFromRulesMatcher.js +114 -0
- package/dist/core/parsingRules/modeFromRulesMatcher.js.map +1 -0
- package/dist/core/parsingRules/rulesConstAndGuards.d.ts +7 -0
- package/dist/core/parsingRules/rulesConstAndGuards.js +35 -0
- package/dist/core/parsingRules/rulesConstAndGuards.js.map +1 -0
- package/dist/core/pipeline/errorListeners.d.ts +18 -0
- package/dist/core/pipeline/errorListeners.js +107 -0
- package/dist/core/pipeline/errorListeners.js.map +1 -0
- package/dist/core/{pipeline.d.ts → pipeline/pipeline.d.ts} +3 -3
- package/dist/core/{pipeline.js → pipeline/pipeline.js} +70 -149
- package/dist/core/pipeline/pipeline.js.map +1 -0
- package/dist/core/resultMetadataBuilder.d.ts +2 -2
- package/dist/core/resultMetadataBuilder.js +29 -8
- package/dist/core/resultMetadataBuilder.js.map +1 -1
- package/dist/core/runtime.d.ts +7 -3
- package/dist/core/runtime.js +32 -20
- package/dist/core/runtime.js.map +1 -1
- package/dist/dev/main.js +49 -118
- package/dist/dev/main.js.map +1 -1
- package/dist/grammar/generated/YiniLexer.js +1 -1
- package/dist/grammar/generated/YiniLexer.js.map +1 -1
- package/dist/grammar/generated/YiniParser.js +1 -1
- package/dist/grammar/generated/YiniParser.js.map +1 -1
- package/dist/grammar/generated/YiniParserVisitor.js +1 -1
- package/dist/grammar/generated/YiniParserVisitor.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +46 -25
- package/examples/basic-output.js +12 -12
- package/package.json +6 -3
- package/dist/core/options/normalizeOptions.d.ts +0 -5
- package/dist/core/options/normalizeOptions.js.map +0 -1
- package/dist/core/options/parserOptionsConstants.d.ts +0 -7
- package/dist/core/options/parserOptionsConstants.js +0 -37
- package/dist/core/options/parserOptionsConstants.js.map +0 -1
- package/dist/core/pipeline.js.map +0 -1
package/dist/core/runtime.js
CHANGED
|
@@ -21,25 +21,27 @@ const env_1 = require("../config/env");
|
|
|
21
21
|
const pathAndFileName_1 = require("../utils/pathAndFileName");
|
|
22
22
|
const print_1 = require("../utils/print");
|
|
23
23
|
const string_1 = require("../utils/string");
|
|
24
|
+
const defaultParserOptions_1 = require("./options/defaultParserOptions");
|
|
24
25
|
const failLevel_1 = require("./options/failLevel");
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const pipeline_1 = require("./pipeline");
|
|
26
|
+
const optionsFunctions_1 = require("./options/optionsFunctions");
|
|
27
|
+
const pipeline_1 = require("./pipeline/pipeline");
|
|
28
28
|
/**
|
|
29
29
|
* Private class representing a runtime context for a single parse call.
|
|
30
30
|
*
|
|
31
31
|
* @note This design prevents race conditions: each call gets its own
|
|
32
32
|
* runtimeInfo and related state. Without this, multiple calls
|
|
33
33
|
* (especially in parallel) could overwrite each other's data.
|
|
34
|
+
*
|
|
35
|
+
* @note The following options MUST be respected!
|
|
36
|
+
* quiet?: boolean // Reduce output (show only errors, does not effect warnings and etc. in meta data).
|
|
37
|
+
* silent?: boolean // Suppress all output (even errors, exit code only).
|
|
34
38
|
*/
|
|
35
39
|
class YiniRuntime {
|
|
36
|
-
// constructor(sourceType: 'Inline' | 'File', seed?: Partial<IRuntimeInfo>) {
|
|
37
40
|
constructor(sourceType) {
|
|
38
41
|
/**
|
|
39
42
|
* @note Leading # makes the property "truly private" at runtime.
|
|
40
43
|
*/
|
|
41
44
|
_YiniRuntime_runtime.set(this, void 0);
|
|
42
|
-
// this.#runtime = { sourceType, fileName: undefined, ...seed }
|
|
43
45
|
__classPrivateFieldSet(this, _YiniRuntime_runtime, this.makeRuntimeInfo(), "f");
|
|
44
46
|
__classPrivateFieldGet(this, _YiniRuntime_runtime, "f").sourceType = sourceType;
|
|
45
47
|
}
|
|
@@ -61,16 +63,16 @@ class YiniRuntime {
|
|
|
61
63
|
failLevel = 'auto', includeMetadata = false) {
|
|
62
64
|
(0, print_1.debugPrint)('-> Entered doParse(..) in YiniRuntime class\n');
|
|
63
65
|
// Runtime guard to catch illegal/ambiguous calls coming from JS or any-cast code
|
|
64
|
-
if ((0,
|
|
66
|
+
if ((0, optionsFunctions_1.isOptionsObjectForm)(arg2) &&
|
|
65
67
|
(failLevel !== 'auto' || includeMetadata !== false)) {
|
|
66
68
|
throw new TypeError('Invalid call: when providing an options object, do not also pass positional parameters.');
|
|
67
69
|
}
|
|
68
|
-
const mode = (0,
|
|
69
|
-
const defaultOptions = (0,
|
|
70
|
+
const mode = (0, optionsFunctions_1.inferModeFromArgs)(arg2);
|
|
71
|
+
const defaultOptions = (0, defaultParserOptions_1.getDefaultUserOptions)(mode);
|
|
70
72
|
// Normalize to a fully-required options object.
|
|
71
73
|
let userOpts;
|
|
72
74
|
// Required, makes all properties in T required, no undefined.
|
|
73
|
-
if ((0,
|
|
75
|
+
if ((0, optionsFunctions_1.isOptionsObjectForm)(arg2)) {
|
|
74
76
|
userOpts = {
|
|
75
77
|
...defaultOptions, // Sets the default options.
|
|
76
78
|
...arg2,
|
|
@@ -101,7 +103,7 @@ class YiniRuntime {
|
|
|
101
103
|
yiniContent += '\n';
|
|
102
104
|
}
|
|
103
105
|
let level = (0, failLevel_1.mapFailLevelToBail)(userOpts.strictMode, userOpts.failLevel);
|
|
104
|
-
const coreOpts = (0,
|
|
106
|
+
const coreOpts = (0, optionsFunctions_1.toCoreOptions)(userOpts, level);
|
|
105
107
|
(0, print_1.debugPrint)();
|
|
106
108
|
(0, print_1.debugPrint)('==== Call runPipeline(..) ==========================');
|
|
107
109
|
const result = (0, pipeline_1.runPipeline)(yiniContent, coreOpts, __classPrivateFieldGet(this, _YiniRuntime_runtime, "f"), userOpts);
|
|
@@ -123,16 +125,16 @@ class YiniRuntime {
|
|
|
123
125
|
(0, print_1.debugPrint)('-> Entered doParseFile(..) in YiniRuntime class\n');
|
|
124
126
|
(0, print_1.debugPrint)('Current directory = ' + process.cwd());
|
|
125
127
|
// Runtime guard to catch illegal/ambiguous calls coming from JS or any-cast code
|
|
126
|
-
if ((0,
|
|
128
|
+
if ((0, optionsFunctions_1.isOptionsObjectForm)(arg2) &&
|
|
127
129
|
(failLevel !== 'auto' || includeMetadata !== false)) {
|
|
128
130
|
throw new TypeError('Invalid call: when providing an options object, do not also pass positional parameters.');
|
|
129
131
|
}
|
|
130
|
-
const mode = (0,
|
|
131
|
-
const defaultOptions = (0,
|
|
132
|
+
const mode = (0, optionsFunctions_1.inferModeFromArgs)(arg2);
|
|
133
|
+
const defaultOptions = (0, defaultParserOptions_1.getDefaultUserOptions)(mode);
|
|
132
134
|
// Normalize to a fully-required options object.
|
|
133
135
|
let userOpts;
|
|
134
136
|
// Required, makes all properties in T required, no undefined.
|
|
135
|
-
if ((0,
|
|
137
|
+
if ((0, optionsFunctions_1.isOptionsObjectForm)(arg2)) {
|
|
136
138
|
// Options-object Form.
|
|
137
139
|
userOpts = {
|
|
138
140
|
...defaultOptions, // Sets the default options.
|
|
@@ -149,9 +151,13 @@ class YiniRuntime {
|
|
|
149
151
|
};
|
|
150
152
|
}
|
|
151
153
|
if ((0, pathAndFileName_1.getFileNameExtension)(filePath).toLowerCase() !== '.yini') {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
// IMPORTANT: If "silent" option is set, do not log anything to console!
|
|
155
|
+
if (!userOpts.silent) {
|
|
156
|
+
// In quiet-mode we still show errors (these are fine).
|
|
157
|
+
console.error('Invalid file extension for YINI file:');
|
|
158
|
+
console.error(`"${filePath}"`);
|
|
159
|
+
console.error('File does not have a valid ".yini" extension (case-insensitive).');
|
|
160
|
+
}
|
|
155
161
|
throw new Error('Error: Unexpected file extension for YINI file');
|
|
156
162
|
}
|
|
157
163
|
// ---- Phase 0: I/O ----
|
|
@@ -163,10 +169,11 @@ class YiniRuntime {
|
|
|
163
169
|
const timeEndMs = performance.now();
|
|
164
170
|
// this.#runtime.sourceType = 'File'
|
|
165
171
|
__classPrivateFieldGet(this, _YiniRuntime_runtime, "f").fileName = filePath;
|
|
172
|
+
__classPrivateFieldGet(this, _YiniRuntime_runtime, "f").timeIoMs = +(timeEndMs - timeStartMs).toFixed(3); // NOTE: (!) Dependent of isWithTiming.
|
|
166
173
|
if (userOpts.includeMetadata) {
|
|
167
174
|
__classPrivateFieldGet(this, _YiniRuntime_runtime, "f").lineCount = content.split(/\r?\n/).length; // Counts the lines.
|
|
168
175
|
__classPrivateFieldGet(this, _YiniRuntime_runtime, "f").fileByteSize = fileByteSize;
|
|
169
|
-
|
|
176
|
+
// this.#runtime.timeIoMs = +(timeEndMs - timeStartMs).toFixed(3) // NOTE: (!) Dependent of isWithTiming.
|
|
170
177
|
__classPrivateFieldGet(this, _YiniRuntime_runtime, "f").preferredBailSensitivity = userOpts.failLevel;
|
|
171
178
|
__classPrivateFieldGet(this, _YiniRuntime_runtime, "f").sha256 = (0, string_1.computeSha256)(content); // NOTE: Compute BEFORE any possible tampering of content.
|
|
172
179
|
}
|
|
@@ -178,8 +185,13 @@ class YiniRuntime {
|
|
|
178
185
|
const result = this.doParse(content, {
|
|
179
186
|
...userOpts,
|
|
180
187
|
});
|
|
181
|
-
if (hasNoNewlineAtEOF && !userOpts.
|
|
182
|
-
|
|
188
|
+
// if (hasNoNewlineAtEOF && !userOpts.quiet && !userOpts.silent) {
|
|
189
|
+
if (hasNoNewlineAtEOF && !userOpts.quiet) {
|
|
190
|
+
// IMPORTANT: If "silent" option is set, do not log anything to console!
|
|
191
|
+
if (!userOpts.silent) {
|
|
192
|
+
//@todo: (or maybe not, 20250917) Maybe let errorHandler emit message
|
|
193
|
+
console.warn(`No newline at end of file, it's recommended to end a file with a newline. File:\n"${filePath}"`);
|
|
194
|
+
}
|
|
183
195
|
}
|
|
184
196
|
return result;
|
|
185
197
|
}
|
package/dist/core/runtime.js.map
CHANGED
|
@@ -1 +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,
|
|
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,yEAAsE;AACtE,mDAAwD;AACxD,iEAImC;AACnC,kDAAiD;AAEjD;;;;;;;;;;GAUG;AACH,MAAa,WAAW;IAMpB,YAAY,UAA6B;QALzC;;WAEG;QACH,uCAAsB;QAGlB,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;YACl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GAAG,IAAI,CAAA;QAC5B,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACjC,GAAG,QAAQ;SACd,CAAC,CAAA;QACF,kEAAkE;QAClE,IAAI,iBAAiB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;YACvC,wEAAwE;YACxE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;gBACnB,qEAAqE;gBACrE,OAAO,CAAC,IAAI,CACR,qFAAqF,QAAQ,GAAG,CACnG,CAAA;YACL,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAA;IACjB,CAAC;CACJ;AA5PD,kCA4PC"}
|
package/dist/dev/main.js
CHANGED
|
@@ -171,116 +171,29 @@ else {
|
|
|
171
171
|
// < SubTitle // NOT OK, SubTitle already exists
|
|
172
172
|
// theme2 = "special-dark"
|
|
173
173
|
// `
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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
|
-
`*/
|
|
174
|
+
const errorYini = `
|
|
175
|
+
^ Section1
|
|
176
|
+
333="oops" // invalid key => error
|
|
177
|
+
`;
|
|
178
|
+
const warnYini = `
|
|
179
|
+
^ Section2
|
|
180
|
+
// => warning, if requireDocTerminator: 'warn-if-missing'
|
|
181
|
+
`;
|
|
182
|
+
// console.log(
|
|
183
|
+
// toPrettyJSON(
|
|
184
|
+
YINI_1.default.parse(`
|
|
185
|
+
^ Section1
|
|
186
|
+
value = // invalid in strict mode => error
|
|
187
|
+
`, {
|
|
188
|
+
// failLevel: 'errors',
|
|
189
|
+
throwOnError: false,
|
|
190
|
+
// requireDocTerminator: 'warn-if-missing',
|
|
191
|
+
strictMode: true,
|
|
192
|
+
silent: false,
|
|
193
|
+
// includeMetadata: false,
|
|
194
|
+
});
|
|
195
|
+
// ),
|
|
196
|
+
// )
|
|
284
197
|
// const yini = `
|
|
285
198
|
// /*sdfsdf*/
|
|
286
199
|
// @yini
|
|
@@ -345,8 +258,11 @@ else {
|
|
|
345
258
|
// ),
|
|
346
259
|
// ),
|
|
347
260
|
// )
|
|
348
|
-
const result =
|
|
349
|
-
|
|
261
|
+
// const result: YiniParseResult = YINI.parseFile(
|
|
262
|
+
// 'comprehensive-example.yini',
|
|
263
|
+
// { includeMetadata: true },
|
|
264
|
+
// )
|
|
265
|
+
// console.log(toPrettyJSON('' + result.meta))
|
|
350
266
|
// console.log(
|
|
351
267
|
// toPrettyJSON(
|
|
352
268
|
// YINI.parseFile('comprehensive-example.yini', {
|
|
@@ -356,16 +272,31 @@ else {
|
|
|
356
272
|
// }),
|
|
357
273
|
// ),
|
|
358
274
|
// )
|
|
359
|
-
// const fileName = './tests/fixtures/
|
|
360
|
-
// YINI.parseFile(fileName, {
|
|
361
|
-
// strictMode:
|
|
362
|
-
// failLevel: '
|
|
363
|
-
// includeMetadata: true,
|
|
275
|
+
// const fileName = './tests/fixtures/invalid/corrupt-config-2.yini'
|
|
276
|
+
// const result = YINI.parseFile(fileName, {
|
|
277
|
+
// strictMode: true,
|
|
278
|
+
// failLevel: 'ignore-errors',
|
|
364
279
|
// })
|
|
280
|
+
// printObject(result)
|
|
281
|
+
// let parserOptions: any = getDefaultUserOptions('lenient')
|
|
282
|
+
// debugPrint('** parserOptions: (lenient)')
|
|
283
|
+
// isDebug() && printObject(parserOptions)
|
|
284
|
+
// isDebug() &&
|
|
285
|
+
// console.log(
|
|
286
|
+
// 'derived mode = ' + matchModeFromParseOptions(parserOptions),
|
|
287
|
+
// )
|
|
288
|
+
// parserOptions = getDefaultUserOptions('strict')
|
|
289
|
+
// debugPrint('** parserOptions: (strict)')
|
|
290
|
+
// isDebug() && printObject(parserOptions)
|
|
291
|
+
// isDebug() &&
|
|
292
|
+
// console.log(
|
|
293
|
+
// 'derived mode = ' +
|
|
294
|
+
// matchModeFromCoreOptions(toCoreOptions(parserOptions)),
|
|
295
|
+
// )
|
|
365
296
|
// const fileName =
|
|
366
297
|
// './tests/fixtures/invalid/bad-user-profile-config-2.yini'
|
|
367
298
|
// YINI.parseFile(fileName, {
|
|
368
|
-
// strictMode:
|
|
299
|
+
// strictMode: false,
|
|
369
300
|
// failLevel: 'auto',
|
|
370
301
|
// includeMetadata: true,
|
|
371
302
|
// })
|
package/dist/dev/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/dev/main.ts"],"names":[],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AEJ,oEAAoE;QACpE,4CAA4C;QAC5C,wBAAwB;QACxB,kCAAkC;QAClC,KAAK;QACL,sBAAsB;QAEtB,4DAA4D;QAC5D,4CAA4C;QAC5C,0CAA0C;QAC1C,eAAe;QACf,mBAAmB;QACnB,wEAAwE;QACxE,QAAQ;QAER,kDAAkD;QAClD,2CAA2C;QAC3C,0CAA0C;QAC1C,eAAe;QACf,mBAAmB;QACnB,8BAA8B;QAC9B,sEAAsE;QACtE,QAAQ;QAER,mBAAmB;QACnB,gEAAgE;QAChE,6BAA6B;QAC7B,yBAAyB;QACzB,yBAAyB;QACzB,6BAA6B;QAC7B,KAAK;IACT,CAAC;AACL,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// Generated from grammar/v1.0.0-rc.3/YiniLexer.g4 by ANTLR 4.13.2
|
|
3
|
+
// Generated from ./grammar/v1.0.0-rc.3/YiniLexer.g4 by ANTLR 4.13.2
|
|
4
4
|
// noinspection ES6UnusedImports,JSUnusedGlobalSymbols,JSUnusedLocalSymbols
|
|
5
5
|
const antlr4_1 = require("antlr4");
|
|
6
6
|
class YiniLexer extends antlr4_1.Lexer {
|