@bablr/language-en-bablr-vm-instruction 0.7.0 → 0.9.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 +24 -15
- package/lib/grammar.macro.js +30 -17
- package/package.json +11 -11
package/lib/grammar.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/* @macrome
|
|
2
2
|
* @generatedby @bablr/macrome-generator-bablr
|
|
3
|
-
* @generatedfrom ./grammar.macro.js#
|
|
3
|
+
* @generatedfrom ./grammar.macro.js#d59a1c2024ebd27e109c529425646b0eb4863552
|
|
4
4
|
* This file is autogenerated. Please do not edit it directly.
|
|
5
5
|
* When editing run `npx macrome watch` then change the file this is generated from.
|
|
6
6
|
*/
|
|
7
7
|
import _applyDecs from "@babel/runtime/helpers/applyDecs2305";
|
|
8
8
|
let _initProto, _StringDecs, _PunctuatorDecs, _KeywordDecs, _AnyDecs;
|
|
9
9
|
import { re, spam as m } from '@bablr/boot';
|
|
10
|
-
import { extendLanguage, o, eat, match } from '@bablr/helpers/grammar';
|
|
10
|
+
import { extendLanguage, o, eat, match, eatMatch } from '@bablr/helpers/grammar';
|
|
11
11
|
import { CoveredBy, Node, InjectFrom } from '@bablr/helpers/decorators';
|
|
12
12
|
import * as Space from '@bablr/language-en-blank-space';
|
|
13
13
|
import * as CSTML from '@bablr/language-en-cstml';
|
|
@@ -19,7 +19,7 @@ import { buildString } from '@bablr/helpers/builders';
|
|
|
19
19
|
export const canonicalURL = 'https://bablr.org/languages/core/en/bablr-vm-instruction';
|
|
20
20
|
export function* eatMatchTrivia() {
|
|
21
21
|
if (yield match(re`/[ \t\n]/`)) {
|
|
22
|
-
return yield eat(m`#:
|
|
22
|
+
return yield eat(m`#: :Space: <*Space />`);
|
|
23
23
|
}
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
@@ -30,8 +30,8 @@ const IJSON = extendLanguage(JSON, {
|
|
|
30
30
|
},
|
|
31
31
|
grammar: class IJSON extends JSON.grammar {
|
|
32
32
|
*Expression(props) {
|
|
33
|
-
if (yield match(re`/(m|re|t)['"\u0060]/`)) {
|
|
34
|
-
yield eat(m
|
|
33
|
+
if (yield match(re`/(m|re|t|i)['"\u0060]/`)) {
|
|
34
|
+
yield eat(m`:Instruction: <_Expression />`);
|
|
35
35
|
} else {
|
|
36
36
|
yield* super.Expression(props);
|
|
37
37
|
}
|
|
@@ -48,7 +48,7 @@ export const dependencies = {
|
|
|
48
48
|
};
|
|
49
49
|
export const grammar = class BABLRVMInstructionGrammar {
|
|
50
50
|
static {
|
|
51
|
-
[_initProto] = _applyDecs(this, [[Node, 2, "Call"], [Node, 2, "SpamexString"], [Node, 2, "CSTMLString"], [Node, 2, "RegexString"], [_StringDecs, 2, "String"], [Node, 2, "Identifier"], [_PunctuatorDecs, 2, "Punctuator"], [_KeywordDecs, 2, "Keyword"], [_AnyDecs, 2, "Any"]], []).e;
|
|
51
|
+
[_initProto] = _applyDecs(this, [[Node, 2, "Call"], [Node, 2, "SpamexString"], [Node, 2, "CSTMLString"], [Node, 2, "RegexString"], [Node, 2, "InstructionString"], [_StringDecs, 2, "String"], [Node, 2, "Identifier"], [_PunctuatorDecs, 2, "Punctuator"], [_KeywordDecs, 2, "Keyword"], [_AnyDecs, 2, "Any"]], []).e;
|
|
52
52
|
}
|
|
53
53
|
constructor() {
|
|
54
54
|
_initProto(this);
|
|
@@ -60,14 +60,16 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
60
60
|
let sp = yield* eatMatchTrivia();
|
|
61
61
|
let first = true;
|
|
62
62
|
while ((first || sp) && (yield match(re`/./s`))) {
|
|
63
|
-
yield eat(m`values[]$: <
|
|
64
|
-
|
|
63
|
+
yield eat(m`values[]$: <__Expression />`);
|
|
64
|
+
yield* eatMatchTrivia();
|
|
65
|
+
sp = yield eatMatch(m`separatorTokens[]: <*Punctuator ',' />`);
|
|
66
|
+
yield* eatMatchTrivia();
|
|
65
67
|
first = false;
|
|
66
68
|
}
|
|
67
69
|
yield eat(m`closeToken: <*Punctuator ')' { balancer: true } />`);
|
|
68
70
|
}
|
|
69
71
|
*Expression() {
|
|
70
|
-
yield eat(m`<
|
|
72
|
+
yield eat(m`<_Any />`, [m`:IJSON: <Array '[' />`, m`:IJSON: <Object '{' />`, m`:JSON: <Boolean /true|false/ />`, m`:JSON: <Null 'null' />`, m`:JSON: <Number /[\d]/ />`, m`:JSON: <Infinity /[+-]?Infinity/ />`, m`<SpamexString /m["'\u0060]/ />`, m`<CSTMLString /t["'\u0060]/ />`, m`<RegexString /re["'\u0060]/ />`, m`<InstructionString /i["'\u0060]/ />`, m`:JSON: <String /["']/ />`]);
|
|
71
73
|
}
|
|
72
74
|
*SpamexString({
|
|
73
75
|
ctx
|
|
@@ -75,7 +77,7 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
75
77
|
yield eat(m`sigilToken: <*Keyword 'm' />`);
|
|
76
78
|
let quot = buildString(ctx.sourceTextFor(yield match(re`/['"\u0060]/`)));
|
|
77
79
|
yield eat(m`openToken: <*Punctuator ${quot} { balanced: ${quot} } />`);
|
|
78
|
-
yield eat(m`content:
|
|
80
|
+
yield eat(m`content: :Spamex: <__Matcher />`);
|
|
79
81
|
yield eat(m`closeToken: <*Punctuator ${quot} { balancer: true } />`);
|
|
80
82
|
}
|
|
81
83
|
*CSTMLString({
|
|
@@ -84,7 +86,7 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
84
86
|
yield eat(m`sigilToken: <*Keyword 't' />`);
|
|
85
87
|
let quot = buildString(ctx.sourceTextFor(yield match(re`/['"\u0060]/`)));
|
|
86
88
|
yield eat(m`openToken: <*Punctuator ${quot} { balanced: ${quot} } />`);
|
|
87
|
-
yield eat(m`content:
|
|
89
|
+
yield eat(m`content: :CSTML: <__Tag />`);
|
|
88
90
|
yield eat(m`closeToken: <*Punctuator ${quot} { balancer: true } />`);
|
|
89
91
|
}
|
|
90
92
|
*RegexString({
|
|
@@ -93,13 +95,20 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
93
95
|
yield eat(m`sigilToken: <*Keyword 're' />`);
|
|
94
96
|
let quot = buildString(ctx.sourceTextFor(yield match(re`/['"\u0060]/`)));
|
|
95
97
|
yield eat(m`openToken: <*Punctuator ${quot} { balanced: ${quot} } />`);
|
|
96
|
-
yield eat(m`content:
|
|
98
|
+
yield eat(m`content: :Regex: <Pattern />`);
|
|
99
|
+
yield eat(m`closeToken: <*Punctuator ${quot} { balancer: true } />`);
|
|
100
|
+
}
|
|
101
|
+
*InstructionString({
|
|
102
|
+
ctx
|
|
103
|
+
}) {
|
|
104
|
+
yield eat(m`sigilToken: <*Keyword 'i' />`);
|
|
105
|
+
let quot = buildString(ctx.sourceTextFor(yield match(re`/['"\u0060]/`)));
|
|
106
|
+
yield eat(m`openToken: <*Punctuator ${quot} { balanced: ${quot} } />`);
|
|
107
|
+
yield eat(m`content: <Call />`);
|
|
97
108
|
yield eat(m`closeToken: <*Punctuator ${quot} { balancer: true } />`);
|
|
98
109
|
}
|
|
99
110
|
*String() {
|
|
100
|
-
yield eat(m
|
|
101
|
-
suppressNode: true
|
|
102
|
-
}));
|
|
111
|
+
yield eat(m`:IJSON: <_String />`);
|
|
103
112
|
}
|
|
104
113
|
*Identifier() {
|
|
105
114
|
yield eat(re`/[a-zA-Z]+/`);
|
package/lib/grammar.macro.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { re, spam as m } from '@bablr/boot';
|
|
2
|
-
import { extendLanguage, o, eat, match } from '@bablr/helpers/grammar';
|
|
2
|
+
import { extendLanguage, o, eat, match, eatMatch } from '@bablr/helpers/grammar';
|
|
3
3
|
import { CoveredBy, Node, InjectFrom } from '@bablr/helpers/decorators';
|
|
4
4
|
import * as Space from '@bablr/language-en-blank-space';
|
|
5
5
|
import * as CSTML from '@bablr/language-en-cstml';
|
|
@@ -13,7 +13,7 @@ export const canonicalURL = 'https://bablr.org/languages/core/en/bablr-vm-instru
|
|
|
13
13
|
|
|
14
14
|
export function* eatMatchTrivia() {
|
|
15
15
|
if (yield match(re`/[ \t\n]/`)) {
|
|
16
|
-
return yield eat(m`#:
|
|
16
|
+
return yield eat(m`#: :Space: <*Space />`);
|
|
17
17
|
}
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
@@ -25,8 +25,8 @@ const IJSON = extendLanguage(JSON, {
|
|
|
25
25
|
},
|
|
26
26
|
grammar: class IJSON extends JSON.grammar {
|
|
27
27
|
*Expression(props) {
|
|
28
|
-
if (yield match(re`/(m|re|t)['"\u0060]/`)) {
|
|
29
|
-
yield eat(m
|
|
28
|
+
if (yield match(re`/(m|re|t|i)['"\u0060]/`)) {
|
|
29
|
+
yield eat(m`:Instruction: <_Expression />`);
|
|
30
30
|
} else {
|
|
31
31
|
yield* super.Expression(props);
|
|
32
32
|
}
|
|
@@ -46,24 +46,28 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
46
46
|
let sp = yield* eatMatchTrivia();
|
|
47
47
|
let first = true;
|
|
48
48
|
while ((first || sp) && (yield match(re`/./s`))) {
|
|
49
|
-
yield eat(m`values[]$: <
|
|
50
|
-
|
|
49
|
+
yield eat(m`values[]$: <__Expression />`);
|
|
50
|
+
yield* eatMatchTrivia();
|
|
51
|
+
sp = yield eatMatch(m`separatorTokens[]: <*Punctuator ',' />`);
|
|
52
|
+
yield* eatMatchTrivia();
|
|
51
53
|
first = false;
|
|
52
54
|
}
|
|
53
55
|
yield eat(m`closeToken: <*Punctuator ')' { balancer: true } />`);
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
*Expression() {
|
|
57
|
-
yield eat(m`<
|
|
58
|
-
m
|
|
59
|
-
m
|
|
60
|
-
m
|
|
61
|
-
m
|
|
62
|
-
m
|
|
59
|
+
yield eat(m`<_Any />`, [
|
|
60
|
+
m`:IJSON: <Array '[' />`,
|
|
61
|
+
m`:IJSON: <Object '{' />`,
|
|
62
|
+
m`:JSON: <Boolean /true|false/ />`,
|
|
63
|
+
m`:JSON: <Null 'null' />`,
|
|
64
|
+
m`:JSON: <Number /[\d]/ />`,
|
|
65
|
+
m`:JSON: <Infinity /[+-]?Infinity/ />`,
|
|
63
66
|
m`<SpamexString /m["'\u0060]/ />`,
|
|
64
67
|
m`<CSTMLString /t["'\u0060]/ />`,
|
|
65
68
|
m`<RegexString /re["'\u0060]/ />`,
|
|
66
|
-
m`<
|
|
69
|
+
m`<InstructionString /i["'\u0060]/ />`,
|
|
70
|
+
m`:JSON: <String /["']/ />`,
|
|
67
71
|
]);
|
|
68
72
|
}
|
|
69
73
|
|
|
@@ -72,7 +76,7 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
72
76
|
yield eat(m`sigilToken: <*Keyword 'm' />`);
|
|
73
77
|
let quot = buildString(ctx.sourceTextFor(yield match(re`/['"\u0060]/`)));
|
|
74
78
|
yield eat(m`openToken: <*Punctuator ${quot} { balanced: ${quot} } />`);
|
|
75
|
-
yield eat(m`content:
|
|
79
|
+
yield eat(m`content: :Spamex: <__Matcher />`);
|
|
76
80
|
yield eat(m`closeToken: <*Punctuator ${quot} { balancer: true } />`);
|
|
77
81
|
}
|
|
78
82
|
|
|
@@ -81,7 +85,7 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
81
85
|
yield eat(m`sigilToken: <*Keyword 't' />`);
|
|
82
86
|
let quot = buildString(ctx.sourceTextFor(yield match(re`/['"\u0060]/`)));
|
|
83
87
|
yield eat(m`openToken: <*Punctuator ${quot} { balanced: ${quot} } />`);
|
|
84
|
-
yield eat(m`content:
|
|
88
|
+
yield eat(m`content: :CSTML: <__Tag />`);
|
|
85
89
|
yield eat(m`closeToken: <*Punctuator ${quot} { balancer: true } />`);
|
|
86
90
|
}
|
|
87
91
|
|
|
@@ -90,7 +94,16 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
90
94
|
yield eat(m`sigilToken: <*Keyword 're' />`);
|
|
91
95
|
let quot = buildString(ctx.sourceTextFor(yield match(re`/['"\u0060]/`)));
|
|
92
96
|
yield eat(m`openToken: <*Punctuator ${quot} { balanced: ${quot} } />`);
|
|
93
|
-
yield eat(m`content:
|
|
97
|
+
yield eat(m`content: :Regex: <Pattern />`);
|
|
98
|
+
yield eat(m`closeToken: <*Punctuator ${quot} { balancer: true } />`);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@Node
|
|
102
|
+
*InstructionString({ ctx }) {
|
|
103
|
+
yield eat(m`sigilToken: <*Keyword 'i' />`);
|
|
104
|
+
let quot = buildString(ctx.sourceTextFor(yield match(re`/['"\u0060]/`)));
|
|
105
|
+
yield eat(m`openToken: <*Punctuator ${quot} { balanced: ${quot} } />`);
|
|
106
|
+
yield eat(m`content: <Call />`);
|
|
94
107
|
yield eat(m`closeToken: <*Punctuator ${quot} { balancer: true } />`);
|
|
95
108
|
}
|
|
96
109
|
|
|
@@ -98,7 +111,7 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
98
111
|
@CoveredBy('Expression')
|
|
99
112
|
@Node
|
|
100
113
|
*String() {
|
|
101
|
-
yield eat(m
|
|
114
|
+
yield eat(m`:IJSON: <_String />`);
|
|
102
115
|
}
|
|
103
116
|
|
|
104
117
|
@Node
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bablr/language-en-bablr-vm-instruction",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "A BABLR language for BABLR VM instructions",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=12.0.0"
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@babel/runtime": "^7.23.2",
|
|
26
|
-
"@bablr/agast-helpers": "0.
|
|
27
|
-
"@bablr/agast-vm-helpers": "0.
|
|
28
|
-
"@bablr/
|
|
29
|
-
"@bablr/
|
|
30
|
-
"@bablr/language-en-
|
|
31
|
-
"@bablr/language-en-
|
|
32
|
-
"@bablr/language-en-
|
|
33
|
-
"@bablr/language-en-
|
|
26
|
+
"@bablr/agast-helpers": "0.8.0",
|
|
27
|
+
"@bablr/agast-vm-helpers": "0.8.0",
|
|
28
|
+
"@bablr/boot": "0.9.0",
|
|
29
|
+
"@bablr/helpers": "0.23.0",
|
|
30
|
+
"@bablr/language-en-blank-space": "0.8.0",
|
|
31
|
+
"@bablr/language-en-cstml": "0.10.0",
|
|
32
|
+
"@bablr/language-en-regex-vm-pattern": "0.10.0",
|
|
33
|
+
"@bablr/language-en-spamex": "0.9.0",
|
|
34
|
+
"@bablr/language-en-cstml-json": "0.3.0"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"@bablr/
|
|
37
|
-
"@bablr/eslint-config-base": "github:bablr-lang/eslint-config-base#49f5952efed27f94ee9b94340eb1563c440bf64e",
|
|
37
|
+
"@bablr/eslint-config-base": "github:bablr-lang/eslint-config-base#c97bfa4b3663f8378e9b3e42bb5a41e685406cf9",
|
|
38
38
|
"@bablr/macrome": "^0.1.3",
|
|
39
39
|
"@bablr/macrome-generator-bablr": "^0.3.2",
|
|
40
40
|
"enhanced-resolve": "^5.12.0",
|