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.
- package/CHANGELOG.md +50 -2
- package/README.md +2 -2
- package/dist/YINI.d.ts +155 -27
- package/dist/YINI.js +145 -174
- package/dist/YINI.js.map +1 -0
- package/dist/config/env.js +1 -0
- package/dist/config/env.js.map +1 -0
- package/dist/core/{ASTBuilder.d.ts → astBuilder.d.ts} +4 -4
- package/dist/core/{ASTBuilder.js → astBuilder.js} +82 -69
- package/dist/core/astBuilder.js.map +1 -0
- package/dist/core/{ErrorDataHandler.d.ts → errorDataHandler.d.ts} +16 -10
- package/dist/core/{ErrorDataHandler.js → errorDataHandler.js} +115 -109
- package/dist/core/errorDataHandler.js.map +1 -0
- package/dist/core/internalTypes.d.ts +127 -0
- package/dist/core/{types.js → internalTypes.js} +6 -0
- package/dist/core/internalTypes.js.map +1 -0
- package/dist/core/objectBuilder.d.ts +2 -2
- package/dist/core/objectBuilder.js +1 -0
- package/dist/core/objectBuilder.js.map +1 -0
- package/dist/core/options/defaultParserOptions.d.ts +17 -0
- package/dist/core/options/defaultParserOptions.js +46 -0
- package/dist/core/options/defaultParserOptions.js.map +1 -0
- package/dist/core/options/failLevel.d.ts +3 -0
- package/dist/core/options/failLevel.js +27 -0
- package/dist/core/options/failLevel.js.map +1 -0
- package/dist/core/options/optionsFunctions.d.ts +8 -0
- package/dist/core/options/optionsFunctions.js +62 -0
- package/dist/core/options/optionsFunctions.js.map +1 -0
- package/dist/core/parsingRules/modeFromRulesMatcher.d.ts +8 -0
- package/dist/core/parsingRules/modeFromRulesMatcher.js +114 -0
- package/dist/core/parsingRules/modeFromRulesMatcher.js.map +1 -0
- package/dist/core/parsingRules/rulesConstAndGuards.d.ts +7 -0
- package/dist/core/parsingRules/rulesConstAndGuards.js +35 -0
- package/dist/core/parsingRules/rulesConstAndGuards.js.map +1 -0
- package/dist/core/pipeline/errorListeners.d.ts +18 -0
- package/dist/core/pipeline/errorListeners.js +107 -0
- package/dist/core/pipeline/errorListeners.js.map +1 -0
- package/dist/core/pipeline/pipeline.d.ts +18 -0
- package/dist/core/pipeline/pipeline.js +244 -0
- package/dist/core/pipeline/pipeline.js.map +1 -0
- package/dist/core/resultMetadataBuilder.d.ts +19 -0
- package/dist/core/resultMetadataBuilder.js +187 -0
- package/dist/core/resultMetadataBuilder.js.map +1 -0
- package/dist/core/runtime.d.ts +21 -0
- package/dist/core/runtime.js +201 -0
- package/dist/core/runtime.js.map +1 -0
- package/dist/dev/main.d.ts +1 -0
- package/dist/dev/main.js +305 -0
- package/dist/dev/main.js.map +1 -0
- package/dist/grammar/{YiniLexer.js → generated/YiniLexer.js} +2 -1
- package/dist/grammar/generated/YiniLexer.js.map +1 -0
- package/dist/grammar/{YiniParser.js → generated/YiniParser.js} +2 -1
- package/dist/grammar/generated/YiniParser.js.map +1 -0
- package/dist/grammar/{YiniParserVisitor.js → generated/YiniParserVisitor.js} +2 -1
- package/dist/grammar/generated/YiniParserVisitor.js.map +1 -0
- package/dist/index.d.ts +40 -1
- package/dist/index.js +60 -359
- package/dist/index.js.map +1 -0
- package/dist/parsers/extractHeaderParts.d.ts +2 -2
- package/dist/parsers/extractHeaderParts.js +2 -1
- package/dist/parsers/extractHeaderParts.js.map +1 -0
- package/dist/parsers/extractSignificantYiniLine.js +2 -1
- package/dist/parsers/extractSignificantYiniLine.js.map +1 -0
- package/dist/parsers/parseBoolean.js +1 -0
- package/dist/parsers/parseBoolean.js.map +1 -0
- package/dist/parsers/parseNull.js +1 -0
- package/dist/parsers/parseNull.js.map +1 -0
- package/dist/parsers/parseNumber.js +1 -0
- package/dist/parsers/parseNumber.js.map +1 -0
- package/dist/parsers/parseSectionHeader.d.ts +3 -3
- package/dist/parsers/parseSectionHeader.js +2 -1
- package/dist/parsers/parseSectionHeader.js.map +1 -0
- package/dist/parsers/parseString.js +3 -3
- package/dist/parsers/parseString.js.map +1 -0
- package/dist/types/index.d.ts +219 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/number.js +1 -0
- package/dist/utils/number.js.map +1 -0
- package/dist/utils/object.d.ts +12 -0
- package/dist/utils/object.js +41 -1
- package/dist/utils/object.js.map +1 -0
- package/dist/utils/pathAndFileName.js +1 -0
- package/dist/utils/pathAndFileName.js.map +1 -0
- package/dist/utils/print.d.ts +2 -2
- package/dist/utils/print.js +11 -6
- package/dist/utils/print.js.map +1 -0
- package/dist/utils/string.d.ts +5 -0
- package/dist/utils/string.js +10 -1
- package/dist/utils/string.js.map +1 -0
- package/dist/utils/system.js +1 -0
- package/dist/utils/system.js.map +1 -0
- package/dist/{yiniHelpers.d.ts → utils/yiniHelpers.d.ts} +1 -1
- package/dist/{yiniHelpers.js → utils/yiniHelpers.js} +3 -2
- package/dist/utils/yiniHelpers.js.map +1 -0
- package/examples/basic-output.js +12 -12
- package/package.json +11 -6
- package/dist/core/types.d.ts +0 -249
- package/dist/parseEntry.d.ts +0 -3
- package/dist/parseEntry.js +0 -456
- /package/dist/grammar/{YiniLexer.d.ts → generated/YiniLexer.d.ts} +0 -0
- /package/dist/grammar/{YiniParser.d.ts → generated/YiniParser.d.ts} +0 -0
- /package/dist/grammar/{YiniParserVisitor.d.ts → generated/YiniParserVisitor.d.ts} +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapFailLevelToBail = mapFailLevelToBail;
|
|
4
|
+
function mapFailLevelToBail(isStrict, failLevel) {
|
|
5
|
+
let bailLevel = '0-Ignore-Errors';
|
|
6
|
+
if (failLevel === 'auto') {
|
|
7
|
+
if (!isStrict)
|
|
8
|
+
bailLevel = '0-Ignore-Errors';
|
|
9
|
+
if (isStrict)
|
|
10
|
+
bailLevel = '1-Abort-on-Errors';
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
switch (failLevel) {
|
|
14
|
+
case 'ignore-errors':
|
|
15
|
+
bailLevel = '0-Ignore-Errors';
|
|
16
|
+
break;
|
|
17
|
+
case 'errors':
|
|
18
|
+
bailLevel = '1-Abort-on-Errors';
|
|
19
|
+
break;
|
|
20
|
+
case 'warnings-and-errors':
|
|
21
|
+
bailLevel = '2-Abort-Even-on-Warnings';
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return bailLevel;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=failLevel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failLevel.js","sourceRoot":"","sources":["../../../src/core/options/failLevel.ts"],"names":[],"mappings":";;AAKA,gDAwBC;AAxBD,SAAgB,kBAAkB,CAC9B,QAAiB,EACjB,SAA6B;IAE7B,IAAI,SAAS,GAA0B,iBAAiB,CAAA;IAExD,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QACvB,IAAI,CAAC,QAAQ;YAAE,SAAS,GAAG,iBAAiB,CAAA;QAC5C,IAAI,QAAQ;YAAE,SAAS,GAAG,mBAAmB,CAAA;IACjD,CAAC;SAAM,CAAC;QACJ,QAAQ,SAAS,EAAE,CAAC;YAChB,KAAK,eAAe;gBAChB,SAAS,GAAG,iBAAiB,CAAA;gBAC7B,MAAK;YACT,KAAK,QAAQ;gBACT,SAAS,GAAG,mBAAmB,CAAA;gBAC/B,MAAK;YACT,KAAK,qBAAqB;gBACtB,SAAS,GAAG,0BAA0B,CAAA;gBACtC,MAAK;QACb,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAA;AACpB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ParseOptions } from '../../types';
|
|
2
|
+
import { IParseCoreOptions, TBailSensitivityLevel, TParserMode } from '../internalTypes';
|
|
3
|
+
/**
|
|
4
|
+
* Map user parse options to core options.
|
|
5
|
+
*/
|
|
6
|
+
export declare const toCoreOptions: (userOpts: Required<ParseOptions>, bailLevel?: TBailSensitivityLevel) => IParseCoreOptions;
|
|
7
|
+
export declare const isOptionsObjectForm: (v: unknown) => v is ParseOptions;
|
|
8
|
+
export declare const inferModeFromArgs: (arg2?: boolean | ParseOptions) => TParserMode;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inferModeFromArgs = exports.isOptionsObjectForm = exports.toCoreOptions = void 0;
|
|
4
|
+
const env_1 = require("../../config/env");
|
|
5
|
+
const failLevel_1 = require("./failLevel");
|
|
6
|
+
/**
|
|
7
|
+
* Map user parse options to core options.
|
|
8
|
+
*/
|
|
9
|
+
const toCoreOptions = (userOpts, bailLevel) => {
|
|
10
|
+
const level = bailLevel ?? (0, failLevel_1.mapFailLevelToBail)(userOpts.strictMode, userOpts.failLevel);
|
|
11
|
+
return {
|
|
12
|
+
rules: {
|
|
13
|
+
initialMode: userOpts.strictMode ? 'strict' : 'lenient',
|
|
14
|
+
onDuplicateKey: userOpts.onDuplicateKey,
|
|
15
|
+
requireDocTerminator: userOpts.requireDocTerminator,
|
|
16
|
+
treatEmptyValueAsNull: userOpts.treatEmptyValueAsNull,
|
|
17
|
+
},
|
|
18
|
+
bailSensitivity: level,
|
|
19
|
+
isIncludeMeta: userOpts.includeMetadata,
|
|
20
|
+
isWithDiagnostics: (0, env_1.isDev)() || (0, env_1.isDebug)() || userOpts.includeDiagnostics,
|
|
21
|
+
isWithTiming: (0, env_1.isDev)() || (0, env_1.isDebug)() || userOpts.includeTiming,
|
|
22
|
+
isKeepUndefinedInMeta: (0, env_1.isDebug)() || userOpts.preserveUndefinedInMeta,
|
|
23
|
+
isQuiet: userOpts.quiet, // Dup of suppressWarnings!
|
|
24
|
+
isSilent: userOpts.silent,
|
|
25
|
+
isThrowOnError: userOpts.throwOnError,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
exports.toCoreOptions = toCoreOptions;
|
|
29
|
+
// Type guard: did the caller use the options-object form?
|
|
30
|
+
const isOptionsObjectForm = (v) => {
|
|
31
|
+
return (v != null &&
|
|
32
|
+
typeof v === 'object' &&
|
|
33
|
+
// Note: If one wants, this can be relax to "typeof v === 'object'"
|
|
34
|
+
// but this keeps accidental booleans/strings out.
|
|
35
|
+
('strictMode' in v ||
|
|
36
|
+
'failLevel' in v ||
|
|
37
|
+
'includeMetadata' in v ||
|
|
38
|
+
'includeDiagnostics' in v ||
|
|
39
|
+
'includeTiming' in v ||
|
|
40
|
+
'preserveUndefinedInMeta' in v ||
|
|
41
|
+
'onDuplicateKey' in v ||
|
|
42
|
+
'requireDocTerminator' in v ||
|
|
43
|
+
'treatEmptyValueAsNull' in v ||
|
|
44
|
+
'quiet' in v ||
|
|
45
|
+
'silent' in v ||
|
|
46
|
+
'isThrowOnError' in v));
|
|
47
|
+
};
|
|
48
|
+
exports.isOptionsObjectForm = isOptionsObjectForm;
|
|
49
|
+
const inferModeFromArgs = (arg2) => {
|
|
50
|
+
if (typeof arg2 === 'boolean') {
|
|
51
|
+
return arg2 ? 'strict' : 'lenient';
|
|
52
|
+
}
|
|
53
|
+
if (arg2 && typeof arg2 === 'object') {
|
|
54
|
+
const sm = arg2.strictMode;
|
|
55
|
+
if (typeof sm === 'boolean') {
|
|
56
|
+
return sm ? 'strict' : 'lenient';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return 'lenient';
|
|
60
|
+
};
|
|
61
|
+
exports.inferModeFromArgs = inferModeFromArgs;
|
|
62
|
+
//# sourceMappingURL=optionsFunctions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optionsFunctions.js","sourceRoot":"","sources":["../../../src/core/options/optionsFunctions.ts"],"names":[],"mappings":";;;AAAA,0CAAiD;AAOjD,2CAAgD;AAEhD;;GAEG;AACI,MAAM,aAAa,GAAG,CACzB,QAAgC,EAChC,SAAiC,EAChB,EAAE;IACnB,MAAM,KAAK,GACP,SAAS,IAAI,IAAA,8B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AQ,IAAK,CAAS;YACtB,gBAAgB,IAAK,CAAS,CAAC,CACtC,CAAA;AACL,CAAC,CAAA;AAnBY,QAAA,mBAAmB,uBAmB/B;AAEM,MAAM,iBAAiB,GAAG,CAC7B,IAA6B,EAClB,EAAE;IACb,IAAI,OAAO,IAAI,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAA;IACtC,CAAC;IACD,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACnC,MAAM,EAAE,GAAI,IAAqB,CAAC,UAAU,CAAA;QAC5C,IAAI,OAAO,EAAE,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAA;QACpC,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAA;AACpB,CAAC,CAAA;AAbY,QAAA,iBAAiB,qBAa7B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ParseOptions } from 'querystring';
|
|
2
|
+
import { IParseCoreOptions, TExactMode } from '../internalTypes';
|
|
3
|
+
export declare const matchModeFromParseOptions: (parserOptions: ParseOptions) => TExactMode;
|
|
4
|
+
/**
|
|
5
|
+
* Determines the effective parse mode from the current options (option rules).
|
|
6
|
+
* @returns 'custom' if no exact match exists, otherwise the matched mode.
|
|
7
|
+
*/
|
|
8
|
+
export declare const matchModeFromCoreOptions: (coreOptions: IParseCoreOptions) => TExactMode;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.matchModeFromCoreOptions = exports.matchModeFromParseOptions = void 0;
|
|
4
|
+
const env_1 = require("../../config/env");
|
|
5
|
+
const print_1 = require("../../utils/print");
|
|
6
|
+
const errorDataHandler_1 = require("../errorDataHandler");
|
|
7
|
+
const optionsFunctions_1 = require("../options/optionsFunctions");
|
|
8
|
+
const MODE_PROFILES = {
|
|
9
|
+
lenient: [0, 0, 0],
|
|
10
|
+
// moderate: [1, 0, 1],
|
|
11
|
+
strict: [2, 0, 2],
|
|
12
|
+
//'pedantic'
|
|
13
|
+
//'paranoid'
|
|
14
|
+
};
|
|
15
|
+
const matchModeFromParseOptions = (parserOptions) => (0, exports.matchModeFromCoreOptions)((0, optionsFunctions_1.toCoreOptions)(parserOptions));
|
|
16
|
+
exports.matchModeFromParseOptions = matchModeFromParseOptions;
|
|
17
|
+
/**
|
|
18
|
+
* Determines the effective parse mode from the current options (option rules).
|
|
19
|
+
* @returns 'custom' if no exact match exists, otherwise the matched mode.
|
|
20
|
+
*/
|
|
21
|
+
const matchModeFromCoreOptions = (coreOptions) => {
|
|
22
|
+
(0, print_1.debugPrint)('-> matchModeFromRules(..):');
|
|
23
|
+
if (!coreOptions?.rules) {
|
|
24
|
+
// Note, after pushing processing may continue or exit, depending on the error and/or the bail threshold.
|
|
25
|
+
new errorDataHandler_1.ErrorDataHandler('None/Ignore').pushOrBail(null, 'Fatal-Error', `The passed input object is missing rules object.`, 'Option might be of wrong type, it must be core options.');
|
|
26
|
+
}
|
|
27
|
+
// debugPrint(
|
|
28
|
+
// 'coreOptions.rules.?onDuplicateKey = ' +
|
|
29
|
+
// coreOptions.rules?.onDuplicateKey,
|
|
30
|
+
// )
|
|
31
|
+
// debugPrint(
|
|
32
|
+
// 'coreOptions.rules.?requireDocTerminator = ' +
|
|
33
|
+
// coreOptions.rules?.requireDocTerminator,
|
|
34
|
+
// )
|
|
35
|
+
// debugPrint(
|
|
36
|
+
// 'coreOptions.rules.?treatEmptyValueAsNull = ' +
|
|
37
|
+
// coreOptions.rules?.treatEmptyValueAsNull,
|
|
38
|
+
// )
|
|
39
|
+
const rules = { ...coreOptions.rules };
|
|
40
|
+
// if (rules.onDuplicateKey === 'error') {
|
|
41
|
+
// if (rules.treatEmptyValueAsNull == 'disallow') {
|
|
42
|
+
// return 'strict'
|
|
43
|
+
// }
|
|
44
|
+
// return 'lenient'
|
|
45
|
+
// }
|
|
46
|
+
// return 'custom'
|
|
47
|
+
const res = inferTParserModeExact(rules);
|
|
48
|
+
(0, print_1.debugPrint)(' mode = ' + res.mode);
|
|
49
|
+
(0, print_1.debugPrint)(' vector = ' + res.vector);
|
|
50
|
+
(0, print_1.debugPrint)('matchedProfile = ' + res.matchedProfile);
|
|
51
|
+
return res.mode;
|
|
52
|
+
};
|
|
53
|
+
exports.matchModeFromCoreOptions = matchModeFromCoreOptions;
|
|
54
|
+
/**
|
|
55
|
+
* Infer mode by **exact vector match** to a canonical profile (option rules).
|
|
56
|
+
* If no exact match exists, returns 'custom'.
|
|
57
|
+
*/
|
|
58
|
+
const inferTParserModeExact = (rules) => {
|
|
59
|
+
// debugPrint('-> inferTParserModeExact(..):')
|
|
60
|
+
// debugPrint('rules.onDuplicateKey = ' + rules.onDuplicateKey)
|
|
61
|
+
// debugPrint('rules.requireDocTerminator = ' + rules.requireDocTerminator)
|
|
62
|
+
// debugPrint('rules.treatEmptyValueAsNull = ' + rules.treatEmptyValueAsNull)
|
|
63
|
+
// Note, **each rule** is scored on a strictness scale (0 = lenient, 1 = medium, 2 = strict).
|
|
64
|
+
const vector = [
|
|
65
|
+
scoreDupl(rules.onDuplicateKey),
|
|
66
|
+
scoreTerm(rules.requireDocTerminator),
|
|
67
|
+
scoreEmpty(rules.treatEmptyValueAsNull),
|
|
68
|
+
];
|
|
69
|
+
(0, print_1.debugPrint)('** vector:');
|
|
70
|
+
// isDebug() && printObject(vector)
|
|
71
|
+
(0, env_1.isDebug)() && console.log(vector);
|
|
72
|
+
for (const mode of Object.keys(MODE_PROFILES)) {
|
|
73
|
+
if (vecEquals(vector, MODE_PROFILES[mode])) {
|
|
74
|
+
return { mode, vector, matchedProfile: mode };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return { mode: 'custom', vector };
|
|
78
|
+
};
|
|
79
|
+
const scoreDupl = (v) => {
|
|
80
|
+
switch (v) {
|
|
81
|
+
case 'keep-first':
|
|
82
|
+
case 'warn-and-keep-first':
|
|
83
|
+
return 0; // Rule in lenient mode.
|
|
84
|
+
case 'overwrite':
|
|
85
|
+
case 'warn-and-overwrite':
|
|
86
|
+
return 1;
|
|
87
|
+
case 'error':
|
|
88
|
+
return 2; // Rule in strict mode.
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const scoreTerm = (v) => {
|
|
92
|
+
switch (v) {
|
|
93
|
+
case 'optional':
|
|
94
|
+
return 0; // Rule in lenient and strict mode.
|
|
95
|
+
case 'warn-if-missing':
|
|
96
|
+
return 1;
|
|
97
|
+
case 'required':
|
|
98
|
+
return 2;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const scoreEmpty = (v) => {
|
|
102
|
+
switch (v) {
|
|
103
|
+
case 'allow':
|
|
104
|
+
return 0; // Rule in lenient mode.
|
|
105
|
+
case 'allow-with-warning':
|
|
106
|
+
return 1;
|
|
107
|
+
case 'disallow':
|
|
108
|
+
return 2; // Rule in strict mode.
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
const vecEquals = (a, b) => {
|
|
112
|
+
return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=modeFromRulesMatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modeFromRulesMatcher.js","sourceRoot":"","sources":["../../../src/core/parsingRules/modeFromRulesMatcher.ts"],"names":[],"mappings":";;;AACA,0CAA0C;AAO1C,6CAA2D;AAC3D,0DAAsD;AAOtD,kEAA2D;AAE3D,MAAM,aAAa,GAA+B;IAC9C,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAClB,yBAAyB;IACzB,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACjB,YAAY;IACZ,YAAY;CACf,CAAA;AAUM,MA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ACD,MAAM,UAAU,GAAG,CAAC,CAAiB,EAAc,EAAE;IACjD,QAAQ,CAAC,EAAE,CAAC;QACR,KAAK,OAAO;YACR,OAAO,CAAC,CAAA,CAAC,wBAAwB;QACrC,KAAK,oBAAoB;YACrB,OAAO,CAAC,CAAA;QACZ,KAAK,UAAU;YACX,OAAO,CAAC,CAAA,CAAC,uBAAuB;IACxC,CAAC;AACL,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,CAAQ,EAAE,CAAQ,EAAW,EAAE;IAC9C,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AAC1D,CAAC,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DocumentTerminatorRule, DuplicateKeyPolicy, EmptyValueRule } from '../../types';
|
|
2
|
+
export declare const DuplicateKeyPolicies: readonly ["error", "warn-and-keep-first", "warn-and-overwrite", "keep-first", "overwrite"];
|
|
3
|
+
export declare const DocumentTerminatorRules: readonly ["optional", "warn-if-missing", "required"];
|
|
4
|
+
export declare const EmptyValueRules: readonly ["allow", "allow-with-warning", "disallow"];
|
|
5
|
+
export declare const isDuplicateKeyPolicy: (v: unknown) => v is DuplicateKeyPolicy;
|
|
6
|
+
export declare const isDocumentTerminatorRule: (v: unknown) => v is DocumentTerminatorRule;
|
|
7
|
+
export declare const isEmptyValueRule: (v: unknown) => v is EmptyValueRule;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// --- Parsing Rule Values -------------------------------------------------
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.isEmptyValueRule = exports.isDocumentTerminatorRule = exports.isDuplicateKeyPolicy = exports.EmptyValueRules = exports.DocumentTerminatorRules = exports.DuplicateKeyPolicies = void 0;
|
|
5
|
+
/*
|
|
6
|
+
NOTE: These rule values are re-exported as **types** (derived from these consants) in types/index.ts.
|
|
7
|
+
NOTE: These constant gives runtime access as they are also used in error messages.
|
|
8
|
+
*/
|
|
9
|
+
exports.DuplicateKeyPolicies = [
|
|
10
|
+
'error',
|
|
11
|
+
'warn-and-keep-first', // Keep first with a warning.
|
|
12
|
+
'warn-and-overwrite', // 'warn-and-overwrite' = 'warn-and-keep-last'
|
|
13
|
+
'keep-first', // Silent, first wins.
|
|
14
|
+
'overwrite', // Silent, last wins.
|
|
15
|
+
];
|
|
16
|
+
exports.DocumentTerminatorRules = [
|
|
17
|
+
'optional',
|
|
18
|
+
'warn-if-missing',
|
|
19
|
+
'required',
|
|
20
|
+
];
|
|
21
|
+
exports.EmptyValueRules = [
|
|
22
|
+
'allow',
|
|
23
|
+
'allow-with-warning',
|
|
24
|
+
'disallow',
|
|
25
|
+
];
|
|
26
|
+
// --- Runtime Guards ------------------------------------------------------
|
|
27
|
+
const isDuplicateKeyPolicy = (v) => typeof v === 'string' &&
|
|
28
|
+
exports.DuplicateKeyPolicies.includes(v);
|
|
29
|
+
exports.isDuplicateKeyPolicy = isDuplicateKeyPolicy;
|
|
30
|
+
const isDocumentTerminatorRule = (v) => typeof v === 'string' &&
|
|
31
|
+
exports.DocumentTerminatorRules.includes(v);
|
|
32
|
+
exports.isDocumentTerminatorRule = isDocumentTerminatorRule;
|
|
33
|
+
const isEmptyValueRule = (v) => typeof v === 'string' && exports.EmptyValueRules.includes(v);
|
|
34
|
+
exports.isEmptyValueRule = isEmptyValueRule;
|
|
35
|
+
//# sourceMappingURL=rulesConstAndGuards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rulesConstAndGuards.js","sourceRoot":"","sources":["../../../src/core/parsingRules/rulesConstAndGuards.ts"],"names":[],"mappings":";AAAA,4EAA4E;;;AAQ5E;;;EAGE;AAEW,QAAA,oBAAoB,GAAG;IAChC,OAAO;IACP,qBAAqB,EAAE,6BAA6B;IACpD,oBAAoB,EAAE,8CAA8C;IACpE,YAAY,EAAE,sBAAsB;IACpC,WAAW,EAAE,qBAAqB;CAC5B,CAAA;AAEG,QAAA,uBAAuB,GAAG;IACnC,UAAU;IACV,iBAAiB;IACjB,UAAU;CACJ,CAAA;AAEG,QAAA,eAAe,GAAG;IAC3B,OAAO;IACP,oBAAoB;IACpB,UAAU;CACJ,CAAA;AAEV,4EAA4E;AAErE,MAAM,oBAAoB,GAAG,CAAC,CAAU,EAA2B,EAAE,CACxE,OAAO,CAAC,KAAK,QAAQ;IACpB,4BAA0C,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;AAF9C,QAAA,oBAAoB,wBAE0B;AAEpD,MAAM,wBAAwB,GAAG,CACpC,CAAU,EACiB,EAAE,CAC7B,OAAO,CAAC,KAAK,QAAQ;IACpB,+BAA6C,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;AAJjD,QAAA,wBAAwB,4BAIyB;AAEvD,MAAM,gBAAgB,GAAG,CAAC,CAAU,EAAuB,EAAE,CAChE,OAAO,CAAC,KAAK,QAAQ,IAAK,uBAAqC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;AADlE,QAAA,gBAAgB,oBACkD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ErrorListener, RecognitionException } from 'antlr4';
|
|
2
|
+
import { ErrorDataHandler } from '../errorDataHandler';
|
|
3
|
+
export declare const createLexerErrorListener: (errorHandler: ErrorDataHandler) => MyLexerErrorListener;
|
|
4
|
+
export declare const createParserErrorListener: (errorHandler: ErrorDataHandler) => MyParserErrorListener;
|
|
5
|
+
declare class MyLexerErrorListener implements ErrorListener<any> {
|
|
6
|
+
private errorHandler;
|
|
7
|
+
constructor(errorHandler: ErrorDataHandler);
|
|
8
|
+
syntaxError(recognizer: any, offendingSymbol: any, line: number, charPositionInLine: number, msg: string, e: RecognitionException | undefined): void;
|
|
9
|
+
}
|
|
10
|
+
declare class MyParserErrorListener implements ErrorListener<any> {
|
|
11
|
+
private errorHandler;
|
|
12
|
+
constructor(errorHandler: ErrorDataHandler);
|
|
13
|
+
syntaxError(recognizer: any, offendingSymbol: any, line: number, charPositionInLine: number, msg: string, e: RecognitionException | undefined): void;
|
|
14
|
+
reportAmbiguity(...args: any[]): void;
|
|
15
|
+
reportAttemptingFullContext(...args: any[]): void;
|
|
16
|
+
reportContextSensitivity(...args: any[]): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createParserErrorListener = exports.createLexerErrorListener = void 0;
|
|
4
|
+
const util_1 = require("util");
|
|
5
|
+
const antlr4_1 = require("antlr4");
|
|
6
|
+
const env_1 = require("../../config/env");
|
|
7
|
+
const YiniParser_1 = require("../../grammar/generated/YiniParser");
|
|
8
|
+
const print_1 = require("../../utils/print");
|
|
9
|
+
const createLexerErrorListener = (errorHandler) => {
|
|
10
|
+
return new MyLexerErrorListener(errorHandler);
|
|
11
|
+
};
|
|
12
|
+
exports.createLexerErrorListener = createLexerErrorListener;
|
|
13
|
+
const createParserErrorListener = (errorHandler) => {
|
|
14
|
+
return new MyParserErrorListener(errorHandler);
|
|
15
|
+
};
|
|
16
|
+
exports.createParserErrorListener = createParserErrorListener;
|
|
17
|
+
/**
|
|
18
|
+
* @param line Line number as 1-based.
|
|
19
|
+
* @param col Column number as 0-based.
|
|
20
|
+
*
|
|
21
|
+
* @note Refactor away this function if possible, due to this context ad-hoc
|
|
22
|
+
* is brittle, it relies on runtime internals of ANTLR generated code.
|
|
23
|
+
*/
|
|
24
|
+
const createGeneralCtx = (line, endColumn, startColumn = undefined) => {
|
|
25
|
+
const startToken = new antlr4_1.Token();
|
|
26
|
+
const stopToken = new antlr4_1.Token();
|
|
27
|
+
const ctx = new YiniParser_1.YiniContext();
|
|
28
|
+
ctx.start = startToken;
|
|
29
|
+
ctx.stop = stopToken;
|
|
30
|
+
ctx.start.line = line; // Note: Line num is 1-based.
|
|
31
|
+
// if (startColumn && startColumn >= 0) {
|
|
32
|
+
if (startColumn !== undefined) {
|
|
33
|
+
ctx.start.column = startColumn; // Note: Column num is 0-based.
|
|
34
|
+
ctx.stop.line = line;
|
|
35
|
+
}
|
|
36
|
+
ctx.stop.column = endColumn; // Note: Column num is 0-based.
|
|
37
|
+
return ctx;
|
|
38
|
+
};
|
|
39
|
+
const parsePossibleStartCol = (errorHandler, recognizer) => {
|
|
40
|
+
let possibleStartCol = undefined;
|
|
41
|
+
try {
|
|
42
|
+
possibleStartCol = recognizer?._ctx.start?.column
|
|
43
|
+
? recognizer?._ctx.start?.column + 1
|
|
44
|
+
: undefined;
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
let msgHint = '';
|
|
48
|
+
if ((0, util_1.isError)(err)) {
|
|
49
|
+
msgHint = 'Error: ' + err.message;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
msgHint = 'Thrown value:' + JSON.stringify(err);
|
|
53
|
+
}
|
|
54
|
+
if ((0, env_1.isProdEnv)()) {
|
|
55
|
+
// return 0
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
errorHandler.pushOrBail(null, 'Internal-Error', 'Catched error of possibleStartCol in parser grammar listener.', msgHint);
|
|
59
|
+
}
|
|
60
|
+
return possibleStartCol;
|
|
61
|
+
};
|
|
62
|
+
class MyLexerErrorListener {
|
|
63
|
+
constructor(errorHandler) {
|
|
64
|
+
this.errorHandler = errorHandler;
|
|
65
|
+
}
|
|
66
|
+
syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e) {
|
|
67
|
+
// Handle the error as you want:
|
|
68
|
+
(0, print_1.debugPrint)('ANTLR lexer cached an error');
|
|
69
|
+
const col = charPositionInLine + 1;
|
|
70
|
+
const possibleStartCol = parsePossibleStartCol(this.errorHandler, recognizer);
|
|
71
|
+
// const msgWhat = `Syntax error at line ${line}, column ${col}:`
|
|
72
|
+
const msgWhat = `Syntax error`;
|
|
73
|
+
// Try to map message:
|
|
74
|
+
// From: "mismatched input '/END' expecting <EOF>"
|
|
75
|
+
// To: "Found '/END', but expected the end of the document."
|
|
76
|
+
// const msgWhy = `${capitalizeFirst(msg)}`
|
|
77
|
+
const msgWhy = `Details: ${msg}`;
|
|
78
|
+
// const msgHint = ``
|
|
79
|
+
const ctx = createGeneralCtx(line, charPositionInLine, possibleStartCol); // So we can show line/col in error message.
|
|
80
|
+
// Note, after pushing processing may continue or exit, depending on the error and/or the bail threshold.
|
|
81
|
+
this.errorHandler.pushOrBail(ctx, 'Syntax-Error', msgWhat, msgWhy);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
class MyParserErrorListener {
|
|
85
|
+
constructor(errorHandler) {
|
|
86
|
+
this.errorHandler = errorHandler;
|
|
87
|
+
}
|
|
88
|
+
syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e) {
|
|
89
|
+
(0, print_1.debugPrint)('ANTLR parser cached an error');
|
|
90
|
+
const col = charPositionInLine + 1;
|
|
91
|
+
const possibleStartCol = parsePossibleStartCol(this.errorHandler, recognizer);
|
|
92
|
+
const msgWhat = `Syntax error`;
|
|
93
|
+
// Try to map message:
|
|
94
|
+
// From: "mismatched input '/END' expecting <EOF>"
|
|
95
|
+
// To: "Found '/END', but expected the end of the document."
|
|
96
|
+
// const msgWhy = `${capitalizeFirst(msg)}`
|
|
97
|
+
const msgWhy = `Details: ${msg}`;
|
|
98
|
+
const ctx = createGeneralCtx(line, charPositionInLine, possibleStartCol); // So we can show line/col in error message.
|
|
99
|
+
// Note, after pushing processing may continue or exit, depending on the error and/or the bail threshold.
|
|
100
|
+
this.errorHandler.pushOrBail(ctx, 'Syntax-Error', msgWhat, msgWhy);
|
|
101
|
+
}
|
|
102
|
+
// The following are required for the interface, but can be left empty.
|
|
103
|
+
reportAmbiguity(...args) { }
|
|
104
|
+
reportAttemptingFullContext(...args) { }
|
|
105
|
+
reportContextSensitivity(...args) { }
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=errorListeners.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorListeners.js","sourceRoot":"","sources":["../../../src/core/pipeline/errorListeners.ts"],"names":[],"mappings":";;;AAAA,+BAA8B;AAC9B,mCAAmE;AACnE,0CAA4C;AAC5C,mEAAgE;AAChE,6CAA8C;AAGvC,MAAM,wBAAwB,GAAG,CACpC,YAA8B,EACV,EAAE;IACtB,OAAO,IAAI,oBAAoB,CAAC,YAAY,CAAC,CAAA;AACjD,CAAC,CAAA;AAJY,QAAA,wBAAwB,4BAIpC;AAEM,MAAM,yBAAyB,GAAG,CACrC,YAA8B,EACT,EAAE;IACvB,OAAO,IAAI,qBAAqB,CAAC,YAAY,CAAC,CAAA;AAClD,CAAC,CAAA;AAJY,QAAA,yBAAyB,6BAIrC;AAED;;;;;;GAMG;AACH,MAAM,gBAAgB,GAAG,CACrB,IAAY,EACZ,SAAiB,EACjB,cAAkC,SAAS,EAChC,EAAE;IACb,MAAM,UAAU,GAAG,IAAI,cAAK,EAAE,CAAA;IAC9B,MAAM,SAAS,GAAG,IAAI,cAAK,EAAE,CAAA;IAC7B,MAAM,GAAG,GAAG,IAAI,wBAAW,EAAE,CAAA;IAC7B,GAAG,CAAC,KAAK,GAAG,UAAU,CAAA;IACtB,GAAG,CAAC,IAAI,GAAG,SAAS,CAAA;IAEpB,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAA,CAAC,6BAA6B;IACnD,yCAAyC;IACzC,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC5B,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,WAAW,CAAA,CAAC,+BAA+B;QAC9D,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IACxB,CAAC;IAED,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,SAA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IAAW,IAAS,CAAC;IACpD,wBAAwB,CAAC,GAAG,IAAW,IAAS,CAAC;CACpD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is the orchestrator that wires up the pipeline (lexer → parser →
|
|
3
|
+
* astBuilder → objectBuilder, etc.)
|
|
4
|
+
*/
|
|
5
|
+
import { ParsedObject, ParseOptions, YiniParseResult } from '../../types';
|
|
6
|
+
import { IParseCoreOptions, IRuntimeInfo } from '../internalTypes';
|
|
7
|
+
/**
|
|
8
|
+
* @internal Single source of truth.
|
|
9
|
+
*
|
|
10
|
+
* Entrypoint for the YINI parsing pipeline:
|
|
11
|
+
* tokenization → grammar parse → AST build → object build → result.
|
|
12
|
+
*
|
|
13
|
+
* @param _meta_userOpts The user options from which the core options were
|
|
14
|
+
* derived/resolved from. This object is provided only for debugging
|
|
15
|
+
* and metadata purposes and should not be relied upon in
|
|
16
|
+
* application logic.
|
|
17
|
+
*/
|
|
18
|
+
export declare const runPipeline: (yiniContent: string, coreOptions: IParseCoreOptions, runtimeInfo: IRuntimeInfo, _meta_userOpts: ParseOptions) => ParsedObject | YiniParseResult;
|