@plurnk/plurnk-parser 1.18.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.
Files changed (37) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +71 -0
  3. package/SPEC.md +35 -0
  4. package/bin/plurnk-parser.js +43 -0
  5. package/dist/AstBuilder.d.ts +21 -0
  6. package/dist/AstBuilder.d.ts.map +1 -0
  7. package/dist/AstBuilder.js +871 -0
  8. package/dist/AstBuilder.js.map +1 -0
  9. package/dist/PlurnkErrorStrategy.d.ts +11 -0
  10. package/dist/PlurnkErrorStrategy.d.ts.map +1 -0
  11. package/dist/PlurnkErrorStrategy.js +288 -0
  12. package/dist/PlurnkErrorStrategy.js.map +1 -0
  13. package/dist/PlurnkParser.d.ts +15 -0
  14. package/dist/PlurnkParser.d.ts.map +1 -0
  15. package/dist/PlurnkParser.js +324 -0
  16. package/dist/PlurnkParser.js.map +1 -0
  17. package/dist/RecordingListener.d.ts +9 -0
  18. package/dist/RecordingListener.d.ts.map +1 -0
  19. package/dist/RecordingListener.js +37 -0
  20. package/dist/RecordingListener.js.map +1 -0
  21. package/dist/generated/plurnkLexer.d.ts +172 -0
  22. package/dist/generated/plurnkLexer.d.ts.map +1 -0
  23. package/dist/generated/plurnkLexer.js +1168 -0
  24. package/dist/generated/plurnkLexer.js.map +1 -0
  25. package/dist/generated/plurnkParser.d.ts +437 -0
  26. package/dist/generated/plurnkParser.d.ts.map +1 -0
  27. package/dist/generated/plurnkParser.js +2974 -0
  28. package/dist/generated/plurnkParser.js.map +1 -0
  29. package/dist/generated/plurnkParserVisitor.d.ts +263 -0
  30. package/dist/generated/plurnkParserVisitor.d.ts.map +1 -0
  31. package/dist/generated/plurnkParserVisitor.js +227 -0
  32. package/dist/generated/plurnkParserVisitor.js.map +1 -0
  33. package/dist/index.d.ts +4 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +5 -0
  36. package/dist/index.js.map +1 -0
  37. package/package.json +73 -0
