@pokesol/pokesol-text-parser-ts 0.1.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/LICENSE +21 -0
- package/README.md +47 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +109 -0
- package/dist/index.js.map +1 -0
- package/dist/parser.d.ts +240 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +567 -0
- package/dist/parser.js.map +1 -0
- package/package.json +26 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Hikaru Kazama
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
|
|
3
|
+
```sh
|
|
4
|
+
$ npm run build
|
|
5
|
+
$ node
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
# Usage
|
|
9
|
+
|
|
10
|
+
```javascript
|
|
11
|
+
import { parse } from "@pokesol/pokesol-text-parser-ts"
|
|
12
|
+
|
|
13
|
+
console.dir(parse("カイリュー @ あおぞらプレート\nテラスタイプ: ステラ\n特性: マルチスケイル\n性格: さみしがり\n166-204(252)-132(252)-105-105-101(4) *C0,D0\nじしん / りゅうのまい / テラバースト / けたぐり"), { depth: null })
|
|
14
|
+
|
|
15
|
+
{
|
|
16
|
+
pokemonName: 'カイリュー',
|
|
17
|
+
itemName: 'あおぞらプレート',
|
|
18
|
+
abilityName: 'マルチスケイル',
|
|
19
|
+
terastalName: 'ステラ',
|
|
20
|
+
natureName: 'さみしがり',
|
|
21
|
+
ivs: {
|
|
22
|
+
hp: 31,
|
|
23
|
+
attack: 31,
|
|
24
|
+
defense: 31,
|
|
25
|
+
specialAttack: 0,
|
|
26
|
+
specialDefense: 0,
|
|
27
|
+
speed: 31
|
|
28
|
+
},
|
|
29
|
+
evs: {
|
|
30
|
+
hp: 0,
|
|
31
|
+
attack: 252,
|
|
32
|
+
defense: 252,
|
|
33
|
+
specialAttack: 0,
|
|
34
|
+
specialDefense: 0,
|
|
35
|
+
speed: 4
|
|
36
|
+
},
|
|
37
|
+
actualValue: {
|
|
38
|
+
hp: 166,
|
|
39
|
+
attack: 204,
|
|
40
|
+
defense: 132,
|
|
41
|
+
specialAttack: 105,
|
|
42
|
+
specialDefense: 105,
|
|
43
|
+
speed: 101
|
|
44
|
+
},
|
|
45
|
+
moveNames: [ 'じしん', 'りゅうのまい', 'テラバースト', 'けたぐり' ]
|
|
46
|
+
}
|
|
47
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
type PokesolTextParseReult = {
|
|
2
|
+
pokemonName: string | null;
|
|
3
|
+
itemName: string | null;
|
|
4
|
+
abilityName: string | null;
|
|
5
|
+
terastalName: string | null;
|
|
6
|
+
natureName: string | null;
|
|
7
|
+
ivs: {
|
|
8
|
+
hp: number;
|
|
9
|
+
attack: number;
|
|
10
|
+
defense: number;
|
|
11
|
+
specialAttack: number;
|
|
12
|
+
specialDefense: number;
|
|
13
|
+
speed: number;
|
|
14
|
+
};
|
|
15
|
+
evs: {
|
|
16
|
+
hp: number;
|
|
17
|
+
attack: number;
|
|
18
|
+
defense: number;
|
|
19
|
+
specialAttack: number;
|
|
20
|
+
specialDefense: number;
|
|
21
|
+
speed: number;
|
|
22
|
+
};
|
|
23
|
+
actualValue: {
|
|
24
|
+
hp: number | null;
|
|
25
|
+
attack: number | null;
|
|
26
|
+
defense: number | null;
|
|
27
|
+
specialAttack: number | null;
|
|
28
|
+
specialDefense: number | null;
|
|
29
|
+
speed: number | null;
|
|
30
|
+
};
|
|
31
|
+
moveNames: string[];
|
|
32
|
+
};
|
|
33
|
+
export declare const parse: (pokesolText: string) => PokesolTextParseReult;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE;QACH,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,GAAG,EAAE;QACH,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,WAAW,EAAE;QACX,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;QAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;QAC9B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;KACtB,CAAC;IACF,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,KAAK,gBAAiB,MAAM,KAAG,qBAsH3C,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { ASTKinds, parse as pegParse } from "./parser.js";
|
|
2
|
+
export const parse = (pokesolText) => {
|
|
3
|
+
const result = pegParse(pokesolText);
|
|
4
|
+
if (!result.ast) {
|
|
5
|
+
throw new Error(`Failed to parse Pokesol Text: ${JSON.stringify(result.errs)}`);
|
|
6
|
+
}
|
|
7
|
+
const pokemonName = result.ast.line1.pokemon;
|
|
8
|
+
const itemName = result.ast.line1.kind === ASTKinds.POKEMON_AND_ITEM_LINE
|
|
9
|
+
? result.ast.line1.item
|
|
10
|
+
: null;
|
|
11
|
+
const terastalName = result.ast.line2.teratype || null;
|
|
12
|
+
const abilityName = result.ast.line3.ability || null;
|
|
13
|
+
const natureName = result.ast.line4.nature || null;
|
|
14
|
+
const evs = {
|
|
15
|
+
hp: result.ast.line5.stats.h.kind === ASTKinds.ACTUAL_AND_EFFORT
|
|
16
|
+
? Number(result.ast.line5.stats.h.effort)
|
|
17
|
+
: 0,
|
|
18
|
+
attack: result.ast.line5.stats.a.kind === ASTKinds.ACTUAL_AND_EFFORT
|
|
19
|
+
? Number(result.ast.line5.stats.a.effort)
|
|
20
|
+
: 0,
|
|
21
|
+
defense: result.ast.line5.stats.b.kind === ASTKinds.ACTUAL_AND_EFFORT
|
|
22
|
+
? Number(result.ast.line5.stats.b.effort)
|
|
23
|
+
: 0,
|
|
24
|
+
specialAttack: result.ast.line5.stats.c.kind === ASTKinds.ACTUAL_AND_EFFORT
|
|
25
|
+
? Number(result.ast.line5.stats.c.effort)
|
|
26
|
+
: 0,
|
|
27
|
+
specialDefense: result.ast.line5.stats.d.kind === ASTKinds.ACTUAL_AND_EFFORT
|
|
28
|
+
? Number(result.ast.line5.stats.d.effort)
|
|
29
|
+
: 0,
|
|
30
|
+
speed: result.ast.line5.stats.s.kind === ASTKinds.ACTUAL_AND_EFFORT
|
|
31
|
+
? Number(result.ast.line5.stats.s.effort)
|
|
32
|
+
: 0,
|
|
33
|
+
};
|
|
34
|
+
const actualValue = {
|
|
35
|
+
hp: Number(result.ast.line5.stats.h.actual),
|
|
36
|
+
attack: Number(result.ast.line5.stats.a.actual),
|
|
37
|
+
defense: Number(result.ast.line5.stats.b.actual),
|
|
38
|
+
specialAttack: Number(result.ast.line5.stats.c.actual),
|
|
39
|
+
specialDefense: Number(result.ast.line5.stats.d.actual),
|
|
40
|
+
speed: Number(result.ast.line5.stats.s.actual),
|
|
41
|
+
};
|
|
42
|
+
const ivs = {
|
|
43
|
+
hp: 31,
|
|
44
|
+
attack: 31,
|
|
45
|
+
defense: 31,
|
|
46
|
+
specialAttack: 31,
|
|
47
|
+
specialDefense: 31,
|
|
48
|
+
speed: 31,
|
|
49
|
+
};
|
|
50
|
+
if (result.ast.line5.kind === ASTKinds.STATS_AND_IV_LINE) {
|
|
51
|
+
result.ast.line5.individuals.split(",").forEach((iv) => {
|
|
52
|
+
const ivStatus = iv.match(/[HABCDS]/);
|
|
53
|
+
const ivValue = iv.match(/\d+/);
|
|
54
|
+
if (ivStatus !== null && ivValue !== null) {
|
|
55
|
+
switch (ivStatus[0]) {
|
|
56
|
+
case "H":
|
|
57
|
+
ivs.hp = Number(ivValue[0]);
|
|
58
|
+
break;
|
|
59
|
+
case "A":
|
|
60
|
+
ivs.attack = Number(ivValue[0]);
|
|
61
|
+
break;
|
|
62
|
+
case "B":
|
|
63
|
+
ivs.defense = Number(ivValue[0]);
|
|
64
|
+
break;
|
|
65
|
+
case "C":
|
|
66
|
+
ivs.specialAttack = Number(ivValue[0]);
|
|
67
|
+
break;
|
|
68
|
+
case "D":
|
|
69
|
+
ivs.specialDefense = Number(ivValue[0]);
|
|
70
|
+
break;
|
|
71
|
+
case "S":
|
|
72
|
+
ivs.speed = Number(ivValue[0]);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const moveNames = [];
|
|
79
|
+
if (result.ast.line6.kind === ASTKinds.MOVES_FOUR) {
|
|
80
|
+
moveNames.push(result.ast.line6.move1);
|
|
81
|
+
moveNames.push(result.ast.line6.move2);
|
|
82
|
+
moveNames.push(result.ast.line6.move3);
|
|
83
|
+
moveNames.push(result.ast.line6.move4);
|
|
84
|
+
}
|
|
85
|
+
else if (result.ast.line6.kind === ASTKinds.MOVES_THREE) {
|
|
86
|
+
moveNames.push(result.ast.line6.move1);
|
|
87
|
+
moveNames.push(result.ast.line6.move2);
|
|
88
|
+
moveNames.push(result.ast.line6.move3);
|
|
89
|
+
}
|
|
90
|
+
else if (result.ast.line6.kind === ASTKinds.MOVES_TWO) {
|
|
91
|
+
moveNames.push(result.ast.line6.move1);
|
|
92
|
+
moveNames.push(result.ast.line6.move2);
|
|
93
|
+
}
|
|
94
|
+
else if (result.ast.line6.kind === ASTKinds.MOVES_ONE) {
|
|
95
|
+
moveNames.push(result.ast.line6.move1);
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
pokemonName,
|
|
99
|
+
itemName,
|
|
100
|
+
abilityName,
|
|
101
|
+
terastalName,
|
|
102
|
+
natureName,
|
|
103
|
+
ivs,
|
|
104
|
+
evs,
|
|
105
|
+
actualValue,
|
|
106
|
+
moveNames,
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AAmC1D,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,WAAmB,EAAyB,EAAE;IAClE,MAAM,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;IAErC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClF,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC;IAC7C,MAAM,QAAQ,GACZ,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,qBAAqB;QACtD,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI;QACvB,CAAC,CAAC,IAAI,CAAC;IAEX,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC;IACvD,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC;IACrD,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC;IAEnD,MAAM,GAA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,240 @@
|
|
|
1
|
+
type Nullable<T> = T | null;
|
|
2
|
+
export interface ASTNodeIntf {
|
|
3
|
+
kind: ASTKinds;
|
|
4
|
+
}
|
|
5
|
+
export declare enum ASTKinds {
|
|
6
|
+
POKESOL_TEXT = "POKESOL_TEXT",
|
|
7
|
+
POKESOL_TEXT_$0_1 = "POKESOL_TEXT_$0_1",
|
|
8
|
+
POKESOL_TEXT_$0_2 = "POKESOL_TEXT_$0_2",
|
|
9
|
+
POKESOL_TEXT_$1_1 = "POKESOL_TEXT_$1_1",
|
|
10
|
+
POKESOL_TEXT_$1_2 = "POKESOL_TEXT_$1_2",
|
|
11
|
+
POKEMON_AND_ITEM_LINE = "POKEMON_AND_ITEM_LINE",
|
|
12
|
+
POKEMON_LINE = "POKEMON_LINE",
|
|
13
|
+
POKEMON_VALUE = "POKEMON_VALUE",
|
|
14
|
+
ITEM_VALUE = "ITEM_VALUE",
|
|
15
|
+
TERATYPE_LINE = "TERATYPE_LINE",
|
|
16
|
+
TERATYPE_VALUE = "TERATYPE_VALUE",
|
|
17
|
+
ABILITY_LINE = "ABILITY_LINE",
|
|
18
|
+
ABILITY_VALUE = "ABILITY_VALUE",
|
|
19
|
+
NATURE_LINE = "NATURE_LINE",
|
|
20
|
+
NATURE_VALUE = "NATURE_VALUE",
|
|
21
|
+
STATS_AND_IV_LINE = "STATS_AND_IV_LINE",
|
|
22
|
+
STATS_LINE = "STATS_LINE",
|
|
23
|
+
STATS = "STATS",
|
|
24
|
+
STAT_1 = "STAT_1",
|
|
25
|
+
STAT_2 = "STAT_2",
|
|
26
|
+
ACTUAL_AND_EFFORT = "ACTUAL_AND_EFFORT",
|
|
27
|
+
ACTUAL = "ACTUAL",
|
|
28
|
+
ACTUAL_VALUE = "ACTUAL_VALUE",
|
|
29
|
+
EFFORT_VALUE = "EFFORT_VALUE",
|
|
30
|
+
INDIVIDUALS = "INDIVIDUALS",
|
|
31
|
+
MOVES_LINE_1 = "MOVES_LINE_1",
|
|
32
|
+
MOVES_LINE_2 = "MOVES_LINE_2",
|
|
33
|
+
MOVES_LINE_3 = "MOVES_LINE_3",
|
|
34
|
+
MOVES_LINE_4 = "MOVES_LINE_4",
|
|
35
|
+
MOVES_FOUR = "MOVES_FOUR",
|
|
36
|
+
MOVES_THREE = "MOVES_THREE",
|
|
37
|
+
MOVES_TWO = "MOVES_TWO",
|
|
38
|
+
MOVES_ONE = "MOVES_ONE",
|
|
39
|
+
MOVE_VALUE = "MOVE_VALUE",
|
|
40
|
+
_ = "_"
|
|
41
|
+
}
|
|
42
|
+
export interface POKESOL_TEXT {
|
|
43
|
+
kind: ASTKinds.POKESOL_TEXT;
|
|
44
|
+
line1: POKESOL_TEXT_$0;
|
|
45
|
+
line2: TERATYPE_LINE;
|
|
46
|
+
line3: ABILITY_LINE;
|
|
47
|
+
line4: NATURE_LINE;
|
|
48
|
+
line5: POKESOL_TEXT_$1;
|
|
49
|
+
line6: MOVES_LINE;
|
|
50
|
+
}
|
|
51
|
+
export type POKESOL_TEXT_$0 = POKESOL_TEXT_$0_1 | POKESOL_TEXT_$0_2;
|
|
52
|
+
export type POKESOL_TEXT_$0_1 = POKEMON_AND_ITEM_LINE;
|
|
53
|
+
export type POKESOL_TEXT_$0_2 = POKEMON_LINE;
|
|
54
|
+
export type POKESOL_TEXT_$1 = POKESOL_TEXT_$1_1 | POKESOL_TEXT_$1_2;
|
|
55
|
+
export type POKESOL_TEXT_$1_1 = STATS_AND_IV_LINE;
|
|
56
|
+
export type POKESOL_TEXT_$1_2 = STATS_LINE;
|
|
57
|
+
export interface POKEMON_AND_ITEM_LINE {
|
|
58
|
+
kind: ASTKinds.POKEMON_AND_ITEM_LINE;
|
|
59
|
+
pokemon: POKEMON_VALUE;
|
|
60
|
+
item: ITEM_VALUE;
|
|
61
|
+
}
|
|
62
|
+
export interface POKEMON_LINE {
|
|
63
|
+
kind: ASTKinds.POKEMON_LINE;
|
|
64
|
+
pokemon: POKEMON_VALUE;
|
|
65
|
+
}
|
|
66
|
+
export type POKEMON_VALUE = string;
|
|
67
|
+
export type ITEM_VALUE = string;
|
|
68
|
+
export interface TERATYPE_LINE {
|
|
69
|
+
kind: ASTKinds.TERATYPE_LINE;
|
|
70
|
+
teratype: Nullable<TERATYPE_VALUE>;
|
|
71
|
+
}
|
|
72
|
+
export type TERATYPE_VALUE = string;
|
|
73
|
+
export interface ABILITY_LINE {
|
|
74
|
+
kind: ASTKinds.ABILITY_LINE;
|
|
75
|
+
ability: Nullable<ABILITY_VALUE>;
|
|
76
|
+
}
|
|
77
|
+
export type ABILITY_VALUE = string;
|
|
78
|
+
export interface NATURE_LINE {
|
|
79
|
+
kind: ASTKinds.NATURE_LINE;
|
|
80
|
+
nature: Nullable<NATURE_VALUE>;
|
|
81
|
+
}
|
|
82
|
+
export type NATURE_VALUE = string;
|
|
83
|
+
export interface STATS_AND_IV_LINE {
|
|
84
|
+
kind: ASTKinds.STATS_AND_IV_LINE;
|
|
85
|
+
stats: STATS;
|
|
86
|
+
individuals: INDIVIDUALS;
|
|
87
|
+
}
|
|
88
|
+
export interface STATS_LINE {
|
|
89
|
+
kind: ASTKinds.STATS_LINE;
|
|
90
|
+
stats: STATS;
|
|
91
|
+
}
|
|
92
|
+
export interface STATS {
|
|
93
|
+
kind: ASTKinds.STATS;
|
|
94
|
+
h: STAT;
|
|
95
|
+
a: STAT;
|
|
96
|
+
b: STAT;
|
|
97
|
+
c: STAT;
|
|
98
|
+
d: STAT;
|
|
99
|
+
s: STAT;
|
|
100
|
+
}
|
|
101
|
+
export type STAT = STAT_1 | STAT_2;
|
|
102
|
+
export type STAT_1 = ACTUAL_AND_EFFORT;
|
|
103
|
+
export type STAT_2 = ACTUAL;
|
|
104
|
+
export interface ACTUAL_AND_EFFORT {
|
|
105
|
+
kind: ASTKinds.ACTUAL_AND_EFFORT;
|
|
106
|
+
actual: ACTUAL_VALUE;
|
|
107
|
+
effort: EFFORT_VALUE;
|
|
108
|
+
}
|
|
109
|
+
export interface ACTUAL {
|
|
110
|
+
kind: ASTKinds.ACTUAL;
|
|
111
|
+
actual: ACTUAL_VALUE;
|
|
112
|
+
}
|
|
113
|
+
export type ACTUAL_VALUE = string;
|
|
114
|
+
export type EFFORT_VALUE = string;
|
|
115
|
+
export type INDIVIDUALS = string;
|
|
116
|
+
export type MOVES_LINE = MOVES_LINE_1 | MOVES_LINE_2 | MOVES_LINE_3 | MOVES_LINE_4;
|
|
117
|
+
export type MOVES_LINE_1 = MOVES_FOUR;
|
|
118
|
+
export type MOVES_LINE_2 = MOVES_THREE;
|
|
119
|
+
export type MOVES_LINE_3 = MOVES_TWO;
|
|
120
|
+
export type MOVES_LINE_4 = MOVES_ONE;
|
|
121
|
+
export interface MOVES_FOUR {
|
|
122
|
+
kind: ASTKinds.MOVES_FOUR;
|
|
123
|
+
move1: MOVE_VALUE;
|
|
124
|
+
move2: MOVE_VALUE;
|
|
125
|
+
move3: MOVE_VALUE;
|
|
126
|
+
move4: MOVE_VALUE;
|
|
127
|
+
}
|
|
128
|
+
export interface MOVES_THREE {
|
|
129
|
+
kind: ASTKinds.MOVES_THREE;
|
|
130
|
+
move1: MOVE_VALUE;
|
|
131
|
+
move2: MOVE_VALUE;
|
|
132
|
+
move3: MOVE_VALUE;
|
|
133
|
+
}
|
|
134
|
+
export interface MOVES_TWO {
|
|
135
|
+
kind: ASTKinds.MOVES_TWO;
|
|
136
|
+
move1: MOVE_VALUE;
|
|
137
|
+
move2: MOVE_VALUE;
|
|
138
|
+
}
|
|
139
|
+
export interface MOVES_ONE {
|
|
140
|
+
kind: ASTKinds.MOVES_ONE;
|
|
141
|
+
move1: MOVE_VALUE;
|
|
142
|
+
}
|
|
143
|
+
export type MOVE_VALUE = string;
|
|
144
|
+
export type _ = string;
|
|
145
|
+
export declare class Parser {
|
|
146
|
+
private readonly input;
|
|
147
|
+
private pos;
|
|
148
|
+
private negating;
|
|
149
|
+
private memoSafe;
|
|
150
|
+
constructor(input: string);
|
|
151
|
+
reset(pos: PosInfo): void;
|
|
152
|
+
finished(): boolean;
|
|
153
|
+
clearMemos(): void;
|
|
154
|
+
matchPOKESOL_TEXT($$dpth: number, $$cr?: ErrorTracker): Nullable<POKESOL_TEXT>;
|
|
155
|
+
matchPOKESOL_TEXT_$0($$dpth: number, $$cr?: ErrorTracker): Nullable<POKESOL_TEXT_$0>;
|
|
156
|
+
matchPOKESOL_TEXT_$0_1($$dpth: number, $$cr?: ErrorTracker): Nullable<POKESOL_TEXT_$0_1>;
|
|
157
|
+
matchPOKESOL_TEXT_$0_2($$dpth: number, $$cr?: ErrorTracker): Nullable<POKESOL_TEXT_$0_2>;
|
|
158
|
+
matchPOKESOL_TEXT_$1($$dpth: number, $$cr?: ErrorTracker): Nullable<POKESOL_TEXT_$1>;
|
|
159
|
+
matchPOKESOL_TEXT_$1_1($$dpth: number, $$cr?: ErrorTracker): Nullable<POKESOL_TEXT_$1_1>;
|
|
160
|
+
matchPOKESOL_TEXT_$1_2($$dpth: number, $$cr?: ErrorTracker): Nullable<POKESOL_TEXT_$1_2>;
|
|
161
|
+
matchPOKEMON_AND_ITEM_LINE($$dpth: number, $$cr?: ErrorTracker): Nullable<POKEMON_AND_ITEM_LINE>;
|
|
162
|
+
matchPOKEMON_LINE($$dpth: number, $$cr?: ErrorTracker): Nullable<POKEMON_LINE>;
|
|
163
|
+
matchPOKEMON_VALUE($$dpth: number, $$cr?: ErrorTracker): Nullable<POKEMON_VALUE>;
|
|
164
|
+
matchITEM_VALUE($$dpth: number, $$cr?: ErrorTracker): Nullable<ITEM_VALUE>;
|
|
165
|
+
matchTERATYPE_LINE($$dpth: number, $$cr?: ErrorTracker): Nullable<TERATYPE_LINE>;
|
|
166
|
+
matchTERATYPE_VALUE($$dpth: number, $$cr?: ErrorTracker): Nullable<TERATYPE_VALUE>;
|
|
167
|
+
matchABILITY_LINE($$dpth: number, $$cr?: ErrorTracker): Nullable<ABILITY_LINE>;
|
|
168
|
+
matchABILITY_VALUE($$dpth: number, $$cr?: ErrorTracker): Nullable<ABILITY_VALUE>;
|
|
169
|
+
matchNATURE_LINE($$dpth: number, $$cr?: ErrorTracker): Nullable<NATURE_LINE>;
|
|
170
|
+
matchNATURE_VALUE($$dpth: number, $$cr?: ErrorTracker): Nullable<NATURE_VALUE>;
|
|
171
|
+
matchSTATS_AND_IV_LINE($$dpth: number, $$cr?: ErrorTracker): Nullable<STATS_AND_IV_LINE>;
|
|
172
|
+
matchSTATS_LINE($$dpth: number, $$cr?: ErrorTracker): Nullable<STATS_LINE>;
|
|
173
|
+
matchSTATS($$dpth: number, $$cr?: ErrorTracker): Nullable<STATS>;
|
|
174
|
+
matchSTAT($$dpth: number, $$cr?: ErrorTracker): Nullable<STAT>;
|
|
175
|
+
matchSTAT_1($$dpth: number, $$cr?: ErrorTracker): Nullable<STAT_1>;
|
|
176
|
+
matchSTAT_2($$dpth: number, $$cr?: ErrorTracker): Nullable<STAT_2>;
|
|
177
|
+
matchACTUAL_AND_EFFORT($$dpth: number, $$cr?: ErrorTracker): Nullable<ACTUAL_AND_EFFORT>;
|
|
178
|
+
matchACTUAL($$dpth: number, $$cr?: ErrorTracker): Nullable<ACTUAL>;
|
|
179
|
+
matchACTUAL_VALUE($$dpth: number, $$cr?: ErrorTracker): Nullable<ACTUAL_VALUE>;
|
|
180
|
+
matchEFFORT_VALUE($$dpth: number, $$cr?: ErrorTracker): Nullable<EFFORT_VALUE>;
|
|
181
|
+
matchINDIVIDUALS($$dpth: number, $$cr?: ErrorTracker): Nullable<INDIVIDUALS>;
|
|
182
|
+
matchMOVES_LINE($$dpth: number, $$cr?: ErrorTracker): Nullable<MOVES_LINE>;
|
|
183
|
+
matchMOVES_LINE_1($$dpth: number, $$cr?: ErrorTracker): Nullable<MOVES_LINE_1>;
|
|
184
|
+
matchMOVES_LINE_2($$dpth: number, $$cr?: ErrorTracker): Nullable<MOVES_LINE_2>;
|
|
185
|
+
matchMOVES_LINE_3($$dpth: number, $$cr?: ErrorTracker): Nullable<MOVES_LINE_3>;
|
|
186
|
+
matchMOVES_LINE_4($$dpth: number, $$cr?: ErrorTracker): Nullable<MOVES_LINE_4>;
|
|
187
|
+
matchMOVES_FOUR($$dpth: number, $$cr?: ErrorTracker): Nullable<MOVES_FOUR>;
|
|
188
|
+
matchMOVES_THREE($$dpth: number, $$cr?: ErrorTracker): Nullable<MOVES_THREE>;
|
|
189
|
+
matchMOVES_TWO($$dpth: number, $$cr?: ErrorTracker): Nullable<MOVES_TWO>;
|
|
190
|
+
matchMOVES_ONE($$dpth: number, $$cr?: ErrorTracker): Nullable<MOVES_ONE>;
|
|
191
|
+
matchMOVE_VALUE($$dpth: number, $$cr?: ErrorTracker): Nullable<MOVE_VALUE>;
|
|
192
|
+
match_($$dpth: number, $$cr?: ErrorTracker): Nullable<_>;
|
|
193
|
+
test(): boolean;
|
|
194
|
+
parse(): ParseResult;
|
|
195
|
+
mark(): PosInfo;
|
|
196
|
+
private loopPlus;
|
|
197
|
+
private loop;
|
|
198
|
+
private run;
|
|
199
|
+
private choice;
|
|
200
|
+
private regexAccept;
|
|
201
|
+
private tryConsume;
|
|
202
|
+
private noConsume;
|
|
203
|
+
private negate;
|
|
204
|
+
private memoise;
|
|
205
|
+
}
|
|
206
|
+
export declare function parse(s: string): ParseResult;
|
|
207
|
+
export interface ParseResult {
|
|
208
|
+
ast: Nullable<POKESOL_TEXT>;
|
|
209
|
+
errs: SyntaxErr[];
|
|
210
|
+
}
|
|
211
|
+
export interface PosInfo {
|
|
212
|
+
readonly overallPos: number;
|
|
213
|
+
readonly line: number;
|
|
214
|
+
readonly offset: number;
|
|
215
|
+
}
|
|
216
|
+
export interface RegexMatch {
|
|
217
|
+
readonly kind: "RegexMatch";
|
|
218
|
+
readonly negated: boolean;
|
|
219
|
+
readonly literal: string;
|
|
220
|
+
}
|
|
221
|
+
export type EOFMatch = {
|
|
222
|
+
kind: "EOF";
|
|
223
|
+
negated: boolean;
|
|
224
|
+
};
|
|
225
|
+
export type MatchAttempt = RegexMatch | EOFMatch;
|
|
226
|
+
export declare class SyntaxErr {
|
|
227
|
+
pos: PosInfo;
|
|
228
|
+
expmatches: MatchAttempt[];
|
|
229
|
+
constructor(pos: PosInfo, expmatches: MatchAttempt[]);
|
|
230
|
+
toString(): string;
|
|
231
|
+
}
|
|
232
|
+
declare class ErrorTracker {
|
|
233
|
+
private mxpos;
|
|
234
|
+
private regexset;
|
|
235
|
+
private pmatches;
|
|
236
|
+
record(pos: PosInfo, result: any, att: MatchAttempt): void;
|
|
237
|
+
getErr(): SyntaxErr | null;
|
|
238
|
+
}
|
|
239
|
+
export {};
|
|
240
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AA2CA,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAE5B,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,QAAQ,CAAC;CAClB;AACD,oBAAY,QAAQ;IAChB,YAAY,iBAAiB;IAC7B,iBAAiB,sBAAsB;IACvC,iBAAiB,sBAAsB;IACvC,iBAAiB,sBAAsB;IACvC,iBAAiB,sBAAsB;IACvC,qBAAqB,0BAA0B;IAC/C,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;IAC/B,UAAU,eAAe;IACzB,aAAa,kBAAkB;IAC/B,cAAc,mBAAmB;IACjC,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;IAC/B,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,iBAAiB,sBAAsB;IACvC,UAAU,eAAe;IACzB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,iBAAiB,sBAAsB;IACvC,MAAM,WAAW;IACjB,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;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AAE,OAAO,CAAC;IACb,UAAU,EAAE,YAAY,EAAE,CAAC;gBACtB,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE;IAI7C,QAAQ,IAAI,MAAM;CAG5B;AACD,cAAM,YAAY;IACd,OAAO,CAAC,KAAK,CAAmD;IAChE,OAAO,CAAC,QAAQ,CAA0B;IAC1C,OAAO,CAAC,QAAQ,CAAsB;IAC/B,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,YAAY;IAkBnD,MAAM,IAAI,SAAS,GAAG,IAAI;CAKpC"}
|
package/dist/parser.js
ADDED
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
export var ASTKinds;
|
|
2
|
+
(function (ASTKinds) {
|
|
3
|
+
ASTKinds["POKESOL_TEXT"] = "POKESOL_TEXT";
|
|
4
|
+
ASTKinds["POKESOL_TEXT_$0_1"] = "POKESOL_TEXT_$0_1";
|
|
5
|
+
ASTKinds["POKESOL_TEXT_$0_2"] = "POKESOL_TEXT_$0_2";
|
|
6
|
+
ASTKinds["POKESOL_TEXT_$1_1"] = "POKESOL_TEXT_$1_1";
|
|
7
|
+
ASTKinds["POKESOL_TEXT_$1_2"] = "POKESOL_TEXT_$1_2";
|
|
8
|
+
ASTKinds["POKEMON_AND_ITEM_LINE"] = "POKEMON_AND_ITEM_LINE";
|
|
9
|
+
ASTKinds["POKEMON_LINE"] = "POKEMON_LINE";
|
|
10
|
+
ASTKinds["POKEMON_VALUE"] = "POKEMON_VALUE";
|
|
11
|
+
ASTKinds["ITEM_VALUE"] = "ITEM_VALUE";
|
|
12
|
+
ASTKinds["TERATYPE_LINE"] = "TERATYPE_LINE";
|
|
13
|
+
ASTKinds["TERATYPE_VALUE"] = "TERATYPE_VALUE";
|
|
14
|
+
ASTKinds["ABILITY_LINE"] = "ABILITY_LINE";
|
|
15
|
+
ASTKinds["ABILITY_VALUE"] = "ABILITY_VALUE";
|
|
16
|
+
ASTKinds["NATURE_LINE"] = "NATURE_LINE";
|
|
17
|
+
ASTKinds["NATURE_VALUE"] = "NATURE_VALUE";
|
|
18
|
+
ASTKinds["STATS_AND_IV_LINE"] = "STATS_AND_IV_LINE";
|
|
19
|
+
ASTKinds["STATS_LINE"] = "STATS_LINE";
|
|
20
|
+
ASTKinds["STATS"] = "STATS";
|
|
21
|
+
ASTKinds["STAT_1"] = "STAT_1";
|
|
22
|
+
ASTKinds["STAT_2"] = "STAT_2";
|
|
23
|
+
ASTKinds["ACTUAL_AND_EFFORT"] = "ACTUAL_AND_EFFORT";
|
|
24
|
+
ASTKinds["ACTUAL"] = "ACTUAL";
|
|
25
|
+
ASTKinds["ACTUAL_VALUE"] = "ACTUAL_VALUE";
|
|
26
|
+
ASTKinds["EFFORT_VALUE"] = "EFFORT_VALUE";
|
|
27
|
+
ASTKinds["INDIVIDUALS"] = "INDIVIDUALS";
|
|
28
|
+
ASTKinds["MOVES_LINE_1"] = "MOVES_LINE_1";
|
|
29
|
+
ASTKinds["MOVES_LINE_2"] = "MOVES_LINE_2";
|
|
30
|
+
ASTKinds["MOVES_LINE_3"] = "MOVES_LINE_3";
|
|
31
|
+
ASTKinds["MOVES_LINE_4"] = "MOVES_LINE_4";
|
|
32
|
+
ASTKinds["MOVES_FOUR"] = "MOVES_FOUR";
|
|
33
|
+
ASTKinds["MOVES_THREE"] = "MOVES_THREE";
|
|
34
|
+
ASTKinds["MOVES_TWO"] = "MOVES_TWO";
|
|
35
|
+
ASTKinds["MOVES_ONE"] = "MOVES_ONE";
|
|
36
|
+
ASTKinds["MOVE_VALUE"] = "MOVE_VALUE";
|
|
37
|
+
ASTKinds["_"] = "_";
|
|
38
|
+
})(ASTKinds || (ASTKinds = {}));
|
|
39
|
+
export class Parser {
|
|
40
|
+
input;
|
|
41
|
+
pos;
|
|
42
|
+
negating = false;
|
|
43
|
+
memoSafe = true;
|
|
44
|
+
constructor(input) {
|
|
45
|
+
this.pos = { overallPos: 0, line: 1, offset: 0 };
|
|
46
|
+
this.input = input;
|
|
47
|
+
}
|
|
48
|
+
reset(pos) {
|
|
49
|
+
this.pos = pos;
|
|
50
|
+
}
|
|
51
|
+
finished() {
|
|
52
|
+
return this.pos.overallPos === this.input.length;
|
|
53
|
+
}
|
|
54
|
+
clearMemos() {
|
|
55
|
+
}
|
|
56
|
+
matchPOKESOL_TEXT($$dpth, $$cr) {
|
|
57
|
+
return this.run($$dpth, () => {
|
|
58
|
+
let $scope$line1;
|
|
59
|
+
let $scope$line2;
|
|
60
|
+
let $scope$line3;
|
|
61
|
+
let $scope$line4;
|
|
62
|
+
let $scope$line5;
|
|
63
|
+
let $scope$line6;
|
|
64
|
+
let $$res = null;
|
|
65
|
+
if (true
|
|
66
|
+
&& ($scope$line1 = this.matchPOKESOL_TEXT_$0($$dpth + 1, $$cr)) !== null
|
|
67
|
+
&& this.regexAccept(String.raw `(?:\n)`, "", $$dpth + 1, $$cr) !== null
|
|
68
|
+
&& ($scope$line2 = this.matchTERATYPE_LINE($$dpth + 1, $$cr)) !== null
|
|
69
|
+
&& this.regexAccept(String.raw `(?:\n)`, "", $$dpth + 1, $$cr) !== null
|
|
70
|
+
&& ($scope$line3 = this.matchABILITY_LINE($$dpth + 1, $$cr)) !== null
|
|
71
|
+
&& this.regexAccept(String.raw `(?:\n)`, "", $$dpth + 1, $$cr) !== null
|
|
72
|
+
&& ($scope$line4 = this.matchNATURE_LINE($$dpth + 1, $$cr)) !== null
|
|
73
|
+
&& this.regexAccept(String.raw `(?:\n)`, "", $$dpth + 1, $$cr) !== null
|
|
74
|
+
&& ($scope$line5 = this.matchPOKESOL_TEXT_$1($$dpth + 1, $$cr)) !== null
|
|
75
|
+
&& this.regexAccept(String.raw `(?:\n)`, "", $$dpth + 1, $$cr) !== null
|
|
76
|
+
&& ($scope$line6 = this.matchMOVES_LINE($$dpth + 1, $$cr)) !== null) {
|
|
77
|
+
$$res = { kind: ASTKinds.POKESOL_TEXT, line1: $scope$line1, line2: $scope$line2, line3: $scope$line3, line4: $scope$line4, line5: $scope$line5, line6: $scope$line6 };
|
|
78
|
+
}
|
|
79
|
+
return $$res;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
matchPOKESOL_TEXT_$0($$dpth, $$cr) {
|
|
83
|
+
return this.choice([
|
|
84
|
+
() => this.matchPOKESOL_TEXT_$0_1($$dpth + 1, $$cr),
|
|
85
|
+
() => this.matchPOKESOL_TEXT_$0_2($$dpth + 1, $$cr),
|
|
86
|
+
]);
|
|
87
|
+
}
|
|
88
|
+
matchPOKESOL_TEXT_$0_1($$dpth, $$cr) {
|
|
89
|
+
return this.matchPOKEMON_AND_ITEM_LINE($$dpth + 1, $$cr);
|
|
90
|
+
}
|
|
91
|
+
matchPOKESOL_TEXT_$0_2($$dpth, $$cr) {
|
|
92
|
+
return this.matchPOKEMON_LINE($$dpth + 1, $$cr);
|
|
93
|
+
}
|
|
94
|
+
matchPOKESOL_TEXT_$1($$dpth, $$cr) {
|
|
95
|
+
return this.choice([
|
|
96
|
+
() => this.matchPOKESOL_TEXT_$1_1($$dpth + 1, $$cr),
|
|
97
|
+
() => this.matchPOKESOL_TEXT_$1_2($$dpth + 1, $$cr),
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
100
|
+
matchPOKESOL_TEXT_$1_1($$dpth, $$cr) {
|
|
101
|
+
return this.matchSTATS_AND_IV_LINE($$dpth + 1, $$cr);
|
|
102
|
+
}
|
|
103
|
+
matchPOKESOL_TEXT_$1_2($$dpth, $$cr) {
|
|
104
|
+
return this.matchSTATS_LINE($$dpth + 1, $$cr);
|
|
105
|
+
}
|
|
106
|
+
matchPOKEMON_AND_ITEM_LINE($$dpth, $$cr) {
|
|
107
|
+
return this.run($$dpth, () => {
|
|
108
|
+
let $scope$pokemon;
|
|
109
|
+
let $scope$item;
|
|
110
|
+
let $$res = null;
|
|
111
|
+
if (true
|
|
112
|
+
&& ($scope$pokemon = this.matchPOKEMON_VALUE($$dpth + 1, $$cr)) !== null
|
|
113
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
114
|
+
&& this.regexAccept(String.raw `(?:@)`, "", $$dpth + 1, $$cr) !== null
|
|
115
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
116
|
+
&& ($scope$item = this.matchITEM_VALUE($$dpth + 1, $$cr)) !== null) {
|
|
117
|
+
$$res = { kind: ASTKinds.POKEMON_AND_ITEM_LINE, pokemon: $scope$pokemon, item: $scope$item };
|
|
118
|
+
}
|
|
119
|
+
return $$res;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
matchPOKEMON_LINE($$dpth, $$cr) {
|
|
123
|
+
return this.run($$dpth, () => {
|
|
124
|
+
let $scope$pokemon;
|
|
125
|
+
let $$res = null;
|
|
126
|
+
if (true
|
|
127
|
+
&& ($scope$pokemon = this.matchPOKEMON_VALUE($$dpth + 1, $$cr)) !== null) {
|
|
128
|
+
$$res = { kind: ASTKinds.POKEMON_LINE, pokemon: $scope$pokemon };
|
|
129
|
+
}
|
|
130
|
+
return $$res;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
matchPOKEMON_VALUE($$dpth, $$cr) {
|
|
134
|
+
return this.regexAccept(String.raw `(?:[0-9a-zA-Zぁ-んァ-ヶー一-龠・()♂♀%]+)`, "", $$dpth + 1, $$cr);
|
|
135
|
+
}
|
|
136
|
+
matchITEM_VALUE($$dpth, $$cr) {
|
|
137
|
+
return this.regexAccept(String.raw `(?:[ぁ-んァ-ヶー]+)`, "", $$dpth + 1, $$cr);
|
|
138
|
+
}
|
|
139
|
+
matchTERATYPE_LINE($$dpth, $$cr) {
|
|
140
|
+
return this.run($$dpth, () => {
|
|
141
|
+
let $scope$teratype;
|
|
142
|
+
let $$res = null;
|
|
143
|
+
if (true
|
|
144
|
+
&& this.regexAccept(String.raw `(?:テラスタイプ)`, "", $$dpth + 1, $$cr) !== null
|
|
145
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
146
|
+
&& this.regexAccept(String.raw `(?::)`, "", $$dpth + 1, $$cr) !== null
|
|
147
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
148
|
+
&& (($scope$teratype = this.matchTERATYPE_VALUE($$dpth + 1, $$cr)) || true)) {
|
|
149
|
+
$$res = { kind: ASTKinds.TERATYPE_LINE, teratype: $scope$teratype };
|
|
150
|
+
}
|
|
151
|
+
return $$res;
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
matchTERATYPE_VALUE($$dpth, $$cr) {
|
|
155
|
+
return this.regexAccept(String.raw `(?:[ぁ-んァ-ヶー]*)`, "", $$dpth + 1, $$cr);
|
|
156
|
+
}
|
|
157
|
+
matchABILITY_LINE($$dpth, $$cr) {
|
|
158
|
+
return this.run($$dpth, () => {
|
|
159
|
+
let $scope$ability;
|
|
160
|
+
let $$res = null;
|
|
161
|
+
if (true
|
|
162
|
+
&& this.regexAccept(String.raw `(?:特性)`, "", $$dpth + 1, $$cr) !== null
|
|
163
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
164
|
+
&& this.regexAccept(String.raw `(?::)`, "", $$dpth + 1, $$cr) !== null
|
|
165
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
166
|
+
&& (($scope$ability = this.matchABILITY_VALUE($$dpth + 1, $$cr)) || true)) {
|
|
167
|
+
$$res = { kind: ASTKinds.ABILITY_LINE, ability: $scope$ability };
|
|
168
|
+
}
|
|
169
|
+
return $$res;
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
matchABILITY_VALUE($$dpth, $$cr) {
|
|
173
|
+
return this.regexAccept(String.raw `(?:[ぁ-んァ-ヶー]+)`, "", $$dpth + 1, $$cr);
|
|
174
|
+
}
|
|
175
|
+
matchNATURE_LINE($$dpth, $$cr) {
|
|
176
|
+
return this.run($$dpth, () => {
|
|
177
|
+
let $scope$nature;
|
|
178
|
+
let $$res = null;
|
|
179
|
+
if (true
|
|
180
|
+
&& this.regexAccept(String.raw `(?:性格)`, "", $$dpth + 1, $$cr) !== null
|
|
181
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
182
|
+
&& this.regexAccept(String.raw `(?::)`, "", $$dpth + 1, $$cr) !== null
|
|
183
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
184
|
+
&& (($scope$nature = this.matchNATURE_VALUE($$dpth + 1, $$cr)) || true)) {
|
|
185
|
+
$$res = { kind: ASTKinds.NATURE_LINE, nature: $scope$nature };
|
|
186
|
+
}
|
|
187
|
+
return $$res;
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
matchNATURE_VALUE($$dpth, $$cr) {
|
|
191
|
+
return this.regexAccept(String.raw `(?:[ぁ-ん]+)`, "", $$dpth + 1, $$cr);
|
|
192
|
+
}
|
|
193
|
+
matchSTATS_AND_IV_LINE($$dpth, $$cr) {
|
|
194
|
+
return this.run($$dpth, () => {
|
|
195
|
+
let $scope$stats;
|
|
196
|
+
let $scope$individuals;
|
|
197
|
+
let $$res = null;
|
|
198
|
+
if (true
|
|
199
|
+
&& ($scope$stats = this.matchSTATS($$dpth + 1, $$cr)) !== null
|
|
200
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
201
|
+
&& this.regexAccept(String.raw `(?:\*)`, "", $$dpth + 1, $$cr) !== null
|
|
202
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
203
|
+
&& ($scope$individuals = this.matchINDIVIDUALS($$dpth + 1, $$cr)) !== null) {
|
|
204
|
+
$$res = { kind: ASTKinds.STATS_AND_IV_LINE, stats: $scope$stats, individuals: $scope$individuals };
|
|
205
|
+
}
|
|
206
|
+
return $$res;
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
matchSTATS_LINE($$dpth, $$cr) {
|
|
210
|
+
return this.run($$dpth, () => {
|
|
211
|
+
let $scope$stats;
|
|
212
|
+
let $$res = null;
|
|
213
|
+
if (true
|
|
214
|
+
&& ($scope$stats = this.matchSTATS($$dpth + 1, $$cr)) !== null) {
|
|
215
|
+
$$res = { kind: ASTKinds.STATS_LINE, stats: $scope$stats };
|
|
216
|
+
}
|
|
217
|
+
return $$res;
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
matchSTATS($$dpth, $$cr) {
|
|
221
|
+
return this.run($$dpth, () => {
|
|
222
|
+
let $scope$h;
|
|
223
|
+
let $scope$a;
|
|
224
|
+
let $scope$b;
|
|
225
|
+
let $scope$c;
|
|
226
|
+
let $scope$d;
|
|
227
|
+
let $scope$s;
|
|
228
|
+
let $$res = null;
|
|
229
|
+
if (true
|
|
230
|
+
&& ($scope$h = this.matchSTAT($$dpth + 1, $$cr)) !== null
|
|
231
|
+
&& this.regexAccept(String.raw `(?:-)`, "", $$dpth + 1, $$cr) !== null
|
|
232
|
+
&& ($scope$a = this.matchSTAT($$dpth + 1, $$cr)) !== null
|
|
233
|
+
&& this.regexAccept(String.raw `(?:-)`, "", $$dpth + 1, $$cr) !== null
|
|
234
|
+
&& ($scope$b = this.matchSTAT($$dpth + 1, $$cr)) !== null
|
|
235
|
+
&& this.regexAccept(String.raw `(?:-)`, "", $$dpth + 1, $$cr) !== null
|
|
236
|
+
&& ($scope$c = this.matchSTAT($$dpth + 1, $$cr)) !== null
|
|
237
|
+
&& this.regexAccept(String.raw `(?:-)`, "", $$dpth + 1, $$cr) !== null
|
|
238
|
+
&& ($scope$d = this.matchSTAT($$dpth + 1, $$cr)) !== null
|
|
239
|
+
&& this.regexAccept(String.raw `(?:-)`, "", $$dpth + 1, $$cr) !== null
|
|
240
|
+
&& ($scope$s = this.matchSTAT($$dpth + 1, $$cr)) !== null) {
|
|
241
|
+
$$res = { kind: ASTKinds.STATS, h: $scope$h, a: $scope$a, b: $scope$b, c: $scope$c, d: $scope$d, s: $scope$s };
|
|
242
|
+
}
|
|
243
|
+
return $$res;
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
matchSTAT($$dpth, $$cr) {
|
|
247
|
+
return this.choice([
|
|
248
|
+
() => this.matchSTAT_1($$dpth + 1, $$cr),
|
|
249
|
+
() => this.matchSTAT_2($$dpth + 1, $$cr),
|
|
250
|
+
]);
|
|
251
|
+
}
|
|
252
|
+
matchSTAT_1($$dpth, $$cr) {
|
|
253
|
+
return this.matchACTUAL_AND_EFFORT($$dpth + 1, $$cr);
|
|
254
|
+
}
|
|
255
|
+
matchSTAT_2($$dpth, $$cr) {
|
|
256
|
+
return this.matchACTUAL($$dpth + 1, $$cr);
|
|
257
|
+
}
|
|
258
|
+
matchACTUAL_AND_EFFORT($$dpth, $$cr) {
|
|
259
|
+
return this.run($$dpth, () => {
|
|
260
|
+
let $scope$actual;
|
|
261
|
+
let $scope$effort;
|
|
262
|
+
let $$res = null;
|
|
263
|
+
if (true
|
|
264
|
+
&& ($scope$actual = this.matchACTUAL_VALUE($$dpth + 1, $$cr)) !== null
|
|
265
|
+
&& this.regexAccept(String.raw `(?:\()`, "", $$dpth + 1, $$cr) !== null
|
|
266
|
+
&& ($scope$effort = this.matchEFFORT_VALUE($$dpth + 1, $$cr)) !== null
|
|
267
|
+
&& this.regexAccept(String.raw `(?:\))`, "", $$dpth + 1, $$cr) !== null) {
|
|
268
|
+
$$res = { kind: ASTKinds.ACTUAL_AND_EFFORT, actual: $scope$actual, effort: $scope$effort };
|
|
269
|
+
}
|
|
270
|
+
return $$res;
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
matchACTUAL($$dpth, $$cr) {
|
|
274
|
+
return this.run($$dpth, () => {
|
|
275
|
+
let $scope$actual;
|
|
276
|
+
let $$res = null;
|
|
277
|
+
if (true
|
|
278
|
+
&& ($scope$actual = this.matchACTUAL_VALUE($$dpth + 1, $$cr)) !== null) {
|
|
279
|
+
$$res = { kind: ASTKinds.ACTUAL, actual: $scope$actual };
|
|
280
|
+
}
|
|
281
|
+
return $$res;
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
matchACTUAL_VALUE($$dpth, $$cr) {
|
|
285
|
+
return this.regexAccept(String.raw `(?:[1-9][0-9]*)`, "", $$dpth + 1, $$cr);
|
|
286
|
+
}
|
|
287
|
+
matchEFFORT_VALUE($$dpth, $$cr) {
|
|
288
|
+
return this.regexAccept(String.raw `(?:[1-9][0-9]*)`, "", $$dpth + 1, $$cr);
|
|
289
|
+
}
|
|
290
|
+
matchINDIVIDUALS($$dpth, $$cr) {
|
|
291
|
+
return this.regexAccept(String.raw `(?:[HABCDS0-9, ]+)`, "", $$dpth + 1, $$cr);
|
|
292
|
+
}
|
|
293
|
+
matchMOVES_LINE($$dpth, $$cr) {
|
|
294
|
+
return this.choice([
|
|
295
|
+
() => this.matchMOVES_LINE_1($$dpth + 1, $$cr),
|
|
296
|
+
() => this.matchMOVES_LINE_2($$dpth + 1, $$cr),
|
|
297
|
+
() => this.matchMOVES_LINE_3($$dpth + 1, $$cr),
|
|
298
|
+
() => this.matchMOVES_LINE_4($$dpth + 1, $$cr),
|
|
299
|
+
]);
|
|
300
|
+
}
|
|
301
|
+
matchMOVES_LINE_1($$dpth, $$cr) {
|
|
302
|
+
return this.matchMOVES_FOUR($$dpth + 1, $$cr);
|
|
303
|
+
}
|
|
304
|
+
matchMOVES_LINE_2($$dpth, $$cr) {
|
|
305
|
+
return this.matchMOVES_THREE($$dpth + 1, $$cr);
|
|
306
|
+
}
|
|
307
|
+
matchMOVES_LINE_3($$dpth, $$cr) {
|
|
308
|
+
return this.matchMOVES_TWO($$dpth + 1, $$cr);
|
|
309
|
+
}
|
|
310
|
+
matchMOVES_LINE_4($$dpth, $$cr) {
|
|
311
|
+
return this.matchMOVES_ONE($$dpth + 1, $$cr);
|
|
312
|
+
}
|
|
313
|
+
matchMOVES_FOUR($$dpth, $$cr) {
|
|
314
|
+
return this.run($$dpth, () => {
|
|
315
|
+
let $scope$move1;
|
|
316
|
+
let $scope$move2;
|
|
317
|
+
let $scope$move3;
|
|
318
|
+
let $scope$move4;
|
|
319
|
+
let $$res = null;
|
|
320
|
+
if (true
|
|
321
|
+
&& ($scope$move1 = this.matchMOVE_VALUE($$dpth + 1, $$cr)) !== null
|
|
322
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
323
|
+
&& this.regexAccept(String.raw `(?:/)`, "", $$dpth + 1, $$cr) !== null
|
|
324
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
325
|
+
&& ($scope$move2 = this.matchMOVE_VALUE($$dpth + 1, $$cr)) !== null
|
|
326
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
327
|
+
&& this.regexAccept(String.raw `(?:/)`, "", $$dpth + 1, $$cr) !== null
|
|
328
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
329
|
+
&& ($scope$move3 = this.matchMOVE_VALUE($$dpth + 1, $$cr)) !== null
|
|
330
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
331
|
+
&& this.regexAccept(String.raw `(?:/)`, "", $$dpth + 1, $$cr) !== null
|
|
332
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
333
|
+
&& ($scope$move4 = this.matchMOVE_VALUE($$dpth + 1, $$cr)) !== null) {
|
|
334
|
+
$$res = { kind: ASTKinds.MOVES_FOUR, move1: $scope$move1, move2: $scope$move2, move3: $scope$move3, move4: $scope$move4 };
|
|
335
|
+
}
|
|
336
|
+
return $$res;
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
matchMOVES_THREE($$dpth, $$cr) {
|
|
340
|
+
return this.run($$dpth, () => {
|
|
341
|
+
let $scope$move1;
|
|
342
|
+
let $scope$move2;
|
|
343
|
+
let $scope$move3;
|
|
344
|
+
let $$res = null;
|
|
345
|
+
if (true
|
|
346
|
+
&& ($scope$move1 = this.matchMOVE_VALUE($$dpth + 1, $$cr)) !== null
|
|
347
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
348
|
+
&& this.regexAccept(String.raw `(?:/)`, "", $$dpth + 1, $$cr) !== null
|
|
349
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
350
|
+
&& ($scope$move2 = this.matchMOVE_VALUE($$dpth + 1, $$cr)) !== null
|
|
351
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
352
|
+
&& this.regexAccept(String.raw `(?:/)`, "", $$dpth + 1, $$cr) !== null
|
|
353
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
354
|
+
&& ($scope$move3 = this.matchMOVE_VALUE($$dpth + 1, $$cr)) !== null) {
|
|
355
|
+
$$res = { kind: ASTKinds.MOVES_THREE, move1: $scope$move1, move2: $scope$move2, move3: $scope$move3 };
|
|
356
|
+
}
|
|
357
|
+
return $$res;
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
matchMOVES_TWO($$dpth, $$cr) {
|
|
361
|
+
return this.run($$dpth, () => {
|
|
362
|
+
let $scope$move1;
|
|
363
|
+
let $scope$move2;
|
|
364
|
+
let $$res = null;
|
|
365
|
+
if (true
|
|
366
|
+
&& ($scope$move1 = this.matchMOVE_VALUE($$dpth + 1, $$cr)) !== null
|
|
367
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
368
|
+
&& this.regexAccept(String.raw `(?:/)`, "", $$dpth + 1, $$cr) !== null
|
|
369
|
+
&& this.match_($$dpth + 1, $$cr) !== null
|
|
370
|
+
&& ($scope$move2 = this.matchMOVE_VALUE($$dpth + 1, $$cr)) !== null) {
|
|
371
|
+
$$res = { kind: ASTKinds.MOVES_TWO, move1: $scope$move1, move2: $scope$move2 };
|
|
372
|
+
}
|
|
373
|
+
return $$res;
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
matchMOVES_ONE($$dpth, $$cr) {
|
|
377
|
+
return this.run($$dpth, () => {
|
|
378
|
+
let $scope$move1;
|
|
379
|
+
let $$res = null;
|
|
380
|
+
if (true
|
|
381
|
+
&& ($scope$move1 = this.matchMOVE_VALUE($$dpth + 1, $$cr)) !== null) {
|
|
382
|
+
$$res = { kind: ASTKinds.MOVES_ONE, move1: $scope$move1 };
|
|
383
|
+
}
|
|
384
|
+
return $$res;
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
matchMOVE_VALUE($$dpth, $$cr) {
|
|
388
|
+
return this.regexAccept(String.raw `(?:[0-9ぁ-んァ-ヶー・]+)`, "", $$dpth + 1, $$cr);
|
|
389
|
+
}
|
|
390
|
+
match_($$dpth, $$cr) {
|
|
391
|
+
return this.regexAccept(String.raw `(?:[ \t]*)`, "", $$dpth + 1, $$cr);
|
|
392
|
+
}
|
|
393
|
+
test() {
|
|
394
|
+
const mrk = this.mark();
|
|
395
|
+
const res = this.matchPOKESOL_TEXT(0);
|
|
396
|
+
const ans = res !== null;
|
|
397
|
+
this.reset(mrk);
|
|
398
|
+
return ans;
|
|
399
|
+
}
|
|
400
|
+
parse() {
|
|
401
|
+
const mrk = this.mark();
|
|
402
|
+
const res = this.matchPOKESOL_TEXT(0);
|
|
403
|
+
if (res)
|
|
404
|
+
return { ast: res, errs: [] };
|
|
405
|
+
this.reset(mrk);
|
|
406
|
+
const rec = new ErrorTracker();
|
|
407
|
+
this.clearMemos();
|
|
408
|
+
this.matchPOKESOL_TEXT(0, rec);
|
|
409
|
+
const err = rec.getErr();
|
|
410
|
+
return { ast: res, errs: err !== null ? [err] : [] };
|
|
411
|
+
}
|
|
412
|
+
mark() {
|
|
413
|
+
return this.pos;
|
|
414
|
+
}
|
|
415
|
+
// @ts-ignore: loopPlus may not be called
|
|
416
|
+
loopPlus(func) {
|
|
417
|
+
return this.loop(func, 1, -1);
|
|
418
|
+
}
|
|
419
|
+
loop(func, lb, ub) {
|
|
420
|
+
const mrk = this.mark();
|
|
421
|
+
const res = [];
|
|
422
|
+
while (ub === -1 || res.length < ub) {
|
|
423
|
+
const preMrk = this.mark();
|
|
424
|
+
const t = func();
|
|
425
|
+
if (t === null || this.pos.overallPos === preMrk.overallPos) {
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
res.push(t);
|
|
429
|
+
}
|
|
430
|
+
if (res.length >= lb) {
|
|
431
|
+
return res;
|
|
432
|
+
}
|
|
433
|
+
this.reset(mrk);
|
|
434
|
+
return null;
|
|
435
|
+
}
|
|
436
|
+
run($$dpth, fn) {
|
|
437
|
+
const mrk = this.mark();
|
|
438
|
+
const res = fn();
|
|
439
|
+
if (res !== null)
|
|
440
|
+
return res;
|
|
441
|
+
this.reset(mrk);
|
|
442
|
+
return null;
|
|
443
|
+
}
|
|
444
|
+
// @ts-ignore: choice may not be called
|
|
445
|
+
choice(fns) {
|
|
446
|
+
for (const f of fns) {
|
|
447
|
+
const res = f();
|
|
448
|
+
if (res !== null) {
|
|
449
|
+
return res;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
return null;
|
|
453
|
+
}
|
|
454
|
+
regexAccept(match, mods, dpth, cr) {
|
|
455
|
+
return this.run(dpth, () => {
|
|
456
|
+
const reg = new RegExp(match, "y" + mods);
|
|
457
|
+
const mrk = this.mark();
|
|
458
|
+
reg.lastIndex = mrk.overallPos;
|
|
459
|
+
const res = this.tryConsume(reg);
|
|
460
|
+
if (cr) {
|
|
461
|
+
cr.record(mrk, res, {
|
|
462
|
+
kind: "RegexMatch",
|
|
463
|
+
// We substring from 3 to len - 1 to strip off the
|
|
464
|
+
// non-capture group syntax added as a WebKit workaround
|
|
465
|
+
literal: match.substring(3, match.length - 1),
|
|
466
|
+
negated: this.negating,
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
return res;
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
tryConsume(reg) {
|
|
473
|
+
const res = reg.exec(this.input);
|
|
474
|
+
if (res) {
|
|
475
|
+
let lineJmp = 0;
|
|
476
|
+
let lind = -1;
|
|
477
|
+
for (let i = 0; i < res[0].length; ++i) {
|
|
478
|
+
if (res[0][i] === "\n") {
|
|
479
|
+
++lineJmp;
|
|
480
|
+
lind = i;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
this.pos = {
|
|
484
|
+
overallPos: reg.lastIndex,
|
|
485
|
+
line: this.pos.line + lineJmp,
|
|
486
|
+
offset: lind === -1 ? this.pos.offset + res[0].length : (res[0].length - lind - 1)
|
|
487
|
+
};
|
|
488
|
+
return res[0];
|
|
489
|
+
}
|
|
490
|
+
return null;
|
|
491
|
+
}
|
|
492
|
+
// @ts-ignore: noConsume may not be called
|
|
493
|
+
noConsume(fn) {
|
|
494
|
+
const mrk = this.mark();
|
|
495
|
+
const res = fn();
|
|
496
|
+
this.reset(mrk);
|
|
497
|
+
return res;
|
|
498
|
+
}
|
|
499
|
+
// @ts-ignore: negate may not be called
|
|
500
|
+
negate(fn) {
|
|
501
|
+
const mrk = this.mark();
|
|
502
|
+
const oneg = this.negating;
|
|
503
|
+
this.negating = !oneg;
|
|
504
|
+
const res = fn();
|
|
505
|
+
this.negating = oneg;
|
|
506
|
+
this.reset(mrk);
|
|
507
|
+
return res === null ? true : null;
|
|
508
|
+
}
|
|
509
|
+
// @ts-ignore: Memoise may not be used
|
|
510
|
+
memoise(rule, memo) {
|
|
511
|
+
const $scope$pos = this.mark();
|
|
512
|
+
const $scope$memoRes = memo.get($scope$pos.overallPos);
|
|
513
|
+
if (this.memoSafe && $scope$memoRes !== undefined) {
|
|
514
|
+
this.reset($scope$memoRes[1]);
|
|
515
|
+
return $scope$memoRes[0];
|
|
516
|
+
}
|
|
517
|
+
const $scope$result = rule();
|
|
518
|
+
if (this.memoSafe)
|
|
519
|
+
memo.set($scope$pos.overallPos, [$scope$result, this.mark()]);
|
|
520
|
+
return $scope$result;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
export function parse(s) {
|
|
524
|
+
const p = new Parser(s);
|
|
525
|
+
return p.parse();
|
|
526
|
+
}
|
|
527
|
+
export class SyntaxErr {
|
|
528
|
+
pos;
|
|
529
|
+
expmatches;
|
|
530
|
+
constructor(pos, expmatches) {
|
|
531
|
+
this.pos = pos;
|
|
532
|
+
this.expmatches = [...expmatches];
|
|
533
|
+
}
|
|
534
|
+
toString() {
|
|
535
|
+
return `Syntax Error at line ${this.pos.line}:${this.pos.offset}. Expected one of ${this.expmatches.map(x => x.kind === "EOF" ? " EOF" : ` ${x.negated ? 'not ' : ''}'${x.literal}'`)}`;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
class ErrorTracker {
|
|
539
|
+
mxpos = { overallPos: -1, line: -1, offset: -1 };
|
|
540
|
+
regexset = new Set();
|
|
541
|
+
pmatches = [];
|
|
542
|
+
record(pos, result, att) {
|
|
543
|
+
if ((result === null) === att.negated)
|
|
544
|
+
return;
|
|
545
|
+
if (pos.overallPos > this.mxpos.overallPos) {
|
|
546
|
+
this.mxpos = pos;
|
|
547
|
+
this.pmatches = [];
|
|
548
|
+
this.regexset.clear();
|
|
549
|
+
}
|
|
550
|
+
if (this.mxpos.overallPos === pos.overallPos) {
|
|
551
|
+
if (att.kind === "RegexMatch") {
|
|
552
|
+
if (!this.regexset.has(att.literal))
|
|
553
|
+
this.pmatches.push(att);
|
|
554
|
+
this.regexset.add(att.literal);
|
|
555
|
+
}
|
|
556
|
+
else {
|
|
557
|
+
this.pmatches.push(att);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
getErr() {
|
|
562
|
+
if (this.mxpos.overallPos !== -1)
|
|
563
|
+
return new SyntaxErr(this.mxpos, this.pmatches);
|
|
564
|
+
return null;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAgDA,MAAM,CAAN,IAAY,QAoCX;AApCD,WAAY,QAAQ;IAChB,yCAA6B,CAAA;IAC7B,mDAAuC,CAAA;IACvC,mDAAuC,CAAA;IACvC,mDAAuC,CAAA;IACvC,mDAAuC,CAAA;IACvC,2DAA+C,CAAA;IAC/C,yCAA6B,CAAA;IAC7B,2CAA+B,CAAA;IAC/B,qCAAyB,CAAA;IACzB,2CAA+B,CAAA;IAC/B,6CAAiC,CAAA;IACjC,yCAA6B,CAAA;IAC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,CAAC,GAAG,CAAC,CAAC;gBAC5B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACnC,CAAC;iBAAM,CAAC;gBACJ,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC5B,CAAC;QACL,CAAC;IACL,CAAC;IACM,MAAM;QACT,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,KAAK,CAAC,CAAC;YAC5B,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pokesol/pokesol-text-parser-ts",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "a pokesol-text parser written in typescript",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": "./dist/index.js",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=18"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tspeg src/grammar.peg src/parser.ts && tsc --project tsconfig.build.json",
|
|
13
|
+
"prepare": "npm run build",
|
|
14
|
+
"test": "vitest"
|
|
15
|
+
},
|
|
16
|
+
"author": "megane42",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"tspeg": "^3.3.1",
|
|
23
|
+
"typescript": "^5.4.5",
|
|
24
|
+
"vitest": "^1.6.0"
|
|
25
|
+
}
|
|
26
|
+
}
|