@plurnk/plurnk-grammar 0.2.1 → 0.6.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/bin/plurnk.js +1 -1
- package/{schema → dist/schema}/LogEntry.json +1 -1
- package/{schema → dist/schema}/Packet.json +16 -4
- package/{schema → dist/schema}/ProviderDeclaration.json +3 -3
- package/{schema → dist/schema}/Run.json +6 -1
- package/{schema → dist/schema}/Session.json +1 -1
- package/{schema → dist/schema}/Turn.json +10 -1
- package/dist/src/AstBuilder.d.ts +19 -0
- package/dist/src/AstBuilder.d.ts.map +1 -0
- package/{src/AstBuilder.ts → dist/src/AstBuilder.js} +176 -161
- package/dist/src/AstBuilder.js.map +1 -0
- package/dist/src/PlurnkErrorStrategy.d.ts +10 -0
- package/dist/src/PlurnkErrorStrategy.d.ts.map +1 -0
- package/{src/PlurnkErrorStrategy.ts → dist/src/PlurnkErrorStrategy.js} +41 -49
- package/dist/src/PlurnkErrorStrategy.js.map +1 -0
- package/dist/src/PlurnkParseError.d.ts +14 -0
- package/dist/src/PlurnkParseError.d.ts.map +1 -0
- package/{src/PlurnkParseError.ts → dist/src/PlurnkParseError.js} +6 -9
- package/dist/src/PlurnkParseError.js.map +1 -0
- package/dist/src/PlurnkParser.d.ts +6 -0
- package/dist/src/PlurnkParser.d.ts.map +1 -0
- package/{src/PlurnkParser.ts → dist/src/PlurnkParser.js} +32 -40
- package/dist/src/PlurnkParser.js.map +1 -0
- package/dist/src/RecordingListener.d.ts +9 -0
- package/dist/src/RecordingListener.d.ts.map +1 -0
- package/dist/src/RecordingListener.js +19 -0
- package/dist/src/RecordingListener.js.map +1 -0
- package/dist/src/Validator.d.ts +28 -0
- package/dist/src/Validator.d.ts.map +1 -0
- package/dist/src/Validator.js +86 -0
- package/dist/src/Validator.js.map +1 -0
- package/dist/src/generated/plurnkLexer.d.ts +88 -0
- package/dist/src/generated/plurnkLexer.d.ts.map +1 -0
- package/dist/src/generated/plurnkLexer.js +440 -0
- package/dist/src/generated/plurnkLexer.js.map +1 -0
- package/dist/src/generated/plurnkParser.d.ts +274 -0
- package/dist/src/generated/plurnkParser.d.ts.map +1 -0
- package/dist/src/generated/plurnkParser.js +1833 -0
- package/dist/src/generated/plurnkParser.js.map +1 -0
- package/{src/generated/plurnkParserVisitor.ts → dist/src/generated/plurnkParserVisitor.d.ts} +2 -7
- package/dist/src/generated/plurnkParserVisitor.d.ts.map +1 -0
- package/dist/src/generated/plurnkParserVisitor.js +131 -0
- package/dist/src/generated/plurnkParserVisitor.js.map +1 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +7 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/types.d.ts +23 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.generated.d.ts +472 -0
- package/dist/src/types.generated.d.ts.map +1 -0
- package/dist/src/types.generated.js +4 -0
- package/dist/src/types.generated.js.map +1 -0
- package/dist/src/types.js +4 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +10 -7
- package/plurnk.md +1 -1
- package/src/RecordingListener.ts +0 -34
- package/src/Validator.ts +0 -94
- package/src/generated/plurnkLexer.ts +0 -467
- package/src/generated/plurnkParser.ts +0 -1891
- package/src/index.ts +0 -29
- package/src/types.generated.ts +0 -497
- package/src/types.ts +0 -30
- /package/{schema → dist/schema}/Agent.json +0 -0
- /package/{schema → dist/schema}/ChannelContent.json +0 -0
- /package/{schema → dist/schema}/Entry.json +0 -0
- /package/{schema → dist/schema}/LineMarker.json +0 -0
- /package/{schema → dist/schema}/Loop.json +0 -0
- /package/{schema → dist/schema}/MatcherBody.json +0 -0
- /package/{schema → dist/schema}/Params.json +0 -0
- /package/{schema → dist/schema}/ParsedPath.json +0 -0
- /package/{schema → dist/schema}/PlurnkStatement.json +0 -0
- /package/{schema → dist/schema}/Position.json +0 -0
- /package/{schema → dist/schema}/SchemeRegistration.json +0 -0
- /package/{schema → dist/schema}/SendBody.json +0 -0
- /package/{schema → dist/schema}/Visibility.json +0 -0
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
InputMismatchException,
|
|
4
|
-
NoViableAltException,
|
|
5
|
-
Token,
|
|
6
|
-
type Parser,
|
|
7
|
-
type RecognitionException,
|
|
8
|
-
} from "antlr4ng";
|
|
9
|
-
import { plurnkParser } from "./generated/plurnkParser.ts";
|
|
10
|
-
import { plurnkLexer } from "./generated/plurnkLexer.ts";
|
|
11
|
-
|
|
1
|
+
import { DefaultErrorStrategy, InputMismatchException, NoViableAltException, Token, } from "antlr4ng";
|
|
2
|
+
import { plurnkParser } from "./generated/plurnkParser.js";
|
|
12
3
|
export default class PlurnkErrorStrategy extends DefaultErrorStrategy {
|
|
13
4
|
static #OFFENDING_CHAR_RE = /at: '([^']*)'$/;
|
|
14
|
-
|
|
15
|
-
static #LEXER_MODE_CONTEXT: Record<string, string> = {
|
|
5
|
+
static #LEXER_MODE_CONTEXT = {
|
|
16
6
|
DEFAULT_MODE: "between statements",
|
|
17
7
|
SLOTS: "in slot region — expected `[signal]`, `(path)`, `<L>`, or `:body:` (any order)",
|
|
18
8
|
SIGNAL_TAGS: "in tag signal — expected tag, `,`, or `]`",
|
|
@@ -21,8 +11,7 @@ export default class PlurnkErrorStrategy extends DefaultErrorStrategy {
|
|
|
21
11
|
PATH: "in path slot — expected path characters or `)`",
|
|
22
12
|
BODY: "in body",
|
|
23
13
|
};
|
|
24
|
-
|
|
25
|
-
static #SLOT_BY_TOKEN: Record<number, string> = {
|
|
14
|
+
static #SLOT_BY_TOKEN = {
|
|
26
15
|
[plurnkParser.OPEN_FIND]: "open tag `<<OPsuffix`",
|
|
27
16
|
[plurnkParser.OPEN_READ]: "open tag `<<OPsuffix`",
|
|
28
17
|
[plurnkParser.OPEN_EDIT]: "open tag `<<OPsuffix`",
|
|
@@ -47,69 +36,71 @@ export default class PlurnkErrorStrategy extends DefaultErrorStrategy {
|
|
|
47
36
|
[plurnkParser.CLOSE_TAG]: "close tag `:OPsuffix`",
|
|
48
37
|
[plurnkParser.TEXT]: "text between statements",
|
|
49
38
|
};
|
|
50
|
-
|
|
51
|
-
static translateLexerMessage(lexer: plurnkLexer, originalMsg: string): string {
|
|
39
|
+
static translateLexerMessage(lexer, originalMsg) {
|
|
52
40
|
const modeName = lexer.modeNames[lexer.mode] ?? "DEFAULT_MODE";
|
|
53
41
|
const context = PlurnkErrorStrategy.#LEXER_MODE_CONTEXT[modeName] ?? "between statements";
|
|
54
42
|
const ch = PlurnkErrorStrategy.#extractOffendingChar(originalMsg);
|
|
55
43
|
return `unrecognized character ${ch} ${context}`;
|
|
56
44
|
}
|
|
57
|
-
|
|
58
|
-
static #extractOffendingChar(msg: string): string {
|
|
45
|
+
static #extractOffendingChar(msg) {
|
|
59
46
|
const m = PlurnkErrorStrategy.#OFFENDING_CHAR_RE.exec(msg);
|
|
60
|
-
if (!m)
|
|
47
|
+
if (!m)
|
|
48
|
+
return "input";
|
|
61
49
|
const text = m[1];
|
|
62
50
|
return text === "" ? "end of input" : `'${text}'`;
|
|
63
51
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
52
|
+
static #describeToken(tok) {
|
|
53
|
+
if (!tok || tok.type === Token.EOF)
|
|
54
|
+
return "end of input";
|
|
67
55
|
const slot = PlurnkErrorStrategy.#SLOT_BY_TOKEN[tok.type];
|
|
68
|
-
if (slot)
|
|
56
|
+
if (slot)
|
|
57
|
+
return slot;
|
|
69
58
|
const text = tok.text ?? "";
|
|
70
59
|
return text.length > 0 ? `'${text}'` : "input";
|
|
71
60
|
}
|
|
72
|
-
|
|
73
|
-
static #describeExpected(e: RecognitionException): string | null {
|
|
61
|
+
static #describeExpected(e) {
|
|
74
62
|
const expected = e.getExpectedTokens();
|
|
75
|
-
if (!expected)
|
|
76
|
-
|
|
77
|
-
|
|
63
|
+
if (!expected)
|
|
64
|
+
return null;
|
|
65
|
+
const types = expected.toArray();
|
|
66
|
+
if (types.length === 0)
|
|
67
|
+
return null;
|
|
78
68
|
const names = types
|
|
79
69
|
.map((t) => PlurnkErrorStrategy.#SLOT_BY_TOKEN[t])
|
|
80
|
-
.filter((s)
|
|
81
|
-
if (names.length === 0)
|
|
82
|
-
|
|
83
|
-
if (names.length ===
|
|
70
|
+
.filter((s) => Boolean(s));
|
|
71
|
+
if (names.length === 0)
|
|
72
|
+
return null;
|
|
73
|
+
if (names.length === 1)
|
|
74
|
+
return names[0];
|
|
75
|
+
if (names.length === 2)
|
|
76
|
+
return `${names[0]} or ${names[1]}`;
|
|
84
77
|
return `${names.slice(0, -1).join(", ")}, or ${names[names.length - 1]}`;
|
|
85
78
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
79
|
+
reportError(recognizer, e) {
|
|
80
|
+
if (this.inErrorRecoveryMode(recognizer))
|
|
81
|
+
return;
|
|
89
82
|
this.beginErrorCondition(recognizer);
|
|
90
|
-
|
|
91
83
|
const got = PlurnkErrorStrategy.#describeToken(e.offendingToken);
|
|
92
84
|
const expected = PlurnkErrorStrategy.#describeExpected(e);
|
|
93
|
-
|
|
94
|
-
let msg: string;
|
|
85
|
+
let msg;
|
|
95
86
|
if (e instanceof InputMismatchException || e instanceof NoViableAltException) {
|
|
96
87
|
msg = expected ? `unexpected ${got}; expected ${expected}` : `unexpected ${got}`;
|
|
97
|
-
}
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
98
90
|
msg = `unexpected ${got}`;
|
|
99
91
|
}
|
|
100
|
-
|
|
101
92
|
recognizer.notifyErrorListeners(msg, e.offendingToken, e);
|
|
102
93
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
94
|
+
reportMissingToken(recognizer) {
|
|
95
|
+
if (this.inErrorRecoveryMode(recognizer))
|
|
96
|
+
return;
|
|
106
97
|
this.beginErrorCondition(recognizer);
|
|
107
98
|
const tok = recognizer.getCurrentToken();
|
|
108
99
|
const expectedTokens = this.getExpectedTokens(recognizer);
|
|
109
100
|
const expectedNames = expectedTokens
|
|
110
101
|
.toArray()
|
|
111
102
|
.map((t) => PlurnkErrorStrategy.#SLOT_BY_TOKEN[t])
|
|
112
|
-
.filter((s)
|
|
103
|
+
.filter((s) => Boolean(s));
|
|
113
104
|
const expected = expectedNames.length > 0
|
|
114
105
|
? (expectedNames.length === 1 ? expectedNames[0] : expectedNames.join(" or "))
|
|
115
106
|
: "more input";
|
|
@@ -117,9 +108,9 @@ export default class PlurnkErrorStrategy extends DefaultErrorStrategy {
|
|
|
117
108
|
const msg = `expected ${expected}; got ${got}`;
|
|
118
109
|
recognizer.notifyErrorListeners(msg, tok, null);
|
|
119
110
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
111
|
+
reportUnwantedToken(recognizer) {
|
|
112
|
+
if (this.inErrorRecoveryMode(recognizer))
|
|
113
|
+
return;
|
|
123
114
|
this.beginErrorCondition(recognizer);
|
|
124
115
|
const tok = recognizer.getCurrentToken();
|
|
125
116
|
const got = PlurnkErrorStrategy.#describeToken(tok);
|
|
@@ -127,7 +118,7 @@ export default class PlurnkErrorStrategy extends DefaultErrorStrategy {
|
|
|
127
118
|
const expectedNames = expectedTokens
|
|
128
119
|
.toArray()
|
|
129
120
|
.map((t) => PlurnkErrorStrategy.#SLOT_BY_TOKEN[t])
|
|
130
|
-
.filter((s)
|
|
121
|
+
.filter((s) => Boolean(s));
|
|
131
122
|
const expected = expectedNames.length > 0
|
|
132
123
|
? (expectedNames.length === 1 ? expectedNames[0] : expectedNames.join(" or "))
|
|
133
124
|
: null;
|
|
@@ -137,3 +128,4 @@ export default class PlurnkErrorStrategy extends DefaultErrorStrategy {
|
|
|
137
128
|
recognizer.notifyErrorListeners(msg, tok, null);
|
|
138
129
|
}
|
|
139
130
|
}
|
|
131
|
+
//# sourceMappingURL=PlurnkErrorStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlurnkErrorStrategy.js","sourceRoot":"","sources":["../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CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC9E,CAAC,CAAC,IAAI,CAAC;QACX,MAAM,GAAG,GAAG,QAAQ;YAChB,CAAC,CAAC,cAAc,GAAG,cAAc,QAAQ,EAAE;YAC3C,CAAC,CAAC,cAAc,GAAG,EAAE,CAAC;QAC1B,UAAU,CAAC,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ErrorSource = "lexer" | "parser" | "visitor";
|
|
2
|
+
export default class PlurnkParseError extends Error {
|
|
3
|
+
readonly line: number;
|
|
4
|
+
readonly column: number;
|
|
5
|
+
readonly source: ErrorSource;
|
|
6
|
+
constructor(line: number, column: number, source: ErrorSource, message: string);
|
|
7
|
+
toJSON(): {
|
|
8
|
+
line: number;
|
|
9
|
+
column: number;
|
|
10
|
+
source: ErrorSource;
|
|
11
|
+
message: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=PlurnkParseError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlurnkParseError.d.ts","sourceRoot":"","sources":["../../src/PlurnkParseError.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEzD,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;gBAEjB,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM;IAQ9E,MAAM,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,WAAW,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAQnF"}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
export type ErrorSource = "lexer" | "parser" | "visitor";
|
|
2
|
-
|
|
3
1
|
export default class PlurnkParseError extends Error {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
constructor(line: number, column: number, source: ErrorSource, message: string) {
|
|
2
|
+
line;
|
|
3
|
+
column;
|
|
4
|
+
source;
|
|
5
|
+
constructor(line, column, source, message) {
|
|
9
6
|
super(`Plurnk ${source} error at ${line}:${column} — ${message}`);
|
|
10
7
|
this.name = "PlurnkParseError";
|
|
11
8
|
this.line = line;
|
|
12
9
|
this.column = column;
|
|
13
10
|
this.source = source;
|
|
14
11
|
}
|
|
15
|
-
|
|
16
|
-
toJSON(): { line: number; column: number; source: ErrorSource; message: string } {
|
|
12
|
+
toJSON() {
|
|
17
13
|
return {
|
|
18
14
|
line: this.line,
|
|
19
15
|
column: this.column,
|
|
@@ -22,3 +18,4 @@ export default class PlurnkParseError extends Error {
|
|
|
22
18
|
};
|
|
23
19
|
}
|
|
24
20
|
}
|
|
21
|
+
//# sourceMappingURL=PlurnkParseError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlurnkParseError.js","sourceRoot":"","sources":["../../src/PlurnkParseError.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,KAAK;IACtC,IAAI,CAAS;IACb,MAAM,CAAS;IACf,MAAM,CAAc;IAE7B,YAAY,IAAY,EAAE,MAAc,EAAE,MAAmB,EAAE,OAAe;QAC1E,KAAK,CAAC,UAAU,MAAM,aAAa,IAAI,IAAI,MAAM,MAAM,OAAO,EAAE,CAAC,CAAC;QAClE,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,MAAM;QACF,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;SACxB,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlurnkParser.d.ts","sourceRoot":"","sources":["../../src/PlurnkParser.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAa,WAAW,EAAY,MAAM,YAAY,CAAC;AAEnE,MAAM,CAAC,OAAO,OAAO,YAAY;;IAC7B,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;CAiF3C"}
|
|
@@ -1,67 +1,61 @@
|
|
|
1
1
|
import { CharStream, CommonTokenStream } from "antlr4ng";
|
|
2
|
-
import { plurnkLexer } from "./generated/plurnkLexer.
|
|
3
|
-
import { plurnkParser } from "./generated/plurnkParser.
|
|
4
|
-
import AstBuilder from "./AstBuilder.
|
|
5
|
-
import PlurnkParseError from "./PlurnkParseError.
|
|
6
|
-
import PlurnkErrorStrategy from "./PlurnkErrorStrategy.
|
|
7
|
-
import RecordingListener from "./RecordingListener.
|
|
8
|
-
import type { ParseItem, ParseResult, Position } from "./types.ts";
|
|
9
|
-
|
|
2
|
+
import { plurnkLexer } from "./generated/plurnkLexer.js";
|
|
3
|
+
import { plurnkParser } from "./generated/plurnkParser.js";
|
|
4
|
+
import AstBuilder from "./AstBuilder.js";
|
|
5
|
+
import PlurnkParseError from "./PlurnkParseError.js";
|
|
6
|
+
import PlurnkErrorStrategy from "./PlurnkErrorStrategy.js";
|
|
7
|
+
import RecordingListener from "./RecordingListener.js";
|
|
10
8
|
export default class PlurnkParser {
|
|
11
|
-
static parse(input
|
|
9
|
+
static parse(input) {
|
|
12
10
|
const lexer = new plurnkLexer(CharStream.fromString(input));
|
|
13
|
-
const errors
|
|
11
|
+
const errors = [];
|
|
14
12
|
lexer.removeErrorListeners();
|
|
15
13
|
lexer.addErrorListener(new RecordingListener("lexer", errors));
|
|
16
|
-
|
|
17
14
|
const tokenStream = new CommonTokenStream(lexer);
|
|
18
15
|
const parser = new plurnkParser(tokenStream);
|
|
19
16
|
parser.removeErrorListeners();
|
|
20
17
|
parser.addErrorListener(new RecordingListener("parser", errors));
|
|
21
18
|
parser.errorHandler = new PlurnkErrorStrategy();
|
|
22
|
-
|
|
23
19
|
const tree = parser.document();
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
const consumedErrors = new Set<PlurnkParseError>();
|
|
27
|
-
|
|
20
|
+
const items = [];
|
|
21
|
+
const consumedErrors = new Set();
|
|
28
22
|
for (const child of tree.children ?? []) {
|
|
29
|
-
const ctx = child
|
|
23
|
+
const ctx = child;
|
|
30
24
|
const start = ctx.start ?? ctx.symbol;
|
|
31
25
|
const stop = ctx.stop ?? ctx.symbol;
|
|
32
|
-
if (!start)
|
|
33
|
-
|
|
26
|
+
if (!start)
|
|
27
|
+
continue;
|
|
34
28
|
if (ctx.ruleIndex === plurnkParser.RULE_statement) {
|
|
35
|
-
const errForStatement = errors.find(
|
|
36
|
-
(e) => !consumedErrors.has(e) && PlurnkParser.#errorInRange(e, start, stop ?? start),
|
|
37
|
-
);
|
|
29
|
+
const errForStatement = errors.find((e) => !consumedErrors.has(e) && PlurnkParser.#errorInRange(e, start, stop ?? start));
|
|
38
30
|
if (errForStatement) {
|
|
39
31
|
consumedErrors.add(errForStatement);
|
|
40
32
|
items.push({ kind: "error", error: errForStatement });
|
|
41
|
-
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
42
35
|
try {
|
|
43
36
|
items.push({ kind: "statement", statement: AstBuilder.build(ctx) });
|
|
44
|
-
}
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
45
39
|
if (e instanceof PlurnkParseError) {
|
|
46
40
|
items.push({ kind: "error", error: e });
|
|
47
|
-
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
48
43
|
throw e;
|
|
49
44
|
}
|
|
50
45
|
}
|
|
51
46
|
}
|
|
52
|
-
}
|
|
53
|
-
|
|
47
|
+
}
|
|
48
|
+
else if (ctx.symbol?.type === plurnkLexer.TEXT) {
|
|
49
|
+
const position = { line: start.line, column: start.column };
|
|
54
50
|
items.push({ kind: "text", text: ctx.symbol.text ?? "", position });
|
|
55
51
|
}
|
|
56
52
|
}
|
|
57
|
-
|
|
58
53
|
for (const err of errors) {
|
|
59
54
|
if (!consumedErrors.has(err)) {
|
|
60
55
|
items.push({ kind: "error", error: err });
|
|
61
56
|
}
|
|
62
57
|
}
|
|
63
|
-
|
|
64
|
-
let unparsedTail: ParseResult["unparsedTail"];
|
|
58
|
+
let unparsedTail;
|
|
65
59
|
if (lexer.mode !== 0) {
|
|
66
60
|
const openTag = lexer.getOpenTag();
|
|
67
61
|
const from = { line: lexer.getOpenTagLine(), column: lexer.getOpenTagColumn() };
|
|
@@ -75,18 +69,16 @@ export default class PlurnkParser {
|
|
|
75
69
|
: `statement \`<<${openTag}\` opened at line ${from.line} but never reached its close tag — add \`:${openTag}\` to terminate`;
|
|
76
70
|
unparsedTail = { from, reason };
|
|
77
71
|
}
|
|
78
|
-
|
|
79
72
|
return { items, unparsedTail };
|
|
80
73
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (err.line === start.line && err.column < start.column) return false;
|
|
89
|
-
if (err.line === stop.line && err.column > stop.column) return false;
|
|
74
|
+
static #errorInRange(err, start, stop) {
|
|
75
|
+
if (err.line < start.line || err.line > stop.line)
|
|
76
|
+
return false;
|
|
77
|
+
if (err.line === start.line && err.column < start.column)
|
|
78
|
+
return false;
|
|
79
|
+
if (err.line === stop.line && err.column > stop.column)
|
|
80
|
+
return false;
|
|
90
81
|
return true;
|
|
91
82
|
}
|
|
92
83
|
}
|
|
84
|
+
//# sourceMappingURL=PlurnkParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlurnkParser.js","sourceRoot":"","sources":["../../src/PlurnkParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAC3D,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAGvD,MAAM,CAAC,OAAO,OAAO,YAAY;IAC7B,MAAM,CAAC,KAAK,CAAC,KAAa;QACtB,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5D,MAAM,MAAM,GAAuB,EAAE,CAAC;QACtC,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7B,KAAK,CAAC,gBAAgB,CAAC,IAAI,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;QAE/D,MAAM,WAAW,GAAG,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACjD,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,WAAW,CAAC,CAAC;QAC7C,MAAM,CAAC,oBAAoB,EAAE,CAAC;QAC9B,MAAM,CAAC,gBAAgB,CAAC,IAAI,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;QACjE,MAAM,CAAC,YAAY,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAEhD,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC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F,CAAC,CAAC,sBAAsB,OAAO,qBAAqB,IAAI,CAAC,IAAI,uDAAuD;oBACpH,CAAC,CAAC,QAAQ,KAAK,MAAM;wBACjB,CAAC,CAAC,oBAAoB,OAAO,qBAAqB,IAAI,CAAC,IAAI,qDAAqD;wBAChH,CAAC,CAAC,iBAAiB,OAAO,qBAAqB,IAAI,CAAC,IAAI,6CAA6C,OAAO,iBAAiB,CAAC;YAC1I,YAAY,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACpC,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,aAAa,CAChB,GAAqB,EACrB,KAAuC,EACvC,IAAsC;QAEtC,IAAI,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI;YAAE,OAAO,KAAK,CAAC;QAChE,IAAI,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QACvE,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QACrE,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseErrorListener, type RecognitionException, type Recognizer, type Token } from "antlr4ng";
|
|
2
|
+
import PlurnkParseError from "./PlurnkParseError.ts";
|
|
3
|
+
export default class RecordingListener extends BaseErrorListener {
|
|
4
|
+
readonly errors: PlurnkParseError[];
|
|
5
|
+
readonly source: "lexer" | "parser";
|
|
6
|
+
constructor(source: "lexer" | "parser", errors: PlurnkParseError[]);
|
|
7
|
+
syntaxError(recognizer: Recognizer<any>, _offendingSymbol: Token | null, line: number, column: number, msg: string, _e: RecognitionException | null): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=RecordingListener.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordingListener.d.ts","sourceRoot":"","sources":["../../src/RecordingListener.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,KAAK,UAAU,EACf,KAAK,KAAK,EACb,MAAM,UAAU,CAAC;AAElB,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AAGrD,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,iBAAiB;IAC5D,QAAQ,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,QAAQ,CAAC;gBAExB,MAAM,EAAE,OAAO,GAAG,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE;IAMzD,WAAW,CAChB,UAAU,EAAE,UAAU,CAAC,GAAG,CAAC,EAC3B,gBAAgB,EAAE,KAAK,GAAG,IAAI,EAC9B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,oBAAoB,GAAG,IAAI,GAChC,IAAI;CAMV"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseErrorListener, } from "antlr4ng";
|
|
2
|
+
import PlurnkParseError from "./PlurnkParseError.js";
|
|
3
|
+
import PlurnkErrorStrategy from "./PlurnkErrorStrategy.js";
|
|
4
|
+
export default class RecordingListener extends BaseErrorListener {
|
|
5
|
+
errors;
|
|
6
|
+
source;
|
|
7
|
+
constructor(source, errors) {
|
|
8
|
+
super();
|
|
9
|
+
this.source = source;
|
|
10
|
+
this.errors = errors;
|
|
11
|
+
}
|
|
12
|
+
syntaxError(recognizer, _offendingSymbol, line, column, msg, _e) {
|
|
13
|
+
const translated = this.source === "lexer"
|
|
14
|
+
? PlurnkErrorStrategy.translateLexerMessage(recognizer, msg)
|
|
15
|
+
: msg;
|
|
16
|
+
this.errors.push(new PlurnkParseError(line, column, this.source, translated));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=RecordingListener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordingListener.js","sourceRoot":"","sources":["../../src/RecordingListener.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,iBAAiB,GAIpB,MAAM,UAAU,CAAC;AAElB,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAE3D,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,iBAAiB;IACnD,MAAM,CAAqB;IAC3B,MAAM,CAAqB;IAEpC,YAAY,MAA0B,EAAE,MAA0B;QAC9D,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAEQ,WAAW,CAChB,UAA2B,EAC3B,gBAA8B,EAC9B,IAAY,EACZ,MAAc,EACd,GAAW,EACX,EAA+B;QAE/B,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,KAAK,OAAO;YACtC,CAAC,CAAC,mBAAmB,CAAC,qBAAqB,CAAC,UAAyB,EAAE,GAAG,CAAC;YAC3E,CAAC,CAAC,GAAG,CAAC;QACV,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IAClF,CAAC;CACJ"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type OutputUnit } from "@cfworker/json-schema";
|
|
2
|
+
export type ValidationResult = {
|
|
3
|
+
valid: boolean;
|
|
4
|
+
errors: OutputUnit[];
|
|
5
|
+
};
|
|
6
|
+
export default class Validator {
|
|
7
|
+
#private;
|
|
8
|
+
static validatePosition(obj: unknown): ValidationResult;
|
|
9
|
+
static validateLineMarker(obj: unknown): ValidationResult;
|
|
10
|
+
static validateParams(obj: unknown): ValidationResult;
|
|
11
|
+
static validateChannelContent(obj: unknown): ValidationResult;
|
|
12
|
+
static validateParsedPath(obj: unknown): ValidationResult;
|
|
13
|
+
static validateMatcherBody(obj: unknown): ValidationResult;
|
|
14
|
+
static validateSendBody(obj: unknown): ValidationResult;
|
|
15
|
+
static validateEntry(obj: unknown): ValidationResult;
|
|
16
|
+
static validateSchemeRegistration(obj: unknown): ValidationResult;
|
|
17
|
+
static validateProviderDeclaration(obj: unknown): ValidationResult;
|
|
18
|
+
static validateVisibility(obj: unknown): ValidationResult;
|
|
19
|
+
static validateLogEntry(obj: unknown): ValidationResult;
|
|
20
|
+
static validatePlurnkStatement(obj: unknown): ValidationResult;
|
|
21
|
+
static validateTurn(obj: unknown): ValidationResult;
|
|
22
|
+
static validateLoop(obj: unknown): ValidationResult;
|
|
23
|
+
static validateRun(obj: unknown): ValidationResult;
|
|
24
|
+
static validateSession(obj: unknown): ValidationResult;
|
|
25
|
+
static validateAgent(obj: unknown): ValidationResult;
|
|
26
|
+
static validatePacket(obj: unknown): ValidationResult;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=Validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Validator.d.ts","sourceRoot":"","sources":["../../src/Validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,UAAU,EAAe,MAAM,uBAAuB,CAAC;AAqB/F,MAAM,MAAM,gBAAgB,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC;AAaxE,MAAM,CAAC,OAAO,OAAO,SAAS;;IAmC1B,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACvD,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACzD,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACrD,MAAM,CAAC,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IAC7D,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACzD,MAAM,CAAC,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IAC1D,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACvD,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACpD,MAAM,CAAC,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACjE,MAAM,CAAC,2BAA2B,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IAClE,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACzD,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACvD,MAAM,CAAC,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IAC9D,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACnD,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACnD,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IAClD,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACtD,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;IACpD,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB;CAMxD"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Validator as CfValidator } from "@cfworker/json-schema";
|
|
2
|
+
import positionSchema from "../schema/Position.json" with { type: "json" };
|
|
3
|
+
import lineMarkerSchema from "../schema/LineMarker.json" with { type: "json" };
|
|
4
|
+
import paramsSchema from "../schema/Params.json" with { type: "json" };
|
|
5
|
+
import channelContentSchema from "../schema/ChannelContent.json" with { type: "json" };
|
|
6
|
+
import parsedPathSchema from "../schema/ParsedPath.json" with { type: "json" };
|
|
7
|
+
import matcherBodySchema from "../schema/MatcherBody.json" with { type: "json" };
|
|
8
|
+
import sendBodySchema from "../schema/SendBody.json" with { type: "json" };
|
|
9
|
+
import entrySchema from "../schema/Entry.json" with { type: "json" };
|
|
10
|
+
import schemeRegistrationSchema from "../schema/SchemeRegistration.json" with { type: "json" };
|
|
11
|
+
import providerDeclarationSchema from "../schema/ProviderDeclaration.json" with { type: "json" };
|
|
12
|
+
import visibilitySchema from "../schema/Visibility.json" with { type: "json" };
|
|
13
|
+
import logEntrySchema from "../schema/LogEntry.json" with { type: "json" };
|
|
14
|
+
import plurnkStatementSchema from "../schema/PlurnkStatement.json" with { type: "json" };
|
|
15
|
+
import turnSchema from "../schema/Turn.json" with { type: "json" };
|
|
16
|
+
import loopSchema from "../schema/Loop.json" with { type: "json" };
|
|
17
|
+
import runSchema from "../schema/Run.json" with { type: "json" };
|
|
18
|
+
import sessionSchema from "../schema/Session.json" with { type: "json" };
|
|
19
|
+
import agentSchema from "../schema/Agent.json" with { type: "json" };
|
|
20
|
+
import packetSchema from "../schema/Packet.json" with { type: "json" };
|
|
21
|
+
// All foundational schemas — handy when a top-level shape transitively references many others.
|
|
22
|
+
const FOUNDATIONAL = [
|
|
23
|
+
positionSchema, lineMarkerSchema, paramsSchema, channelContentSchema,
|
|
24
|
+
parsedPathSchema, matcherBodySchema, sendBodySchema,
|
|
25
|
+
plurnkStatementSchema,
|
|
26
|
+
entrySchema, logEntrySchema,
|
|
27
|
+
schemeRegistrationSchema, providerDeclarationSchema,
|
|
28
|
+
visibilitySchema,
|
|
29
|
+
packetSchema,
|
|
30
|
+
];
|
|
31
|
+
export default class Validator {
|
|
32
|
+
static #position = new CfValidator(positionSchema, "2020-12");
|
|
33
|
+
static #lineMarker = new CfValidator(lineMarkerSchema, "2020-12");
|
|
34
|
+
static #params = new CfValidator(paramsSchema, "2020-12");
|
|
35
|
+
static #channelContent = new CfValidator(channelContentSchema, "2020-12");
|
|
36
|
+
static #parsedPath = Validator.#buildWithRefs(parsedPathSchema, [paramsSchema]);
|
|
37
|
+
static #matcherBody = new CfValidator(matcherBodySchema, "2020-12");
|
|
38
|
+
static #sendBody = new CfValidator(sendBodySchema, "2020-12");
|
|
39
|
+
static #entry = Validator.#buildWithRefs(entrySchema, [paramsSchema, channelContentSchema]);
|
|
40
|
+
static #schemeRegistration = new CfValidator(schemeRegistrationSchema, "2020-12");
|
|
41
|
+
static #providerDeclaration = new CfValidator(providerDeclarationSchema, "2020-12");
|
|
42
|
+
static #visibility = new CfValidator(visibilitySchema, "2020-12");
|
|
43
|
+
static #logEntry = Validator.#buildWithRefs(logEntrySchema, [paramsSchema, lineMarkerSchema]);
|
|
44
|
+
static #plurnkStatement = Validator.#buildWithRefs(plurnkStatementSchema, [positionSchema, lineMarkerSchema, paramsSchema, parsedPathSchema, matcherBodySchema, sendBodySchema]);
|
|
45
|
+
static #turn = Validator.#buildWithRefs(turnSchema, FOUNDATIONAL);
|
|
46
|
+
static #loop = new CfValidator(loopSchema, "2020-12");
|
|
47
|
+
static #run = new CfValidator(runSchema, "2020-12");
|
|
48
|
+
static #session = Validator.#buildWithRefs(sessionSchema, [schemeRegistrationSchema]);
|
|
49
|
+
static #agent = Validator.#buildWithRefs(agentSchema, [providerDeclarationSchema, schemeRegistrationSchema]);
|
|
50
|
+
static #packet = Validator.#buildWithRefs(packetSchema, FOUNDATIONAL);
|
|
51
|
+
static #buildWithRefs(mainSchema, refSchemas) {
|
|
52
|
+
const validator = new CfValidator(mainSchema, "2020-12");
|
|
53
|
+
const mainId = mainSchema.$id;
|
|
54
|
+
for (const ref of refSchemas) {
|
|
55
|
+
const refId = ref.$id;
|
|
56
|
+
if (refId && refId === mainId)
|
|
57
|
+
continue;
|
|
58
|
+
validator.addSchema(ref);
|
|
59
|
+
}
|
|
60
|
+
return validator;
|
|
61
|
+
}
|
|
62
|
+
static validatePosition(obj) { return Validator.#run_(Validator.#position, obj); }
|
|
63
|
+
static validateLineMarker(obj) { return Validator.#run_(Validator.#lineMarker, obj); }
|
|
64
|
+
static validateParams(obj) { return Validator.#run_(Validator.#params, obj); }
|
|
65
|
+
static validateChannelContent(obj) { return Validator.#run_(Validator.#channelContent, obj); }
|
|
66
|
+
static validateParsedPath(obj) { return Validator.#run_(Validator.#parsedPath, obj); }
|
|
67
|
+
static validateMatcherBody(obj) { return Validator.#run_(Validator.#matcherBody, obj); }
|
|
68
|
+
static validateSendBody(obj) { return Validator.#run_(Validator.#sendBody, obj); }
|
|
69
|
+
static validateEntry(obj) { return Validator.#run_(Validator.#entry, obj); }
|
|
70
|
+
static validateSchemeRegistration(obj) { return Validator.#run_(Validator.#schemeRegistration, obj); }
|
|
71
|
+
static validateProviderDeclaration(obj) { return Validator.#run_(Validator.#providerDeclaration, obj); }
|
|
72
|
+
static validateVisibility(obj) { return Validator.#run_(Validator.#visibility, obj); }
|
|
73
|
+
static validateLogEntry(obj) { return Validator.#run_(Validator.#logEntry, obj); }
|
|
74
|
+
static validatePlurnkStatement(obj) { return Validator.#run_(Validator.#plurnkStatement, obj); }
|
|
75
|
+
static validateTurn(obj) { return Validator.#run_(Validator.#turn, obj); }
|
|
76
|
+
static validateLoop(obj) { return Validator.#run_(Validator.#loop, obj); }
|
|
77
|
+
static validateRun(obj) { return Validator.#run_(Validator.#run, obj); }
|
|
78
|
+
static validateSession(obj) { return Validator.#run_(Validator.#session, obj); }
|
|
79
|
+
static validateAgent(obj) { return Validator.#run_(Validator.#agent, obj); }
|
|
80
|
+
static validatePacket(obj) { return Validator.#run_(Validator.#packet, obj); }
|
|
81
|
+
static #run_(validator, obj) {
|
|
82
|
+
const result = validator.validate(obj);
|
|
83
|
+
return { valid: result.valid, errors: result.errors };
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CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACnG,MAAM,CAAC,eAAe,CAAC,GAAY,IAAsB,OAAO,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3G,MAAM,CAAC,aAAa,CAAC,GAAY,IAAsB,OAAO,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACvG,MAAM,CAAC,cAAc,CAAC,GAAY,IAAsB,OAAO,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAEzG,MAAM,CAAC,KAAK,CAAC,SAAsB,EAAE,GAAY;QAC7C,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACvC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;IAC1D,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as antlr from "antlr4ng";
|
|
2
|
+
export declare class plurnkLexer extends antlr.Lexer {
|
|
3
|
+
static readonly LBRACKET = 1;
|
|
4
|
+
static readonly RBRACKET = 2;
|
|
5
|
+
static readonly LPAREN = 3;
|
|
6
|
+
static readonly RPAREN = 4;
|
|
7
|
+
static readonly L_MARKER = 5;
|
|
8
|
+
static readonly COLON = 6;
|
|
9
|
+
static readonly COMMA = 7;
|
|
10
|
+
static readonly INT = 8;
|
|
11
|
+
static readonly IDENT = 9;
|
|
12
|
+
static readonly TAG = 10;
|
|
13
|
+
static readonly PATH_TEXT = 11;
|
|
14
|
+
static readonly BODY_TEXT = 12;
|
|
15
|
+
static readonly CLOSE_TAG = 13;
|
|
16
|
+
static readonly TEXT = 14;
|
|
17
|
+
static readonly OPEN_FIND = 15;
|
|
18
|
+
static readonly OPEN_READ = 16;
|
|
19
|
+
static readonly OPEN_EDIT = 17;
|
|
20
|
+
static readonly OPEN_COPY = 18;
|
|
21
|
+
static readonly OPEN_MOVE = 19;
|
|
22
|
+
static readonly OPEN_SHOW = 20;
|
|
23
|
+
static readonly OPEN_HIDE = 21;
|
|
24
|
+
static readonly OPEN_SEND = 22;
|
|
25
|
+
static readonly OPEN_EXEC = 23;
|
|
26
|
+
static readonly SLOTS_WS = 24;
|
|
27
|
+
static readonly ST_WS = 25;
|
|
28
|
+
static readonly SI_WS = 26;
|
|
29
|
+
static readonly SD_WS = 27;
|
|
30
|
+
static readonly ST_COMMA = 28;
|
|
31
|
+
static readonly B_COLON = 29;
|
|
32
|
+
static readonly SLOTS = 1;
|
|
33
|
+
static readonly SIGNAL_TAGS = 2;
|
|
34
|
+
static readonly SIGNAL_INT = 3;
|
|
35
|
+
static readonly SIGNAL_IDENT = 4;
|
|
36
|
+
static readonly PATH = 5;
|
|
37
|
+
static readonly BODY = 6;
|
|
38
|
+
static readonly channelNames: string[];
|
|
39
|
+
static readonly literalNames: (string | null)[];
|
|
40
|
+
static readonly symbolicNames: (string | null)[];
|
|
41
|
+
static readonly modeNames: string[];
|
|
42
|
+
static readonly ruleNames: string[];
|
|
43
|
+
private openTag;
|
|
44
|
+
private openTagLine;
|
|
45
|
+
private openTagColumn;
|
|
46
|
+
private setOpenTag;
|
|
47
|
+
getOpenTag(): string;
|
|
48
|
+
getOpenTagLine(): number;
|
|
49
|
+
getOpenTagColumn(): number;
|
|
50
|
+
private atColonCloseTag;
|
|
51
|
+
private isIdentChar;
|
|
52
|
+
private consumeRestOfCloseTagAfterColon;
|
|
53
|
+
private isOpKeywordAfterLtLt;
|
|
54
|
+
private isSendOp;
|
|
55
|
+
private isExecOp;
|
|
56
|
+
constructor(input: antlr.CharStream);
|
|
57
|
+
get grammarFileName(): string;
|
|
58
|
+
get literalNames(): (string | null)[];
|
|
59
|
+
get symbolicNames(): (string | null)[];
|
|
60
|
+
get ruleNames(): string[];
|
|
61
|
+
get serializedATN(): number[];
|
|
62
|
+
get channelNames(): string[];
|
|
63
|
+
get modeNames(): string[];
|
|
64
|
+
action(localContext: antlr.ParserRuleContext | null, ruleIndex: number, actionIndex: number): void;
|
|
65
|
+
private OPEN_FIND_action;
|
|
66
|
+
private OPEN_READ_action;
|
|
67
|
+
private OPEN_EDIT_action;
|
|
68
|
+
private OPEN_COPY_action;
|
|
69
|
+
private OPEN_MOVE_action;
|
|
70
|
+
private OPEN_SHOW_action;
|
|
71
|
+
private OPEN_HIDE_action;
|
|
72
|
+
private OPEN_SEND_action;
|
|
73
|
+
private OPEN_EXEC_action;
|
|
74
|
+
private B_CLOSE_action;
|
|
75
|
+
sempred(localContext: antlr.ParserRuleContext | null, ruleIndex: number, predIndex: number): boolean;
|
|
76
|
+
private TEXT_sempred;
|
|
77
|
+
private SLOTS_LB_TAGS_sempred;
|
|
78
|
+
private SLOTS_LB_INT_sempred;
|
|
79
|
+
private SLOTS_LB_IDENT_sempred;
|
|
80
|
+
private B_CLOSE_sempred;
|
|
81
|
+
static readonly _serializedATN: number[];
|
|
82
|
+
private static __ATN;
|
|
83
|
+
static get _ATN(): antlr.ATN;
|
|
84
|
+
private static readonly vocabulary;
|
|
85
|
+
get vocabulary(): antlr.Vocabulary;
|
|
86
|
+
private static readonly decisionsToDFA;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=plurnkLexer.d.ts.map
|