yini-parser 1.4.3 → 1.5.0
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 +19 -0
- package/README.md +18 -12
- package/dist/YINI.d.ts +9 -13
- package/dist/YINI.js +3 -3
- package/dist/YINI.js.map +1 -1
- package/dist/core/astBuilder.d.ts +3 -6
- package/dist/core/astBuilder.js +80 -49
- package/dist/core/astBuilder.js.map +1 -1
- package/dist/core/objectBuilder.d.ts +8 -4
- package/dist/core/objectBuilder.js +31 -61
- package/dist/core/objectBuilder.js.map +1 -1
- package/dist/core/options/defaultParserOptions.js +9 -1
- package/dist/core/options/defaultParserOptions.js.map +1 -1
- package/dist/core/options/optionsFunctions.js +1 -3
- package/dist/core/options/optionsFunctions.js.map +1 -1
- package/dist/core/parsingRules/modeFromRulesMatcher.d.ts +1 -1
- package/dist/core/parsingRules/modeFromRulesMatcher.js +22 -13
- package/dist/core/parsingRules/modeFromRulesMatcher.js.map +1 -1
- package/dist/core/pipeline/pipeline.js +4 -0
- package/dist/core/pipeline/pipeline.js.map +1 -1
- package/dist/dev/main.js +55 -84
- package/dist/dev/main.js.map +1 -1
- package/dist/grammar/generated/YiniLexer.d.ts +43 -49
- package/dist/grammar/generated/YiniLexer.js +320 -332
- package/dist/grammar/generated/YiniLexer.js.map +1 -1
- package/dist/grammar/generated/YiniParser.d.ts +60 -82
- package/dist/grammar/generated/YiniParser.js +461 -726
- package/dist/grammar/generated/YiniParser.js.map +1 -1
- package/dist/grammar/generated/YiniParserVisitor.d.ts +7 -7
- package/dist/grammar/generated/YiniParserVisitor.js +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/dev/main.js
CHANGED
|
@@ -17,7 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
const env_1 = require("../config/env");
|
|
18
18
|
const print_1 = require("../utils/print");
|
|
19
19
|
const YINI_1 = __importDefault(require("../YINI"));
|
|
20
|
-
const defect_inputs_1 = require("./quick-test-samples/defect-inputs");
|
|
21
20
|
require("./quick-test-samples/valid-inputs"); // validConfigComplex,
|
|
22
21
|
(0, print_1.debugPrint)();
|
|
23
22
|
(0, print_1.debugPrint)('-> Entered dev/main.ts');
|
|
@@ -56,101 +55,73 @@ else {
|
|
|
56
55
|
^ App
|
|
57
56
|
// val = 3e3
|
|
58
57
|
// 3val = 33
|
|
59
|
-
name = "Shebang-\\"demo"
|
|
60
|
-
value = c"Hello World"
|
|
61
|
-
badEscape = c"E:\\logs\\nebula\\app.log"
|
|
62
|
-
|
|
58
|
+
// name = "Shebang-\\"demo"
|
|
59
|
+
// value = c"Hello World"
|
|
60
|
+
// badEscape = c"E:\\logs\\nebula\\app.log"
|
|
61
|
+
// \`value\`.B = "dfdfgd"
|
|
62
|
+
// value.A = "gdfgdf"
|
|
63
|
+
|
|
64
|
+
num1 = 10
|
|
65
|
+
num2 = null
|
|
66
|
+
num3 = Null
|
|
67
|
+
num4 = NULL
|
|
68
|
+
num5 = nULL
|
|
69
|
+
num6 =
|
|
70
|
+
num20 = 20
|
|
63
71
|
`;
|
|
64
72
|
console.log('--start0------------------------------------------');
|
|
65
73
|
const res0 = YINI_1.default.parse(yiniContent, {
|
|
66
74
|
strictMode: false,
|
|
67
|
-
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
// requireDocTerminator: 'optional',
|
|
75
|
+
treatEmptyValueAsNull: 'disallow',
|
|
76
|
+
// throwOnError: true,
|
|
77
|
+
// failLevel: 'errors',
|
|
71
78
|
});
|
|
72
79
|
console.log('res0:');
|
|
73
80
|
console.log(res0);
|
|
74
81
|
console.log('--end------------------------------------------\n');
|
|
75
|
-
console.log('--
|
|
76
|
-
const
|
|
77
|
-
strictMode: true,
|
|
78
|
-
failLevel: 'ignore-errors',
|
|
79
|
-
// includeMetadata: true,
|
|
80
|
-
// includeDiagnostics: true,
|
|
81
|
-
// requireDocTerminator: 'optional',
|
|
82
|
-
});
|
|
83
|
-
console.log('res2:');
|
|
84
|
-
console.log(res2);
|
|
85
|
-
console.log('--end------------------------------------------\n');
|
|
86
|
-
console.log('--start3------------------------------------------');
|
|
87
|
-
const res3 = YINI_1.default.parse(defect_inputs_1.defectConfigCombo3, {
|
|
88
|
-
strictMode: false,
|
|
89
|
-
failLevel: 'ignore-errors',
|
|
90
|
-
// includeMetadata: true,
|
|
91
|
-
// includeDiagnostics: true,
|
|
92
|
-
// requireDocTerminator: 'optional',
|
|
93
|
-
});
|
|
94
|
-
console.log('res3:');
|
|
95
|
-
console.log(res3);
|
|
96
|
-
console.log('--end------------------------------------------\n');
|
|
97
|
-
console.log('--start4------------------------------------------');
|
|
98
|
-
const res4 = YINI_1.default.parse(defect_inputs_1.defectConfigCombo3, {
|
|
99
|
-
strictMode: true,
|
|
100
|
-
failLevel: 'ignore-errors',
|
|
101
|
-
// includeMetadata: true,
|
|
102
|
-
// includeDiagnostics: true,
|
|
103
|
-
// requireDocTerminator: 'optional',
|
|
104
|
-
});
|
|
105
|
-
console.log('res4:');
|
|
106
|
-
console.log(res4);
|
|
107
|
-
console.log('--end------------------------------------------\n');
|
|
108
|
-
console.log('--start5------------------------------------------');
|
|
109
|
-
const res5 = YINI_1.default.parse(defect_inputs_1.defectConfig2Combo3, {
|
|
82
|
+
console.log('--start1------------------------------------------');
|
|
83
|
+
const res1 = YINI_1.default.parse(yiniContent, {
|
|
110
84
|
strictMode: false,
|
|
111
|
-
|
|
112
|
-
// includeMetadata: true,
|
|
113
|
-
// includeDiagnostics: true,
|
|
114
|
-
// requireDocTerminator: 'optional',
|
|
115
|
-
});
|
|
116
|
-
console.log('res5:');
|
|
117
|
-
console.log(res5);
|
|
118
|
-
console.log('--end------------------------------------------\n');
|
|
119
|
-
console.log('--start6------------------------------------------');
|
|
120
|
-
const res6 = YINI_1.default.parse(defect_inputs_1.defectConfig2Combo3, {
|
|
121
|
-
strictMode: true,
|
|
122
|
-
// failLevel: 'ignore-errors',
|
|
123
|
-
// includeMetadata: true,
|
|
124
|
-
// includeDiagnostics: true,
|
|
125
|
-
// requireDocTerminator: 'optional',
|
|
126
|
-
});
|
|
127
|
-
console.log('res6:');
|
|
128
|
-
console.log(res6);
|
|
129
|
-
console.log('--end------------------------------------------\n');
|
|
130
|
-
console.log('--start7------------------------------------------');
|
|
131
|
-
const res7 = YINI_1.default.parse(defect_inputs_1.defectConfig2Combo3, {
|
|
132
|
-
throwOnError: true,
|
|
133
|
-
//strictMode: false,
|
|
134
|
-
// failLevel: 'ignore-errors',
|
|
135
|
-
// includeMetadata: true,
|
|
136
|
-
// includeDiagnostics: true,
|
|
137
|
-
// requireDocTerminator: 'optional',
|
|
138
|
-
});
|
|
139
|
-
console.log('res7:');
|
|
140
|
-
console.log(res7);
|
|
141
|
-
console.log('--end------------------------------------------\n');
|
|
142
|
-
console.log('--start8------------------------------------------');
|
|
143
|
-
const res8 = YINI_1.default.parse(defect_inputs_1.defectConfig2Combo3, {
|
|
144
|
-
strictMode: true,
|
|
85
|
+
treatEmptyValueAsNull: 'disallow',
|
|
145
86
|
throwOnError: true,
|
|
146
|
-
|
|
147
|
-
// includeMetadata: true,
|
|
148
|
-
// includeDiagnostics: true,
|
|
149
|
-
// requireDocTerminator: 'optional',
|
|
87
|
+
failLevel: 'errors',
|
|
150
88
|
});
|
|
151
|
-
console.log('
|
|
152
|
-
console.log(
|
|
89
|
+
console.log('res1:');
|
|
90
|
+
console.log(res1);
|
|
153
91
|
console.log('--end------------------------------------------\n');
|
|
92
|
+
// console.log('--start2------------------------------------------')
|
|
93
|
+
// const res2 = YINI.parse(defectConfig2Combo3, {
|
|
94
|
+
// strictMode: true,
|
|
95
|
+
// failLevel: 'ignore-errors',
|
|
96
|
+
// includeMetadata: true,
|
|
97
|
+
// includeDiagnostics: true,
|
|
98
|
+
// requireDocTerminator: 'optional',
|
|
99
|
+
// })
|
|
100
|
+
// console.log('res2:')
|
|
101
|
+
// printObject(res2)
|
|
102
|
+
// console.log('--end------------------------------------------\n')
|
|
103
|
+
// console.log('--start3------------------------------------------')
|
|
104
|
+
// const res3 = YINI.parse(defectConfigCombo3, {
|
|
105
|
+
// strictMode: false,
|
|
106
|
+
// failLevel: 'ignore-errors',
|
|
107
|
+
// includeMetadata: true,
|
|
108
|
+
// includeDiagnostics: true,
|
|
109
|
+
// requireDocTerminator: 'optional',
|
|
110
|
+
// })
|
|
111
|
+
// console.log('res3:')
|
|
112
|
+
// console.log(res3)
|
|
113
|
+
// console.log('--end------------------------------------------\n')
|
|
114
|
+
// console.log('--start4------------------------------------------')
|
|
115
|
+
// const res4 = YINI.parse(defectConfigCombo3, {
|
|
116
|
+
// strictMode: true,
|
|
117
|
+
// failLevel: 'ignore-errors',
|
|
118
|
+
// includeMetadata: true,
|
|
119
|
+
// includeDiagnostics: true,
|
|
120
|
+
// requireDocTerminator: 'optional',
|
|
121
|
+
// })
|
|
122
|
+
// console.log('res4:')
|
|
123
|
+
// console.log(res4)
|
|
124
|
+
// console.log('--end------------------------------------------\n')
|
|
154
125
|
// console.log(
|
|
155
126
|
// toPrettyJSON(
|
|
156
127
|
// // YINI.parse(validConfig, {
|
package/dist/dev/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/dev/main.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;;;AAElB;;;;;;;;;GASG;AAEH,uCAQsB;AACtB,0CAAsE;AACtE,mDAA0B;
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/dev/main.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;;;AAElB;;;;;;;;;GASG;AAEH,uCAQsB;AACtB,0CAAsE;AACtE,mDAA0B;AAM1B,6CAA0C,CAAC,sBAAsB;AAMjE,IAAA,kBAAU,GAAE,CAAA;AACZ,IAAA,kBAAU,EAAC,wBAAwB,CAAC,CAAA;AACpC,IAAA,kBAAU,GAAE,CAAA;AAEZ,IAAI,IAAA,WAAK,GAAE,IAAI,IAA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kC;QAClC,yBAAyB;QACzB,4BAA4B;QAC5B,oCAAoC;QACpC,KAAK;QACL,uBAAuB;QACvB,oBAAoB;QACpB,mEAAmE;QAEnE,eAAe;QACf,oBAAoB;QACpB,uCAAuC;QACvC,oCAAoC;QACpC,gCAAgC;QAChC,6CAA6C;QAC7C,wCAAwC;QACxC,2CAA2C;QAC3C,mDAAmD;QACnD,cAAc;QACd,SAAS;QACT,IAAI;IACR,CAAC;AACL,CAAC"}
|
|
@@ -1,55 +1,49 @@
|
|
|
1
1
|
import { ATN, CharStream, DFA, Lexer, RuleContext } from "antlr4";
|
|
2
2
|
export default class YiniLexer extends Lexer {
|
|
3
|
-
static readonly
|
|
4
|
-
static readonly
|
|
5
|
-
static readonly
|
|
6
|
-
static readonly
|
|
3
|
+
static readonly SHEBANG = 1;
|
|
4
|
+
static readonly YINI_TOKEN = 2;
|
|
5
|
+
static readonly INCLUDE_TOKEN = 3;
|
|
6
|
+
static readonly DEPRECATED_TOKEN = 4;
|
|
7
7
|
static readonly TERMINAL_TOKEN = 5;
|
|
8
|
-
static readonly
|
|
9
|
-
static readonly
|
|
10
|
-
static readonly
|
|
11
|
-
static readonly
|
|
12
|
-
static readonly
|
|
13
|
-
static readonly
|
|
14
|
-
static readonly
|
|
15
|
-
static readonly
|
|
16
|
-
static readonly
|
|
17
|
-
static readonly
|
|
18
|
-
static readonly
|
|
19
|
-
static readonly
|
|
20
|
-
static readonly
|
|
21
|
-
static readonly
|
|
22
|
-
static readonly
|
|
23
|
-
static readonly
|
|
24
|
-
static readonly
|
|
25
|
-
static readonly
|
|
26
|
-
static readonly
|
|
27
|
-
static readonly
|
|
28
|
-
static readonly
|
|
29
|
-
static readonly
|
|
30
|
-
static readonly
|
|
31
|
-
static readonly
|
|
32
|
-
static readonly
|
|
33
|
-
static readonly
|
|
34
|
-
static readonly
|
|
35
|
-
static readonly
|
|
36
|
-
static readonly
|
|
37
|
-
static readonly
|
|
38
|
-
static readonly
|
|
39
|
-
static readonly
|
|
40
|
-
static readonly
|
|
41
|
-
static readonly
|
|
42
|
-
static readonly
|
|
43
|
-
static readonly
|
|
44
|
-
static readonly
|
|
45
|
-
static readonly
|
|
46
|
-
static readonly
|
|
47
|
-
static readonly COMMENT = 45;
|
|
48
|
-
static readonly LINE_COMMENT = 46;
|
|
49
|
-
static readonly INLINE_COMMENT = 47;
|
|
50
|
-
static readonly IDENT_INVALID = 48;
|
|
51
|
-
static readonly REST = 49;
|
|
52
|
-
static readonly META_INVALID = 50;
|
|
8
|
+
static readonly SECTION_HEAD = 6;
|
|
9
|
+
static readonly INVALID_SECTION_HEAD = 7;
|
|
10
|
+
static readonly BOOLEAN_FALSE = 8;
|
|
11
|
+
static readonly BOOLEAN_TRUE = 9;
|
|
12
|
+
static readonly NULL = 10;
|
|
13
|
+
static readonly EMPTY_OBJECT = 11;
|
|
14
|
+
static readonly EMPTY_LIST = 12;
|
|
15
|
+
static readonly STRING = 13;
|
|
16
|
+
static readonly TRIPLE_QUOTED_STRING = 14;
|
|
17
|
+
static readonly SINGLE_OR_DOUBLE = 15;
|
|
18
|
+
static readonly R_AND_C_STRING = 16;
|
|
19
|
+
static readonly HYPER_STRING = 17;
|
|
20
|
+
static readonly NUMBER = 18;
|
|
21
|
+
static readonly SS = 19;
|
|
22
|
+
static readonly CARET = 20;
|
|
23
|
+
static readonly GT = 21;
|
|
24
|
+
static readonly LT = 22;
|
|
25
|
+
static readonly EQ = 23;
|
|
26
|
+
static readonly HASH = 24;
|
|
27
|
+
static readonly COMMA = 25;
|
|
28
|
+
static readonly COLON = 26;
|
|
29
|
+
static readonly OB = 27;
|
|
30
|
+
static readonly CB = 28;
|
|
31
|
+
static readonly OC = 29;
|
|
32
|
+
static readonly CC = 30;
|
|
33
|
+
static readonly PLUS = 31;
|
|
34
|
+
static readonly DOLLAR = 32;
|
|
35
|
+
static readonly PC = 33;
|
|
36
|
+
static readonly AT = 34;
|
|
37
|
+
static readonly SEMICOLON = 35;
|
|
38
|
+
static readonly NL = 36;
|
|
39
|
+
static readonly WS = 37;
|
|
40
|
+
static readonly BLOCK_COMMENT = 38;
|
|
41
|
+
static readonly LINE_COMMENT = 39;
|
|
42
|
+
static readonly INLINE_COMMENT = 40;
|
|
43
|
+
static readonly KEY = 41;
|
|
44
|
+
static readonly IDENT_INVALID = 42;
|
|
45
|
+
static readonly REST = 43;
|
|
46
|
+
static readonly META_INVALID = 44;
|
|
53
47
|
static readonly EOF: number;
|
|
54
48
|
static readonly channelNames: string[];
|
|
55
49
|
static readonly literalNames: (string | null)[];
|