astn 0.110.5 → 0.110.7
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 +17 -0
- package/README.md +414 -0
- package/dist/bin/validate_astn.d.ts +2 -0
- package/dist/bin/validate_astn.js +48 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -5
- package/dist/lib/create_error_message.d.ts +3 -3
- package/dist/lib/create_error_message.js +1 -1
- package/dist/lib/format.d.ts +18 -38
- package/dist/lib/format.js +1 -1
- package/dist/lib/parse.d.ts +16 -42
- package/dist/lib/parse.js +19 -19
- package/dist/lib/transformations/create_error_message.d.ts +5 -0
- package/dist/lib/transformations/create_error_message.js +75 -0
- package/dist/lib/transformations/format.d.ts +42 -0
- package/dist/lib/transformations/format.js +172 -0
- package/dist/lib/transformations/parse.d.ts +55 -0
- package/dist/lib/transformations/parse.js +865 -0
- package/dist/lib/types/ast.d.ts +123 -0
- package/dist/lib/types/ast.js +3 -0
- package/dist/lib/types/ide.d.ts +21 -0
- package/dist/lib/types/ide.js +3 -0
- package/dist/lib/types/parse_result.d.ts +30 -0
- package/dist/lib/types/parse_result.js +3 -0
- package/dist/lib/types/tokenize_result.d.ts +14 -0
- package/dist/lib/types/tokenize_result.js +3 -0
- package/documentation/railroad_diagram/diagram/apostrophed_string.png +0 -0
- package/documentation/railroad_diagram/diagram/astn_document.png +0 -0
- package/documentation/railroad_diagram/diagram/backticked_string.png +0 -0
- package/documentation/railroad_diagram/diagram/comment.png +0 -0
- package/documentation/railroad_diagram/diagram/concise_group.png +0 -0
- package/documentation/railroad_diagram/diagram/content.png +0 -0
- package/documentation/railroad_diagram/diagram/dictionary.png +0 -0
- package/documentation/railroad_diagram/diagram/elements.png +0 -0
- package/documentation/railroad_diagram/diagram/escaped_character.png +0 -0
- package/documentation/railroad_diagram/diagram/four_hexadecimal_digits.png +0 -0
- package/documentation/railroad_diagram/diagram/header.png +0 -0
- package/documentation/railroad_diagram/diagram/hexadecimal_digit.png +0 -0
- package/documentation/railroad_diagram/diagram/ignorable.png +0 -0
- package/documentation/railroad_diagram/diagram/include.png +0 -0
- package/documentation/railroad_diagram/diagram/key_value_pairs.png +0 -0
- package/documentation/railroad_diagram/diagram/line_comment.png +0 -0
- package/documentation/railroad_diagram/diagram/list.png +0 -0
- package/documentation/railroad_diagram/diagram/newline_character.png +0 -0
- package/documentation/railroad_diagram/diagram/normal_character.png +0 -0
- package/documentation/railroad_diagram/diagram/normal_or_newline_character.png +0 -0
- package/documentation/railroad_diagram/diagram/quoted_string.png +0 -0
- package/documentation/railroad_diagram/diagram/rr-2.5.png +0 -0
- package/documentation/railroad_diagram/diagram/set_optional_value.png +0 -0
- package/documentation/railroad_diagram/diagram/string.png +0 -0
- package/documentation/railroad_diagram/diagram/string_content_character.png +0 -0
- package/documentation/railroad_diagram/diagram/tagged_value.png +0 -0
- package/documentation/railroad_diagram/diagram/traditional_comment.png +0 -0
- package/documentation/railroad_diagram/diagram/undelimited_string.png +0 -0
- package/documentation/railroad_diagram/diagram/value.png +0 -0
- package/documentation/railroad_diagram/diagram/verbose_group.png +0 -0
- package/documentation/railroad_diagram/diagram/whitespace.png +0 -0
- package/documentation/railroad_diagram/index.md +425 -0
- package/package.json +59 -3
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
<div style="background-color: white; color: black; padding: 1em;">
|
|
2
|
+
|
|
3
|
+
**astn_document:**
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
astn_document
|
|
9
|
+
::= ( '!' header )? content
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**header:**
|
|
13
|
+
|
|
14
|
+

|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
header ::= value
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
referenced by:
|
|
21
|
+
|
|
22
|
+
* astn_document
|
|
23
|
+
|
|
24
|
+
**content:**
|
|
25
|
+
|
|
26
|
+

