@bablr/boot 0.6.0 → 0.6.1

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/index.js CHANGED
@@ -220,7 +220,7 @@ const getAgASTValue = (language, miniNode) => {
220
220
  const str = buildTag(cstml, 'String');
221
221
  const num = buildTag(cstml, 'Integer');
222
222
  const cst = buildTag(cstml, 'Node');
223
- const spam = buildTag(spamex, 'Pattern');
223
+ const spam = buildTag(spamex, 'Matcher');
224
224
  const re = buildTag(regex, 'Pattern');
225
225
  const i = buildTag(instruction, 'Call');
226
226
 
@@ -66,9 +66,12 @@ const covers = buildCovers({
66
66
  'NullTag',
67
67
  'GapTag',
68
68
  'Node',
69
+ 'Fragment',
69
70
  'IdentifierPath',
70
71
  'OpenNodeTag',
71
72
  'CloseNodeTag',
73
+ 'OpenFragmentTag',
74
+ 'CloseFragmentTag',
72
75
  'Tag',
73
76
  'Number',
74
77
  'Digit',
@@ -92,7 +95,7 @@ const grammar = class CSTMLMiniparserGrammar {
92
95
  Document(p) {
93
96
  p.eatProduction('DoctypeTag', { path: 'doctype' });
94
97
  p.eatMatchTrivia(_);
95
- p.eatProduction('Node', { path: 'tree' });
98
+ p.eatProduction('Fragment', { path: 'tree' });
96
99
  }
97
100
 
98
101
  // @Node
@@ -163,6 +166,25 @@ const grammar = class CSTMLMiniparserGrammar {
163
166
  }
164
167
  }
165
168
 
169
+ // @Node
170
+ Fragment(p) {
171
+ let open = p.eatProduction('OpenFragmentTag', { path: 'open' });
172
+
173
+ p.eatMatchTrivia(_);
174
+
175
+ if (open.properties.flags?.token) {
176
+ p.eatProduction('NodeChild', { path: 'children[]' }, { token: true });
177
+ p.eatMatchTrivia(_);
178
+ }
179
+
180
+ while (!(p.match('</') || p.done)) {
181
+ p.eatProduction('NodeChild', { path: 'children[]' });
182
+ p.eatMatchTrivia(_);
183
+ }
184
+
185
+ p.eatProduction('CloseFragmentTag', { path: 'close' });
186
+ }
187
+
166
188
  // @Node
167
189
  Property(p) {
168
190
  p.eatProduction('ReferenceTag', { path: 'reference' });
@@ -237,6 +259,27 @@ const grammar = class CSTMLMiniparserGrammar {
237
259
  p.eat('>', PN, { path: 'closeToken', endSpan: 'Tag', balancer: true });
238
260
  }
239
261
 
262
+ // @Node
263
+ OpenFragmentTag(p) {
264
+ p.eat('<', PN, { path: 'openToken', startSpan: 'Tag', balanced: '>' });
265
+
266
+ let flags = null;
267
+ if (!p.atExpression) {
268
+ flags = p.eatProduction('Flags', { path: 'flags' });
269
+ }
270
+
271
+ if (p.done) {
272
+ p.eat('>', PN, { path: 'closeToken', endSpan: 'Tag', balancer: true });
273
+ return;
274
+ }
275
+ }
276
+
277
+ // @Node
278
+ CloseFragmentTag(p) {
279
+ p.eat('</', PN, { path: 'openToken', startSpan: 'Tag', balanced: '>' });
280
+ p.eat('>', PN, { path: 'closeToken', endSpan: 'Tag', balancer: true });
281
+ }
282
+
240
283
  // @Fragment
241
284
  Attributes(p) {
242
285
  let sp = true;
@@ -288,7 +331,7 @@ const grammar = class CSTMLMiniparserGrammar {
288
331
  }
289
332
 
290
333
  TagType(p) {
291
- if (p.match(/[a-zA-Z\.]+:/y)) {
334
+ if (p.match(/['"]|[a-zA-Z\.]+:/y)) {
292
335
  p.eatProduction('LanguageReference', { path: 'language' });
293
336
  p.eat(':', PN, { path: 'namespaceSeparatorToken' });
294
337
  p.eatProduction('Identifier', { path: 'type' });
@@ -14,18 +14,22 @@ const canonicalURL = 'https://bablr.org/languages/core/en/spamex';
14
14
  const dependencies = { CSTML, Regex };
15
15
 
16
16
  const covers = buildCovers({
17
- [sym.node]: ['Attribute', 'Identifier', 'Pattern', 'Matcher', 'Literal', 'CSTML:Flags'],
17
+ [sym.node]: [
18
+ 'Attribute',
19
+ 'Identifier',
20
+ 'Matcher',
21
+ 'OpenNodeMatcher',
22
+ 'CloseNodeMatcher',
23
+ 'Literal',
24
+ 'CSTML:Flags',
25
+ ],
18
26
  Attribute: ['MappingAttribute', 'BooleanAttribute'],
19
27
  AttributeValue: ['CSTML:String', 'CSTML:Number'],
20
- Matcher: ['NodeMatcher', 'OpenNodeMatcher', 'CloseNodeMatcher', 'StringMatcher'],
28
+ Matcher: ['NodeMatcher', 'StringMatcher'],
21
29
  StringMatcher: ['CSTML:String', 'Regex:Pattern'],
22
30
  });
23
31
 
24
32
  const grammar = class SpamexMiniparserGrammar {
25
- Pattern(p) {
26
- p.eatProduction('Matcher', { path: 'matcher' });
27
- }
28
-
29
33
  // @Cover
30
34
  Matcher(p) {
31
35
  if (p.match(/<[^!/]/y)) {
@@ -67,10 +71,8 @@ const grammar = class SpamexMiniparserGrammar {
67
71
  p.eatProduction('CSTML:Flags', { path: 'flags' });
68
72
  }
69
73
 
70
- if (p.match(/[a-zA-Z]+:/y)) {
71
- p.eat(/[a-zA-Z]+/y, ID, { path: 'language' });
72
- p.eat(':', PN, { path: 'namespaceSeparatorToken' });
73
- p.eat(/[a-zA-Z]+/y, ID, { path: 'type' });
74
+ if (p.match(/['"]|[a-zA-Z]+:/y)) {
75
+ p.eatProduction('CSTML:TagType', { path: 'type' });
74
76
  } else if (p.match('?')) {
75
77
  p.eat('?', PN, { path: 'type' });
76
78
  } else if (p.match(' ')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bablr/boot",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Compile-time tools for bootstrapping BABLR VM",
5
5
  "engines": {
6
6
  "node": ">=12.0.0"