@bablr/language-en-spamex 0.9.0 → 0.11.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/lib/grammar.js +133 -97
- package/package.json +13 -16
- package/lib/grammar.macro.js +0 -186
package/lib/grammar.js
CHANGED
|
@@ -1,137 +1,173 @@
|
|
|
1
|
-
/* @macrome
|
|
2
|
-
* @generatedby @bablr/macrome-generator-bablr
|
|
3
|
-
* @generatedfrom ./grammar.macro.js#d3a89c912a3321b6fe824122fc60ff07c79b0f7f
|
|
4
|
-
* This file is autogenerated. Please do not edit it directly.
|
|
5
|
-
* When editing run `npx macrome watch` then change the file this is generated from.
|
|
6
|
-
*/
|
|
7
|
-
import _applyDecs from "@babel/runtime/helpers/applyDecs2305";
|
|
8
|
-
let _initProto, _MatcherDecs, _GapNodeMatcherDecs, _ArrayNodeMatcherDecs, _NullNodeMatcherDecs, _PropertyMatcherDecs, _BasicNodeMatcherDecs, _CloseNodeMatcherDecs, _StringMatcherDecs, _StringDecs, _RegexDecs, _ListDecs, _PunctuatorDecs, _AnyDecs;
|
|
9
1
|
import { re, spam as m } from '@bablr/boot';
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
2
|
+
import { o, eat, eatMatch, fail, match, defineAttribute } from '@bablr/helpers/grammar';
|
|
3
|
+
import Regex from '@bablr/language-en-regex-vm-pattern';
|
|
4
|
+
import { default as CSTML, eatMatchTrivia } from '@bablr/language-en-cstml';
|
|
5
|
+
import JSON from '@bablr/language-en-cstml-json';
|
|
6
|
+
import Space from '@bablr/language-en-blank-space';
|
|
7
|
+
import { buildString } from '@bablr/helpers/builders';
|
|
8
|
+
import { printSource } from '@bablr/agast-helpers/tree';
|
|
9
|
+
|
|
17
10
|
export const canonicalURL = 'https://bablr.org/languages/core/en/spamex';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
const {
|
|
25
|
-
eatMatchTrivia
|
|
26
|
-
} = CSTML;
|
|
11
|
+
|
|
12
|
+
export const dependencies = { Regex, CSTML, JSON, Space };
|
|
13
|
+
|
|
14
|
+
export const defaultMatcher = m`<_Matcher />`;
|
|
15
|
+
|
|
27
16
|
export const grammar = class SpamexGrammar {
|
|
28
|
-
static {
|
|
29
|
-
[_initProto] = _applyDecs(this, [[_MatcherDecs, 2, "Matcher"], [_GapNodeMatcherDecs, 2, "GapNodeMatcher"], [_ArrayNodeMatcherDecs, 2, "ArrayNodeMatcher"], [_NullNodeMatcherDecs, 2, "NullNodeMatcher"], [_PropertyMatcherDecs, 2, "PropertyMatcher"], [Node, 2, "ReferenceMatcher"], [Node, 2, "BindingMatcher"], [_BasicNodeMatcherDecs, 2, "BasicNodeMatcher"], [Node, 2, "OpenNodeMatcher"], [_CloseNodeMatcherDecs, 2, "CloseNodeMatcher"], [_StringMatcherDecs, 2, "StringMatcher"], [_StringDecs, 2, "String"], [_RegexDecs, 2, "Regex"], [_ListDecs, 2, "List"], [_PunctuatorDecs, 2, "Punctuator"], [_AnyDecs, 2, "Any"]], []).e;
|
|
30
|
-
}
|
|
31
17
|
constructor() {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
18
|
+
this.attributes = new Map(
|
|
19
|
+
Object.entries({
|
|
20
|
+
TreeNodeMatcherOpen: { selfClosing: undefined },
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
*Matcher() {
|
|
26
|
+
yield eat(m`<BoundNodeMatcher />`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
*BoundNodeMatcher() {
|
|
30
|
+
while (yield eatMatch(m`bindingMatchers[]: <BindingMatcher ':' />`));
|
|
31
|
+
|
|
32
|
+
yield eat(m`nodeMatcher: <_NodeMatcher />`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
*PropertyMatcher() {
|
|
36
|
+
yield eatMatch(m`refMatcher$: <ReferenceMatcher />`);
|
|
37
|
+
yield* eatMatchTrivia();
|
|
38
|
+
yield eat(m`valueMatcher$: <BoundNodeMatcher />`);
|
|
36
39
|
}
|
|
40
|
+
|
|
37
41
|
*NodeMatcher() {
|
|
38
|
-
|
|
42
|
+
let chrs = yield match(re`/:|\<\/\/?\>|\<|null|['"/]/`);
|
|
43
|
+
switch (printSource(chrs)) {
|
|
44
|
+
case '<//>':
|
|
45
|
+
yield eat(m`<GapNodeMatcher />`);
|
|
46
|
+
break;
|
|
47
|
+
case '</>':
|
|
48
|
+
yield fail();
|
|
49
|
+
break;
|
|
50
|
+
case '<':
|
|
51
|
+
case '"':
|
|
52
|
+
case "'":
|
|
53
|
+
case '/':
|
|
54
|
+
yield eat(m`<TreeNodeMatcher />`);
|
|
55
|
+
break;
|
|
56
|
+
case 'null':
|
|
57
|
+
yield eat(m`<NullNodeMatcher />`);
|
|
58
|
+
break;
|
|
59
|
+
default:
|
|
60
|
+
yield eat(m`<TreeNodeMatcher />`);
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
39
63
|
}
|
|
64
|
+
|
|
40
65
|
*GapNodeMatcher() {
|
|
41
|
-
yield eat(m`sigilToken
|
|
42
|
-
}
|
|
43
|
-
*ArrayNodeMatcher() {
|
|
44
|
-
yield eat(m`sigilToken: <*Punctuator '[]' />`);
|
|
66
|
+
yield eat(m`sigilToken*: <* '<//>' />`);
|
|
45
67
|
}
|
|
68
|
+
|
|
46
69
|
*NullNodeMatcher() {
|
|
47
|
-
yield eat(m`sigilToken
|
|
48
|
-
}
|
|
49
|
-
*PropertyMatcher() {
|
|
50
|
-
yield eatMatch(m`refMatcher: <ReferenceMatcher />`);
|
|
51
|
-
yield* eatMatchTrivia();
|
|
52
|
-
yield eatMatch(m`bindingMatcher: <BindingMatcher />`);
|
|
53
|
-
yield* eatMatchTrivia();
|
|
54
|
-
yield eat(m`nodeMatcher: <__NodeMatcher />`);
|
|
70
|
+
yield eat(m`sigilToken*: <* 'null' />`);
|
|
55
71
|
}
|
|
72
|
+
|
|
56
73
|
*ReferenceMatcher() {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
yield eat(m`
|
|
60
|
-
} else {
|
|
61
|
-
yield eat(m`type: null`);
|
|
62
|
-
yield eat(m`name$: :CSTML: <Identifier />`);
|
|
74
|
+
let type;
|
|
75
|
+
if ((type = yield match(re`/\.\.|[.#@]/`))) {
|
|
76
|
+
yield eat(m`type*: <* ${buildString(printSource(type))} />`);
|
|
63
77
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
78
|
+
|
|
79
|
+
if (!type || printSource(type) === '#') {
|
|
80
|
+
if (type) {
|
|
81
|
+
yield eatMatch(m`name$: :CSTML: <Identifier />`);
|
|
82
|
+
} else {
|
|
83
|
+
yield eat(m`name$: :CSTML: <Identifier />`);
|
|
84
|
+
}
|
|
67
85
|
} else {
|
|
68
|
-
yield
|
|
86
|
+
yield eat(m`name$: null`);
|
|
69
87
|
}
|
|
88
|
+
|
|
70
89
|
yield* eatMatchTrivia();
|
|
71
|
-
yield eatMatch(m`flags
|
|
90
|
+
yield eatMatch(m`flags*: :CSTML: <ReferenceFlags />`);
|
|
72
91
|
yield* eatMatchTrivia();
|
|
73
|
-
yield eat(m`sigilToken
|
|
92
|
+
yield eat(m`sigilToken*: <* ':' />`);
|
|
74
93
|
}
|
|
94
|
+
|
|
75
95
|
*BindingMatcher() {
|
|
76
|
-
yield eat(m`
|
|
77
|
-
yield* eatMatchTrivia();
|
|
78
|
-
yield eat(m`languagePath: :CSTML: <IdentifierPath />`);
|
|
96
|
+
yield eat(m`bindingMatcher*: :CSTML: <BindingTag />`);
|
|
79
97
|
yield* eatMatchTrivia();
|
|
80
|
-
yield eat(m`
|
|
98
|
+
yield eat(m`valueMatcher+$: <_ />`);
|
|
81
99
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
100
|
+
|
|
101
|
+
*TreeNodeMatcher() {
|
|
102
|
+
if (yield eatMatch(m`children[]*: <PropertyMatcher /[a-zA-Z.#@\g]/ />`)) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
let open = yield eat(m`open*: <TreeNodeMatcherOpen />`);
|
|
107
|
+
|
|
108
|
+
const { selfClosing } = open.node.value.attributes;
|
|
109
|
+
|
|
85
110
|
if (selfClosing) {
|
|
86
|
-
yield eat(m`
|
|
87
|
-
yield eat(m`close: null`);
|
|
111
|
+
yield eat(m`close*: null`);
|
|
88
112
|
} else {
|
|
89
113
|
// TODO
|
|
90
114
|
yield* eatMatchTrivia();
|
|
91
|
-
|
|
115
|
+
|
|
116
|
+
yield eat(m`close*: <TreeNodeMatcherClose />`);
|
|
92
117
|
}
|
|
93
118
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
119
|
+
|
|
120
|
+
*TreeNodeMatcherOpen() {
|
|
121
|
+
if (yield match(re`/['"/]/`)) {
|
|
122
|
+
yield eat(m`flags*: :CSTML: <NodeFlags />`, o({ token: true }));
|
|
123
|
+
yield eat(m`literalValue*: <_StringMatcher />`);
|
|
124
|
+
|
|
125
|
+
yield defineAttribute('selfClosing', true);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
yield eat(m`openToken*: <* '<' />`);
|
|
130
|
+
yield eat(m`flags*: :CSTML: <NodeFlags />`);
|
|
131
|
+
let type = yield eatMatch(m`type*: <* /__?/ />`);
|
|
132
|
+
|
|
133
|
+
let isMultiFragment = type && printSource(type.node) === '__';
|
|
134
|
+
|
|
135
|
+
if (
|
|
136
|
+
!isMultiFragment &&
|
|
137
|
+
(yield eatMatch(m`name$: :CSTML: <Identifier /[a-zA-Z\u{80}-\u{10ffff}\u0060\g]/ />`))
|
|
138
|
+
) {
|
|
98
139
|
// continue
|
|
99
|
-
} else if (!flags.get('fragmentToken')) {
|
|
100
|
-
if (yield eatMatch(m`type$: <*Punctuator '?' />`)) {
|
|
101
|
-
// continue
|
|
102
|
-
} else {
|
|
103
|
-
yield fail();
|
|
104
|
-
}
|
|
105
140
|
}
|
|
141
|
+
|
|
106
142
|
let sp = yield* eatMatchTrivia();
|
|
107
|
-
|
|
143
|
+
|
|
144
|
+
if (sp && !(yield match(re`/\/$/`)) && (yield eatMatch(m`literalValue$: <_StringMatcher />`))) {
|
|
108
145
|
sp = yield* eatMatchTrivia();
|
|
109
146
|
}
|
|
147
|
+
|
|
110
148
|
while (sp && (yield match('{'))) {
|
|
111
|
-
yield eat(m`attributes
|
|
149
|
+
yield eat(m`attributes$: :JSON: <Object />`);
|
|
112
150
|
sp = yield* eatMatchTrivia();
|
|
113
151
|
}
|
|
114
|
-
|
|
115
|
-
yield
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
yield eat(m`
|
|
119
|
-
|
|
120
|
-
|
|
152
|
+
|
|
153
|
+
let sc = yield eatMatch(m`selfClosingToken*: <* '/' />`);
|
|
154
|
+
|
|
155
|
+
yield defineAttribute('selfClosing', !!sc);
|
|
156
|
+
yield eat(m`closeToken*: <* '>' />`);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
*TreeNodeMatcherClose() {
|
|
160
|
+
yield eat(m`openToken*: <* '</' />`);
|
|
161
|
+
yield eat(m`closeToken*: <* '>' />`);
|
|
162
|
+
}
|
|
163
|
+
|
|
121
164
|
*StringMatcher() {
|
|
122
165
|
if (yield match(re`/['"]/`)) {
|
|
123
|
-
yield eat(m
|
|
166
|
+
yield eat(m`:JSON: <String />`);
|
|
124
167
|
} else {
|
|
125
|
-
yield eat(m
|
|
168
|
+
yield eat(m`:Regex: <Pattern />`);
|
|
126
169
|
}
|
|
127
170
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
*Regex() {
|
|
132
|
-
yield eat(m`:Regex: <_Pattern />`);
|
|
133
|
-
}
|
|
134
|
-
List() {}
|
|
135
|
-
Punctuator() {}
|
|
136
|
-
Any() {}
|
|
137
|
-
};
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export default { canonicalURL, dependencies, grammar, defaultMatcher };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bablr/language-en-spamex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "A BABLR language for SPAM Expressions",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=12.0.0"
|
|
@@ -15,26 +15,20 @@
|
|
|
15
15
|
],
|
|
16
16
|
"sideEffects": false,
|
|
17
17
|
"scripts": {
|
|
18
|
-
"build": "macrome build",
|
|
19
|
-
"watch": "macrome watch",
|
|
20
|
-
"clean": "macrome clean",
|
|
21
18
|
"test": "mocha"
|
|
22
19
|
},
|
|
23
20
|
"dependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"@bablr/agast-helpers": "0.
|
|
26
|
-
"@bablr/
|
|
27
|
-
"@bablr/
|
|
28
|
-
"@bablr/
|
|
29
|
-
"@bablr/language-en-
|
|
30
|
-
"@bablr/language-en-cstml": "0.
|
|
31
|
-
"@bablr/language-en-
|
|
32
|
-
"@bablr/language-en-regex-vm-pattern": "0.10.0"
|
|
21
|
+
"@bablr/agast-helpers": "0.10.0",
|
|
22
|
+
"@bablr/agast-vm-helpers": "0.10.0",
|
|
23
|
+
"@bablr/boot": "0.11.0",
|
|
24
|
+
"@bablr/helpers": "0.25.0",
|
|
25
|
+
"@bablr/language-en-blank-space": "0.10.0",
|
|
26
|
+
"@bablr/language-en-cstml": "0.12.0",
|
|
27
|
+
"@bablr/language-en-cstml-json": "0.5.0",
|
|
28
|
+
"@bablr/language-en-regex-vm-pattern": "0.12.0"
|
|
33
29
|
},
|
|
34
30
|
"devDependencies": {
|
|
35
31
|
"@bablr/eslint-config-base": "github:bablr-lang/eslint-config-base#c97bfa4b3663f8378e9b3e42bb5a41e685406cf9",
|
|
36
|
-
"@bablr/macrome": "^0.1.3",
|
|
37
|
-
"@bablr/macrome-generator-bablr": "^0.3.2",
|
|
38
32
|
"enhanced-resolve": "^5.12.0",
|
|
39
33
|
"eslint": "^7.32.0",
|
|
40
34
|
"eslint-import-resolver-enhanced-resolve": "^1.0.5",
|
|
@@ -49,7 +43,10 @@
|
|
|
49
43
|
"english",
|
|
50
44
|
"spamex"
|
|
51
45
|
],
|
|
52
|
-
"repository":
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "git+ssh://git@github.com/bablr-lang/language-en-spamex.git"
|
|
49
|
+
},
|
|
53
50
|
"homepage": "https://github.com/bablr-lang/language-en-spamex",
|
|
54
51
|
"author": "Conrad Buck <conartist6@gmail.com>",
|
|
55
52
|
"license": "MIT"
|
package/lib/grammar.macro.js
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { re, spam as m } from '@bablr/boot';
|
|
2
|
-
import { Node, CoveredBy, InjectFrom, Literal } from '@bablr/helpers/decorators';
|
|
3
|
-
import * as productions from '@bablr/helpers/productions';
|
|
4
|
-
import { eat, eatMatch, match, fail } from '@bablr/helpers/grammar';
|
|
5
|
-
import * as Regex from '@bablr/language-en-regex-vm-pattern';
|
|
6
|
-
import * as CSTML from '@bablr/language-en-cstml';
|
|
7
|
-
import * as JSON from '@bablr/language-en-cstml-json';
|
|
8
|
-
import * as Space from '@bablr/language-en-blank-space';
|
|
9
|
-
|
|
10
|
-
export const canonicalURL = 'https://bablr.org/languages/core/en/spamex';
|
|
11
|
-
|
|
12
|
-
export const dependencies = { Regex, CSTML, JSON, Space };
|
|
13
|
-
|
|
14
|
-
const { eatMatchTrivia } = CSTML;
|
|
15
|
-
|
|
16
|
-
export const grammar = class SpamexGrammar {
|
|
17
|
-
@CoveredBy('Expression')
|
|
18
|
-
*Matcher() {
|
|
19
|
-
yield eat(m`<_Any />`, [m`<PropertyMatcher /[a-zA-Z.@#<]/ />`, m`<__StringMatcher /[/'"]/ />`]);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
*NodeMatcher() {
|
|
23
|
-
yield eat(m`<_Any />`, [
|
|
24
|
-
m`<GapNodeMatcher '<//>' />`,
|
|
25
|
-
m`<BasicNodeMatcher '<' />`,
|
|
26
|
-
m`<ArrayNodeMatcher '[' />`,
|
|
27
|
-
m`<NullNodeMatcher 'null' />`,
|
|
28
|
-
]);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@Node
|
|
32
|
-
@CoveredBy('NodeMatcher')
|
|
33
|
-
*GapNodeMatcher() {
|
|
34
|
-
yield eat(m`sigilToken: <*Punctuator '<//>' />`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@Node
|
|
38
|
-
@CoveredBy('NodeMatcher')
|
|
39
|
-
*ArrayNodeMatcher() {
|
|
40
|
-
yield eat(m`sigilToken: <*Punctuator '[]' />`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
@Node
|
|
44
|
-
@CoveredBy('NodeMatcher')
|
|
45
|
-
*NullNodeMatcher() {
|
|
46
|
-
yield eat(m`sigilToken: <*Punctuator 'null' />`);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@Node
|
|
50
|
-
@CoveredBy('Matcher')
|
|
51
|
-
*PropertyMatcher() {
|
|
52
|
-
yield eatMatch(m`refMatcher: <ReferenceMatcher />`);
|
|
53
|
-
yield* eatMatchTrivia();
|
|
54
|
-
yield eatMatch(m`bindingMatcher: <BindingMatcher />`);
|
|
55
|
-
yield* eatMatchTrivia();
|
|
56
|
-
yield eat(m`nodeMatcher: <__NodeMatcher />`);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@Node
|
|
60
|
-
*ReferenceMatcher() {
|
|
61
|
-
if (yield match(re`/[.#@]/`)) {
|
|
62
|
-
yield eat(m`type: <*Punctuator /[.#@]/ />`);
|
|
63
|
-
yield eat(m`name$: null`);
|
|
64
|
-
} else {
|
|
65
|
-
yield eat(m`type: null`);
|
|
66
|
-
yield eat(m`name$: :CSTML: <Identifier />`);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (yield eatMatch(m`openIndexToken: <*Punctuator '[' { balanced: ']' } />`)) {
|
|
70
|
-
yield* eatMatchTrivia();
|
|
71
|
-
yield eatMatch(m`closeIndexToken: <*Punctuator ']' { balancer: true } />`);
|
|
72
|
-
} else {
|
|
73
|
-
yield eatMatch(m`closeIndexToken: null`);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
yield* eatMatchTrivia();
|
|
77
|
-
yield eatMatch(m`flags: :CSTML: <ReferenceFlags />`);
|
|
78
|
-
yield* eatMatchTrivia();
|
|
79
|
-
yield eat(m`sigilToken: <*Punctuator ':' />`);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
@Node
|
|
83
|
-
*BindingMatcher() {
|
|
84
|
-
yield eat(m`sigilToken: <*Punctuator ':' />`);
|
|
85
|
-
yield* eatMatchTrivia();
|
|
86
|
-
yield eat(m`languagePath: :CSTML: <IdentifierPath />`);
|
|
87
|
-
yield* eatMatchTrivia();
|
|
88
|
-
yield eat(m`sigilToken: <*Punctuator ':' />`);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
@Node
|
|
92
|
-
@CoveredBy('NodeMatcher')
|
|
93
|
-
*BasicNodeMatcher() {
|
|
94
|
-
let open = yield eat(m`open: <OpenNodeMatcher />`);
|
|
95
|
-
|
|
96
|
-
const selfClosing = open.get('selfClosingTagToken');
|
|
97
|
-
|
|
98
|
-
if (selfClosing) {
|
|
99
|
-
yield eat(m`children[]$: []`);
|
|
100
|
-
yield eat(m`close: null`);
|
|
101
|
-
} else {
|
|
102
|
-
// TODO
|
|
103
|
-
yield* eatMatchTrivia();
|
|
104
|
-
|
|
105
|
-
yield eat(m`close: <CloseNodeMatcher />`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
@Node
|
|
110
|
-
*OpenNodeMatcher() {
|
|
111
|
-
yield eat(m`openToken: <*Punctuator '<' { balancedSpan: 'Tag', balanced: '>' } />`);
|
|
112
|
-
let flags = yield eat(m`flags: :CSTML: <NodeFlags />`);
|
|
113
|
-
|
|
114
|
-
if (yield eatMatch(m`type$: :CSTML: <Identifier /[a-zA-Z\u{80}-\u{10ffff}\u0060\g]/ />`)) {
|
|
115
|
-
// continue
|
|
116
|
-
} else if (!flags.get('fragmentToken')) {
|
|
117
|
-
if (yield eatMatch(m`type$: <*Punctuator '?' />`)) {
|
|
118
|
-
// continue
|
|
119
|
-
} else {
|
|
120
|
-
yield fail();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
let sp = yield* eatMatchTrivia();
|
|
125
|
-
|
|
126
|
-
if (
|
|
127
|
-
sp &&
|
|
128
|
-
!(yield match(re`/\/$/`)) &&
|
|
129
|
-
(yield eatMatch(m`intrinsicValue$: <__StringMatcher />`))
|
|
130
|
-
) {
|
|
131
|
-
sp = yield* eatMatchTrivia();
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
while (sp && (yield match('{'))) {
|
|
135
|
-
yield eat(m`attributes: :JSON: <Object />`);
|
|
136
|
-
sp = yield* eatMatchTrivia();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
yield eatMatch(m`selfClosingTagToken: <*Punctuator '/' />`);
|
|
140
|
-
yield eat(m`closeToken: <*Punctuator '>' { balancer: true } />`);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
@Node
|
|
144
|
-
@CoveredBy('Matcher')
|
|
145
|
-
*CloseNodeMatcher() {
|
|
146
|
-
yield eat(m`openToken: <*Punctuator '</' { balanced: '>' } />`);
|
|
147
|
-
yield eat(m`closeToken: <*Punctuator '>' { balancer: true } />`);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
@CoveredBy('Matcher')
|
|
151
|
-
@CoveredBy('Expression')
|
|
152
|
-
*StringMatcher() {
|
|
153
|
-
if (yield match(re`/['"]/`)) {
|
|
154
|
-
yield eat(m`<String />`);
|
|
155
|
-
} else {
|
|
156
|
-
yield eat(m`<Regex />`);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
@CoveredBy('StringMatcher')
|
|
161
|
-
@CoveredBy('Matcher')
|
|
162
|
-
@CoveredBy('Expression')
|
|
163
|
-
@Node
|
|
164
|
-
*String() {
|
|
165
|
-
yield eat(m`:JSON: <_String />`);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
@CoveredBy('StringMatcher')
|
|
169
|
-
@CoveredBy('Matcher')
|
|
170
|
-
@CoveredBy('Expression')
|
|
171
|
-
@Node
|
|
172
|
-
*Regex() {
|
|
173
|
-
yield eat(m`:Regex: <_Pattern />`);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
@InjectFrom(productions)
|
|
177
|
-
List() {}
|
|
178
|
-
|
|
179
|
-
@Literal
|
|
180
|
-
@Node
|
|
181
|
-
@InjectFrom(productions)
|
|
182
|
-
Punctuator() {}
|
|
183
|
-
|
|
184
|
-
@InjectFrom(productions)
|
|
185
|
-
Any() {}
|
|
186
|
-
};
|