astn 0.110.5 → 0.110.8
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 +7 -4
- package/dist/index.js +9 -9
- 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 +11 -0
- package/dist/lib/transformations/parse.js +253 -0
- package/dist/lib/transformations/parse_generic.d.ts +44 -0
- package/dist/lib/transformations/parse_generic.js +644 -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,123 @@
|
|
|
1
|
+
import * as _et from 'exupery-core-types';
|
|
2
|
+
export type Location = {
|
|
3
|
+
readonly 'relative': Relative_Location;
|
|
4
|
+
readonly 'absolute': number;
|
|
5
|
+
};
|
|
6
|
+
export type Range = {
|
|
7
|
+
readonly 'start': Location;
|
|
8
|
+
readonly 'end': Location;
|
|
9
|
+
};
|
|
10
|
+
export type Relative_Location = {
|
|
11
|
+
readonly 'line': number;
|
|
12
|
+
readonly 'column': number;
|
|
13
|
+
};
|
|
14
|
+
export type Document = {
|
|
15
|
+
'header': _et.Optional_Value<{
|
|
16
|
+
'!': Structural_Token;
|
|
17
|
+
'value': Value;
|
|
18
|
+
}>;
|
|
19
|
+
'content': Value;
|
|
20
|
+
};
|
|
21
|
+
export type Value = {
|
|
22
|
+
'start': Location;
|
|
23
|
+
'end': Location;
|
|
24
|
+
'type': Value_Type;
|
|
25
|
+
};
|
|
26
|
+
export type Value_Type = ['string', StringX] | [
|
|
27
|
+
'indexed collection',
|
|
28
|
+
[
|
|
29
|
+
'dictionary',
|
|
30
|
+
{
|
|
31
|
+
'{': Structural_Token;
|
|
32
|
+
'entries': Key_Value_Pairs;
|
|
33
|
+
'}': Structural_Token;
|
|
34
|
+
}
|
|
35
|
+
] | [
|
|
36
|
+
'verbose group',
|
|
37
|
+
{
|
|
38
|
+
'(': Structural_Token;
|
|
39
|
+
'entries': Key_Value_Pairs;
|
|
40
|
+
')': Structural_Token;
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
] | [
|
|
44
|
+
'ordered collection',
|
|
45
|
+
[
|
|
46
|
+
'list',
|
|
47
|
+
{
|
|
48
|
+
'[': Structural_Token;
|
|
49
|
+
'elements': Elements;
|
|
50
|
+
']': Structural_Token;
|
|
51
|
+
}
|
|
52
|
+
] | [
|
|
53
|
+
'concise group',
|
|
54
|
+
{
|
|
55
|
+
'<': Structural_Token;
|
|
56
|
+
'elements': Elements;
|
|
57
|
+
'>': Structural_Token;
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
] | [
|
|
61
|
+
'include',
|
|
62
|
+
{
|
|
63
|
+
'@': Structural_Token;
|
|
64
|
+
'path': StringX;
|
|
65
|
+
}
|
|
66
|
+
] | [
|
|
67
|
+
'tagged value',
|
|
68
|
+
{
|
|
69
|
+
'|': Structural_Token;
|
|
70
|
+
'state': StringX;
|
|
71
|
+
'value': Value;
|
|
72
|
+
}
|
|
73
|
+
] | [
|
|
74
|
+
'not set',
|
|
75
|
+
{
|
|
76
|
+
'~': Structural_Token;
|
|
77
|
+
}
|
|
78
|
+
] | [
|
|
79
|
+
'set optional value',
|
|
80
|
+
{
|
|
81
|
+
'*': Structural_Token;
|
|
82
|
+
'value': Value;
|
|
83
|
+
}
|
|
84
|
+
];
|
|
85
|
+
export type StringX = {
|
|
86
|
+
readonly 'trailing trivia': Trivia;
|
|
87
|
+
readonly 'start': Location;
|
|
88
|
+
readonly 'value': string;
|
|
89
|
+
readonly 'type': String_Type;
|
|
90
|
+
readonly 'end': Location;
|
|
91
|
+
};
|
|
92
|
+
export type String_Type = ['quoted', null] | ['apostrophed', null] | ['undelimited', null] | ['backticked', null];
|
|
93
|
+
export type Key_Value_Pairs = _et.Array<Key_Value_Pair>;
|
|
94
|
+
export type Element = {
|
|
95
|
+
'value': Value;
|
|
96
|
+
',': _et.Optional_Value<Structural_Token>;
|
|
97
|
+
};
|
|
98
|
+
export type Elements = _et.Array<Element>;
|
|
99
|
+
export type Key_Value_Pair = {
|
|
100
|
+
'key': StringX;
|
|
101
|
+
'value': _et.Optional_Value<{
|
|
102
|
+
':': Structural_Token;
|
|
103
|
+
'value': Value;
|
|
104
|
+
}>;
|
|
105
|
+
',': _et.Optional_Value<Structural_Token>;
|
|
106
|
+
};
|
|
107
|
+
export type Structural_Token = {
|
|
108
|
+
readonly 'trailing trivia': Trivia;
|
|
109
|
+
readonly 'range': Range;
|
|
110
|
+
};
|
|
111
|
+
export type Whitespace = {
|
|
112
|
+
'range': Range;
|
|
113
|
+
'value': string;
|
|
114
|
+
};
|
|
115
|
+
export type Trivia = {
|
|
116
|
+
'leading whitespace': Whitespace;
|
|
117
|
+
'comments': _et.Array<{
|
|
118
|
+
'type': ['line', null] | ['block', null];
|
|
119
|
+
'content': string;
|
|
120
|
+
'range': Range;
|
|
121
|
+
'trailing whitespace': Whitespace;
|
|
122
|
+
}>;
|
|
123
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2xpYi90eXBlcy9hc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as _et from 'exupery-core-types';
|
|
2
|
+
import * as ast from "./ast";
|
|
3
|
+
export type Text_Edit = [
|
|
4
|
+
'insert',
|
|
5
|
+
{
|
|
6
|
+
'location': ast.Relative_Location;
|
|
7
|
+
'text': string;
|
|
8
|
+
}
|
|
9
|
+
] | [
|
|
10
|
+
'replace',
|
|
11
|
+
{
|
|
12
|
+
'range': ast.Range;
|
|
13
|
+
'text': string;
|
|
14
|
+
}
|
|
15
|
+
] | [
|
|
16
|
+
'delete',
|
|
17
|
+
{
|
|
18
|
+
'range': ast.Range;
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
export type Text_Edits = _et.Array<Text_Edit>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWRlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2xpYi90eXBlcy9pZGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as _et from 'exupery-core-types';
|
|
2
|
+
import * as ast from "./ast";
|
|
3
|
+
export type Token_Type = readonly ['{', null] | readonly ['}', null] | readonly ['[', null] | readonly [']', null] | readonly ['(', null] | readonly [')', null] | readonly ['<', null] | readonly ['>', null] | readonly ['!', null] | readonly ['@', null] | readonly ['~', null] | readonly ['*', null] | readonly [',', null] | readonly [':', null] | readonly ['|', null] | readonly [
|
|
4
|
+
'string',
|
|
5
|
+
{
|
|
6
|
+
'value': string;
|
|
7
|
+
'type': ast.String_Type;
|
|
8
|
+
}
|
|
9
|
+
];
|
|
10
|
+
export type Parse_Error_Type = [
|
|
11
|
+
'lexer',
|
|
12
|
+
['unexpected control character', number] | ['missing character after escape', null] | ['unexpected end of line in delimited string', null] | ['unexpected character', number] | ['unterminated string', null] | ['unterminated block comment', null] | ['unterminated unicode escape sequence', null] | ['invalid unicode escape sequence', null] | ['unknown escape character', null] | ['unexpected end of input', null] | ['dangling slash', null]
|
|
13
|
+
] | [
|
|
14
|
+
'parser',
|
|
15
|
+
{
|
|
16
|
+
'expected': _et.Array<Expected>;
|
|
17
|
+
'cause': ['missing token', null] | [
|
|
18
|
+
'unexpected token',
|
|
19
|
+
{
|
|
20
|
+
'found': Token_Type;
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
export type Expected = 'a string' | 'a value' | '!' | '>' | '}' | '@' | ',' | ':' | ')' | ']';
|
|
26
|
+
export type Parse_Error = {
|
|
27
|
+
'type': Parse_Error_Type;
|
|
28
|
+
'range': ast.Range;
|
|
29
|
+
};
|
|
30
|
+
export type Parse_Result = ['failure', Parse_Error] | ['success', ast.Document];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFyc2VfcmVzdWx0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2xpYi90eXBlcy9wYXJzZV9yZXN1bHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as _et from 'exupery-core-types';
|
|
2
|
+
import * as ast from "./ast";
|
|
3
|
+
import * as parse_result from "./parse_result";
|
|
4
|
+
export type Annotated_Token = {
|
|
5
|
+
readonly 'start': ast.Location;
|
|
6
|
+
readonly 'type': parse_result.Token_Type;
|
|
7
|
+
readonly 'end': ast.Location;
|
|
8
|
+
readonly 'trailing trivia': ast.Trivia;
|
|
9
|
+
};
|
|
10
|
+
export type Tokenizer_Result = {
|
|
11
|
+
readonly 'leading trivia': ast.Trivia;
|
|
12
|
+
readonly 'tokens': _et.Array<Annotated_Token>;
|
|
13
|
+
readonly 'end': ast.Location;
|
|
14
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9rZW5pemVfcmVzdWx0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2xpYi90eXBlcy90b2tlbml6ZV9yZXN1bHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|