|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
content ::= value
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
referenced by:
|
|
33
|
+
|
|
34
|
+
* astn_document
|
|
35
|
+
|
|
36
|
+
**value:**
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
value ::= concise_group
|
|
42
|
+
| dictionary
|
|
43
|
+
| include
|
|
44
|
+
| list
|
|
45
|
+
| '~'
|
|
46
|
+
| set_optional_value
|
|
47
|
+
| string
|
|
48
|
+
| tagged_value
|
|
49
|
+
| verbose_group
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
referenced by:
|
|
53
|
+
|
|
54
|
+
* content
|
|
55
|
+
* elements
|
|
56
|
+
* header
|
|
57
|
+
* include
|
|
58
|
+
* key_value_pairs
|
|
59
|
+
* set_optional_value
|
|
60
|
+
* tagged_value
|
|
61
|
+
|
|
62
|
+
**concise_group:**
|
|
63
|
+
|
|
64
|
+

|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
concise_group
|
|
68
|
+
::= '<' elements '>'
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
referenced by:
|
|
72
|
+
|
|
73
|
+
* value
|
|
74
|
+
|
|
75
|
+
**dictionary:**
|
|
76
|
+
|
|
77
|
+

|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
dictionary
|
|
81
|
+
::= '{' key_value_pairs '}'
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
referenced by:
|
|
85
|
+
|
|
86
|
+
* value
|
|
87
|
+
|
|
88
|
+
**include:**
|
|
89
|
+
|
|
90
|
+

|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
include ::= '@' value
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
referenced by:
|
|
97
|
+
|
|
98
|
+
* value
|
|
99
|
+
|
|
100
|
+
**list:**
|
|
101
|
+
|
|
102
|
+

|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
list ::= '[' elements ']'
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
referenced by:
|
|
109
|
+
|
|
110
|
+
* value
|
|
111
|
+
|
|
112
|
+
**set_optional_value:**
|
|
113
|
+
|
|
114
|
+

|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
set_optional_value
|
|
118
|
+
::= '*' value
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
referenced by:
|
|
122
|
+
|
|
123
|
+
* value
|
|
124
|
+
|
|
125
|
+
**string:**
|
|
126
|
+
|
|
127
|
+

|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
string ::= quoted_string
|
|
131
|
+
| apostrophed_string
|
|
132
|
+
| backticked_string
|
|
133
|
+
| undelimited_string
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
referenced by:
|
|
137
|
+
|
|
138
|
+
* key_value_pairs
|
|
139
|
+
* tagged_value
|
|
140
|
+
* value
|
|
141
|
+
|
|
142
|
+
**tagged_value:**
|
|
143
|
+
|
|
144
|
+

|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
tagged_value
|
|
148
|
+
::= '|' string value
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
referenced by:
|
|
152
|
+
|
|
153
|
+
* value
|
|
154
|
+
|
|
155
|
+
**verbose_group:**
|
|
156
|
+
|
|
157
|
+

|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
verbose_group
|
|
161
|
+
::= '(' key_value_pairs ')'
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
referenced by:
|
|
165
|
+
|
|
166
|
+
* value
|
|
167
|
+
|
|
168
|
+
**elements:**
|
|
169
|
+
|
|
170
|
+

|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
elements ::= ( value ','? )*
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
referenced by:
|
|
177
|
+
|
|
178
|
+
* concise_group
|
|
179
|
+
* list
|
|
180
|
+
|
|
181
|
+
**key_value_pairs:**
|
|
182
|
+
|
|
183
|
+

|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
key_value_pairs
|
|
187
|
+
::= ( string ( ':' value )? ','? )*
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
referenced by:
|
|
191
|
+
|
|
192
|
+
* dictionary
|
|
193
|
+
* verbose_group
|
|
194
|
+
|
|
195
|
+
**ignorable:**
|
|
196
|
+
|
|
197
|
+

|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
ignorable
|
|
201
|
+
::= whitespace
|
|
202
|
+
| comment
|
|
203
|
+
/* ws: definition */
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**quoted_string:**
|
|
207
|
+
|
|
208
|
+

|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
quoted_string
|
|
212
|
+
::= '"' ( string_content_character - '"' | newline_character )* '"'
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
referenced by:
|
|
216
|
+
|
|
217
|
+
* string
|
|
218
|
+
|
|
219
|
+
**apostrophed_string:**
|
|
220
|
+
|
|
221
|
+

