yini-parser 1.1.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.
Files changed (103) hide show
  1. package/CHANGELOG.md +50 -2
  2. package/README.md +2 -2
  3. package/dist/YINI.d.ts +155 -27
  4. package/dist/YINI.js +145 -174
  5. package/dist/YINI.js.map +1 -0
  6. package/dist/config/env.js +1 -0
  7. package/dist/config/env.js.map +1 -0
  8. package/dist/core/{ASTBuilder.d.ts → astBuilder.d.ts} +4 -4
  9. package/dist/core/{ASTBuilder.js → astBuilder.js} +82 -69
  10. package/dist/core/astBuilder.js.map +1 -0
  11. package/dist/core/{ErrorDataHandler.d.ts → errorDataHandler.d.ts} +16 -10
  12. package/dist/core/{ErrorDataHandler.js → errorDataHandler.js} +115 -109
  13. package/dist/core/errorDataHandler.js.map +1 -0
  14. package/dist/core/internalTypes.d.ts +127 -0
  15. package/dist/core/{types.js → internalTypes.js} +6 -0
  16. package/dist/core/internalTypes.js.map +1 -0
  17. package/dist/core/objectBuilder.d.ts +2 -2
  18. package/dist/core/objectBuilder.js +1 -0
  19. package/dist/core/objectBuilder.js.map +1 -0
  20. package/dist/core/options/defaultParserOptions.d.ts +17 -0
  21. package/dist/core/options/defaultParserOptions.js +46 -0
  22. package/dist/core/options/defaultParserOptions.js.map +1 -0
  23. package/dist/core/options/failLevel.d.ts +3 -0
  24. package/dist/core/options/failLevel.js +27 -0
  25. package/dist/core/options/failLevel.js.map +1 -0
  26. package/dist/core/options/optionsFunctions.d.ts +8 -0
  27. package/dist/core/options/optionsFunctions.js +62 -0
  28. package/dist/core/options/optionsFunctions.js.map +1 -0
  29. package/dist/core/parsingRules/modeFromRulesMatcher.d.ts +8 -0
  30. package/dist/core/parsingRules/modeFromRulesMatcher.js +114 -0
  31. package/dist/core/parsingRules/modeFromRulesMatcher.js.map +1 -0
  32. package/dist/core/parsingRules/rulesConstAndGuards.d.ts +7 -0
  33. package/dist/core/parsingRules/rulesConstAndGuards.js +35 -0
  34. package/dist/core/parsingRules/rulesConstAndGuards.js.map +1 -0
  35. package/dist/core/pipeline/errorListeners.d.ts +18 -0
  36. package/dist/core/pipeline/errorListeners.js +107 -0
  37. package/dist/core/pipeline/errorListeners.js.map +1 -0
  38. package/dist/core/pipeline/pipeline.d.ts +18 -0
  39. package/dist/core/pipeline/pipeline.js +244 -0
  40. package/dist/core/pipeline/pipeline.js.map +1 -0
  41. package/dist/core/resultMetadataBuilder.d.ts +19 -0
  42. package/dist/core/resultMetadataBuilder.js +187 -0
  43. package/dist/core/resultMetadataBuilder.js.map +1 -0
  44. package/dist/core/runtime.d.ts +21 -0
  45. package/dist/core/runtime.js +201 -0
  46. package/dist/core/runtime.js.map +1 -0
  47. package/dist/dev/main.d.ts +1 -0
  48. package/dist/dev/main.js +305 -0
  49. package/dist/dev/main.js.map +1 -0
  50. package/dist/grammar/{YiniLexer.js → generated/YiniLexer.js} +2 -1
  51. package/dist/grammar/generated/YiniLexer.js.map +1 -0
  52. package/dist/grammar/{YiniParser.js → generated/YiniParser.js} +2 -1
  53. package/dist/grammar/generated/YiniParser.js.map +1 -0
  54. package/dist/grammar/{YiniParserVisitor.js → generated/YiniParserVisitor.js} +2 -1
  55. package/dist/grammar/generated/YiniParserVisitor.js.map +1 -0
  56. package/dist/index.d.ts +40 -1
  57. package/dist/index.js +60 -359
  58. package/dist/index.js.map +1 -0
  59. package/dist/parsers/extractHeaderParts.d.ts +2 -2
  60. package/dist/parsers/extractHeaderParts.js +2 -1
  61. package/dist/parsers/extractHeaderParts.js.map +1 -0
  62. package/dist/parsers/extractSignificantYiniLine.js +2 -1
  63. package/dist/parsers/extractSignificantYiniLine.js.map +1 -0
  64. package/dist/parsers/parseBoolean.js +1 -0
  65. package/dist/parsers/parseBoolean.js.map +1 -0
  66. package/dist/parsers/parseNull.js +1 -0
  67. package/dist/parsers/parseNull.js.map +1 -0
  68. package/dist/parsers/parseNumber.js +1 -0
  69. package/dist/parsers/parseNumber.js.map +1 -0
  70. package/dist/parsers/parseSectionHeader.d.ts +3 -3
  71. package/dist/parsers/parseSectionHeader.js +2 -1
  72. package/dist/parsers/parseSectionHeader.js.map +1 -0
  73. package/dist/parsers/parseString.js +3 -3
  74. package/dist/parsers/parseString.js.map +1 -0
  75. package/dist/types/index.d.ts +219 -0
  76. package/dist/types/index.js +4 -0
  77. package/dist/types/index.js.map +1 -0
  78. package/dist/utils/number.js +1 -0
  79. package/dist/utils/number.js.map +1 -0
  80. package/dist/utils/object.d.ts +12 -0
  81. package/dist/utils/object.js +41 -1
  82. package/dist/utils/object.js.map +1 -0
  83. package/dist/utils/pathAndFileName.js +1 -0
  84. package/dist/utils/pathAndFileName.js.map +1 -0
  85. package/dist/utils/print.d.ts +2 -2
  86. package/dist/utils/print.js +11 -6
  87. package/dist/utils/print.js.map +1 -0
  88. package/dist/utils/string.d.ts +5 -0
  89. package/dist/utils/string.js +10 -1
  90. package/dist/utils/string.js.map +1 -0
  91. package/dist/utils/system.js +1 -0
  92. package/dist/utils/system.js.map +1 -0
  93. package/dist/{yiniHelpers.d.ts → utils/yiniHelpers.d.ts} +1 -1
  94. package/dist/{yiniHelpers.js → utils/yiniHelpers.js} +3 -2
  95. package/dist/utils/yiniHelpers.js.map +1 -0
  96. package/examples/basic-output.js +12 -12
  97. package/package.json +11 -6
  98. package/dist/core/types.d.ts +0 -249
  99. package/dist/parseEntry.d.ts +0 -3
  100. package/dist/parseEntry.js +0 -456
  101. /package/dist/grammar/{YiniLexer.d.ts → generated/YiniLexer.d.ts} +0 -0
  102. /package/dist/grammar/{YiniParser.d.ts → generated/YiniParser.d.ts} +0 -0
  103. /package/dist/grammar/{YiniParserVisitor.d.ts → generated/YiniParserVisitor.d.ts} +0 -0