@@ -0,0 +1,227 @@
1
+ import { AbstractParseTreeVisitor } from "antlr4ng";
2
+ /**
3
+ * This interface defines a complete generic visitor for a parse tree produced
4
+ * by `plurnkParser`.
5
+ *
6
+ * @param <Result> The return type of the visit operation. Use `void` for
7
+ * operations with no return type.
8
+ */
9
+ export class plurnkParserVisitor extends AbstractParseTreeVisitor {
10
+ /**
11
+ * Visit a parse tree produced by `plurnkParser.document`.
12
+ * @param ctx the parse tree
13
+ * @return the visitor result
14
+ */
15
+ visitDocument;
16
+ /**
17
+ * Visit a parse tree produced by `plurnkParser.log`.
18
+ * @param ctx the parse tree
19
+ * @return the visitor result
20
+ */
21
+ visitLog;
22
+ /**
23
+ * Visit a parse tree produced by `plurnkParser.turn`.
24
+ * @param ctx the parse tree
25
+ * @return the visitor result
26
+ */
27
+ visitTurn;
28
+ /**
29
+ * Visit a parse tree produced by `plurnkParser.modelTurn`.
30
+ * @param ctx the parse tree
31
+ * @return the visitor result
32
+ */
33
+ visitModelTurn;
34
+ /**
35
+ * Visit a parse tree produced by `plurnkParser.statementSeq`.
36
+ * @param ctx the parse tree
37
+ * @return the visitor result
38
+ */
39
+ visitStatementSeq;
40
+ /**
41
+ * Visit a parse tree produced by `plurnkParser.clientStatementSeq`.
42
+ * @param ctx the parse tree
43
+ * @return the visitor result
44
+ */
45
+ visitClientStatementSeq;
46
+ /**
47
+ * Visit a parse tree produced by `plurnkParser.clientStatement`.
48
+ * @param ctx the parse tree
49
+ * @return the visitor result
50
+ */
51
+ visitClientStatement;
52
+ /**
53
+ * Visit a parse tree produced by `plurnkParser.statement`.
54
+ * @param ctx the parse tree
55
+ * @return the visitor result
56
+ */
57
+ visitStatement;
58
+ /**
59
+ * Visit a parse tree produced by `plurnkParser.midStatement`.
60
+ * @param ctx the parse tree
61
+ * @return the visitor result
62
+ */
63
+ visitMidStatement;
64
+ /**
65
+ * Visit a parse tree produced by `plurnkParser.findStatement`.
66
+ * @param ctx the parse tree
67
+ * @return the visitor result
68
+ */
69
+ visitFindStatement;
70
+ /**
71
+ * Visit a parse tree produced by `plurnkParser.readStatement`.
72
+ * @param ctx the parse tree
73
+ * @return the visitor result
74
+ */
75
+ visitReadStatement;
76
+ /**
77
+ * Visit a parse tree produced by `plurnkParser.editStatement`.
78
+ * @param ctx the parse tree
79
+ * @return the visitor result
80
+ */
81
+ visitEditStatement;
82
+ /**
83
+ * Visit a parse tree produced by `plurnkParser.copyStatement`.
84
+ * @param ctx the parse tree
85
+ * @return the visitor result
86
+ */
87
+ visitCopyStatement;
88
+ /**
89
+ * Visit a parse tree produced by `plurnkParser.moveStatement`.
90
+ * @param ctx the parse tree
91
+ * @return the visitor result
92
+ */
93
+ visitMoveStatement;
94
+ /**
95
+ * Visit a parse tree produced by `plurnkParser.dispositionStatement`.
96
+ * @param ctx the parse tree
97
+ * @return the visitor result
98
+ */
99
+ visitDispositionStatement;
100
+ /**
101
+ * Visit a parse tree produced by `plurnkParser.sendStatement`.
102
+ * @param ctx the parse tree
103
+ * @return the visitor result
104
+ */
105
+ visitSendStatement;
106
+ /**
107
+ * Visit a parse tree produced by `plurnkParser.execStatement`.
108
+ * @param ctx the parse tree
109
+ * @return the visitor result
110
+ */
111
+ visitExecStatement;
112
+ /**
113
+ * Visit a parse tree produced by `plurnkParser.bareStatement`.
114
+ * @param ctx the parse tree
115
+ * @return the visitor result
116
+ */
117
+ visitBareStatement;
118
+ /**
119
+ * Visit a parse tree produced by `plurnkParser.workStatement`.
120
+ * @param ctx the parse tree
121
+ * @return the visitor result
122
+ */
123
+ visitWorkStatement;
124
+ /**
125
+ * Visit a parse tree produced by `plurnkParser.forkStatement`.
126
+ * @param ctx the parse tree
127
+ * @return the visitor result
128
+ */
129
+ visitForkStatement;
130
+ /**
131
+ * Visit a parse tree produced by `plurnkParser.killStatement`.
132
+ * @param ctx the parse tree
133
+ * @return the visitor result
134
+ */
135
+ visitKillStatement;
136
+ /**
137
+ * Visit a parse tree produced by `plurnkParser.lookStatement`.
138
+ * @param ctx the parse tree
139
+ * @return the visitor result
140
+ */
141
+ visitLookStatement;
142
+ /**
143
+ * Visit a parse tree produced by `plurnkParser.opAside`.
144
+ * @param ctx the parse tree
145
+ * @return the visitor result
146
+ */
147
+ visitOpAside;
148
+ /**
149
+ * Visit a parse tree produced by `plurnkParser.statementEnd`.
150
+ * @param ctx the parse tree
151
+ * @return the visitor result
152
+ */
153
+ visitStatementEnd;
154
+ /**
155
+ * Visit a parse tree produced by `plurnkParser.transferModifiers`.
156
+ * @param ctx the parse tree
157
+ * @return the visitor result
158
+ */
159
+ visitTransferModifiers;
160
+ /**
161
+ * Visit a parse tree produced by `plurnkParser.resourceSelection`.
162
+ * @param ctx the parse tree
163
+ * @return the visitor result
164
+ */
165
+ visitResourceSelection;
166
+ /**
167
+ * Visit a parse tree produced by `plurnkParser.selectionModifier`.
168
+ * @param ctx the parse tree
169
+ * @return the visitor result
170
+ */
171
+ visitSelectionModifier;
172
+ /**
173
+ * Visit a parse tree produced by `plurnkParser.emptyStatementEnd`.
174
+ * @param ctx the parse tree
175
+ * @return the visitor result
176
+ */
177
+ visitEmptyStatementEnd;
178
+ /**
179
+ * Visit a parse tree produced by `plurnkParser.slotModifiers`.
180
+ * @param ctx the parse tree
181
+ * @return the visitor result
182
+ */
183
+ visitSlotModifiers;
184
+ /**
185
+ * Visit a parse tree produced by `plurnkParser.execModifiers`.
186
+ * @param ctx the parse tree
187
+ * @return the visitor result
188
+ */
189
+ visitExecModifiers;
190
+ /**
191
+ * Visit a parse tree produced by `plurnkParser.execSlot`.
192
+ * @param ctx the parse tree
193
+ * @return the visitor result
194
+ */
195
+ visitExecSlot;
196
+ /**
197
+ * Visit a parse tree produced by `plurnkParser.target`.
198
+ * @param ctx the parse tree
199
+ * @return the visitor result
200
+ */
201
+ visitTarget;
202
+ /**
203
+ * Visit a parse tree produced by `plurnkParser.targetWithMetadata`.
204
+ * @param ctx the parse tree
205
+ * @return the visitor result
206
+ */
207
+ visitTargetWithMetadata;
208
+ /**
209
+ * Visit a parse tree produced by `plurnkParser.metadata`.
210
+ * @param ctx the parse tree
211
+ * @return the visitor result
212
+ */
213
+ visitMetadata;
214
+ /**
215
+ * Visit a parse tree produced by `plurnkParser.lineMarker`.
216
+ * @param ctx the parse tree
217
+ * @return the visitor result
218
+ */
219
+ visitLineMarker;
220
+ /**
221
+ * Visit a parse tree produced by `plurnkParser.body`.
222
+ * @param ctx the parse tree
223
+ * @return the visitor result
224
+ */
225
+ visitBody;
226
+ }
227
+ //# sourceMappingURL=plurnkParserVisitor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plurnkParserVisitor.js","sourceRoot":"","sources":["../../src/generated/plurnkParserVisitor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAyCpD;;;;;;GAMG;AACH,MAAM,OAAO,mBAA4B,SAAQ,wBAAgC;IAC7E;;;;OAIG;IACH,aAAa,CAAoC;IACjD;;;;OAIG;IACH,QAAQ,CAA+B;IACvC;;;;OAIG;IACH,SAAS,CAAgC;IACzC;;;;OAIG;IACH,cAAc,CAAqC;IACnD;;;;OAIG;IACH,iBAAiB,CAAwC;IACzD;;;;OAIG;IACH,uBAAuB,CAA8C;IACrE;;;;OAIG;IACH,oBAAoB,CAA2C;IAC/D;;;;OAIG;IACH,cAAc,CAAqC;IACnD;;;;OAIG;IACH,iBAAiB,CAAwC;IACzD;;;;OAIG;IACH,kBAAkB,CAAyC;IAC3D;;;;OAIG;IACH,kBAAkB,CAAyC;IAC3D;;;;OAIG;IACH,kBAAkB,CAAyC;IAC3D;;;;OAIG;IACH,kBAAkB,CAAyC;IAC3D;;;;OAIG;IACH,kBAAkB,CAAyC;IAC3D;;;;OAIG;IACH,yBAAyB,CAAgD;IACzE;;;;OAIG;IACH,kBAAkB,CAAyC;IAC3D;;;;OAIG;IACH,kBAAkB,CAAyC;IAC3D;;;;OAIG;IACH,kBAAkB,CAAyC;IAC3D;;;;OAIG;IACH,kBAAkB,CAAyC;IAC3D;;;;OAIG;IACH,kBAAkB,CAAyC;IAC3D;;;;OAIG;IACH,kBAAkB,CAAyC;IAC3D;;;;OAIG;IACH,kBAAkB,CAAyC;IAC3D;;;;OAIG;IACH,YAAY,CAAmC;IAC/C;;;;OAIG;IACH,iBAAiB,CAAwC;IACzD;;;;OAIG;IACH,sBAAsB,CAA6C;IACnE;;;;OAIG;IACH,sBAAsB,CAA6C;IACnE;;;;OAIG;IACH,sBAAsB,CAA6C;IACnE;;;;OAIG;IACH,sBAAsB,CAA6C;IACnE;;;;OAIG;IACH,kBAAkB,CAAyC;IAC3D;;;;OAIG;IACH,kBAAkB,CAAyC;IAC3D;;;;OAIG;IACH,aAAa,CAAoC;IACjD;;;;OAIG;IACH,WAAW,CAAkC;IAC7C;;;;OAIG;IACH,uBAAuB,CAA8C;IACrE;;;;OAIG;IACH,aAAa,CAAoC;IACjD;;;;OAIG;IACH,eAAe,CAAsC;IACrD;;;;OAIG;IACH,SAAS,CAAgC;CAC5C"}
@@ -0,0 +1,4 @@
1
+ export { default as PlurnkParser } from "./PlurnkParser.ts";
2
+ export type { ParseOptions } from "./PlurnkParser.ts";
3
+ export declare const parsePath: (raw: string) => import("@plurnk/plurnk-contracts").ParsedPath | null;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,eAAO,MAAM,SAAS,QAAS,MAAM,yDAA8B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import AstBuilder from "./AstBuilder.js";
2
+ export { default as PlurnkParser } from "./PlurnkParser.js";
3
+ // One path or URI, decomposed exactly as the parser decomposes a target ({§path-syntax}).
4
+ export const parsePath = (raw) => AstBuilder.parsePath(raw);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG5D,0FAA0F;AAC1F,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@plurnk/plurnk-parser",
3
+ "version": "1.18.0",
4
+ "description": "The PLURNK language parser: ANTLR grammars, generated parser, AST builder, and path decomposition implementing @plurnk/plurnk-contracts",
5
+ "keywords": [
6
+ "plurnk",
7
+ "antlr",
8
+ "parser",
9
+ "protocol"
10
+ ],
11
+ "homepage": "https://github.com/plurnk/plurnk-service/tree/main/plurnk-parser#readme",
12
+ "bugs": {
13
+ "url": "https://repo.possumtech.com/plurnk/plurnk-service/issues"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/plurnk/plurnk-service.git",
18
+ "directory": "plurnk-parser"
19
+ },
20
+ "engines": {
21
+ "node": ">=26"
22
+ },
23
+ "license": "MIT",
24
+ "author": "@wikitopian",
25
+ "type": "module",
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "exports": {
30
+ ".": {
31
+ "plurnk-dev": "./src/index.ts",
32
+ "types": "./dist/index.d.ts",
33
+ "default": "./dist/index.js"
34
+ },
35
+ "./package.json": "./package.json"
36
+ },
37
+ "bin": {
38
+ "plurnk-parser": "./bin/plurnk-parser.js"
39
+ },
40
+ "files": [
41
+ "bin/plurnk-parser.js",
42
+ "dist/**/*",
43
+ "README.md",
44
+ "SPEC.md"
45
+ ],
46
+ "scripts": {
47
+ "build:grammar": "antlr-ng -D language=TypeScript -o src/generated --generate-visitor true --generate-listener false plurnkLexer.g4 plurnkParser.g4 && node --conditions=plurnk-dev scriptify/fix-generated-imports.ts",
48
+ "build:clean": "rm -rf dist",
49
+ "build:dist": "tsc -p tsconfig.build.json",
50
+ "build": "npm run build:clean && npm run build:grammar && npm run build:dist",
51
+ "antlr:tokens": "testrig src/generated/plurnk document --tokens",
52
+ "antlr:trace": "testrig src/generated/plurnk document --trace",
53
+ "antlr:parse": "testrig src/generated/plurnk document --tree",
54
+ "test:lint": "tsc --noEmit",
55
+ "test:unit": "node --conditions=plurnk-dev --test src/*.test.ts test/unit/*.test.ts",
56
+ "test:intg": "node --conditions=plurnk-dev --test test/integration/*.test.ts test/demo/*.test.ts",
57
+ "test:installation": "node --conditions=plurnk-dev scriptify/smoke-test.ts",
58
+ "test": "npm run test:lint && npm run test:unit && npm run test:intg",
59
+ "release:check": "npm run test:installation",
60
+ "prepublishOnly": "npm audit && npm run build && npm test && npm run test:installation",
61
+ "prepack": "npm run build"
62
+ },
63
+ "dependencies": {
64
+ "@plurnk/plurnk-contracts": "1.18.0",
65
+ "antlr4ng": "^3.0.0",
66
+ "json-p3": "2.2.2",
67
+ "xpath": "^0.0.34"
68
+ },
69
+ "devDependencies": {
70
+ "antlr-ng": "^1.0.10",
71
+ "esbuild": "^0.28.1"
72
+ }
73
+ }