|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
apostrophed_string
|
|
225
|
+
::= "'" ( string_content_character - "'" )* "'"
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
referenced by:
|
|
229
|
+
|
|
230
|
+
* string
|
|
231
|
+
|
|
232
|
+
**backticked_string:**
|
|
233
|
+
|
|
234
|
+

|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
backticked_string
|
|
238
|
+
::= '`' ( string_content_character - '`' )* '`'
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
referenced by:
|
|
242
|
+
|
|
243
|
+
* string
|
|
244
|
+
|
|
245
|
+
**undelimited_string:**
|
|
246
|
+
|
|
247
|
+

|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
undelimited_string
|
|
251
|
+
::= ( normal_character - ( '{' | '}' | '<' | '>' '(' | ')' '[' | ']' | '!' | '*' | ',' | '~' | ':' | '@'
|
|
252
|
+
| '|' | "'" | '"' | '`' | '/' | ' ' | '\t' )? )*
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
referenced by:
|
|
256
|
+
|
|
257
|
+
* string
|
|
258
|
+
|
|
259
|
+
**string_content_character:**
|
|
260
|
+
|
|
261
|
+

|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
string_content_character
|
|
265
|
+
::= normal_character
|
|
266
|
+
| escaped_character
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
referenced by:
|
|
270
|
+
|
|
271
|
+
* apostrophed_string
|
|
272
|
+
* backticked_string
|
|
273
|
+
* quoted_string
|
|
274
|
+
|
|
275
|
+
**normal_character:**
|
|
276
|
+
|
|
277
|
+

|
|
278
|
+
|
|
279
|
+
```
|
|
280
|
+
normal_character
|
|
281
|
+
::= [#x20-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF]?
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
referenced by:
|
|
285
|
+
|
|
286
|
+
* line_comment
|
|
287
|
+
* normal_or_newline_character
|
|
288
|
+
* string_content_character
|
|
289
|
+
* undelimited_string
|
|
290
|
+
|
|
291
|
+
**escaped_character:**
|
|
292
|
+
|
|
293
|
+

|
|
294
|
+
|
|
295
|
+
```
|
|
296
|
+
escaped_character
|
|
297
|
+
::= '\"'
|
|
298
|
+
| '\`'
|
|
299
|
+
| "\'"
|
|
300
|
+
| '\\'
|
|
301
|
+
| '\/'
|
|
302
|
+
| '\b'
|
|
303
|
+
| '\f'
|
|
304
|
+
| '\n'
|
|
305
|
+
| '\r'
|
|
306
|
+
| '\t'
|
|
307
|
+
| '\u' four_hexadecimal_digits
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
referenced by:
|
|
311
|
+
|
|
312
|
+
* string_content_character
|
|
313
|
+
|
|
314
|
+
**newline_character:**
|
|
315
|
+
|
|
316
|
+

|
|
317
|
+
|
|
318
|
+
```
|
|
319
|
+
newline_character
|
|
320
|
+
::= [#xA#xD]
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
referenced by:
|
|
324
|
+
|
|
325
|
+
* normal_or_newline_character
|
|
326
|
+
* quoted_string
|
|
327
|
+
|
|
328
|
+
**normal_or_newline_character:**
|
|
329
|
+
|
|
330
|
+

|
|
331
|
+
|
|
332
|
+
```
|
|
333
|
+
normal_or_newline_character
|
|
334
|
+
::= normal_character
|
|
335
|
+
| newline_character
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
referenced by:
|
|
339
|
+
|
|
340
|
+
* traditional_comment
|
|
341
|
+
|
|
342
|
+
**comment:**
|
|
343
|
+
|
|
344
|
+

|
|
345
|
+
|
|
346
|
+
```
|
|
347
|
+
comment ::= traditional_comment
|
|
348
|
+
| line_comment
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
referenced by:
|
|
352
|
+
|
|
353
|
+
* ignorable
|
|
354
|
+
|
|
355
|
+
**traditional_comment:**
|
|
356
|
+
|
|
357
|
+

|
|
358
|
+
|
|
359
|
+
```
|
|
360
|
+
traditional_comment
|
|
361
|
+
::= '/*' ( normal_or_newline_character* - ( normal_or_newline_character* '*/' normal_or_newline_character* ) ) '*/'
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
referenced by:
|
|
365
|
+
|
|
366
|
+
* comment
|
|
367
|
+
|
|
368
|
+
**line_comment:**
|
|
369
|
+
|
|
370
|
+