@@ -28,7 +28,9 @@ class ErrorDataHandler {
28
28
  - Level 1 = abort on errors only
29
29
  - Level 2 = abort even on warnings
30
30
  */
31
- constructor(subjectType, threshold = '1-Abort-on-Errors', fileName = undefined) {
31
+ constructor(subjectType, fileName = undefined, bailSensitivityLevel = '1-Abort-on-Errors', isQuiet = false, // Reduce output (show only errors, does not effect warnings and etc. in meta data).
32
+ isSilent = false, // Suppress all output (even errors, exit code only).
33
+ isThrowOnError = false) {
32
34
  this.errors = [];
33
35
  this.warnings = [];
34
36
  this.notices = [];
@@ -40,8 +42,11 @@ class ErrorDataHandler {
40
42
  this.numNotices = 0;
41
43
  this.numInfos = 0;
42
44
  this.subjectType = subjectType;
43
- this.persistThreshold = threshold;
44
45
  this.fileName = fileName;
46
+ this.persistThreshold = bailSensitivityLevel;
47
+ this.isQuiet = isQuiet;
48
+ this.isSilent = isSilent;
49
+ this.isThrowOnError = isThrowOnError;
45
50
  }
46
51
  makeIssue(line, column, type, message, advice = undefined, hint = undefined) {
47
52
  const issue = {
@@ -58,48 +63,43 @@ class ErrorDataHandler {
58
63
  }
59
64
  /**
60
65
  * After pushing processing may continue or exit, depending on the error
61
- * and/or the bail threshold (that can be optionally set my the user).
66
+ * and/or the bail threshold (that can be optionally set by the user).
62
67
  *
63
68
  * @note This function MIGHT result in a return, throw, or exit depending
64
- * on the bail policy (set my the user).
69
+ * on the bail policy (set by the user).
65
70
  *
66
71
  * @param ctx
67
72
  * @param type
68
73
  * @param msgWhat Name of the specific error or what failed. E.g. "Key already exists in this section scope".
69
74
  * @param msgWhy More details and more specific info about the issue/error.
70
- * @param msgHint Hint or HUMBLE description on how to fix the issue.
75
+ * @param msgHint Hint or HUMBLE suggestion on how to fix the issue.
71
76
  */
72
77
  pushOrBail(ctx, type, msgWhat, msgWhy = '', msgHint = '') {
73
- var _a, _b, _c, _d, _e, _f;
74
78
  (0, print_1.debugPrint)('-> pushOrBail(..)');
75
- (0, print_1.debugPrint)('ctx.exception?.name =' + ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.exception) === null || _a === void 0 ? void 0 : _a.name));
76
- (0, print_1.debugPrint)('ctx.exception?.message = ' + ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.exception) === null || _b === void 0 ? void 0 : _b.message));
77
- (0, print_1.debugPrint)('exception?.offendingToken = ' + ((_c = ctx === null || ctx === void 0 ? void 0 : ctx.exception) === null || _c === void 0 ? void 0 : _c.offendingToken));
79
+ (0, print_1.debugPrint)('ctx.exception?.name =' + ctx?.exception?.name);
80
+ (0, print_1.debugPrint)('ctx.exception?.message = ' + ctx?.exception?.message);
81
+ (0, print_1.debugPrint)('exception?.offendingToken = ' + ctx?.exception?.offendingToken);
78
82
  (0, print_1.debugPrint)();
79
- (0, print_1.debugPrint)('ctx.ruleIndex = ' + (ctx === null || ctx === void 0 ? void 0 : ctx.start.channel));
80
- (0, print_1.debugPrint)('ctx.ruleIndex = ' + (ctx === null || ctx === void 0 ? void 0 : ctx.ruleIndex));
81
- (0, print_1.debugPrint)('ctx.ruleContext = ' + (ctx === null || ctx === void 0 ? void 0 : ctx.ruleContext));
82
- (0, print_1.debugPrint)('ctx.stop?.line = ' + ((_d = ctx === null || ctx === void 0 ? void 0 : ctx.stop) === null || _d === void 0 ? void 0 : _d.line));
83
- (0, print_1.debugPrint)('ctx.stop?.column = ' + ((_e = ctx === null || ctx === void 0 ? void 0 : ctx.stop) === null || _e === void 0 ? void 0 : _e.column));
84
- const lineNum = (ctx === null || ctx === void 0 ? void 0 : ctx.start.line) || undefined; // Line (1-based).
85
- // const startCol = !ctx ? 0 : ++ctx.start.column // Column (0-based).
86
- const startCol = !ctx
87
- ? undefined
88
- : ++ctx.start.column; // Column (0-based).
89
- // const endCol = (ctx?.stop?.column || 0) + 1 // Column (0-based).
90
- const endCol = !!((_f = ctx === null || ctx === void 0 ? void 0 : ctx.stop) === null || _f === void 0 ? void 0 : _f.column)
91
- ? ++ctx.stop.column
92
- : undefined; // Note: Column (0-based).
83
+ (0, print_1.debugPrint)('ctx.ruleIndex = ' + ctx?.start.channel);
84
+ (0, print_1.debugPrint)('ctx.ruleIndex = ' + ctx?.ruleIndex);
85
+ (0, print_1.debugPrint)('ctx.ruleContext = ' + ctx?.ruleContext);
86
+ (0, print_1.debugPrint)('ctx.stop?.line = ' + ctx?.stop?.line);
87
+ (0, print_1.debugPrint)('ctx.stop?.column = ' + ctx?.stop?.column);
88
+ const lineNum = ctx?.start.line || undefined; // Line (1-based).
89
+ // const startCol: number | undefined = !ctx
90
+ // ? undefined
91
+ // : ++ctx.start.column // Column (0-based).
92
+ // const endCol: number | undefined = !!ctx?.stop?.column
93
+ // ? ++ctx.stop.column
94
+ // : undefined // Note: Column (0-based).
95
+ const startCol = ctx?.start?.column != null ? ctx.start.column + 1 : undefined; // Note: Column (0-based).
96
+ const endCol = ctx?.stop?.column != null ? ctx.stop.column + 1 : undefined; // Note: Column (0-based).
93
97
  let colNum = startCol || endCol;
94
- // if (colNum === 0) {
95
- // colNum = undefined
96
- // }
97
98
  let msgWhatWithLineNum = msgWhat;
98
99
  if (lineNum && lineNum > 0) {
99
100
  //@todo func that removes possible . at end
100
101
  //msgWhatWithLineNum =
101
102
  // Patch message with the offending line number.
102
- // msgWhatWithLineNum += ', at line: ' + lineNum
103
103
  msgWhatWithLineNum += ' at line ' + lineNum;
104
104
  if (colNum) {
105
105
  msgWhatWithLineNum += ', column ' + colNum;
@@ -118,86 +118,83 @@ class ErrorDataHandler {
118
118
  lineNum: lineNum || 0, // 1-based, if n/a use 0.
119
119
  colNum: colNum || 0, // 1-based, if n/a use 0.
120
120
  };
121
- console.log(); // Print an empty line before outputting message.
121
+ if (!this.isSilent) {
122
+ console.log(); // Print an empty line before outputting message.
123
+ }
122
124
  switch (type) {
123
125
  case 'Internal-Error':
124
126
  this.numInternalErrors++;
125
127
  this.errors.push(this.makeIssue(lineNum, colNum, type, msgWhat, msgWhy, msgHint));
126
128
  this.emitInternalError(loc, msgWhatWithLineNum, msgWhy, msgHint);
127
- console.log(); // Emit an empty line before outputting message.
128
129
  if (this.persistThreshold === '1-Abort-on-Errors' ||
129
130
  this.persistThreshold === '2-Abort-Even-on-Warnings') {
130
- // if (process.env.NODE_ENV === 'test') {
131
- // In test, throw an error instead of exiting.
132
- throw new Error(`Internal-Error: ${msgWhat}`);
133
- // } else {
134
- // process.exit(2)
135
- // }
131
+ if (!this.isThrowOnError) {
132
+ (0, print_1.debugPrint)('Skipped throwing');
133
+ }
134
+ else {
135
+ // (?, not if can delete this message now (it may have been superceded), 20250921) In test, throw an error instead of exiting.
136
+ throw new Error(`Internal-Error: ${msgWhat}`);
137
+ }
136
138
  }
137
139
  break;
138
140
  case 'Syntax-Error':
139
141
  this.numSyntaxErrors++;
140
142
  this.errors.push(this.makeIssue(lineNum, colNum, type, msgWhat, msgWhy, msgHint));
141
143
  this.emitSyntaxError(loc, msgWhatWithLineNum, msgWhy, msgHint);
142
- console.log(); // Emit an empty line before outputting message.
143
144
  if (this.persistThreshold === '1-Abort-on-Errors' ||
144
145
  this.persistThreshold === '2-Abort-Even-on-Warnings') {
145
- // if (process.env.NODE_ENV === 'test') {
146
- // In test, throw an error instead of exiting.
147
- throw new Error(`Syntax-Error: ${'' + msgWhat}`);
148
- // } else {
149
- // process.exit(3)
150
- // }
146
+ if (!this.isThrowOnError) {
147
+ (0, print_1.debugPrint)('Skipped throwing');
148
+ }
149
+ else {
150
+ // (?, not if can delete this message now (it may have been superceded), 20250921) In test, throw an error instead of exiting.
151
+ throw new Error(`Syntax-Error: ${'' + msgWhat}`);
152
+ }
151
153
  }
152
154
  break;
153
155
  case 'Syntax-Warning':
154
156
  this.numSyntaxWarnings++;
155
157
  this.warnings.push(this.makeIssue(lineNum, colNum, type, msgWhat, msgWhy, msgHint));
156
- this.emitSyntaxWarning(loc, msgWhatWithLineNum, msgWhy, msgHint);
157
- console.log(); // Emit an empty line before outputting message.
158
+ if (!this.isQuiet) {
159
+ this.emitSyntaxWarning(loc, msgWhatWithLineNum, msgWhy, msgHint);
160
+ }
158
161
  if (this.persistThreshold === '2-Abort-Even-on-Warnings') {
159
- // if (process.env.NODE_ENV === 'test') {
160
- // In test, throw an error instead of exiting.
161
- throw new Error(`Syntax-Warning: ${msgWhat}`);
162
- // } else {
163
- // process.exit(4)
164
- // }
162
+ if (!this.isThrowOnError) {
163
+ (0, print_1.debugPrint)('Skipped throwing');
164
+ }
165
+ else {
166
+ // (?, not if can delete this message now (it may have been superceded), 20250921) In test, throw an error instead of exiting.
167
+ throw new Error(`Syntax-Warning: ${msgWhat}`);
168
+ }
165
169
  }
166
170
  break;
167
171
  case 'Notice':
168
172
  this.numNotices++;
169
173
  this.notices.push(this.makeIssue(lineNum, colNum, type, msgWhat, msgWhy, msgHint));
170
174
  this.emitNotice(loc, msgWhatWithLineNum, msgWhy, msgHint);
171
- console.log(); // Emit an empty line before outputting message.
172
175
  break;
173
176
  case 'Info':
174
177
  this.numInfos++;
175
178
  this.infos.push(this.makeIssue(lineNum, colNum, type, msgWhat, msgWhy, msgHint));
176
179
  this.emitInfo(loc, msgWhatWithLineNum, msgWhy, msgHint);
177
- console.log(); // Emit an empty line before outputting message.
178
180
  break;
179
- default: // Including 'Internal-Error'.
181
+ default: // Unhandled/unknown error type → Fatal.
180
182
  this.numFatalErrors++;
181
183
  this.errors.push(this.makeIssue(lineNum, colNum, type, msgWhat, msgWhy, msgHint));
182
184
  this.emitFatalError(loc, msgWhatWithLineNum, msgWhy, msgHint);
183
- console.log(); // Emit an empty line before outputting message.
184
- // CANNOT recover fatal errors, will lead to an exit!
185
- // if (process.env.NODE_ENV === 'test') {
186
- // In test, throw an error instead of exiting.
185
+ /*
186
+ "Best practises":
187
+ - ONLY on I/O failures: file not found, unreadable file, encoding errors.
188
+ - ONLY on programmer/usage errors: invalid options, conflicting flags.
189
+ - ONLY on internal faults: invariants broken, unexpected exceptions from dependencies.
190
+ */
191
+ // CANNOT recover fatal errors, will lead to an bail!
192
+ // In test, throw an error instead of bailing/exiting.
193
+ // IMPORTANT: Never exit with exit code since this is a library!
187
194
  throw new Error(`Internal-Error: ${msgWhat}`);
188
- // } else {
189
- // process.exit(1)
190
- // (!) Not sure about the below yet, if it's preferable in this case...
191
- // Use this instead of process.exit(1), this will
192
- // lead to that the current thread(s) will exit as well.
193
- // process.exitCode = 1
194
- // }
195
195
  }
196
196
  }
197
197
  formatSignificantMessageLine(loc, issueTitle) {
198
- // if (this.subjectType === 'None/Ignore') {
199
- // return issueTitle
200
- // }
201
198
  switch (this.subjectType) {
202
199
  case 'None/Ignore':
203
200
  return issueTitle;
@@ -208,80 +205,88 @@ class ErrorDataHandler {
208
205
  let line = `${titlePart} in `;
209
206
  if (this.subjectType === 'Inline') {
210
207
  line += 'inline YINI content';
211
- // if (loc?.lineNum) {
212
- // line += `, ${loc.lineNum}`
213
- // if (loc?.colNum) line += `:${loc.colNum}`
214
- // }
215
208
  }
216
209
  else {
217
- line += `in ${this.fileName}`;
218
- // if (loc?.lineNum) {
219
- // line += `:${loc.lineNum}`
220
- // if (loc?.colNum) line += `:${loc.colNum}`
221
- // }
210
+ line += `${this.fileName}`;
222
211
  }
223
- if (loc === null || loc === void 0 ? void 0 : loc.lineNum) {
212
+ if (loc?.lineNum) {
224
213
  line += `:${loc.lineNum}`;
225
- if (loc === null || loc === void 0 ? void 0 : loc.colNum)
214
+ if (loc?.colNum)
226
215
  line += `:${loc.colNum}`;
227
216
  }
228
217
  return line;
229
218
  }
230
219
  }
231
220
  }
221
+ /*
222
+ * - error/warning → console.error / console.warn
223
+ * - notice/info → console.log / console.info
224
+ */
232
225
  emitFatalError(loc, msgWhat = 'Something went wrong!', msgWhy = '', msgHint = '') {
233
- // console.error(issueTitle[0]) // Print the issue title.
234
226
  const messageHeader = this.formatSignificantMessageLine(loc, issueTitle[0]);
235
- console.error(messageHeader); // Print the issue title.
236
- msgWhat && console.log(msgWhat);
237
- msgWhy && console.log(msgWhy);
238
- msgHint && console.log(msgHint);
227
+ if (!this.isSilent) {
228
+ console.error(messageHeader); // Print the issue title.
229
+ msgWhat && console.log(msgWhat);
230
+ msgWhy && console.log(msgWhy);
231
+ msgHint && console.log(msgHint);
232
+ console.log(); // Emit an empty line before outputting message.
233
+ }
239
234
  }
240
235
  emitInternalError(loc, msgWhat = 'Something went wrong!', msgWhy = '', msgHint = '') {
241
- // console.error(issueTitle[1]) // Print the issue title.
242
236
  const messageHeader = this.formatSignificantMessageLine(loc, issueTitle[1]);
243
- console.error(messageHeader); // Print the issue title.
244
- msgWhat && console.log(msgWhat);
245
- msgWhy && console.log(msgWhy);
246
- msgHint && console.log(msgHint);
237
+ if (!this.isSilent) {
238
+ console.error(messageHeader); // Print the issue title.
239
+ msgWhat && console.log(msgWhat);
240
+ msgWhy && console.log(msgWhy);
241
+ msgHint && console.log(msgHint);
242
+ console.log(); // Emit an empty line before outputting message.
243
+ }
247
244
  }
248
245
  emitSyntaxError(loc, msgWhat, msgWhy = '', msgHint = '') {
249
- // console.error(issueTitle[2]) // Print the issue title.
250
246
  const messageHeader = this.formatSignificantMessageLine(loc, issueTitle[2]);
251
- console.error(messageHeader); // Print the issue title.
252
- msgWhat && console.log(msgWhat);
253
- msgWhy && console.log(msgWhy);
254
- msgHint && console.log(msgHint);
247
+ if (!this.isSilent) {
248
+ console.error(messageHeader); // Print the issue title.
249
+ msgWhat && console.log(msgWhat);
250
+ msgWhy && console.log(msgWhy);
251
+ msgHint && console.log(msgHint);
252
+ console.log(); // Emit an empty line before outputting message.
253
+ }
255
254
  }
256
255
  emitSyntaxWarning(loc, msgWhat, msgWhy = '', msgHint = '') {
257
- // console.warn(issueTitle[3]) // Print the issue title.
258
256
  const messageHeader = this.formatSignificantMessageLine(loc, issueTitle[3]);
259
- console.warn(messageHeader); // Print the issue title.
260
- msgWhat && console.log(msgWhat);
261
- msgWhy && console.log(msgWhy);
262
- msgHint && console.log(msgHint);
257
+ if (!this.isQuiet && !this.isSilent) {
258
+ console.warn(messageHeader); // Print the issue title.
259
+ msgWhat && console.log(msgWhat);
260
+ msgWhy && console.log(msgWhy);
261
+ msgHint && console.log(msgHint);
262
+ console.log(); // Emit an empty line before outputting message.
263
+ }
263
264
  }
264
265
  emitNotice(loc, msgWhat, msgWhy = '', msgHint = '') {
265
- // console.warn(issueTitle[4]) // Print the issue title.
266
266
  const messageHeader = this.formatSignificantMessageLine(loc, issueTitle[4]);
267
- console.warn(messageHeader); // Print the issue title.
268
- msgWhat && console.log(msgWhat);
269
- msgWhy && console.log(msgWhy);
270
- msgHint && console.log(msgHint);
267
+ if (!this.isQuiet && !this.isSilent) {
268
+ console.log(messageHeader); // Print the issue title.
269
+ msgWhat && console.log(msgWhat);
270
+ msgWhy && console.log(msgWhy);
271
+ msgHint && console.log(msgHint);
272
+ console.log(); // Emit an empty line before outputting message.
273
+ }
271
274
  }
272
275
  emitInfo(loc, msgWhat, msgWhy = '', msgHint = '') {
273
- // console.info(issueTitle[5]) // Print the issue title.
274
276
  const messageHeader = this.formatSignificantMessageLine(loc, issueTitle[5]);
275
- console.info(messageHeader); // Print the issue title.
276
- msgWhat && console.log(msgWhat);
277
- msgWhy && console.log(msgWhy);
278
- msgHint && console.log(msgHint);
277
+ if (!this.isQuiet && !this.isSilent) {
278
+ console.info(messageHeader); // Print the issue title.
279
+ msgWhat && console.log(msgWhat);
280
+ msgWhy && console.log(msgWhy);
281
+ msgHint && console.log(msgHint);
282
+ console.log(); // Emit an empty line before outputting message.
283
+ }
279
284
  }
280
285
  getNumOfAllMessages() {
281
286
  return (this.getNumOfErrors() +
282
287
  this.getNumOfWarnings() +
283
288
  this.getNumOfNotices() +
284
- this.getNumOfNotices());
289
+ this.getNumOfInfos());
285
290
  }
286
291
  getNumOfErrors() {
287
292
  return (this.numFatalErrors + this.numInternalErrors + this.numSyntaxErrors);
@@ -309,3 +314,4 @@ class ErrorDataHandler {
309
314
  }
310
315
  }
311
316
  exports.ErrorDataHandler = ErrorDataHandler;
317
+ //# sourceMappingURL=errorDataHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorDataHandler.js","sourceRoot":"","sources":["../../src/core/errorDataHandler.ts"],"names":[],"mappings":";;;AAAA,uCAAkD;AAGlD,0CAAwD;AACxD,4CAA0E;AAO1E,uEAAuE;AACvE,qEAAqE;AACrE,oBAAoB;AACp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QACtB,OAAO,CACH,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,gBAAgB,EAAE;YACvB,IAAI,CAAC,eAAe,EAAE;YACtB,IAAI,CAAC,aAAa,EAAE,CACvB,CAAA;IACL,CAAC;IAEM,cAAc;QACjB,OAAO,CACH,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,eAAe,CACtE,CAAA;IACL,CAAC;IAEM,gBAAgB;QACnB,OAAO,IAAI,CAAC,iBAAiB,CAAA;IACjC,CAAC;IAEM,eAAe;QAClB,OAAO,IAAI,CAAC,UAAU,CAAA;IAC1B,CAAC;IAEM,aAAa;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAA;IACxB,CAAC;IAEM,SAAS;QACZ,OAAO,IAAI,CAAC,MAAM,CAAA;IACtB,CAAC;IAEM,WAAW;QACd,OAAO,IAAI,CAAC,QAAQ,CAAA;IACxB,CAAC;IAEM,UAAU;QACb,OAAO,IAAI,CAAC,OAAO,CAAA;IACvB,CAAC;IAEM,QAAQ;QACX,OAAO,IAAI,CAAC,KAAK,CAAA;IACrB,CAAC;CACJ;AAzdD,4CAydC"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Internal types ONLY, public (user-facing) type should go into src/types/index.ts.
3
+ *
4
+ * @note
5
+ * The use of null vs undefined
6
+ * ----------------------------
7
+ * The convention here (in this file) is:
8
+ * - undefined is used where a value is missing, or does not apply.
9
+ * - null is used where a value is missing or has not yet been computed.
10
+ *
11
+ * @note All names of **internal** types and interfaces (shapes) must be
12
+ * prefixed with `T` or `I`.
13
+ */
14
+ import { DocumentTerminatorRule, DuplicateKeyPolicy, EmptyValueRule, OnDuplicateKey, PreferredFailLevel } from '../types';
15
+ export type TParserMode = 'lenient' | 'strict';
16
+ export type TExactMode = 'custom' | TParserMode;
17
+ export type TSourceType = 'File' | 'Inline';
18
+ export type TSubjectType = 'None/Ignore' | TSourceType;
19
+ export type TBailSensitivityLevel = '0-Ignore-Errors' | '1-Abort-on-Errors' | '2-Abort-Even-on-Warnings';
20
+ /**
21
+ * Scalar literal, a single, indivisible piece of data:
22
+ * string, number, boolean, and null.
23
+ * @property {string | undefined} [tag]
24
+ * Its contents may change at any time and should not
25
+ * be relied upon for any significant purpose.
26
+ * @note Undefined is included here despite that JSON cannot represent
27
+ * it (undefined), but JS objects can (it's sometimes useful in
28
+ * debugging etc), it will later get stripped if converted into JSON.
29
+ */
30
+ export type TScalarValue = {
31
+ type: 'String';
32
+ value: string;
33
+ tag: string | undefined;
34
+ } | {
35
+ type: 'Number';
36
+ value: number;
37
+ tag: string | undefined;
38
+ } | {
39
+ type: 'Boolean';
40
+ value: boolean;
41
+ tag: string | undefined;
42
+ } | {
43
+ type: 'Null';
44
+ value: null;
45
+ tag: string | undefined;
46
+ } | {
47
+ type: 'Undefined';
48
+ value: undefined;
49
+ tag: string | undefined;
50
+ };
51
+ /** Any literal value in YINI: scalar, list, or object. */
52
+ export type TValueLiteral = TScalarValue | TListValue | TObjectValue;
53
+ /**
54
+ * @property {string | undefined} [tag]
55
+ * Debugging only. Its contents may change at any time and
56
+ * must not be relied upon for any functional purpose.
57
+ */
58
+ export type TListValue = {
59
+ type: 'List';
60
+ elems: readonly TValueLiteral[];
61
+ tag: string | undefined;
62
+ };
63
+ /**
64
+ * @property {string | undefined} [tag]
65
+ * Debugging only. Its contents may change at any time and
66
+ * must not be relied upon for any functional purpose.
67
+ */
68
+ export type TObjectValue = {
69
+ type: 'Object';
70
+ entries: Readonly<Record<string, TValueLiteral>>;
71
+ tag: string | undefined;
72
+ };
73
+ export type TSectionHeaderType = undefined | 'Classic-Header-Marker' | 'Numeric-Header-Marker';
74
+ export type TIssueType = 'Fatal-Error' | 'Internal-Error' | 'Syntax-Error' | 'Syntax-Warning' | 'Notice' | 'Info';
75
+ interface IMetaBaseInfo {
76
+ sourceType: TSourceType;
77
+ fileName: string | undefined;
78
+ }
79
+ /**
80
+ * Internal runtime info / meta data.
81
+ * @note Used for internal diagnostics, bookkeeping, state, etc.
82
+ */
83
+ export interface IRuntimeInfo extends IMetaBaseInfo {
84
+ lineCount: number | null;
85
+ fileByteSize: number | null;
86
+ timeIoMs: number | null;
87
+ preferredBailSensitivity: null | PreferredFailLevel;
88
+ sha256: string | null;
89
+ }
90
+ export interface IParseCoreOptions {
91
+ rules: IParseRuleOptions;
92
+ bailSensitivity: TBailSensitivityLevel;
93
+ isIncludeMeta: boolean;
94
+ isWithDiagnostics: boolean;
95
+ isWithTiming: boolean;
96
+ isKeepUndefinedInMeta: boolean;
97
+ isQuiet: boolean;
98
+ isSilent: boolean;
99
+ isThrowOnError: boolean;
100
+ }
101
+ export interface IParseRuleOptions {
102
+ initialMode: 'custom' | TParserMode;
103
+ onDuplicateKey: DuplicateKeyPolicy;
104
+ requireDocTerminator: DocumentTerminatorRule;
105
+ treatEmptyValueAsNull: EmptyValueRule;
106
+ }
107
+ export interface IYiniAST extends IMetaBaseInfo {
108
+ root: IYiniSection;
109
+ isStrict: boolean;
110
+ terminatorSeen: boolean;
111
+ yiniMarkerSeen: boolean;
112
+ maxDepth: number | null;
113
+ numOfSections: number;
114
+ numOfMembers: number;
115
+ sectionNamePaths: string[] | null;
116
+ }
117
+ export interface IYiniSection {
118
+ sectionName: string;
119
+ level: number;
120
+ members: Map<string, TValueLiteral>;
121
+ children: IYiniSection[];
122
+ }
123
+ export interface IBuildOptions {
124
+ mode?: 'lenient' | 'strict';
125
+ onDuplicateKey?: OnDuplicateKey;
126
+ }
127
+ export {};
@@ -1,10 +1,16 @@
1
1
  "use strict";
2
2
  /**
3
+ * Internal types ONLY, public (user-facing) type should go into src/types/index.ts.
4
+ *
3
5
  * @note
4
6
  * The use of null vs undefined
5
7
  * ----------------------------
6
8
  * The convention here (in this file) is:
7
9
  * - undefined is used where a value is missing, or does not apply.
8
10
  * - null is used where a value is missing or has not yet been computed.
11
+ *
12
+ * @note All names of **internal** types and interfaces (shapes) must be
13
+ * prefixed with `T` or `I`.
9
14
  */
10
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
+ //# sourceMappingURL=internalTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internalTypes.js","sourceRoot":"","sources":["../../src/core/internalTypes.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG"}
@@ -1,5 +1,5 @@
1
- import { IYiniAST } from '../core/types';
2
- import { ErrorDataHandler } from './ErrorDataHandler';
1
+ import { ErrorDataHandler } from './errorDataHandler';
2
+ import { IYiniAST } from './internalTypes';
3
3
  /**
4
4
  * Construct the final JavaScript Object.
5
5
  * Transforms the AST to the plain JS object.
@@ -146,3 +146,4 @@ const define = (obj, key, value) => {
146
146
  writable: true,
147
147
  });
148
148
  };
149
+ //# sourceMappingURL=objectBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectBuilder.js","sourceRoot":"","sources":["../../src/core/objectBuilder.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,0CAAsE;AAItE;;;;;;;;GAQG;AACI,MAAM,WAAW,GAAG,CACvB,GAAa,EACb,YAA8B,EAEP,EAAE;IACzB,IAAA,kBAAU,EAAC,6BAA6B,CAAC,CAAA;IACzC,2CAA2C;IAE3C,MAAM,GAAG,GAA4B,EAAE,CAAA;IACvC,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,WAAW,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,CAAA;IAC1D,CAAC;IACD,OAAO,GAAG,CAAA;AACd,CAAC,CAAA;AAbY,QAAA,WAAW,eAavB;AAED,kFAAkF;AAClF,oCAAoC;AACpC,4BAA4B;AAC5B,+BAA+B;AAC/B,8CAA8C;AAC9C,8CAA8C;AAC9C,0DAA0D;AAC1D,QAAQ;AACR,iBAAiB;AACjB,IAAI;AAEJ,2EAA2E;AAC3E,yEAAyE;AACzE,8CAA8C;AAE9C,8BAA8B;AAC9B,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C;AACL,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,GAAG,CACX,GAAM,EACN,GAAM,EACN,KAAc,EACV,EAAE;IACN,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE;QAC5B,KAAK;QACL,UAAU,EAAE,IAAI;QAChB,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE,IAAI;KACjB,CAAC,CAAA;AACN,CAAC,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { ParseOptions } from '../../types';
2
+ import { TParserMode } from '../internalTypes';
3
+ export declare const getDefaultUserOptions: (mode: TParserMode) => {
4
+ includeDiagnostics: boolean;
5
+ includeTiming: boolean;
6
+ preserveUndefinedInMeta: boolean;
7
+ onDuplicateKey: import("../../types").OnDuplicateKey;
8
+ requireDocTerminator: import("../../types").DocumentTerminatorRule;
9
+ treatEmptyValueAsNull: import("../../types").EmptyValueRule;
10
+ quiet: boolean;
11
+ silent: boolean;
12
+ throwOnError: boolean;
13
+ strictMode: boolean;
14
+ failLevel: import("../../types").PreferredFailLevel;
15
+ includeMetadata: boolean;
16
+ };
17
+ export type TNormalizedUserOptions = Required<Pick<ParseOptions, 'strictMode' | 'failLevel' | 'includeMetadata' | 'includeDiagnostics' | 'includeTiming' | 'preserveUndefinedInMeta' | 'onDuplicateKey' | 'requireDocTerminator' | 'treatEmptyValueAsNull' | 'quiet' | 'silent' | 'throwOnError'>>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefaultUserOptions = void 0;
4
+ // export const getDefaultUserOptions = (mode: TParserMode): ParseOptions =>
5
+ // export const getDefaultUserOptions = (mode: TParserMode) =>
6
+ // mode === 'strict' ? DEFAULT_STRICT_OPTS : DEFAULT_LENIENT_OPTS
7
+ const getDefaultUserOptions = (mode) => mode === 'strict' ? { ...DEFAULT_STRICT_OPTS } : { ...DEFAULT_LENIENT_OPTS };
8
+ exports.getDefaultUserOptions = getDefaultUserOptions;
9
+ // Base (mode-agnostic) defaults
10
+ const BASE_DEFAULTS = {
11
+ strictMode: false,
12
+ failLevel: 'auto',
13
+ includeMetadata: false,
14
+ includeDiagnostics: false,
15
+ includeTiming: false,
16
+ preserveUndefinedInMeta: false,
17
+ // suppressWarnings: false, // Suppress warnings in console (does not affect warnings in meta data).
18
+ onDuplicateKey: 'error',
19
+ requireDocTerminator: 'optional',
20
+ treatEmptyValueAsNull: 'allow-with-warning',
21
+ quiet: false, // Suppress warnings in console (does not affect warnings in meta data).
22
+ silent: false,
23
+ //@todo: Change default throwOnError to false
24
+ throwOnError: true, // Will throw on first parse error encountered.
25
+ };
26
+ const DEFAULT_LENIENT_OPTS = {
27
+ ...BASE_DEFAULTS,
28
+ strictMode: false,
29
+ failLevel: 'ignore-errors',
30
+ // suppressWarnings: false, // Suppress warnings in console (does not affect warnings in meta data).
31
+ // Below are options for pure rules:
32
+ onDuplicateKey: 'warn-and-keep-first',
33
+ requireDocTerminator: 'optional',
34
+ treatEmptyValueAsNull: 'allow',
35
+ };
36
+ const DEFAULT_STRICT_OPTS = {
37
+ ...BASE_DEFAULTS,
38
+ strictMode: true,
39
+ failLevel: 'errors',
40
+ // suppressWarnings: false, // Suppress warnings in console (does not affect warnings in meta data).
41
+ // Below are options for pure rules:
42
+ onDuplicateKey: 'error',
43
+ requireDocTerminator: 'optional',
44
+ treatEmptyValueAsNull: 'disallow',
45
+ };
46
+ //# sourceMappingURL=defaultParserOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultParserOptions.js","sourceRoot":"","sources":["../../../src/core/options/defaultParserOptions.ts"],"names":[],"mappings":";;;AAGA,4EAA4E;AAC5E,8DAA8D;AAC9D,qEAAqE;AAE9D,MAAM,qBAAqB,GAAG,CAAC,IAAiB,EAAE,EAAE,CACvD,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,oBAAoB,EAAE,CAAA;AADnE,QAAA,qBAAqB,yBAC8C;AAsBhF,gCAAgC;AAChC,MAAM,aAAa,GAA2B;IAC1C,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,MAAM;IACjB,eAAe,EAAE,KAAK;IACtB,kBAAkB,EAAE,KAAK;IACzB,aAAa,EAAE,KAAK;IACpB,uBAAuB,EAAE,KAAK;IAC9B,oGAAoG;IACpG,cAAc,EAAE,OAAO;IACvB,oBAAoB,EAAE,UAAU;IAChC,qBAAqB,EAAE,oBAAoB;IAC3C,KAAK,EAAE,KAAK,EAAE,wEAAwE;IACtF,MAAM,EAAE,KAAK;IACb,6CAA6C;IAC7C,YAAY,EAAE,IAAI,EAAE,+CAA+C;CACtE,CAAA;AAED,MAAM,oBAAoB,GAA2B;IACjD,GAAG,aAAa;IAChB,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,eAAe;IAC1B,oGAAoG;IACpG,oCAAoC;IACpC,cAAc,EAAE,qBAAqB;IACrC,oBAAoB,EAAE,UAAU;IAChC,qBAAqB,EAAE,OAAO;CACjC,CAAA;AAED,MAAM,mBAAmB,GAA2B;IAChD,GAAG,aAAa;IAChB,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,QAAQ;IACnB,oGAAoG;IACpG,oCAAoC;IACpC,cAAc,EAAE,OAAO;IACvB,oBAAoB,EAAE,UAAU;IAChC,qBAAqB,EAAE,UAAU;CACpC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { PreferredFailLevel } from '../../types';
2
+ import { TBailSensitivityLevel } from '../internalTypes';
3
+ export declare function mapFailLevelToBail(isStrict: boolean, failLevel: PreferredFailLevel): TBailSensitivityLevel;