grammar-well 1.1.2 → 1.1.4
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/build/compiler/compiler.d.ts +49 -49
- package/build/compiler/compiler.js +227 -227
- package/build/compiler/generator.d.ts +23 -23
- package/build/compiler/generator.js +213 -212
- package/build/compiler/generator.js.map +1 -1
- package/build/compiler/import-resolver.d.ts +15 -15
- package/build/compiler/import-resolver.js +36 -36
- package/build/compiler/outputs/javascript.d.ts +3 -3
- package/build/compiler/outputs/javascript.js +14 -14
- package/build/compiler/outputs/json.d.ts +2 -2
- package/build/compiler/outputs/json.js +7 -7
- package/build/compiler/outputs/typescript.d.ts +2 -2
- package/build/compiler/outputs/typescript.js +9 -8
- package/build/compiler/outputs/typescript.js.map +1 -1
- package/build/grammars/gwell.d.ts +1023 -997
- package/build/grammars/gwell.js +540 -536
- package/build/grammars/gwell.js.map +1 -1
- package/build/grammars/json.d.ts +151 -151
- package/build/grammars/json.js +111 -111
- package/build/grammars/number.d.ts +239 -239
- package/build/grammars/number.js +114 -114
- package/build/grammars/number.json +1 -1
- package/build/grammars/string.d.ts +116 -116
- package/build/grammars/string.js +49 -49
- package/build/grammars/string.json +1 -1
- package/build/grammars/whitespace.d.ts +51 -51
- package/build/grammars/whitespace.js +29 -29
- package/build/grammars/whitespace.json +1 -1
- package/build/index.d.ts +4 -4
- package/build/index.js +20 -20
- package/build/lexers/character-lexer.d.ts +27 -27
- package/build/lexers/character-lexer.js +70 -70
- package/build/lexers/stateful-lexer.d.ts +48 -48
- package/build/lexers/stateful-lexer.js +308 -308
- package/build/lexers/token-buffer.d.ts +32 -32
- package/build/lexers/token-buffer.js +91 -91
- package/build/parser/algorithms/cyk.d.ts +16 -16
- package/build/parser/algorithms/cyk.js +57 -57
- package/build/parser/algorithms/earley.d.ts +48 -48
- package/build/parser/algorithms/earley.js +157 -157
- package/build/parser/algorithms/lr.d.ts +10 -10
- package/build/parser/algorithms/lr.js +33 -33
- package/build/parser/parser.d.ts +26 -26
- package/build/parser/parser.js +73 -73
- package/build/typings.d.ts +199 -198
- package/build/typings.js +2 -2
- package/build/utility/general.d.ts +55 -55
- package/build/utility/general.js +175 -165
- package/build/utility/general.js.map +1 -1
- package/build/utility/lint.d.ts +2 -2
- package/build/utility/lint.js +27 -27
- package/build/utility/lr.d.ts +52 -52
- package/build/utility/lr.js +129 -129
- package/build/utility/text-format.d.ts +11 -11
- package/build/utility/text-format.js +83 -83
- package/package.json +1 -1
- package/src/compiler/generator.ts +1 -0
- package/src/compiler/outputs/typescript.ts +2 -1
- package/src/grammars/gwell.gwell +15 -13
- package/src/grammars/gwell.js +17 -13
- package/src/grammars/gwell.json +1 -1
- package/src/typings.ts +1 -0
- package/src/utility/general.ts +31 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "state": { "grammar": { "start": "dqstring", "rules": { "dqstring$RPT0Nx1": [{ "name": "dqstring$RPT0Nx1", "symbols": [] }, { "name": "dqstring$RPT0Nx1", "symbols": [{ "rule": "dqstring$RPT0Nx1" }, { "rule": "dstrchar" }], "postprocess": { "builtin": "concat" } }], "dqstring": [{ "name": "dqstring", "symbols": [{ "literal": "\"", "insensitive": false }, { "rule": "dqstring$RPT0Nx1" }, { "literal": "\"", "insensitive": false }], "postprocess": { "template": "$1.join(\"\")" } }], "sqstring$RPT0Nx1": [{ "name": "sqstring$RPT0Nx1", "symbols": [] }, { "name": "sqstring$RPT0Nx1", "symbols": [{ "rule": "sqstring$RPT0Nx1" }, { "rule": "sstrchar" }], "postprocess": { "builtin": "concat" } }], "sqstring": [{ "name": "sqstring", "symbols": [{ "literal": "'", "insensitive": false }, { "rule": "sqstring$RPT0Nx1" }, { "literal": "'", "insensitive": false }], "postprocess": { "template": "$1.join(\"\")" } }], "btstring$RPT0Nx1": [{ "name": "btstring$RPT0Nx1", "symbols": [] }, { "name": "btstring$RPT0Nx1", "symbols": [{ "rule": "btstring$RPT0Nx1" }, { "regex": "[^`]", "flags": "" }], "postprocess": { "builtin": "concat" } }], "btstring": [{ "name": "btstring", "symbols": [{ "literal": "`", "insensitive": false }, { "rule": "btstring$RPT0Nx1" }, { "literal": "`", "insensitive": false }], "postprocess": { "template": "$1.join(\"\")" } }], "dstrchar": [{ "name": "dstrchar", "symbols": [{ "regex": "[^\\\\\"\\n]", "flags": "" }], "postprocess": { "template": "$0" } }, { "name": "dstrchar", "symbols": [{ "literal": "\\", "insensitive": false }, { "rule": "strescape" }], "postprocess": { "template": "JSON.parse(\"\\\"\"+data.join(\"\")+\"\\\"\")" } }], "sstrchar": [{ "name": "sstrchar", "symbols": [{ "regex": "[^\\\\'\\n]", "flags": "" }], "postprocess": { "template": "$0" } }, { "name": "sstrchar", "symbols": [{ "literal": "\\", "insensitive": false }, { "rule": "strescape" }], "postprocess": { "template": "JSON.parse(\"\\\"\"+data.join(\"\")+\"\\\"\")" } }, { "name": "sstrchar", "symbols": [{ "rule": "sstrchar$STRx1" }], "postprocess": { "template": "\"'\"" } }], "sstrchar$STRx1": [{ "name": "sstrchar$STRx1", "symbols": [{ "literal": "\\" }, { "literal": "'" }], "postprocess": { "builtin": "join" } }], "strescape": [{ "name": "strescape", "symbols": [{ "regex": "[\"\\/bfnrt]", "flags": "" }], "postprocess": { "template": "$0" } }, { "name": "strescape", "symbols": [{ "literal": "u", "insensitive": false }, { "regex": "[a-fA-F0-9]", "flags": "" }, { "regex": "[a-fA-F0-9]", "flags": "" }, { "regex": "[a-fA-F0-9]", "flags": "" }, { "regex": "[a-fA-F0-9]", "flags": "" }], "postprocess": { "template": "data.join(\"\")" } }] }, "uuids": { "dqstring$RPT0N": 1, "sqstring$RPT0N": 1, "btstring$RPT0N": 1, "sstrchar$STR": 1 } }, "lexer": null, "head": [], "body": [], "config": {}, "version": "unknown" }, "exportName": "GWLanguage" }
|
|
1
|
+
{ "state": { "grammar": { "start": "dqstring", "rules": { "dqstring$RPT0Nx1": [{ "name": "dqstring$RPT0Nx1", "symbols": [] }, { "name": "dqstring$RPT0Nx1", "symbols": [{ "rule": "dqstring$RPT0Nx1" }, { "rule": "dstrchar" }], "postprocess": { "builtin": "concat" } }], "dqstring": [{ "name": "dqstring", "symbols": [{ "literal": "\"", "insensitive": false }, { "rule": "dqstring$RPT0Nx1" }, { "literal": "\"", "insensitive": false }], "postprocess": { "template": "$1.join(\"\")" } }], "sqstring$RPT0Nx1": [{ "name": "sqstring$RPT0Nx1", "symbols": [] }, { "name": "sqstring$RPT0Nx1", "symbols": [{ "rule": "sqstring$RPT0Nx1" }, { "rule": "sstrchar" }], "postprocess": { "builtin": "concat" } }], "sqstring": [{ "name": "sqstring", "symbols": [{ "literal": "'", "insensitive": false }, { "rule": "sqstring$RPT0Nx1" }, { "literal": "'", "insensitive": false }], "postprocess": { "template": "$1.join(\"\")" } }], "btstring$RPT0Nx1": [{ "name": "btstring$RPT0Nx1", "symbols": [] }, { "name": "btstring$RPT0Nx1", "symbols": [{ "rule": "btstring$RPT0Nx1" }, { "regex": "[^`]", "flags": "" }], "postprocess": { "builtin": "concat" } }], "btstring": [{ "name": "btstring", "symbols": [{ "literal": "`", "insensitive": false }, { "rule": "btstring$RPT0Nx1" }, { "literal": "`", "insensitive": false }], "postprocess": { "template": "$1.join(\"\")" } }], "dstrchar": [{ "name": "dstrchar", "symbols": [{ "regex": "[^\\\\\"\\n]", "flags": "" }], "postprocess": { "template": "$0" } }, { "name": "dstrchar", "symbols": [{ "literal": "\\", "insensitive": false }, { "rule": "strescape" }], "postprocess": { "template": "JSON.parse(\"\\\"\"+data.join(\"\")+\"\\\"\")" } }], "sstrchar": [{ "name": "sstrchar", "symbols": [{ "regex": "[^\\\\'\\n]", "flags": "" }], "postprocess": { "template": "$0" } }, { "name": "sstrchar", "symbols": [{ "literal": "\\", "insensitive": false }, { "rule": "strescape" }], "postprocess": { "template": "JSON.parse(\"\\\"\"+data.join(\"\")+\"\\\"\")" } }, { "name": "sstrchar", "symbols": [{ "rule": "sstrchar$STRx1" }], "postprocess": { "template": "\"'\"" } }], "sstrchar$STRx1": [{ "name": "sstrchar$STRx1", "symbols": [{ "literal": "\\" }, { "literal": "'" }], "postprocess": { "builtin": "join" } }], "strescape": [{ "name": "strescape", "symbols": [{ "regex": "[\"\\/bfnrt]", "flags": "" }], "postprocess": { "template": "$0" } }, { "name": "strescape", "symbols": [{ "literal": "u", "insensitive": false }, { "regex": "[a-fA-F0-9]", "flags": "" }, { "regex": "[a-fA-F0-9]", "flags": "" }, { "regex": "[a-fA-F0-9]", "flags": "" }, { "regex": "[a-fA-F0-9]", "flags": "" }], "postprocess": { "template": "data.join(\"\")" } }] }, "uuids": { "dqstring$RPT0N": 1, "sqstring$RPT0N": 1, "btstring$RPT0N": 1, "sstrchar$STR": 1 } }, "lexer": null, "head": [], "body": [], "config": {}, "version": "unknown" }, "exportName": "GWLanguage" }
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
export default GWLanguage;
|
|
2
|
-
declare function GWLanguage(): {
|
|
3
|
-
grammar: {
|
|
4
|
-
start: string;
|
|
5
|
-
rules: {
|
|
6
|
-
_$RPT0Nx1: ({
|
|
7
|
-
name: string;
|
|
8
|
-
symbols: any[];
|
|
9
|
-
postprocess?: undefined;
|
|
10
|
-
} | {
|
|
11
|
-
name: string;
|
|
12
|
-
symbols: string[];
|
|
13
|
-
postprocess: ({ data }: {
|
|
14
|
-
data: any;
|
|
15
|
-
}) => any;
|
|
16
|
-
})[];
|
|
17
|
-
_: {
|
|
18
|
-
name: string;
|
|
19
|
-
symbols: string[];
|
|
20
|
-
postprocess: ({ data }: {
|
|
21
|
-
data: any;
|
|
22
|
-
}) => any;
|
|
23
|
-
}[];
|
|
24
|
-
__$RPT1Nx1: ({
|
|
25
|
-
name: string;
|
|
26
|
-
symbols: string[];
|
|
27
|
-
postprocess?: undefined;
|
|
28
|
-
} | {
|
|
29
|
-
name: string;
|
|
30
|
-
symbols: string[];
|
|
31
|
-
postprocess: ({ data }: {
|
|
32
|
-
data: any;
|
|
33
|
-
}) => any;
|
|
34
|
-
})[];
|
|
35
|
-
__: {
|
|
36
|
-
name: string;
|
|
37
|
-
symbols: string[];
|
|
38
|
-
postprocess: ({ data }: {
|
|
39
|
-
data: any;
|
|
40
|
-
}) => any;
|
|
41
|
-
}[];
|
|
42
|
-
wschar: {
|
|
43
|
-
name: string;
|
|
44
|
-
symbols: RegExp[];
|
|
45
|
-
postprocess: ({ data }: {
|
|
46
|
-
data: any;
|
|
47
|
-
}) => any;
|
|
48
|
-
}[];
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
};
|
|
1
|
+
export default GWLanguage;
|
|
2
|
+
declare function GWLanguage(): {
|
|
3
|
+
grammar: {
|
|
4
|
+
start: string;
|
|
5
|
+
rules: {
|
|
6
|
+
_$RPT0Nx1: ({
|
|
7
|
+
name: string;
|
|
8
|
+
symbols: any[];
|
|
9
|
+
postprocess?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
name: string;
|
|
12
|
+
symbols: string[];
|
|
13
|
+
postprocess: ({ data }: {
|
|
14
|
+
data: any;
|
|
15
|
+
}) => any;
|
|
16
|
+
})[];
|
|
17
|
+
_: {
|
|
18
|
+
name: string;
|
|
19
|
+
symbols: string[];
|
|
20
|
+
postprocess: ({ data }: {
|
|
21
|
+
data: any;
|
|
22
|
+
}) => any;
|
|
23
|
+
}[];
|
|
24
|
+
__$RPT1Nx1: ({
|
|
25
|
+
name: string;
|
|
26
|
+
symbols: string[];
|
|
27
|
+
postprocess?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
name: string;
|
|
30
|
+
symbols: string[];
|
|
31
|
+
postprocess: ({ data }: {
|
|
32
|
+
data: any;
|
|
33
|
+
}) => any;
|
|
34
|
+
})[];
|
|
35
|
+
__: {
|
|
36
|
+
name: string;
|
|
37
|
+
symbols: string[];
|
|
38
|
+
postprocess: ({ data }: {
|
|
39
|
+
data: any;
|
|
40
|
+
}) => any;
|
|
41
|
+
}[];
|
|
42
|
+
wschar: {
|
|
43
|
+
name: string;
|
|
44
|
+
symbols: RegExp[];
|
|
45
|
+
postprocess: ({ data }: {
|
|
46
|
+
data: any;
|
|
47
|
+
}) => any;
|
|
48
|
+
}[];
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function GWLanguage() {
|
|
4
|
-
return {
|
|
5
|
-
grammar: {
|
|
6
|
-
start: "_",
|
|
7
|
-
rules: {
|
|
8
|
-
_$RPT0Nx1: [
|
|
9
|
-
{ name: "_$RPT0Nx1", symbols: [] },
|
|
10
|
-
{ name: "_$RPT0Nx1", symbols: ["_$RPT0Nx1", "wschar"], postprocess: ({ data }) => data[0].concat([data[1]]) }
|
|
11
|
-
],
|
|
12
|
-
_: [
|
|
13
|
-
{ name: "_", symbols: ["_$RPT0Nx1"], postprocess: ({ data }) => { return null; } }
|
|
14
|
-
],
|
|
15
|
-
__$RPT1Nx1: [
|
|
16
|
-
{ name: "__$RPT1Nx1", symbols: ["wschar"] },
|
|
17
|
-
{ name: "__$RPT1Nx1", symbols: ["__$RPT1Nx1", "wschar"], postprocess: ({ data }) => data[0].concat([data[1]]) }
|
|
18
|
-
],
|
|
19
|
-
__: [
|
|
20
|
-
{ name: "__", symbols: ["__$RPT1Nx1"], postprocess: ({ data }) => { return null; } }
|
|
21
|
-
],
|
|
22
|
-
wschar: [
|
|
23
|
-
{ name: "wschar", symbols: [/[\t\n\v\f]/], postprocess: ({ data }) => { return data[0].value; } }
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
exports.default = GWLanguage;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function GWLanguage() {
|
|
4
|
+
return {
|
|
5
|
+
grammar: {
|
|
6
|
+
start: "_",
|
|
7
|
+
rules: {
|
|
8
|
+
_$RPT0Nx1: [
|
|
9
|
+
{ name: "_$RPT0Nx1", symbols: [] },
|
|
10
|
+
{ name: "_$RPT0Nx1", symbols: ["_$RPT0Nx1", "wschar"], postprocess: ({ data }) => data[0].concat([data[1]]) }
|
|
11
|
+
],
|
|
12
|
+
_: [
|
|
13
|
+
{ name: "_", symbols: ["_$RPT0Nx1"], postprocess: ({ data }) => { return null; } }
|
|
14
|
+
],
|
|
15
|
+
__$RPT1Nx1: [
|
|
16
|
+
{ name: "__$RPT1Nx1", symbols: ["wschar"] },
|
|
17
|
+
{ name: "__$RPT1Nx1", symbols: ["__$RPT1Nx1", "wschar"], postprocess: ({ data }) => data[0].concat([data[1]]) }
|
|
18
|
+
],
|
|
19
|
+
__: [
|
|
20
|
+
{ name: "__", symbols: ["__$RPT1Nx1"], postprocess: ({ data }) => { return null; } }
|
|
21
|
+
],
|
|
22
|
+
wschar: [
|
|
23
|
+
{ name: "wschar", symbols: [/[\t\n\v\f]/], postprocess: ({ data }) => { return data[0].value; } }
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
exports.default = GWLanguage;
|
|
30
30
|
//# sourceMappingURL=whitespace.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "state": { "grammar": { "start": "_", "rules": { "_$RPT0Nx1": [{ "name": "_$RPT0Nx1", "symbols": [] }, { "name": "_$RPT0Nx1", "symbols": [{ "rule": "_$RPT0Nx1" }, { "rule": "wschar" }], "postprocess": { "builtin": "concat" } }], "_": [{ "name": "_", "symbols": [{ "rule": "_$RPT0Nx1" }], "postprocess": { "template": "null" } }], "__$RPT1Nx1": [{ "name": "__$RPT1Nx1", "symbols": [{ "rule": "wschar" }] }, { "name": "__$RPT1Nx1", "symbols": [{ "rule": "__$RPT1Nx1" }, { "rule": "wschar" }], "postprocess": { "builtin": "concat" } }], "__": [{ "name": "__", "symbols": [{ "rule": "__$RPT1Nx1" }], "postprocess": { "template": "null" } }], "wschar": [{ "name": "wschar", "symbols": [{ "regex": "[\\t\\n\\v\\f]", "flags": "" }], "postprocess": { "template": "$0.value" } }] }, "uuids": { "_$RPT0N": 1, "__$RPT1N": 1 } }, "lexer": null, "head": [], "body": [], "config": {}, "version": "unknown" }, "exportName": "GWLanguage" }
|
|
1
|
+
{ "state": { "grammar": { "start": "_", "rules": { "_$RPT0Nx1": [{ "name": "_$RPT0Nx1", "symbols": [] }, { "name": "_$RPT0Nx1", "symbols": [{ "rule": "_$RPT0Nx1" }, { "rule": "wschar" }], "postprocess": { "builtin": "concat" } }], "_": [{ "name": "_", "symbols": [{ "rule": "_$RPT0Nx1" }], "postprocess": { "template": "null" } }], "__$RPT1Nx1": [{ "name": "__$RPT1Nx1", "symbols": [{ "rule": "wschar" }] }, { "name": "__$RPT1Nx1", "symbols": [{ "rule": "__$RPT1Nx1" }, { "rule": "wschar" }], "postprocess": { "builtin": "concat" } }], "__": [{ "name": "__", "symbols": [{ "rule": "__$RPT1Nx1" }], "postprocess": { "template": "null" } }], "wschar": [{ "name": "wschar", "symbols": [{ "regex": "[\\t\\n\\v\\f]", "flags": "" }], "postprocess": { "template": "$0.value" } }] }, "uuids": { "_$RPT0N": 1, "__$RPT1N": 1 } }, "lexer": null, "head": [], "body": [], "config": {}, "version": "unknown" }, "exportName": "GWLanguage" }
|
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './compiler/compiler';
|
|
2
|
-
export * from './compiler/import-resolver';
|
|
3
|
-
export * from './parser/parser';
|
|
4
|
-
export * from './typings';
|
|
1
|
+
export * from './compiler/compiler';
|
|
2
|
+
export * from './compiler/import-resolver';
|
|
3
|
+
export * from './parser/parser';
|
|
4
|
+
export * from './typings';
|
package/build/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./compiler/compiler"), exports);
|
|
18
|
-
__exportStar(require("./compiler/import-resolver"), exports);
|
|
19
|
-
__exportStar(require("./parser/parser"), exports);
|
|
20
|
-
__exportStar(require("./typings"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./compiler/compiler"), exports);
|
|
18
|
+
__exportStar(require("./compiler/import-resolver"), exports);
|
|
19
|
+
__exportStar(require("./parser/parser"), exports);
|
|
20
|
+
__exportStar(require("./typings"), exports);
|
|
21
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { Lexer } from "../typings";
|
|
2
|
-
export declare class CharacterLexer implements Lexer {
|
|
3
|
-
private buffer;
|
|
4
|
-
private $indexOffset;
|
|
5
|
-
private $index;
|
|
6
|
-
get index(): number;
|
|
7
|
-
private $lineOffset;
|
|
8
|
-
private $line;
|
|
9
|
-
get line(): number;
|
|
10
|
-
private column;
|
|
11
|
-
next(): {
|
|
12
|
-
type: string;
|
|
13
|
-
value: any;
|
|
14
|
-
offset: number;
|
|
15
|
-
line: number;
|
|
16
|
-
column: number;
|
|
17
|
-
};
|
|
18
|
-
feed(buffer: string | any[], state?: ReturnType<CharacterLexer['state']>): void;
|
|
19
|
-
state(): {
|
|
20
|
-
index: number;
|
|
21
|
-
indexOffset: number;
|
|
22
|
-
line: number;
|
|
23
|
-
lineOffset: number;
|
|
24
|
-
column: number;
|
|
25
|
-
};
|
|
26
|
-
flush(): void;
|
|
27
|
-
}
|
|
1
|
+
import { Lexer } from "../typings";
|
|
2
|
+
export declare class CharacterLexer implements Lexer {
|
|
3
|
+
private buffer;
|
|
4
|
+
private $indexOffset;
|
|
5
|
+
private $index;
|
|
6
|
+
get index(): number;
|
|
7
|
+
private $lineOffset;
|
|
8
|
+
private $line;
|
|
9
|
+
get line(): number;
|
|
10
|
+
private column;
|
|
11
|
+
next(): {
|
|
12
|
+
type: string;
|
|
13
|
+
value: any;
|
|
14
|
+
offset: number;
|
|
15
|
+
line: number;
|
|
16
|
+
column: number;
|
|
17
|
+
};
|
|
18
|
+
feed(buffer: string | any[], state?: ReturnType<CharacterLexer['state']>): void;
|
|
19
|
+
state(): {
|
|
20
|
+
index: number;
|
|
21
|
+
indexOffset: number;
|
|
22
|
+
line: number;
|
|
23
|
+
lineOffset: number;
|
|
24
|
+
column: number;
|
|
25
|
+
};
|
|
26
|
+
flush(): void;
|
|
27
|
+
}
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CharacterLexer = void 0;
|
|
4
|
-
class CharacterLexer {
|
|
5
|
-
buffer = '';
|
|
6
|
-
$indexOffset = 0;
|
|
7
|
-
$index = -1;
|
|
8
|
-
get index() { return this.$index + this.$indexOffset; }
|
|
9
|
-
$lineOffset = 0;
|
|
10
|
-
$line = 0;
|
|
11
|
-
get line() { return this.$line + this.$lineOffset; }
|
|
12
|
-
column = 0;
|
|
13
|
-
next() {
|
|
14
|
-
if (this.$index + 1 < this.buffer.length) {
|
|
15
|
-
if (this.buffer[this.index] === '\n') {
|
|
16
|
-
this.column = 0;
|
|
17
|
-
}
|
|
18
|
-
this.column++;
|
|
19
|
-
const value = this.buffer[++this.$index];
|
|
20
|
-
if (value === '\n') {
|
|
21
|
-
this.$line++;
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
type: '',
|
|
25
|
-
value,
|
|
26
|
-
offset: this.index,
|
|
27
|
-
line: this.line,
|
|
28
|
-
column: this.column
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
feed(buffer, state) {
|
|
33
|
-
if (Array.isArray(buffer) && (!this.buffer || Array.isArray(this.buffer))) {
|
|
34
|
-
this.buffer = Array.isArray(this.buffer) ? this.buffer : [];
|
|
35
|
-
this.buffer.push(...buffer);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
if (Array.isArray(this.buffer)) {
|
|
39
|
-
this.buffer.push(buffer);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
this.buffer = this.buffer + buffer;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (state) {
|
|
46
|
-
this.$index = state.index;
|
|
47
|
-
this.$indexOffset = state.indexOffset;
|
|
48
|
-
this.$line = state.line;
|
|
49
|
-
this.$lineOffset = state.lineOffset;
|
|
50
|
-
this.column = state.column;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
state() {
|
|
54
|
-
return {
|
|
55
|
-
index: this.$index,
|
|
56
|
-
indexOffset: this.$indexOffset,
|
|
57
|
-
line: this.$line,
|
|
58
|
-
lineOffset: this.$lineOffset,
|
|
59
|
-
column: this.column
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
flush() {
|
|
63
|
-
this.buffer = this.buffer.slice(this.$index);
|
|
64
|
-
this.$indexOffset += this.$index;
|
|
65
|
-
this.$lineOffset += this.$line;
|
|
66
|
-
this.$index = 0;
|
|
67
|
-
this.$line = 0;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.CharacterLexer = CharacterLexer;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CharacterLexer = void 0;
|
|
4
|
+
class CharacterLexer {
|
|
5
|
+
buffer = '';
|
|
6
|
+
$indexOffset = 0;
|
|
7
|
+
$index = -1;
|
|
8
|
+
get index() { return this.$index + this.$indexOffset; }
|
|
9
|
+
$lineOffset = 0;
|
|
10
|
+
$line = 0;
|
|
11
|
+
get line() { return this.$line + this.$lineOffset; }
|
|
12
|
+
column = 0;
|
|
13
|
+
next() {
|
|
14
|
+
if (this.$index + 1 < this.buffer.length) {
|
|
15
|
+
if (this.buffer[this.index] === '\n') {
|
|
16
|
+
this.column = 0;
|
|
17
|
+
}
|
|
18
|
+
this.column++;
|
|
19
|
+
const value = this.buffer[++this.$index];
|
|
20
|
+
if (value === '\n') {
|
|
21
|
+
this.$line++;
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
type: '',
|
|
25
|
+
value,
|
|
26
|
+
offset: this.index,
|
|
27
|
+
line: this.line,
|
|
28
|
+
column: this.column
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
feed(buffer, state) {
|
|
33
|
+
if (Array.isArray(buffer) && (!this.buffer || Array.isArray(this.buffer))) {
|
|
34
|
+
this.buffer = Array.isArray(this.buffer) ? this.buffer : [];
|
|
35
|
+
this.buffer.push(...buffer);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
if (Array.isArray(this.buffer)) {
|
|
39
|
+
this.buffer.push(buffer);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.buffer = this.buffer + buffer;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (state) {
|
|
46
|
+
this.$index = state.index;
|
|
47
|
+
this.$indexOffset = state.indexOffset;
|
|
48
|
+
this.$line = state.line;
|
|
49
|
+
this.$lineOffset = state.lineOffset;
|
|
50
|
+
this.column = state.column;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
state() {
|
|
54
|
+
return {
|
|
55
|
+
index: this.$index,
|
|
56
|
+
indexOffset: this.$indexOffset,
|
|
57
|
+
line: this.$line,
|
|
58
|
+
lineOffset: this.$lineOffset,
|
|
59
|
+
column: this.column
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
flush() {
|
|
63
|
+
this.buffer = this.buffer.slice(this.$index);
|
|
64
|
+
this.$indexOffset += this.$index;
|
|
65
|
+
this.$lineOffset += this.$line;
|
|
66
|
+
this.$index = 0;
|
|
67
|
+
this.$line = 0;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.CharacterLexer = CharacterLexer;
|
|
71
71
|
//# sourceMappingURL=character-lexer.js.map
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { LexerStateDefinition, LexerConfig } from "../typings";
|
|
2
|
-
export declare class StatefulLexer {
|
|
3
|
-
private start;
|
|
4
|
-
private states;
|
|
5
|
-
private buffer;
|
|
6
|
-
private stack;
|
|
7
|
-
private index;
|
|
8
|
-
private line;
|
|
9
|
-
private column;
|
|
10
|
-
private prefetched?;
|
|
11
|
-
private current;
|
|
12
|
-
private unmatched;
|
|
13
|
-
private rules;
|
|
14
|
-
private regexp;
|
|
15
|
-
private tags;
|
|
16
|
-
constructor({ states, start }: LexerConfig);
|
|
17
|
-
feed(data?: string, state?: ReturnType<StatefulLexer['state']>): void;
|
|
18
|
-
state(): {
|
|
19
|
-
line: number;
|
|
20
|
-
column: number;
|
|
21
|
-
state: string;
|
|
22
|
-
stack: string[];
|
|
23
|
-
prefetched: RegExpExecArray;
|
|
24
|
-
};
|
|
25
|
-
next(): {
|
|
26
|
-
type: string;
|
|
27
|
-
tag: Set<string>;
|
|
28
|
-
value: string;
|
|
29
|
-
text: string;
|
|
30
|
-
offset: number;
|
|
31
|
-
line: number;
|
|
32
|
-
column: number;
|
|
33
|
-
state: string;
|
|
34
|
-
};
|
|
35
|
-
private set;
|
|
36
|
-
private pop;
|
|
37
|
-
private goto;
|
|
38
|
-
private matchNext;
|
|
39
|
-
private createToken;
|
|
40
|
-
private getTags;
|
|
41
|
-
private processRule;
|
|
42
|
-
private getGroup;
|
|
43
|
-
}
|
|
44
|
-
export declare function ResolveStates(states: {
|
|
45
|
-
[key: string]: LexerStateDefinition;
|
|
46
|
-
}, start: string): {
|
|
47
|
-
[key: string]: LexerStateDefinition;
|
|
48
|
-
};
|
|
1
|
+
import { LexerStateDefinition, LexerConfig } from "../typings";
|
|
2
|
+
export declare class StatefulLexer {
|
|
3
|
+
private start;
|
|
4
|
+
private states;
|
|
5
|
+
private buffer;
|
|
6
|
+
private stack;
|
|
7
|
+
private index;
|
|
8
|
+
private line;
|
|
9
|
+
private column;
|
|
10
|
+
private prefetched?;
|
|
11
|
+
private current;
|
|
12
|
+
private unmatched;
|
|
13
|
+
private rules;
|
|
14
|
+
private regexp;
|
|
15
|
+
private tags;
|
|
16
|
+
constructor({ states, start }: LexerConfig);
|
|
17
|
+
feed(data?: string, state?: ReturnType<StatefulLexer['state']>): void;
|
|
18
|
+
state(): {
|
|
19
|
+
line: number;
|
|
20
|
+
column: number;
|
|
21
|
+
state: string;
|
|
22
|
+
stack: string[];
|
|
23
|
+
prefetched: RegExpExecArray;
|
|
24
|
+
};
|
|
25
|
+
next(): {
|
|
26
|
+
type: string;
|
|
27
|
+
tag: Set<string>;
|
|
28
|
+
value: string;
|
|
29
|
+
text: string;
|
|
30
|
+
offset: number;
|
|
31
|
+
line: number;
|
|
32
|
+
column: number;
|
|
33
|
+
state: string;
|
|
34
|
+
};
|
|
35
|
+
private set;
|
|
36
|
+
private pop;
|
|
37
|
+
private goto;
|
|
38
|
+
private matchNext;
|
|
39
|
+
private createToken;
|
|
40
|
+
private getTags;
|
|
41
|
+
private processRule;
|
|
42
|
+
private getGroup;
|
|
43
|
+
}
|
|
44
|
+
export declare function ResolveStates(states: {
|
|
45
|
+
[key: string]: LexerStateDefinition;
|
|
46
|
+
}, start: string): {
|
|
47
|
+
[key: string]: LexerStateDefinition;
|
|
48
|
+
};
|