|
|
371
|
+
|
|
372
|
+
```
|
|
373
|
+
line_comment
|
|
374
|
+
::= '//' normal_character*
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
referenced by:
|
|
378
|
+
|
|
379
|
+
* comment
|
|
380
|
+
|
|
381
|
+
**four_hexadecimal_digits:**
|
|
382
|
+
|
|
383
|
+

|
|
384
|
+
|
|
385
|
+
```
|
|
386
|
+
four_hexadecimal_digits
|
|
387
|
+
::= hexadecimal_digit hexadecimal_digit hexadecimal_digit hexadecimal_digit
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
referenced by:
|
|
391
|
+
|
|
392
|
+
* escaped_character
|
|
393
|
+
|
|
394
|
+
**hexadecimal_digit:**
|
|
395
|
+
|
|
396
|
+

|
|
397
|
+
|
|
398
|
+
```
|
|
399
|
+
hexadecimal_digit
|
|
400
|
+
::= [0-9A-Fa-f]
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
referenced by:
|
|
404
|
+
|
|
405
|
+
* four_hexadecimal_digits
|
|
406
|
+
|
|
407
|
+
**whitespace:**
|
|
408
|
+
|
|
409
|
+

|
|
410
|
+
|
|
411
|
+
```
|
|
412
|
+
whitespace
|
|
413
|
+
::= [#x9#xA#xD#x20]+
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
referenced by:
|
|
417
|
+
|
|
418
|
+
* ignorable
|
|
419
|
+
|
|
420
|
+
##
|
|
421
|
+
 <sup>generated by [RR - Railroad Diagram Generator][RR]</sup>
|
|
422
|
+
|
|
423
|
+
[RR]: https://www.bottlecaps.de/rr/ui
|
|
424
|
+
|
|
425
|
+
</div>
|
package/package.json
CHANGED
|
@@ -1,15 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astn",
|
|
3
|
-
"version": "0.110.
|
|
4
|
-
"description": "A library for parsing and formatting ASTN (Abstract Syntax Tree Notation)",
|
|
3
|
+
"version": "0.110.7",
|
|
4
|
+
"description": "A TypeScript library for parsing and formatting ASTN (Abstract Syntax Tree Notation) - a human-editable data format for structured content",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./format": {
|
|
14
|
+
"types": "./dist/lib/transformations/format.d.ts",
|
|
15
|
+
"default": "./dist/lib/transformations/format.js"
|
|
16
|
+
},
|
|
17
|
+
"./create_error_message": {
|
|
18
|
+
"types": "./dist/lib/transformations/create_error_message.d.ts",
|
|
19
|
+
"default": "./dist/lib/transformations/create_error_message.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"bin": {
|
|
23
|
+
"astn-validate": "./dist/bin/validate_astn.js"
|
|
24
|
+
},
|
|
7
25
|
"files": [
|
|
8
|
-
"dist"
|
|
26
|
+
"dist",
|
|
27
|
+
"README.md",
|
|
28
|
+
"LICENSE",
|
|
29
|
+
"documentation"
|
|
9
30
|
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc",
|
|
33
|
+
"clean": "rm -rf dist",
|
|
34
|
+
"prepare": "npm run build",
|
|
35
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
36
|
+
"validate": "node dist/bin/validate_astn.js"
|
|
37
|
+
},
|
|
38
|
+
"keywords": [
|
|
39
|
+
"astn",
|
|
40
|
+
"parser",
|
|
41
|
+
"formatter",
|
|
42
|
+
"abstract-syntax-tree",
|
|
43
|
+
"data-format",
|
|
44
|
+
"typescript",
|
|
45
|
+
"lexer",
|
|
46
|
+
"structured-data",
|
|
47
|
+
"configuration",
|
|
48
|
+
"serialization"
|
|
49
|
+
],
|
|
50
|
+
"author": "Corno",
|
|
51
|
+
"license": "MIT",
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "https://github.com/corno/astn.git"
|
|
55
|
+
},
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "https://github.com/corno/astn/issues"
|
|
58
|
+
},
|
|
59
|
+
"homepage": "https://github.com/corno/astn#readme",
|
|
60
|
+
"engines": {
|
|
61
|
+
"node": ">=14.0.0"
|
|
62
|
+
},
|
|
10
63
|
"dependencies": {
|
|
11
64
|
"exupery-core-alg": "^0.1.4",
|
|
12
65
|
"exupery-core-resources": "^0.2.1",
|
|
13
66
|
"pareto-standard-operations": "^0.1.0"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"typescript": "^5.0.0"
|
|
14
70
|
}
|
|
15
71
|
}
|