yini-parser 1.0.0-alpha.7x → 1.0.1-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 +11 -1
- package/README.md +15 -1
- package/dist/YINI.js +17 -19
- package/dist/core/ErrorDataHandler.js +15 -15
- package/dist/core/YINIVisitor.d.ts +7 -1
- package/dist/core/YINIVisitor.js +184 -175
- package/dist/core/objectBuilder.js +39 -39
- package/dist/grammar/YiniLexer.d.ts +1 -0
- package/dist/grammar/YiniLexer.js +236 -228
- package/dist/grammar/YiniParser.d.ts +18 -1
- package/dist/grammar/YiniParser.js +480 -305
- package/dist/grammar/YiniParserVisitor.d.ts +7 -0
- package/dist/grammar/YiniParserVisitor.js +1 -1
- package/dist/index.js +24 -44
- package/dist/parseEntry.js +47 -27
- package/dist/parsers/extractHeaderParts.js +14 -14
- package/dist/parsers/extractSignificantYiniLine.js +18 -18
- package/dist/parsers/parseBoolean.js +2 -2
- package/dist/parsers/parseNull.js +2 -2
- package/dist/parsers/parseNumber.js +8 -8
- package/dist/parsers/parseSectionHeader.js +19 -19
- package/dist/parsers/parseString.js +9 -9
- package/dist/utils/string.js +3 -3
- package/dist/yiniHelpers.js +3 -3
- package/examples/basic-output.js +15 -0
- package/examples/nested-output.js +18 -0
- package/package.json +5 -1
- /package/dist/utils/{system.d.ts → print.d.ts} +0 -0
- /package/dist/utils/{system.js → print.js} +0 -0
package/dist/core/YINIVisitor.js
CHANGED
|
@@ -11,8 +11,8 @@ const parseNull_1 = __importDefault(require("../parsers/parseNull"));
|
|
|
11
11
|
const parseNumber_1 = __importDefault(require("../parsers/parseNumber"));
|
|
12
12
|
const parseSectionHeader_1 = __importDefault(require("../parsers/parseSectionHeader"));
|
|
13
13
|
const parseString_1 = __importDefault(require("../parsers/parseString"));
|
|
14
|
+
const print_1 = require("../utils/print");
|
|
14
15
|
const string_1 = require("../utils/string");
|
|
15
|
-
const system_1 = require("../utils/system");
|
|
16
16
|
const yiniHelpers_1 = require("../yiniHelpers");
|
|
17
17
|
const ErrorDataHandler_1 = require("./ErrorDataHandler");
|
|
18
18
|
/**
|
|
@@ -55,12 +55,12 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
55
55
|
this.pushOnTree = (ctx, sReslult) => {
|
|
56
56
|
if ((0, env_1.isDebug)()) {
|
|
57
57
|
console.log();
|
|
58
|
-
(0,
|
|
59
|
-
(0,
|
|
60
|
-
(0,
|
|
58
|
+
(0, print_1.debugPrint)('--- In pushOnTree(..) --------');
|
|
59
|
+
(0, print_1.debugPrint)('sReslult:');
|
|
60
|
+
(0, print_1.printObject)(sReslult);
|
|
61
61
|
}
|
|
62
62
|
const key = sReslult.level + '-' + sReslult.name;
|
|
63
|
-
(0,
|
|
63
|
+
(0, print_1.debugPrint)('KKKKKK, key = ' + key);
|
|
64
64
|
// if (this.existingSectionTitles.has(key)) {
|
|
65
65
|
if (this.hasDefinedSectionTitle(key, sReslult.level)) {
|
|
66
66
|
this.errorHandler.pushOrBail(ctx, 'Syntax-Error', 'Section name already exists', 'Cannot redefine section name: "' +
|
|
@@ -71,7 +71,7 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
73
73
|
if (sReslult.members === undefined) {
|
|
74
|
-
(0,
|
|
74
|
+
(0, print_1.debugPrint)('This sReslult does not hold any valid members (=undefined)');
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
77
|
// this.existingSectionTitles.set(key, true)
|
|
@@ -107,9 +107,9 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
107
107
|
this.reversedTree.push(chain);
|
|
108
108
|
// }
|
|
109
109
|
this.meta_numOfChains++;
|
|
110
|
-
(0,
|
|
111
|
-
(0,
|
|
112
|
-
(0,
|
|
110
|
+
(0, print_1.debugPrint)('this.reversedTree: [list]');
|
|
111
|
+
(0, print_1.printObject)(this.reversedTree);
|
|
112
|
+
(0, print_1.debugPrint)('--- /end of pushOnTree(..) --------');
|
|
113
113
|
};
|
|
114
114
|
this.getDepthOfLevels = () => {
|
|
115
115
|
return this.lastActiveSectionNameAtLevels.length;
|
|
@@ -140,55 +140,55 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
140
140
|
// Note, after pushing processing may continue or exit, depending on the error and/or the bail threshold.
|
|
141
141
|
new ErrorDataHandler_1.ErrorDataHandler().pushOrBail(null, 'Fatal-Error', 'Has no ErrorDataHandler instance when calling visitYini(..)', 'Something in the code is done incorrectly in order for this to happen... :S');
|
|
142
142
|
}
|
|
143
|
-
(0,
|
|
144
|
-
(0,
|
|
143
|
+
(0, print_1.debugPrint)();
|
|
144
|
+
(0, print_1.debugPrint)('abcde99');
|
|
145
145
|
(0, env_1.isDebug)() && console.log();
|
|
146
|
-
(0,
|
|
147
|
-
(0,
|
|
146
|
+
(0, print_1.debugPrint)('-> Entered visitYini(..) in YINIVisitor');
|
|
147
|
+
(0, print_1.debugPrint)('QQQQ');
|
|
148
148
|
(_a = ctx.section_list()) === null || _a === void 0 ? void 0 : _a.forEach((section) => {
|
|
149
149
|
// ctx?.section_list()?.forEach((section: any) => {
|
|
150
|
-
(0,
|
|
150
|
+
(0, print_1.debugPrint)('\nStart of each element in forEeach(..) of section_list():');
|
|
151
151
|
const topSectionResult = this.visitSection(section);
|
|
152
152
|
this.pushOnTree(ctx, topSectionResult);
|
|
153
153
|
const topSectionName = topSectionResult === null || topSectionResult === void 0 ? void 0 : topSectionResult.name;
|
|
154
154
|
const topSectionMembers = topSectionResult === null || topSectionResult === void 0 ? void 0 : topSectionResult.members;
|
|
155
155
|
const topSectionLevel = topSectionResult === null || topSectionResult === void 0 ? void 0 : topSectionResult.level; // This must have a value of 1.
|
|
156
|
-
(0,
|
|
156
|
+
(0, print_1.debugPrint)('\ntopSectionResult (visitSection(..)):');
|
|
157
157
|
if ((0, env_1.isDebug)()) {
|
|
158
158
|
console.log(topSectionResult);
|
|
159
159
|
}
|
|
160
|
-
(0,
|
|
160
|
+
(0, print_1.debugPrint)('Found section head, topSectionName = "' + topSectionName + '"');
|
|
161
161
|
topSectionMembers &&
|
|
162
|
-
(0,
|
|
162
|
+
(0, print_1.debugPrint)('Num of Props of topSectionResult?.members: ' +
|
|
163
163
|
Object.keys(topSectionResult === null || topSectionResult === void 0 ? void 0 : topSectionResult.members).length);
|
|
164
|
-
(0,
|
|
164
|
+
(0, print_1.debugPrint)('topSectionMembers:');
|
|
165
165
|
if ((0, env_1.isDebug)()) {
|
|
166
166
|
console.log(topSectionMembers);
|
|
167
167
|
}
|
|
168
168
|
if (topSectionName) {
|
|
169
|
-
(0,
|
|
170
|
-
(0,
|
|
171
|
-
(0,
|
|
172
|
-
(0,
|
|
173
|
-
(0,
|
|
174
|
-
(0,
|
|
169
|
+
(0, print_1.debugPrint)();
|
|
170
|
+
(0, print_1.debugPrint)('-- Just extracted TOP/FIRST section info ---------------------------');
|
|
171
|
+
(0, print_1.debugPrint)(' TOP/FIRST topSectionName = ' + topSectionName);
|
|
172
|
+
(0, print_1.debugPrint)(' topSectionLevel = ' + topSectionLevel);
|
|
173
|
+
(0, print_1.debugPrint)(' this.level = ' + this.level);
|
|
174
|
+
(0, print_1.debugPrint)('Mounted/assigned section onto resultSections...');
|
|
175
175
|
}
|
|
176
|
-
(0,
|
|
176
|
+
(0, print_1.debugPrint)('\n=== resultSections: =====================================');
|
|
177
177
|
if ((0, env_1.isDebug)()) {
|
|
178
178
|
console.log('2222222222222');
|
|
179
179
|
console.log(`lastActiveSectionAtLevels[${this.level - 1}]`);
|
|
180
|
-
(0,
|
|
180
|
+
(0, print_1.printObject)(this.lastActiveSectionAtLevels[this.level - 1]);
|
|
181
181
|
}
|
|
182
|
-
(0,
|
|
183
|
-
(0,
|
|
184
|
-
(0,
|
|
182
|
+
(0, print_1.debugPrint)('==============================================\n');
|
|
183
|
+
(0, print_1.debugPrint)('End of each element in forEeach(..) of section_list().');
|
|
184
|
+
(0, print_1.debugPrint)();
|
|
185
185
|
});
|
|
186
186
|
const syntaxTree = this.reversedTree.reverse();
|
|
187
187
|
if ((0, env_1.isDebug)()) {
|
|
188
188
|
console.log();
|
|
189
189
|
console.log('=========================================================================');
|
|
190
190
|
console.log('=== syntaxTree: ==========================================================');
|
|
191
|
-
(0,
|
|
191
|
+
(0, print_1.printObject)(syntaxTree);
|
|
192
192
|
console.log('=========================================================================');
|
|
193
193
|
console.log('=========================================================================');
|
|
194
194
|
console.log();
|
|
@@ -216,19 +216,19 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
216
216
|
// 'Classic-Header-Marker'
|
|
217
217
|
var _a, _b, _c;
|
|
218
218
|
(0, env_1.isDebug)() && console.log();
|
|
219
|
-
(0,
|
|
219
|
+
(0, print_1.debugPrint)('-> Entered visitSection(..)');
|
|
220
220
|
const res = {};
|
|
221
|
-
(0,
|
|
222
|
-
(0,
|
|
223
|
-
(0,
|
|
224
|
-
(0,
|
|
221
|
+
(0, print_1.debugPrint)('start');
|
|
222
|
+
(0, print_1.debugPrint)('XXXX0:ctx.getText() = ' + ctx.getText());
|
|
223
|
+
(0, print_1.debugPrint)('XXXX1:ctx.SECTION_HEAD() = ' + ctx.SECTION_HEAD());
|
|
224
|
+
(0, print_1.debugPrint)('XXXX1:SECTION_HEAD().getText() = ' +
|
|
225
225
|
((_a = ctx.SECTION_HEAD()) === null || _a === void 0 ? void 0 : _a.getText().trim()));
|
|
226
|
-
(0,
|
|
226
|
+
(0, print_1.debugPrint)('end\n');
|
|
227
227
|
let line = '';
|
|
228
228
|
try {
|
|
229
|
-
(0,
|
|
229
|
+
(0, print_1.debugPrint)('S1');
|
|
230
230
|
line = ((_b = ctx.SECTION_HEAD()) === null || _b === void 0 ? void 0 : _b.getText().trim()) || '';
|
|
231
|
-
(0,
|
|
231
|
+
(0, print_1.debugPrint)('S2, line: >>>' + line + '<<<');
|
|
232
232
|
}
|
|
233
233
|
catch (error) {
|
|
234
234
|
const msgWhat = `Unexpected syntax while parsing a member or section head`;
|
|
@@ -238,14 +238,14 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
238
238
|
}
|
|
239
239
|
// If no section head can be found in the above SECTION_HEAD(),
|
|
240
240
|
// try alternative method of reading the section content.
|
|
241
|
-
(0,
|
|
241
|
+
(0, print_1.debugPrint)('S3, line: >>>' + line + '<<<');
|
|
242
242
|
if (!line) {
|
|
243
|
-
(0,
|
|
244
|
-
(0,
|
|
245
|
-
(0,
|
|
243
|
+
(0, print_1.debugPrint)();
|
|
244
|
+
(0, print_1.debugPrint)('Nothing in SECTION_HEAD() is found, trying to read the section content directly...');
|
|
245
|
+
(0, print_1.debugPrint)('--- Start: parse line from section content-----------------');
|
|
246
246
|
// const sectionContent = '' + ctx.getText().trim()
|
|
247
247
|
const sectionContent = ctx.getText().trim();
|
|
248
|
-
(0,
|
|
248
|
+
(0, print_1.debugPrint)('Section content: ' + ctx.getText());
|
|
249
249
|
line = (0, extractSignificantYiniLine_1.extractYiniLine)(sectionContent);
|
|
250
250
|
// const contentLines = splitLines(sectionContent)
|
|
251
251
|
// if (isDebug()) {
|
|
@@ -278,9 +278,9 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
278
278
|
// )
|
|
279
279
|
// debugPrint()
|
|
280
280
|
}
|
|
281
|
-
(0,
|
|
281
|
+
(0, print_1.debugPrint)('S4, line: >>>' + line + '<<<');
|
|
282
282
|
if (!line) {
|
|
283
|
-
(0,
|
|
283
|
+
(0, print_1.debugPrint)('*** ERROR: Nothing to parse in section line');
|
|
284
284
|
}
|
|
285
285
|
this.prevLevel = this.level;
|
|
286
286
|
let { sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(line, this.errorHandler, ctx);
|
|
@@ -297,18 +297,18 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
297
297
|
else {
|
|
298
298
|
nestDirection = 'higher';
|
|
299
299
|
}
|
|
300
|
-
(0,
|
|
301
|
-
(0,
|
|
302
|
-
(0,
|
|
303
|
-
(0,
|
|
304
|
-
(0,
|
|
305
|
-
(0,
|
|
306
|
-
(0,
|
|
307
|
-
(0,
|
|
308
|
-
(0,
|
|
309
|
-
(0,
|
|
300
|
+
(0, print_1.debugPrint)('-- In visitSection(..) ---------------------------');
|
|
301
|
+
(0, print_1.debugPrint)(' sectionName = ' + sectionName);
|
|
302
|
+
(0, print_1.debugPrint)(' sectionLevel = ' + sectionLevel);
|
|
303
|
+
(0, print_1.debugPrint)(' this.level = ' + this.level);
|
|
304
|
+
(0, print_1.debugPrint)(' this.prevLevel = ' + this.prevLevel);
|
|
305
|
+
(0, print_1.debugPrint)(' this.prevSectionName = ' + this.prevSectionName);
|
|
306
|
+
(0, print_1.debugPrint)(' nestDirection = ' + nestDirection);
|
|
307
|
+
(0, print_1.debugPrint)(' this.numOfLevelOnes = ' + this.numOfLevelOnes);
|
|
308
|
+
(0, print_1.debugPrint)('this.getDepthOfLevels() = ' + this.getDepthOfLevels());
|
|
309
|
+
(0, print_1.debugPrint)();
|
|
310
310
|
if (nestDirection === 'higher') {
|
|
311
|
-
(0,
|
|
311
|
+
(0, print_1.debugPrint)(`Is level skipping: ${this.level - this.prevLevel} >= 2?`);
|
|
312
312
|
// if (Math.abs(this.prevLevel - this.level) >= 2) {
|
|
313
313
|
if (this.level - this.prevLevel >= 2) {
|
|
314
314
|
if (this.level === 2) {
|
|
@@ -337,17 +337,17 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
this.prevSectionName = sectionName;
|
|
340
|
-
(0,
|
|
340
|
+
(0, print_1.debugPrint)('About to visit members of section...');
|
|
341
341
|
let members;
|
|
342
342
|
if (!ctx.section_members()) {
|
|
343
|
-
(0,
|
|
343
|
+
(0, print_1.debugPrint)('(!) Section has no members!');
|
|
344
344
|
}
|
|
345
345
|
else {
|
|
346
346
|
members = this.visitSection_members(ctx.section_members());
|
|
347
347
|
}
|
|
348
348
|
// ---------------------------------------------------------------
|
|
349
349
|
(_c = ctx.children) === null || _c === void 0 ? void 0 : _c.forEach((child) => {
|
|
350
|
-
(0,
|
|
350
|
+
(0, print_1.debugPrint)('* child: ' + child);
|
|
351
351
|
});
|
|
352
352
|
if (this.level === 1) {
|
|
353
353
|
this.numOfLevelOnes++;
|
|
@@ -380,26 +380,26 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
380
380
|
// }
|
|
381
381
|
// this.prevSectionName = sectionName
|
|
382
382
|
if (nestDirection !== 'higher') {
|
|
383
|
-
(0,
|
|
384
|
-
(0,
|
|
385
|
-
(0,
|
|
386
|
-
(0,
|
|
383
|
+
(0, print_1.debugPrint)('About to reset result');
|
|
384
|
+
(0, print_1.printObject)({ [sectionName]: members });
|
|
385
|
+
(0, print_1.debugPrint)(`Current lastActiveSectionAtLevels[${this.level - 1}]`);
|
|
386
|
+
(0, print_1.printObject)(this.lastActiveSectionAtLevels[this.level - 1]);
|
|
387
387
|
if (
|
|
388
388
|
// (level === 0 && !sectionName) ||
|
|
389
389
|
// (sectionName === 'undefined' && !!members)
|
|
390
390
|
sectionLevel === 0 &&
|
|
391
391
|
sectionName === 'undefined' &&
|
|
392
392
|
!!members) {
|
|
393
|
-
(0,
|
|
394
|
-
(0,
|
|
393
|
+
(0, print_1.debugPrint)('HIT2!!!!');
|
|
394
|
+
(0, print_1.debugPrint)('(!) Detected a member (that does not have a sectionName), but a memberless object in "members"');
|
|
395
395
|
sectionName = Object.keys(members)[0];
|
|
396
|
-
(0,
|
|
396
|
+
(0, print_1.debugPrint)('sectionName = ' + sectionName);
|
|
397
397
|
members = {};
|
|
398
398
|
// this.lastActiveSectionAtLevels[0] = { [sectionName]: {} }
|
|
399
399
|
// this.pushOnTree({ level: 1, name: sectionName, members: {} })
|
|
400
|
-
(0,
|
|
401
|
-
(0,
|
|
402
|
-
(0,
|
|
400
|
+
(0, print_1.debugPrint)('(!) Skipping mounted since this is actually a memberless section');
|
|
401
|
+
(0, print_1.debugPrint)();
|
|
402
|
+
(0, print_1.debugPrint)('<- Leaving visitSection(..) EARLY');
|
|
403
403
|
if ((0, env_1.isDebug)()) {
|
|
404
404
|
console.log('returning (a memberless section):');
|
|
405
405
|
console.log({
|
|
@@ -426,61 +426,61 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
426
426
|
members,
|
|
427
427
|
});
|
|
428
428
|
// this.lastActiveSectionNameAtLevels.push(sectionName)
|
|
429
|
-
(0,
|
|
429
|
+
(0, print_1.debugPrint)('Mounted as append');
|
|
430
430
|
}
|
|
431
|
-
(0,
|
|
432
|
-
(0,
|
|
431
|
+
(0, print_1.debugPrint)(`After: lastActiveSectionAtLevels[${this.level - 1}]`);
|
|
432
|
+
(0, print_1.printObject)(this.lastActiveSectionAtLevels[this.level - 1]);
|
|
433
433
|
if ((0, env_1.isDebug)()) {
|
|
434
434
|
console.log(`After append lastActiveSectionAtLevels[${this.level - 1}]`);
|
|
435
|
-
(0,
|
|
436
|
-
(0,
|
|
437
|
-
(0,
|
|
435
|
+
(0, print_1.printObject)(this.lastActiveSectionAtLevels[this.level - 1]);
|
|
436
|
+
(0, print_1.debugPrint)('Before this.lastActiveSectionNameAtLevels:');
|
|
437
|
+
(0, print_1.printObject)(this.lastActiveSectionNameAtLevels);
|
|
438
438
|
// Reset.
|
|
439
439
|
let i = this.level;
|
|
440
440
|
while (this.lastActiveSectionNameAtLevels[i]) {
|
|
441
441
|
this.lastActiveSectionNameAtLevels[i++] = undefined;
|
|
442
442
|
}
|
|
443
|
-
(0,
|
|
444
|
-
(0,
|
|
443
|
+
(0, print_1.debugPrint)('After this.lastActiveSectionNameAtLevels:');
|
|
444
|
+
(0, print_1.printObject)(this.lastActiveSectionNameAtLevels);
|
|
445
445
|
}
|
|
446
|
-
(0,
|
|
447
|
-
(0,
|
|
448
|
-
(0,
|
|
449
|
-
(0,
|
|
450
|
-
(0,
|
|
451
|
-
(0,
|
|
452
|
-
(0,
|
|
446
|
+
(0, print_1.debugPrint)('HIT!!! - Just a lower or same level section, a continues full (nested) section,');
|
|
447
|
+
(0, print_1.debugPrint)(`Has above in lastActiveSectionAtLevels[${this.level - 1}]`);
|
|
448
|
+
(0, print_1.debugPrint)(' this.level: ' + this.level);
|
|
449
|
+
(0, print_1.debugPrint)('this.prevLevel: ' + this.prevLevel);
|
|
450
|
+
(0, print_1.debugPrint)(' this.level: ' + this.level);
|
|
451
|
+
(0, print_1.debugPrint)();
|
|
452
|
+
(0, print_1.debugPrint)(' HERE.... Should mount section to correct section at this.level: ' +
|
|
453
453
|
this.level);
|
|
454
454
|
//this.lastActiveSectionNameAtLevels[this.level - 1] = sectionName
|
|
455
|
-
(0,
|
|
456
|
-
(0,
|
|
455
|
+
(0, print_1.debugPrint)();
|
|
456
|
+
(0, print_1.debugPrint)('Resetted local result');
|
|
457
457
|
sectionName = '';
|
|
458
458
|
members = undefined;
|
|
459
459
|
}
|
|
460
460
|
//------------------------
|
|
461
|
-
(0,
|
|
461
|
+
(0, print_1.debugPrint)();
|
|
462
462
|
if ((0, env_1.isDebug)()) {
|
|
463
463
|
if (members) {
|
|
464
|
-
(0,
|
|
464
|
+
(0, print_1.printObject)({ [sectionName]: members });
|
|
465
465
|
this.lastActiveSectionAtLevels[this.level - 1] = Object.assign({}, members);
|
|
466
466
|
// this.lastActiveSectionNameAtLevels[this.level - 1] = sectionName
|
|
467
|
-
(0,
|
|
468
|
-
(0,
|
|
469
|
-
(0,
|
|
467
|
+
(0, print_1.debugPrint)('Mounted as assigned');
|
|
468
|
+
(0, print_1.debugPrint)(`lastActiveSectionAtLevels[${this.level - 1}]`);
|
|
469
|
+
(0, print_1.printObject)(this.lastActiveSectionAtLevels[this.level - 1]);
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
(0,
|
|
472
|
+
(0, print_1.debugPrint)('-----------------------');
|
|
473
473
|
if ((0, env_1.isDebug)()) {
|
|
474
474
|
console.log('At end of visitSection(..), this.lastActiveSectionNameAtLevels:');
|
|
475
|
-
(0,
|
|
476
|
-
(0,
|
|
477
|
-
(0,
|
|
478
|
-
(0,
|
|
479
|
-
(0,
|
|
480
|
-
(0,
|
|
475
|
+
(0, print_1.printObject)(this.lastActiveSectionNameAtLevels);
|
|
476
|
+
(0, print_1.debugPrint)(' this.level: ' + this.level);
|
|
477
|
+
(0, print_1.debugPrint)('this.prevLevel: ' + this.prevLevel);
|
|
478
|
+
(0, print_1.debugPrint)(' this.level: ' + this.level);
|
|
479
|
+
(0, print_1.debugPrint)('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
|
|
480
|
+
(0, print_1.debugPrint)('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
|
|
481
481
|
console.log();
|
|
482
482
|
}
|
|
483
|
-
(0,
|
|
483
|
+
(0, print_1.debugPrint)('<- Leaving visitSection(..)');
|
|
484
484
|
if ((0, env_1.isDebug)()) {
|
|
485
485
|
console.log('returning:');
|
|
486
486
|
console.log({
|
|
@@ -496,6 +496,15 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
496
496
|
members: members,
|
|
497
497
|
};
|
|
498
498
|
};
|
|
499
|
+
/**
|
|
500
|
+
* Visit a parse tree produced by `YiniParser.bad_member`.
|
|
501
|
+
* @param ctx the parse tree
|
|
502
|
+
* @return the visitor result
|
|
503
|
+
*/
|
|
504
|
+
this.visitBad_member = (ctx) => {
|
|
505
|
+
ctx.REST;
|
|
506
|
+
this.errorHandler.pushOrBail(ctx, 'Syntax-Error', 'Invalid or malformed member found.', `Offending text: ${ctx.getText()}`);
|
|
507
|
+
};
|
|
499
508
|
/**
|
|
500
509
|
* Visit a parse tree produced by `YiniParser.section_members`.
|
|
501
510
|
* In here will mount object onto members object.
|
|
@@ -506,24 +515,24 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
506
515
|
// visitSection_members = (ctx: Section_membersContext): any => {
|
|
507
516
|
this.visitSection_members = (ctx) => {
|
|
508
517
|
(0, env_1.isDebug)() && console.log();
|
|
509
|
-
(0,
|
|
510
|
-
(0,
|
|
518
|
+
(0, print_1.debugPrint)('************************************************************');
|
|
519
|
+
(0, print_1.debugPrint)('-> Entered visitSection_members(..)');
|
|
511
520
|
const members = {};
|
|
512
|
-
(0,
|
|
521
|
+
(0, print_1.debugPrint)('Will loop through each member (or section head)...');
|
|
513
522
|
ctx.member_list().forEach((member) => {
|
|
514
523
|
const { type, key, value } = this.visitMember(member);
|
|
515
|
-
(0,
|
|
516
|
-
(0,
|
|
524
|
+
(0, print_1.debugPrint)('+++++++++++++++++++++++++++++++++++++++++++++++++++++');
|
|
525
|
+
(0, print_1.debugPrint)('* Item of member_list:');
|
|
517
526
|
if ((0, env_1.isDebug)()) {
|
|
518
527
|
console.log(value);
|
|
519
528
|
}
|
|
520
|
-
(0,
|
|
521
|
-
(0,
|
|
522
|
-
(0,
|
|
523
|
-
(0,
|
|
524
|
-
(0,
|
|
529
|
+
(0, print_1.debugPrint)(' type = >>>' + type + '<<<');
|
|
530
|
+
(0, print_1.debugPrint)(' key = >>>' + key + '<<<');
|
|
531
|
+
(0, print_1.debugPrint)('value = >>>' + value + '<<<');
|
|
532
|
+
(0, print_1.debugPrint)('value[key] = >>>' + (value === null || value === void 0 ? void 0 : value[key]) + '<<<');
|
|
533
|
+
(0, print_1.debugPrint)('--');
|
|
525
534
|
if (key === '') {
|
|
526
|
-
(0,
|
|
535
|
+
(0, print_1.debugPrint)('Skipping this member, due to key = ""');
|
|
527
536
|
}
|
|
528
537
|
else {
|
|
529
538
|
if (members[key] !== undefined) {
|
|
@@ -540,7 +549,7 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
540
549
|
else {
|
|
541
550
|
(0, env_1.isDebug)() && console.log();
|
|
542
551
|
// NOTE: (!) Only if nested section.
|
|
543
|
-
(0,
|
|
552
|
+
(0, print_1.debugPrint)('About to mount a single member or section onto members...');
|
|
544
553
|
(0, env_1.isDebug)() && console.log({ [key]: value });
|
|
545
554
|
// if ((type as TDataType) === 'Object') {
|
|
546
555
|
// const isExistingSectionName =
|
|
@@ -559,7 +568,7 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
559
568
|
// }
|
|
560
569
|
// }
|
|
561
570
|
Object.assign(members, { [key]: value });
|
|
562
|
-
(0,
|
|
571
|
+
(0, print_1.debugPrint)('+ Added member or section onto members: "' +
|
|
563
572
|
key +
|
|
564
573
|
'"');
|
|
565
574
|
}
|
|
@@ -567,17 +576,17 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
567
576
|
}
|
|
568
577
|
});
|
|
569
578
|
if ((0, env_1.isDebug)()) {
|
|
570
|
-
(0,
|
|
571
|
-
(0,
|
|
572
|
-
(0,
|
|
579
|
+
(0, print_1.debugPrint)('~~~ After mounting in visitSection_members(..) ~~~~~~~~~~');
|
|
580
|
+
(0, print_1.debugPrint)('this.resultSections:');
|
|
581
|
+
(0, print_1.debugPrint)('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
|
|
573
582
|
}
|
|
574
583
|
//@todo handle member colon list
|
|
575
584
|
// ctx..member_colon_list().forEach((mcl) => {
|
|
576
585
|
// const { key, value } = this.visit(mcl)
|
|
577
586
|
// members[key] = value
|
|
578
587
|
// })
|
|
579
|
-
(0,
|
|
580
|
-
(0,
|
|
588
|
+
(0, print_1.debugPrint)();
|
|
589
|
+
(0, print_1.debugPrint)('<- Leaving visitSection_members(..)');
|
|
581
590
|
if ((0, env_1.isDebug)()) {
|
|
582
591
|
console.log('returning:');
|
|
583
592
|
console.log(members);
|
|
@@ -598,12 +607,12 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
598
607
|
this.visitMember = (ctx) => {
|
|
599
608
|
var _a, _b, _c, _d;
|
|
600
609
|
(0, env_1.isDebug)() && console.log();
|
|
601
|
-
(0,
|
|
602
|
-
(0,
|
|
603
|
-
(0,
|
|
610
|
+
(0, print_1.debugPrint)('-> Entered visitMember(..)');
|
|
611
|
+
(0, print_1.debugPrint)(' key = ' + ((_a = ctx.KEY()) === null || _a === void 0 ? void 0 : _a.getText().trim()));
|
|
612
|
+
(0, print_1.debugPrint)('Or, section head = ' +
|
|
604
613
|
((_b = ctx.SECTION_HEAD()) === null || _b === void 0 ? void 0 : _b.getText().trim()) +
|
|
605
614
|
' (head WITHOUT any members (ONLY detected here))');
|
|
606
|
-
(0,
|
|
615
|
+
(0, print_1.debugPrint)(' ctx.value() = ' + ctx.value());
|
|
607
616
|
// For logging and debugging purposes.
|
|
608
617
|
let entityType = 'Unknown';
|
|
609
618
|
let resultType = undefined;
|
|
@@ -617,7 +626,7 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
617
626
|
resultKey = ctx.KEY().getText();
|
|
618
627
|
}
|
|
619
628
|
catch (error) {
|
|
620
|
-
(0,
|
|
629
|
+
(0, print_1.debugPrint)('in catch..');
|
|
621
630
|
const msg = `Unexpected syntax while parsing a member (key-value pair)`;
|
|
622
631
|
// Note, after pushing processing may continue or exit, depending on the error and/or the bail threshold.
|
|
623
632
|
this.errorHandler.pushOrBail(ctx, 'Syntax-Error', msg);
|
|
@@ -627,18 +636,18 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
627
636
|
: null;
|
|
628
637
|
resultType = result === null || result === void 0 ? void 0 : result.type;
|
|
629
638
|
resultValue = result === null || result === void 0 ? void 0 : result.value;
|
|
630
|
-
(0,
|
|
631
|
-
(0,
|
|
639
|
+
(0, print_1.debugPrint)(' type = ' + resultType + ' @visitValue(..)');
|
|
640
|
+
(0, print_1.debugPrint)('value = ' + resultValue + ' @visitValue(..)');
|
|
632
641
|
}
|
|
633
642
|
else if ((_d = ctx.SECTION_HEAD()) === null || _d === void 0 ? void 0 : _d.getText().trim()) {
|
|
634
643
|
entityType = 'Section-Head';
|
|
635
644
|
//NOTE: There might be an issue here that some subsection gets missing!!
|
|
636
645
|
// const line = '' + ctx.SECTION_HEAD().getText().trim()
|
|
637
646
|
const line = ctx.SECTION_HEAD().getText().trim();
|
|
638
|
-
(0,
|
|
647
|
+
(0, print_1.debugPrint)('(!) Detected a section head instead: ' + line);
|
|
639
648
|
followingSection = this.visitSection(ctx);
|
|
640
649
|
// Object.assign(members, sectionObj)
|
|
641
|
-
(0,
|
|
650
|
+
(0, print_1.debugPrint)('Got constructed object of builtSection (visitSection(..):');
|
|
642
651
|
if ((0, env_1.isDebug)()) {
|
|
643
652
|
console.log(followingSection);
|
|
644
653
|
}
|
|
@@ -647,25 +656,25 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
647
656
|
// resultValue[nestedSection?.name] = nestedSection?.members
|
|
648
657
|
resultValue = (followingSection === null || followingSection === void 0 ? void 0 : followingSection.members) || {};
|
|
649
658
|
resultKey = followingSection.name;
|
|
650
|
-
(0,
|
|
651
|
-
(0,
|
|
659
|
+
(0, print_1.debugPrint)("resultKey = '" + resultKey + "'");
|
|
660
|
+
(0, print_1.debugPrint)('resultValue:');
|
|
652
661
|
if ((0, env_1.isDebug)()) {
|
|
653
|
-
(0,
|
|
662
|
+
(0, print_1.printObject)(resultValue);
|
|
654
663
|
}
|
|
655
|
-
(0,
|
|
664
|
+
(0, print_1.debugPrint)('Mounted/assigned a section onto resultValue...');
|
|
656
665
|
// Object.assign(value, { dummy: 6767 })
|
|
657
666
|
// Object.assign(resultValue, {
|
|
658
667
|
// dummy: 'That was detected a section head instead!',
|
|
659
668
|
// })
|
|
660
|
-
(0,
|
|
669
|
+
(0, print_1.debugPrint)();
|
|
661
670
|
}
|
|
662
|
-
(0,
|
|
663
|
-
(0,
|
|
664
|
-
(0,
|
|
665
|
-
(0,
|
|
671
|
+
(0, print_1.debugPrint)();
|
|
672
|
+
(0, print_1.debugPrint)("entity = '" + entityType + "'");
|
|
673
|
+
(0, print_1.debugPrint)("resultType = '" + resultType + "'");
|
|
674
|
+
(0, print_1.debugPrint)("resultKey = '" + resultKey + "'");
|
|
666
675
|
if (resultKey) {
|
|
667
|
-
(0,
|
|
668
|
-
(0,
|
|
676
|
+
(0, print_1.debugPrint)();
|
|
677
|
+
(0, print_1.debugPrint)('Has a key... Validate it either as a simple or a backticked ident...');
|
|
669
678
|
if ((0, string_1.isEnclosedInBackticks)(resultKey)) {
|
|
670
679
|
if (!(0, yiniHelpers_1.isValidBacktickedIdent)(resultKey)) {
|
|
671
680
|
this.errorHandler.pushOrBail(ctx, 'Syntax-Error', 'Invalid key name of this member, backticked key/identifier: "' +
|
|
@@ -673,7 +682,7 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
673
682
|
'"', 'Section name should be backticked like e.g. `My section name`.');
|
|
674
683
|
}
|
|
675
684
|
resultKey = (0, string_1.trimBackticks)(resultKey);
|
|
676
|
-
(0,
|
|
685
|
+
(0, print_1.debugPrint)("resultKey = '" + resultKey + "' (trimBackticks)");
|
|
677
686
|
}
|
|
678
687
|
else {
|
|
679
688
|
if (!(0, yiniHelpers_1.isValidSimpleIdent)(resultKey)) {
|
|
@@ -686,22 +695,22 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
686
695
|
}
|
|
687
696
|
}
|
|
688
697
|
if (resultValue === undefined) {
|
|
689
|
-
(0,
|
|
698
|
+
(0, print_1.debugPrint)('Detected value as undefined');
|
|
690
699
|
if (!this.isStrict) {
|
|
691
|
-
(0,
|
|
700
|
+
(0, print_1.debugPrint)('Overloading undefined value with null');
|
|
692
701
|
resultValue = null;
|
|
693
702
|
}
|
|
694
703
|
else {
|
|
695
704
|
this.errorHandler.pushOrBail(ctx, 'Syntax-Error', 'Encountered an empty/missing value in strict mode', 'Expected a value but found nothing, strict mode does not allow implicit null.', 'If you intend to have a null value, please specify "null" explicitly as the value.');
|
|
696
705
|
}
|
|
697
706
|
}
|
|
698
|
-
(0,
|
|
699
|
-
(0,
|
|
707
|
+
(0, print_1.debugPrint)('*** Constructed JS object ***');
|
|
708
|
+
(0, print_1.debugPrint)('resultValue:');
|
|
700
709
|
if ((0, env_1.isDebug)()) {
|
|
701
710
|
console.log(resultValue);
|
|
702
711
|
}
|
|
703
|
-
(0,
|
|
704
|
-
(0,
|
|
712
|
+
(0, print_1.debugPrint)();
|
|
713
|
+
(0, print_1.debugPrint)('<- About to leave visitMember(..)');
|
|
705
714
|
if ((0, env_1.isDebug)()) {
|
|
706
715
|
console.log('returning:');
|
|
707
716
|
console.log({
|
|
@@ -728,8 +737,8 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
728
737
|
// '`, `My key name`.',
|
|
729
738
|
// )
|
|
730
739
|
// }
|
|
731
|
-
(0,
|
|
732
|
-
(0,
|
|
740
|
+
(0, print_1.debugPrint)();
|
|
741
|
+
(0, print_1.debugPrint)('<- Leaving visitMember(..)');
|
|
733
742
|
if ((0, env_1.isDebug)()) {
|
|
734
743
|
console.log('returning:');
|
|
735
744
|
console.log({
|
|
@@ -753,7 +762,7 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
753
762
|
//visitMember_colon_list?: (ctx: Member_colon_listContext) => IResult
|
|
754
763
|
this.visitMember_colon_list = (ctx) => {
|
|
755
764
|
(0, env_1.isDebug)() && console.log();
|
|
756
|
-
(0,
|
|
765
|
+
(0, print_1.debugPrint)('-> Entered visitMember_colon_list(..)');
|
|
757
766
|
const key = ctx.KEY().getText();
|
|
758
767
|
const values = this.visit(ctx.elements());
|
|
759
768
|
return { key, value: values };
|
|
@@ -766,9 +775,9 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
766
775
|
// visitValue?: (ctx: ValueContext) => IResult
|
|
767
776
|
this.visitValue = (ctx) => {
|
|
768
777
|
(0, env_1.isDebug)() && console.log();
|
|
769
|
-
(0,
|
|
770
|
-
(0,
|
|
771
|
-
(0,
|
|
778
|
+
(0, print_1.debugPrint)('-> Entered visitValue(..)');
|
|
779
|
+
(0, print_1.debugPrint)('ctx.number_literal(): ' + ctx.number_literal());
|
|
780
|
+
(0, print_1.debugPrint)('ctx.boolean_literal(): ' + ctx.boolean_literal());
|
|
772
781
|
if (ctx.string_literal())
|
|
773
782
|
return this.visit(ctx.string_literal());
|
|
774
783
|
if (ctx.number_literal())
|
|
@@ -791,9 +800,9 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
791
800
|
*/
|
|
792
801
|
// visitString_literal?: (ctx: String_literalContext) => Result
|
|
793
802
|
this.visitString_literal = (ctx) => {
|
|
794
|
-
(0,
|
|
803
|
+
(0, print_1.debugPrint)('-> Entered visitString_literal(..)');
|
|
795
804
|
const raw = ctx.getText();
|
|
796
|
-
(0,
|
|
805
|
+
(0, print_1.debugPrint)('raw = >>>' + raw + '<<<');
|
|
797
806
|
const value = (0, parseString_1.default)(raw);
|
|
798
807
|
return { type: 'String', value };
|
|
799
808
|
};
|
|
@@ -804,7 +813,7 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
804
813
|
*/
|
|
805
814
|
// visitNumber_literal?: (ctx: Number_literalContext) => IResult
|
|
806
815
|
this.visitNumber_literal = (ctx) => {
|
|
807
|
-
(0,
|
|
816
|
+
(0, print_1.debugPrint)('-> Entered visitNumber_literal(..)');
|
|
808
817
|
const txt = ctx.getText();
|
|
809
818
|
const { type, value } = (0, parseNumber_1.default)(txt);
|
|
810
819
|
return { type, value };
|
|
@@ -816,7 +825,7 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
816
825
|
*/
|
|
817
826
|
//visitBoolean_literal?: (ctx: Boolean_literalContext) => IResult
|
|
818
827
|
this.visitBoolean_literal = (ctx) => {
|
|
819
|
-
(0,
|
|
828
|
+
(0, print_1.debugPrint)('-> Entered visitBoolean_literal(..)');
|
|
820
829
|
const txt = ctx.getText().toLowerCase();
|
|
821
830
|
// return ['true', 'yes', 'on'].includes(text) as IResult
|
|
822
831
|
const value = (0, parseBoolean_1.default)(txt);
|
|
@@ -828,7 +837,7 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
828
837
|
* @return the visitor result
|
|
829
838
|
*/
|
|
830
839
|
this.visitNull_literal = (ctx) => {
|
|
831
|
-
(0,
|
|
840
|
+
(0, print_1.debugPrint)('-> Entered visitNull_literal(..)');
|
|
832
841
|
const txt = ctx.getText();
|
|
833
842
|
const value = (0, parseNull_1.default)(txt);
|
|
834
843
|
return { type: 'Null', value };
|
|
@@ -884,18 +893,18 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
884
893
|
*/
|
|
885
894
|
// visitList_in_brackets?: (ctx: List_in_bracketsContext) => IResult
|
|
886
895
|
this.visitList_in_brackets = (ctx) => {
|
|
887
|
-
(0,
|
|
896
|
+
(0, print_1.debugPrint)('-> Entered visitList_in_brackets(..)');
|
|
888
897
|
let elements = [];
|
|
889
898
|
if (!ctx.elements()) {
|
|
890
|
-
(0,
|
|
899
|
+
(0, print_1.debugPrint)('Detected elements() is [], in list brackets');
|
|
891
900
|
// elements = []
|
|
892
901
|
return { type: 'List', value: [] };
|
|
893
902
|
}
|
|
894
903
|
else {
|
|
895
|
-
(0,
|
|
904
|
+
(0, print_1.debugPrint)('Detected elements() has items, in list brackets');
|
|
896
905
|
elements = this.visit(ctx.elements());
|
|
897
906
|
}
|
|
898
|
-
(0,
|
|
907
|
+
(0, print_1.debugPrint)('<- Leaving visitList_in_brackets(..)');
|
|
899
908
|
if ((0, env_1.isDebug)()) {
|
|
900
909
|
console.log('returning:');
|
|
901
910
|
console.log({ type: 'List', value: elements.value });
|
|
@@ -909,49 +918,49 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
909
918
|
* @return the visitor result
|
|
910
919
|
*/
|
|
911
920
|
this.visitElements = (ctx) => {
|
|
912
|
-
(0,
|
|
921
|
+
(0, print_1.debugPrint)('-> Entered visitElements(..)');
|
|
913
922
|
const firstElem = ctx.element();
|
|
914
923
|
let elements = [];
|
|
915
|
-
(0,
|
|
916
|
-
(0,
|
|
917
|
-
(0,
|
|
924
|
+
(0, print_1.debugPrint)(' element = ' + firstElem);
|
|
925
|
+
(0, print_1.debugPrint)(' element.getText() = ' + firstElem.getText());
|
|
926
|
+
(0, print_1.debugPrint)(' elements = ' + !!ctx.elements());
|
|
918
927
|
const resultElem = ctx.element()
|
|
919
928
|
? this.visitElement(ctx.element())
|
|
920
929
|
: null;
|
|
921
930
|
const resultTypeElem = resultElem === null || resultElem === void 0 ? void 0 : resultElem.type;
|
|
922
931
|
const resultValueElem = resultElem === null || resultElem === void 0 ? void 0 : resultElem.value;
|
|
923
|
-
(0,
|
|
924
|
-
(0,
|
|
932
|
+
(0, print_1.debugPrint)(' elem type = ' + resultTypeElem + ' @visitElements(..)');
|
|
933
|
+
(0, print_1.debugPrint)(' elem value = ' + resultValueElem + ' @visitElements(..)');
|
|
925
934
|
const resultElems = ctx.elements()
|
|
926
935
|
? this.visitElements(ctx.elements())
|
|
927
936
|
: null;
|
|
928
937
|
const resultTypeElems = resultElems === null || resultElems === void 0 ? void 0 : resultElems.type;
|
|
929
938
|
const resultValueElems = resultElems === null || resultElems === void 0 ? void 0 : resultElems.value;
|
|
930
|
-
(0,
|
|
939
|
+
(0, print_1.debugPrint)(' elems type = ' +
|
|
931
940
|
resultTypeElems +
|
|
932
941
|
' @visitElements(..)');
|
|
933
|
-
(0,
|
|
942
|
+
(0, print_1.debugPrint)(' elems value = ' +
|
|
934
943
|
resultValueElems +
|
|
935
944
|
' @visitElements(..)');
|
|
936
945
|
if (!ctx.elements()) {
|
|
937
|
-
(0,
|
|
946
|
+
(0, print_1.debugPrint)('In visitElements(..) detected that elements() has no elements');
|
|
938
947
|
elements = undefined;
|
|
939
948
|
}
|
|
940
949
|
else {
|
|
941
|
-
(0,
|
|
950
|
+
(0, print_1.debugPrint)('In visitElements(..) detected elements in elements()');
|
|
942
951
|
elements = this.visit(ctx.elements());
|
|
943
952
|
if ((0, env_1.isDebug)()) {
|
|
944
953
|
console.log('result of visited elements:');
|
|
945
|
-
(0,
|
|
954
|
+
(0, print_1.printObject)(elements);
|
|
946
955
|
}
|
|
947
956
|
}
|
|
948
957
|
const returnValues = elements
|
|
949
958
|
? [resultElem].concat(elements.value)
|
|
950
959
|
: [resultElem];
|
|
951
|
-
(0,
|
|
960
|
+
(0, print_1.debugPrint)('<- Leaving visitElements(..)');
|
|
952
961
|
if ((0, env_1.isDebug)()) {
|
|
953
962
|
console.log('returnValues:');
|
|
954
|
-
(0,
|
|
963
|
+
(0, print_1.printObject)(returnValues);
|
|
955
964
|
}
|
|
956
965
|
return {
|
|
957
966
|
type: 'List',
|
|
@@ -967,7 +976,7 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
967
976
|
// visitElement?: (ctx: ElementContext) => IResult
|
|
968
977
|
// visitElement = (ctx: ElementContext): IResult => {
|
|
969
978
|
this.visitElement = (ctx) => {
|
|
970
|
-
(0,
|
|
979
|
+
(0, print_1.debugPrint)('-> Entered visitElement(..)');
|
|
971
980
|
// if (ctx.value()) {
|
|
972
981
|
// return this.visit(ctx.value())
|
|
973
982
|
// } else {
|
|
@@ -980,10 +989,10 @@ class YINIVisitor extends YiniParserVisitor_1.default {
|
|
|
980
989
|
else {
|
|
981
990
|
result = { type: 'Null', value: null };
|
|
982
991
|
}
|
|
983
|
-
(0,
|
|
992
|
+
(0, print_1.debugPrint)('<- Leaving visitElement(..)');
|
|
984
993
|
if ((0, env_1.isDebug)()) {
|
|
985
994
|
console.log('returning:');
|
|
986
|
-
(0,
|
|
995
|
+
(0, print_1.printObject)(result);
|
|
987
996
|
console.log();
|
|
988
997
|
}
|
|
989
998
|
//return 'value'
|