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
@@ -0,0 +1,244 @@
1
+ "use strict";
2
+ /**
3
+ * This file is the orchestrator that wires up the pipeline (lexer → parser →
4
+ * astBuilder → objectBuilder, etc.)
5
+ */
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.runPipeline = void 0;
11
+ const perf_hooks_1 = require("perf_hooks");
12
+ const antlr4_1 = require("antlr4");
13
+ const env_1 = require("../../config/env");
14
+ const YiniLexer_1 = __importDefault(require("../../grammar/generated/YiniLexer"));
15
+ const YiniParser_1 = __importDefault(require("../../grammar/generated/YiniParser"));
16
+ const object_1 = require("../../utils/object");
17
+ const print_1 = require("../../utils/print");
18
+ const astBuilder_1 = __importDefault(require("../astBuilder"));
19
+ const errorDataHandler_1 = require("../errorDataHandler");
20
+ const objectBuilder_1 = require("../objectBuilder");
21
+ const resultMetadataBuilder_1 = require("../resultMetadataBuilder");
22
+ const errorListeners_1 = require("./errorListeners");
23
+ /**
24
+ * @internal Single source of truth.
25
+ *
26
+ * Entrypoint for the YINI parsing pipeline:
27
+ * tokenization → grammar parse → AST build → object build → result.
28
+ *
29
+ * @param _meta_userOpts The user options from which the core options were
30
+ * derived/resolved from. This object is provided only for debugging
31
+ * and metadata purposes and should not be relied upon in
32
+ * application logic.
33
+ */
34
+ const runPipeline = (yiniContent, coreOptions, runtimeInfo, _meta_userOpts) => {
35
+ (0, print_1.debugPrint)();
36
+ (0, print_1.debugPrint)('-> Entered runPipeline(..) in pipeline.ts');
37
+ (0, print_1.debugPrint)(' isStrict initialMode = ' + coreOptions.rules.initialMode);
38
+ (0, print_1.debugPrint)(' bailSensitivity = ' + coreOptions.bailSensitivity);
39
+ (0, print_1.debugPrint)(' isIncludeMeta = ' + coreOptions.isIncludeMeta);
40
+ (0, print_1.debugPrint)(' isWithDiagnostics = ' + coreOptions.isWithDiagnostics);
41
+ (0, print_1.debugPrint)(' isWithTiming = ' + coreOptions.isWithTiming);
42
+ (0, print_1.debugPrint)(' isKeepUndefinedInMeta = ' + coreOptions.isKeepUndefinedInMeta);
43
+ (0, print_1.debugPrint)('isQuiet = ' + coreOptions.isQuiet);
44
+ (0, print_1.debugPrint)(' onDuplicateKey = ' + coreOptions.rules.onDuplicateKey);
45
+ (0, print_1.debugPrint)(' requireDocTerminator = ' + coreOptions.rules.requireDocTerminator);
46
+ (0, print_1.debugPrint)(' treatEmptyValueAsNull = ' + coreOptions.rules.treatEmptyValueAsNull);
47
+ (0, print_1.debugPrint)();
48
+ (0, print_1.debugPrint)(' runtimeInfo.sourceType = ' + runtimeInfo.sourceType);
49
+ (0, print_1.debugPrint)(' runtimeInfo.fileName = ' + runtimeInfo.fileName);
50
+ // let persistThreshold: TBailSensitivityLevel
51
+ // switch (coreOptions.bailSensitivity) {
52
+ // case '0-Ignore-Errors':
53
+ // persistThreshold = '0-Ignore-Errors'
54
+ // break
55
+ // case 1:
56
+ // persistThreshold = '1-Abort-on-Errors'
57
+ // break
58
+ // default:
59
+ // persistThreshold = '2-Abort-Even-on-Warnings'
60
+ // }
61
+ const errorHandler = new errorDataHandler_1.ErrorDataHandler(runtimeInfo.sourceType, runtimeInfo.fileName, coreOptions.bailSensitivity, coreOptions.isQuiet, coreOptions.isSilent, coreOptions.isThrowOnError);
62
+ if (yiniContent.trim() === '') {
63
+ const isFileSourceType = runtimeInfo?.sourceType === 'File';
64
+ // Note, after pushing processing may continue or exit, depending on the error and/or the bail threshold.
65
+ errorHandler.pushOrBail(null, 'Syntax-Error', 'Empty YINI document.', `The input is blank or contains only whitespace in the ${isFileSourceType ? 'YINI file' : 'YINI inline content'}.`, `Tip: Add at least one section '^ SectionName' or a key-value pair 'key = value' to make it a valid YINI file.`);
66
+ }
67
+ //---------------------------------------------
68
+ // Note: Only computed when isWithTiming.
69
+ let timeStartMs = 0;
70
+ let timeEnd1Ms = 0;
71
+ let timeEnd2Ms = 0;
72
+ let timeEnd3Ms = 0;
73
+ let timeEnd4Ms = 0;
74
+ //---------------------------------------------
75
+ //---------------------------------------------
76
+ // Note: Should ALWAYS be computed.
77
+ let runStartedAt = '';
78
+ let runFinishedAt = '';
79
+ let durationMs = 0;
80
+ //---------------------------------------------
81
+ (0, env_1.isDebug)() && console.log();
82
+ (0, print_1.debugPrint)('=== Phase 1 - Lexing ===================================================');
83
+ // -----------------------------
84
+ // Below block should always be done despite isWithTiming to compute
85
+ // total time and runStartedAt that should always be computed.
86
+ {
87
+ timeStartMs = perf_hooks_1.performance.now();
88
+ runStartedAt = new Date().toISOString();
89
+ }
90
+ // -----------------------------
91
+ const inputStream = antlr4_1.CharStreams.fromString(yiniContent);
92
+ const lexer = new YiniLexer_1.default(inputStream);
93
+ // Remove the default ConsoleErrorListener
94
+ lexer.removeErrorListeners(); // Removes the default lexer console error output.
95
+ // const lexerErrorListener = new MyLexerErrorListener(errorHandler)
96
+ const lexerErrorListener = (0, errorListeners_1.createLexerErrorListener)(errorHandler);
97
+ lexer.addErrorListener(lexerErrorListener);
98
+ const tokenStream = new antlr4_1.CommonTokenStream(lexer);
99
+ // Important: force tokenization here so lexing is measured separately.
100
+ tokenStream.fill();
101
+ (0, print_1.debugPrint)('--- Parsing done. ---');
102
+ (0, print_1.debugPrint)('=== Ended phase 1 =============================================');
103
+ (0, env_1.isDebug)() && console.log();
104
+ (0, print_1.debugPrint)('=== Phase 2 - Parsing ===================================================');
105
+ if (coreOptions.isWithTiming) {
106
+ timeEnd1Ms = perf_hooks_1.performance.now();
107
+ }
108
+ const parser = new YiniParser_1.default(tokenStream);
109
+ // const errorListener = new MyParserErrorListener(errorHandler)
110
+ parser.removeErrorListeners(); // Removes the default parser console error output.
111
+ // const parserErrorListener = new MyParserErrorListener(errorHandler)
112
+ const parserErrorListener = (0, errorListeners_1.createParserErrorListener)(errorHandler);
113
+ parser.addErrorListener(parserErrorListener);
114
+ const parseTree = parser.yini(); // The function yini() is the start rule.
115
+ // if (
116
+ // parserErrorListener.errors.length > 0 ||
117
+ // lexerErrorListener.errors.length > 0
118
+ // ) {
119
+ // debugPrint('*** ERROR detected ***')
120
+ // if (isDebug()) {
121
+ // // Handle or display syntax errors
122
+ // console.error(
123
+ // 'Syntax errors detected:',
124
+ // parserErrorListener.errors,
125
+ // lexerErrorListener.errors,
126
+ // )
127
+ // }
128
+ // }
129
+ (0, print_1.debugPrint)('=== Ended phase 2 =============================================');
130
+ (0, env_1.isDebug)() && console.log();
131
+ (0, print_1.debugPrint)('=== Phase 3 - AST Model build & validation ===================================================');
132
+ if (coreOptions.isWithTiming) {
133
+ timeEnd2Ms = perf_hooks_1.performance.now();
134
+ }
135
+ const builder = new astBuilder_1.default(errorHandler, coreOptions, runtimeInfo.sourceType, runtimeInfo.fileName || null);
136
+ const ast = builder.buildAST(parseTree);
137
+ if (ast.numOfMembers === 0 && ast.numOfSections === 0) {
138
+ // Note, after pushing processing may continue or exit, depending on the error and/or the bail threshold.
139
+ errorHandler.pushOrBail(null, 'Syntax-Error', 'No meaningful content.', `No sections or members found in the ${ast.sourceType === 'File' ? 'YINI file' : 'YINI inline content'}.`, `${ast.sourceType === 'File' ? 'A valid YINI file' : 'Any valid YINI inline content'} must contain at least one section '^ SectionName' or a key–value pair 'key = value' to make it a valid YINI file.`);
140
+ }
141
+ if ((0, env_1.isDebug)()) {
142
+ console.log();
143
+ console.log('**************************************************************************');
144
+ console.log('*** AST *************************************************');
145
+ (0, print_1.printObject)(ast);
146
+ console.log('**************************************************************************');
147
+ console.log('**************************************************************************');
148
+ console.log();
149
+ }
150
+ (0, print_1.debugPrint)('=== Ended phase 3 =============================================');
151
+ (0, env_1.isDebug)() && console.log();
152
+ (0, print_1.debugPrint)('=== Phase 4 - Object Building Construction / Binding / Evaluation) ===================================================');
153
+ if (coreOptions.isWithTiming) {
154
+ timeEnd3Ms = perf_hooks_1.performance.now();
155
+ }
156
+ // Construct.
157
+ // const finalJSResult = constructFinalObject(syntaxTreeC, errorHandler)
158
+ // const finalJSResult = builder.build(parseTree)
159
+ // const finalJSResult = ast //NOTE: ONLY TEMP so code runs
160
+ const finalJSResult = (0, objectBuilder_1.astToObject)(ast, errorHandler);
161
+ (0, print_1.debugPrint)('=== Ended phase 4 =============================================');
162
+ // -----------------------------
163
+ // Below block should always be done despite isWithTiming to compute
164
+ // total time and runStartedAt that should always be computed.
165
+ {
166
+ timeEnd4Ms = perf_hooks_1.performance.now();
167
+ durationMs = timeEnd4Ms - timeStartMs;
168
+ runFinishedAt = new Date().toISOString();
169
+ }
170
+ // -----------------------------
171
+ (0, print_1.debugPrint)('visitor.visit(..): finalJSResult:');
172
+ (0, env_1.isDebug)() && console.debug(finalJSResult);
173
+ (0, print_1.debugPrint)();
174
+ if (coreOptions.rules.initialMode === 'strict') {
175
+ // Note, after pushing processing may continue or exit, depending on the error and/or the bail threshold.
176
+ errorHandler.pushOrBail(null, 'Syntax-Warning', 'Warning: Strict initialMode is not yet fully implemented.', 'Some validation rules may still be missing or incomplete.');
177
+ if (coreOptions.bailSensitivity === '0-Ignore-Errors') {
178
+ // IMPORTANT: If "silent" option is set, do not log anything to console!
179
+ if (!coreOptions.isQuiet && !coreOptions.isSilent) {
180
+ console.warn(`Warning: The initial mode was set to strict mode, but fail level is set to 'ignore-errors'. This combination is contradictory and might be a mistake.`);
181
+ }
182
+ }
183
+ }
184
+ else {
185
+ (0, print_1.debugPrint)('visitor.visit(..): finalJSResult:');
186
+ (0, env_1.isDebug)() && console.debug(finalJSResult);
187
+ }
188
+ const params = {
189
+ ast,
190
+ coreOptions,
191
+ runtimeInfo,
192
+ _meta_userOpts,
193
+ errorHandler,
194
+ runStartedAt,
195
+ runFinishedAt,
196
+ durationMs,
197
+ timeStartMs,
198
+ timeEnd1Ms,
199
+ timeEnd2Ms,
200
+ timeEnd3Ms,
201
+ timeEnd4Ms,
202
+ };
203
+ const constructedMetadata = (0, resultMetadataBuilder_1.buildResultMetadata)(params);
204
+ (0, print_1.debugPrint)('getNumOfErrors(): ' + errorHandler.getNumOfErrors());
205
+ // Print a summary line at the end if any errors or warnings.
206
+ if (!coreOptions.isQuiet && !coreOptions.isSilent) {
207
+ const errors = errorHandler.getNumOfErrors();
208
+ const warnings = errorHandler.getNumOfWarnings();
209
+ // Notes:
210
+ // - if any errors, print to console **ERROR**.
211
+ // - if no errors but warnings, print to console **WARN**.
212
+ // Otherwise, adds a lot more complexity to auto testing (especially options testing), etc.
213
+ //
214
+ // Also, output one concise summary line (according to "best practices").
215
+ if (coreOptions.bailSensitivity !== '0-Ignore-Errors') {
216
+ /*
217
+ '1-Abort-on-Errors':
218
+ Show summary if: errors >= 1 or warnings >= 3.
219
+
220
+ '2-Abort-Even-on-Warnings':
221
+ Show summary if: errors >= 1 or warnings >= 1
222
+ */
223
+ const numOfWarningsToTrigger = coreOptions.bailSensitivity === '1-Abort-on-Errors' ? 3 : 1;
224
+ if (errors) {
225
+ console.error(`Parsing completed with ${errors} error(s), ${warnings} warning(s). Please see details above.`);
226
+ }
227
+ else if (warnings >= numOfWarningsToTrigger &&
228
+ !coreOptions.isQuiet) {
229
+ console.warn(`Parsing completed with ${errors} error(s), ${warnings} warning(s).`);
230
+ }
231
+ }
232
+ }
233
+ if (coreOptions.isIncludeMeta) {
234
+ return {
235
+ result: finalJSResult,
236
+ meta: !coreOptions.isKeepUndefinedInMeta
237
+ ? (0, object_1.removeUndefinedDeep)(constructedMetadata)
238
+ : constructedMetadata,
239
+ };
240
+ }
241
+ return finalJSResult;
242
+ };
243
+ exports.runPipeline = runPipeline;
244
+ //# sourceMappingURL=pipeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../../src/core/pipeline/pipeline.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,2CAAwC;AACxC,mCAAuD;AACvD,0CAA0C;AAC1C,kFAAyD;AACzD,oFAA4E;AAO5E,+CAAwD;AACxD,6CAA2D;AAC3D,+DAAsC;AACtC,0DAAsD;AAEtD,oDAA8C;AAC9C,oEAGiC;AACjC,qDAGyB;AAEzB;;;;;;;;;;GAUG;AACI,MAAM,WAAW,GAAG,CACvB,WAAmB,EACnB,WAA8B,EAC9B,WAAyB,EACzB,cAA4B,EACE,EAAE;IAChC,IAAA,kBAAU,GAAE,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AAW,CAAC,qBAAqB;gBACpC,CAAC,CAAC,IAAA,4BAAmB,EAAC,mBAAmB,CAAC;gBAC1C,CAAC,CAAC,mBAAmB;SACT,CAAA;IACxB,CAAC;IAED,OAAO,aAA6B,CAAA;AACxC,CAAC,CAAA;AAxTY,QAAA,WAAW,eAwTvB"}
@@ -0,0 +1,19 @@
1
+ import { ParseOptions, ResultMetadata } from '../types';
2
+ import { ErrorDataHandler } from './errorDataHandler';
3
+ import { IParseCoreOptions, IRuntimeInfo, IYiniAST } from './internalTypes';
4
+ export interface IBuildResultMetadataParams {
5
+ ast: IYiniAST;
6
+ coreOptions: IParseCoreOptions;
7
+ runtimeInfo: IRuntimeInfo;
8
+ _meta_userOpts: ParseOptions;
9
+ errorHandler: ErrorDataHandler;
10
+ runStartedAt: string;
11
+ runFinishedAt: string;
12
+ durationMs: number;
13
+ timeStartMs: number;
14
+ timeEnd1Ms: number;
15
+ timeEnd2Ms: number;
16
+ timeEnd3Ms: number;
17
+ timeEnd4Ms: number;
18
+ }
19
+ export declare const buildResultMetadata: (p: IBuildResultMetadataParams) => ResultMetadata;
@@ -0,0 +1,187 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.buildResultMetadata = void 0;
7
+ // const pkg = require('../../package.json')
8
+ const package_json_1 = __importDefault(require("../../package.json")); // NOTE: Requires "resolveJsonModule": true (or "esModuleInterop": true).
9
+ const env_1 = require("../config/env");
10
+ const object_1 = require("../utils/object");
11
+ const print_1 = require("../utils/print");
12
+ const string_1 = require("../utils/string");
13
+ const modeFromRulesMatcher_1 = require("./parsingRules/modeFromRulesMatcher");
14
+ const buildResultMetadata = (p) => {
15
+ // --- Construct meta information -------------------------------------
16
+ const to3 = (n) => {
17
+ if (!n) {
18
+ if ((0, env_1.isProdEnv)()) {
19
+ return 0;
20
+ }
21
+ else {
22
+ (0, print_1.debugPrint)('In buildResultMetadata(..): p.runtimeInfo:');
23
+ (0, print_1.printObject)(p.runtimeInfo);
24
+ (0, print_1.debugPrint)('In buildResultMetadata(..): p.coreOptions:');
25
+ (0, print_1.printObject)(p.coreOptions);
26
+ (0, print_1.debugPrint)('In buildResultMetadata(..): p.durationMs:');
27
+ (0, print_1.printObject)(p.durationMs);
28
+ // p.errorHandler.pushOrBail(null,'Internal-Error', 'to3 received undefined')
29
+ throw Error('to3(..) received undefined');
30
+ }
31
+ }
32
+ return Number.parseFloat(n.toFixed(3));
33
+ };
34
+ // Construct meta data.
35
+ const metadata = {
36
+ parserVersion: package_json_1.default.version,
37
+ mode: p.coreOptions.rules.initialMode,
38
+ totalErrors: p.errorHandler.getNumOfErrors(),
39
+ totalWarnings: p.errorHandler.getNumOfWarnings(),
40
+ totalMessages: p.errorHandler.getNumOfAllMessages(),
41
+ runStartedAt: p.runStartedAt,
42
+ runFinishedAt: p.runFinishedAt,
43
+ durationMs: to3(p.durationMs),
44
+ preservesOrder: true,
45
+ orderGuarantee: 'implementation-defined',
46
+ source: {
47
+ // sourceType: toLowerSnakeCase(ast.sourceType),
48
+ sourceType: (0, string_1.toLowerKebabCase)(p.ast.sourceType),
49
+ fileName: p.ast.fileName,
50
+ hasDocumentTerminator: p.ast.terminatorSeen,
51
+ hasYiniMarker: p.ast.yiniMarkerSeen,
52
+ lineCount: p.runtimeInfo.lineCount,
53
+ byteSize: p.runtimeInfo.fileByteSize,
54
+ sha256: p.runtimeInfo.sha256,
55
+ },
56
+ structure: {
57
+ maxDepth: p.ast.maxDepth,
58
+ sectionCount: p.ast.numOfSections,
59
+ memberCount: p.ast.numOfMembers,
60
+ keysParsedCount: null,
61
+ // objectCount: null,
62
+ // listCount: null,
63
+ sectionNamePaths: p.ast.sectionNamePaths,
64
+ },
65
+ metaSchemaVersion: '1.1.1',
66
+ };
67
+ // Attach optional diagnostics.
68
+ if (p.coreOptions.isWithDiagnostics) {
69
+ const mapLevelKey = (level) => {
70
+ switch (level) {
71
+ case '0-Ignore-Errors':
72
+ return 'ignore-errors';
73
+ case '1-Abort-on-Errors':
74
+ return 'errors';
75
+ case '2-Abort-Even-on-Warnings':
76
+ return 'warnings-and-errors';
77
+ }
78
+ };
79
+ const mapLevelDescription = (level) => {
80
+ switch (level) {
81
+ case '0-Ignore-Errors':
82
+ return 'Continue despite errors.';
83
+ case '1-Abort-on-Errors':
84
+ return 'Abort when errors occur.';
85
+ case '2-Abort-Even-on-Warnings':
86
+ return 'Abort when errors or warnings occur.';
87
+ }
88
+ return null;
89
+ };
90
+ const effectiveMode = (0, modeFromRulesMatcher_1.matchModeFromCoreOptions)(p.coreOptions);
91
+ metadata.diagnostics = {
92
+ failLevel: {
93
+ preferredLevel: p.runtimeInfo.preferredBailSensitivity,
94
+ usedLevelType: p.coreOptions.bailSensitivity,
95
+ usedLevelKey: mapLevelKey(p.coreOptions.bailSensitivity),
96
+ levelDescription: (mapLevelDescription(p.coreOptions.bailSensitivity)),
97
+ },
98
+ errors: {
99
+ errorCount: p.errorHandler.getNumOfErrors(),
100
+ payload: p.errorHandler.getErrors(),
101
+ },
102
+ warnings: {
103
+ warningCount: p.errorHandler.getNumOfWarnings(),
104
+ payload: p.errorHandler.getWarnings(),
105
+ },
106
+ notices: {
107
+ noticeCount: p.errorHandler.getNumOfNotices(),
108
+ payload: p.errorHandler.getNotices(),
109
+ },
110
+ infos: {
111
+ infoCount: p.errorHandler.getNumOfInfos(),
112
+ payload: p.errorHandler.getInfos(),
113
+ },
114
+ environment: {
115
+ NODE_ENV: process.env.NODE_ENV,
116
+ APP_ENV: process.env.APP_ENV,
117
+ lib: {
118
+ nodeEnv: env_1.localNodeEnv,
119
+ appEnv: env_1.localAppEnv,
120
+ flags: { isDev: (0, env_1.isDev)(), isDebug: (0, env_1.isDebug)() },
121
+ },
122
+ },
123
+ effectiveOptions: (0, object_1.sortObjectKeys)({
124
+ effectiveMode: effectiveMode, // Appended.
125
+ // IMPORTANT: (!) These user options MUST be mapped from coreOptions (to user options).
126
+ strictMode: effectiveMode === 'strict' ? true : false,
127
+ failLevel: mapLevelKey(p.coreOptions.bailSensitivity),
128
+ includeMetadata: p.coreOptions.isIncludeMeta,
129
+ includeDiagnostics: p.coreOptions.isWithDiagnostics,
130
+ includeTiming: p.coreOptions.isWithTiming,
131
+ preserveUndefinedInMeta: p.coreOptions.isKeepUndefinedInMeta,
132
+ quiet: p.coreOptions.isQuiet,
133
+ requireDocTerminator: p.coreOptions.rules.requireDocTerminator,
134
+ treatEmptyValueAsNull: p.coreOptions.rules.treatEmptyValueAsNull,
135
+ onDuplicateKey: p.coreOptions.rules.onDuplicateKey,
136
+ }),
137
+ options: (0, object_1.sortObjectKeys)(p._meta_userOpts),
138
+ };
139
+ }
140
+ // Attach optional durations timing data.
141
+ if (p.coreOptions.isWithTiming) {
142
+ metadata.timing = {
143
+ total: !p.coreOptions.isWithTiming
144
+ ? null
145
+ : {
146
+ timeMs: to3(p.durationMs), // durationMs = timeEnd4Ms - timeStartMs
147
+ name: p.runtimeInfo.sourceType === 'Inline'
148
+ ? 'Total'
149
+ : 'Total (excluding phase0 (I/O))',
150
+ },
151
+ phase0: !p.coreOptions.isWithTiming ||
152
+ p.runtimeInfo.sourceType === 'Inline'
153
+ ? undefined
154
+ : {
155
+ timeMs: to3(p.runtimeInfo.timeIoMs),
156
+ name: 'I/O',
157
+ },
158
+ phase1: !p.coreOptions.isWithTiming
159
+ ? null
160
+ : {
161
+ timeMs: to3(p.timeEnd1Ms - p.timeStartMs),
162
+ name: 'Lexing',
163
+ },
164
+ phase2: !p.coreOptions.isWithTiming
165
+ ? null
166
+ : {
167
+ timeMs: to3(p.timeEnd2Ms - p.timeEnd1Ms),
168
+ name: 'Parsing',
169
+ },
170
+ phase3: !p.coreOptions.isWithTiming
171
+ ? null
172
+ : {
173
+ timeMs: to3(p.timeEnd3Ms - p.timeEnd2Ms),
174
+ name: 'AST Building',
175
+ },
176
+ phase4: !p.coreOptions.isWithTiming
177
+ ? null
178
+ : {
179
+ timeMs: to3(p.timeEnd4Ms - p.timeEnd3Ms),
180
+ name: 'Object Building',
181
+ },
182
+ };
183
+ }
184
+ return metadata;
185
+ };
186
+ exports.buildResultMetadata = buildResultMetadata;
187
+ //# sourceMappingURL=resultMetadataBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resultMetadataBuilder.js","sourceRoot":"","sources":["../../src/core/resultMetadataBuilder.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA4C;AAC5C,sEAAoC,CAAC,yEAAyE;AAC9G,uCAMsB;AAEtB,4CAAgD;AAChD,0CAAwD;AACxD,4CAAkD;AASlD,8EAA8E;AAmBvE,MAAM,mBAAmB,GAAG,CAC/B,CAA6B,EACf,EAAE;IAChB,uEAAuE;IACvE,MAAM,GAAG,GAAG,CAAC,CAAS,EAAU,EAAE;QAC9B,IAAI,CAAC,CAAC,EAAE,CAAC;YACL,IAAI,IAAA,eAAS,GAAE,EAAE,CAAC;gBACd,OAAO,CAAC,CAAA;YACZ,CAAC;iBAAM,CAAC;gBACJ,IAAA,kBAAU,EAAC,4CAA4C,CAAC,CAAA;gBACxD,IAAA,mBAAW,EAAC,CAAC,CAAC,WAAW,CAAC,CAAA;gBAC1B,IAAA,kBAAU,EAAC,4CAA4C,CAAC,CAAA;gBACxD,IAAA,mBAAW,EAAC,CAAC,CAAC,WAAW,CAAC,CAAA;gBAC1B,IAAA,kBAAU,EAAC,2CAA2C,CAAC,CAAA;gBACvD,IAAA,mBAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAA;gBACzB,6EAA6E;gBAC7E,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;YAC7C,CAAC;QACL,CAAC;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1C,CAAC,CAAA;IAED,uBAAuB;IACvB,MAAM,QAAQ,GAAmB;QAC7B,aAAa,EAAE,sBAAG,CA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ACI,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;oBACxC,IAAI,EAAE,cAAc;iBACvB;YACP,MAAM,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,YAAY;gBAC/B,CAAC,CAAC,IAAI;gBACN,CAAC,CAAC;oBACI,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;oBACxC,IAAI,EAAE,iBAAiB;iBAC1B;SACV,CAAA;IACL,CAAC;IAED,OAAO,QAAQ,CAAA;AACnB,CAAC,CAAA;AA7LY,QAAA,mBAAmB,uBA6L/B"}
@@ -0,0 +1,21 @@
1
+ import { ParsedObject, ParseOptions, PreferredFailLevel } from '../types';
2
+ /**
3
+ * Private class representing a runtime context for a single parse call.
4
+ *
5
+ * @note This design prevents race conditions: each call gets its own
6
+ * runtimeInfo and related state. Without this, multiple calls
7
+ * (especially in parallel) could overwrite each other's data.
8
+ *
9
+ * @note The following options MUST be respected!
10
+ * quiet?: boolean // Reduce output (show only errors, does not effect warnings and etc. in meta data).
11
+ * silent?: boolean // Suppress all output (even errors, exit code only).
12
+ */
13
+ export declare class YiniRuntime {
14
+ #private;
15
+ constructor(sourceType: 'Inline' | 'File');
16
+ private makeRuntimeInfo;
17
+ doParse(yiniContent: string, strictMode?: boolean, failLevel?: PreferredFailLevel, includeMetadata?: boolean): ParsedObject;
18
+ doParse(yiniContent: string, options?: ParseOptions): ParsedObject;
19
+ doParseFile(filePath: string, strictMode?: boolean, failLevel?: PreferredFailLevel, includeMetadata?: boolean): ParsedObject;
20
+ doParseFile(filePath: string, options?: ParseOptions): ParsedObject;
21
+ }