@bablr/language-en-bablr-vm-instruction 0.8.0 → 0.10.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 +12 -11
- package/lib/grammar.macro.js +19 -16
- package/package.json +12 -12
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#47f25aae061ffc415e01f1c6898e6397cd0a8e0b
|
|
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,
|
|
10
|
+
import { extendLanguage, 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';
|
|
@@ -17,9 +17,10 @@ import * as JSON from '@bablr/language-en-cstml-json';
|
|
|
17
17
|
import * as productions from '@bablr/helpers/productions';
|
|
18
18
|
import { buildString } from '@bablr/helpers/builders';
|
|
19
19
|
export const canonicalURL = 'https://bablr.org/languages/core/en/bablr-vm-instruction';
|
|
20
|
+
export const defaultMatcher = m`<Call />`;
|
|
20
21
|
export function* eatMatchTrivia() {
|
|
21
22
|
if (yield match(re`/[ \t\n]/`)) {
|
|
22
|
-
return yield eat(m`#:
|
|
23
|
+
return yield eat(m`#: :Space: <__Blank />`);
|
|
23
24
|
}
|
|
24
25
|
return null;
|
|
25
26
|
}
|
|
@@ -31,7 +32,7 @@ const IJSON = extendLanguage(JSON, {
|
|
|
31
32
|
grammar: class IJSON extends JSON.grammar {
|
|
32
33
|
*Expression(props) {
|
|
33
34
|
if (yield match(re`/(m|re|t|i)['"\u0060]/`)) {
|
|
34
|
-
yield eat(m
|
|
35
|
+
yield eat(m`:Instruction: <__Expression />`);
|
|
35
36
|
} else {
|
|
36
37
|
yield* super.Expression(props);
|
|
37
38
|
}
|
|
@@ -60,16 +61,16 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
60
61
|
let sp = yield* eatMatchTrivia();
|
|
61
62
|
let first = true;
|
|
62
63
|
while ((first || sp) && (yield match(re`/./s`))) {
|
|
63
|
-
yield eat(m`values[]$: <
|
|
64
|
+
yield eat(m`values[]$: <_Expression />`);
|
|
64
65
|
yield* eatMatchTrivia();
|
|
65
|
-
sp = yield eatMatch(m
|
|
66
|
+
sp = yield eatMatch(m`#separatorTokens[]: <*Punctuator ',' />`);
|
|
66
67
|
yield* eatMatchTrivia();
|
|
67
68
|
first = false;
|
|
68
69
|
}
|
|
69
70
|
yield eat(m`closeToken: <*Punctuator ')' { balancer: true } />`);
|
|
70
71
|
}
|
|
71
72
|
*Expression() {
|
|
72
|
-
yield eat(m`<
|
|
73
|
+
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 /["']/ />`]);
|
|
73
74
|
}
|
|
74
75
|
*SpamexString({
|
|
75
76
|
ctx
|
|
@@ -77,7 +78,7 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
77
78
|
yield eat(m`sigilToken: <*Keyword 'm' />`);
|
|
78
79
|
let quot = buildString(ctx.sourceTextFor(yield match(re`/['"\u0060]/`)));
|
|
79
80
|
yield eat(m`openToken: <*Punctuator ${quot} { balanced: ${quot} } />`);
|
|
80
|
-
yield eat(m`content:
|
|
81
|
+
yield eat(m`content: :Spamex: <_Matcher />`);
|
|
81
82
|
yield eat(m`closeToken: <*Punctuator ${quot} { balancer: true } />`);
|
|
82
83
|
}
|
|
83
84
|
*CSTMLString({
|
|
@@ -86,7 +87,7 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
86
87
|
yield eat(m`sigilToken: <*Keyword 't' />`);
|
|
87
88
|
let quot = buildString(ctx.sourceTextFor(yield match(re`/['"\u0060]/`)));
|
|
88
89
|
yield eat(m`openToken: <*Punctuator ${quot} { balanced: ${quot} } />`);
|
|
89
|
-
yield eat(m`content:
|
|
90
|
+
yield eat(m`content: :CSTML: <_Tag />`);
|
|
90
91
|
yield eat(m`closeToken: <*Punctuator ${quot} { balancer: true } />`);
|
|
91
92
|
}
|
|
92
93
|
*RegexString({
|
|
@@ -95,7 +96,7 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
95
96
|
yield eat(m`sigilToken: <*Keyword 're' />`);
|
|
96
97
|
let quot = buildString(ctx.sourceTextFor(yield match(re`/['"\u0060]/`)));
|
|
97
98
|
yield eat(m`openToken: <*Punctuator ${quot} { balanced: ${quot} } />`);
|
|
98
|
-
yield eat(m`content:
|
|
99
|
+
yield eat(m`content: :Regex: <Pattern />`);
|
|
99
100
|
yield eat(m`closeToken: <*Punctuator ${quot} { balancer: true } />`);
|
|
100
101
|
}
|
|
101
102
|
*InstructionString({
|
|
@@ -108,7 +109,7 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
108
109
|
yield eat(m`closeToken: <*Punctuator ${quot} { balancer: true } />`);
|
|
109
110
|
}
|
|
110
111
|
*String() {
|
|
111
|
-
yield eat(m
|
|
112
|
+
yield eat(m`:IJSON: <__String />`);
|
|
112
113
|
}
|
|
113
114
|
*Identifier() {
|
|
114
115
|
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,
|
|
2
|
+
import { extendLanguage, 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';
|
|
@@ -11,9 +11,11 @@ import { buildString } from '@bablr/helpers/builders';
|
|
|
11
11
|
|
|
12
12
|
export const canonicalURL = 'https://bablr.org/languages/core/en/bablr-vm-instruction';
|
|
13
13
|
|
|
14
|
+
export const defaultMatcher = m`<Call />`;
|
|
15
|
+
|
|
14
16
|
export function* eatMatchTrivia() {
|
|
15
17
|
if (yield match(re`/[ \t\n]/`)) {
|
|
16
|
-
return yield eat(m`#:
|
|
18
|
+
return yield eat(m`#: :Space: <__Blank />`);
|
|
17
19
|
}
|
|
18
20
|
return null;
|
|
19
21
|
}
|
|
@@ -26,7 +28,7 @@ const IJSON = extendLanguage(JSON, {
|
|
|
26
28
|
grammar: class IJSON extends JSON.grammar {
|
|
27
29
|
*Expression(props) {
|
|
28
30
|
if (yield match(re`/(m|re|t|i)['"\u0060]/`)) {
|
|
29
|
-
yield eat(m
|
|
31
|
+
yield eat(m`:Instruction: <__Expression />`);
|
|
30
32
|
} else {
|
|
31
33
|
yield* super.Expression(props);
|
|
32
34
|
}
|
|
@@ -46,9 +48,9 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
46
48
|
let sp = yield* eatMatchTrivia();
|
|
47
49
|
let first = true;
|
|
48
50
|
while ((first || sp) && (yield match(re`/./s`))) {
|
|
49
|
-
yield eat(m`values[]$: <
|
|
51
|
+
yield eat(m`values[]$: <_Expression />`);
|
|
50
52
|
yield* eatMatchTrivia();
|
|
51
|
-
sp = yield eatMatch(m
|
|
53
|
+
sp = yield eatMatch(m`#separatorTokens[]: <*Punctuator ',' />`);
|
|
52
54
|
yield* eatMatchTrivia();
|
|
53
55
|
first = false;
|
|
54
56
|
}
|
|
@@ -56,17 +58,18 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
*Expression() {
|
|
59
|
-
yield eat(m`<
|
|
60
|
-
m
|
|
61
|
-
m
|
|
62
|
-
m
|
|
63
|
-
m
|
|
64
|
-
m
|
|
61
|
+
yield eat(m`<__Any />`, [
|
|
62
|
+
m`:IJSON: <Array '[' />`,
|
|
63
|
+
m`:IJSON: <Object '{' />`,
|
|
64
|
+
m`:JSON: <Boolean /true|false/ />`,
|
|
65
|
+
m`:JSON: <Null 'null' />`,
|
|
66
|
+
m`:JSON: <Number /[\d]/ />`,
|
|
67
|
+
m`:JSON: <Infinity /[+-]?Infinity/ />`,
|
|
65
68
|
m`<SpamexString /m["'\u0060]/ />`,
|
|
66
69
|
m`<CSTMLString /t["'\u0060]/ />`,
|
|
67
70
|
m`<RegexString /re["'\u0060]/ />`,
|
|
68
71
|
m`<InstructionString /i["'\u0060]/ />`,
|
|
69
|
-
m
|
|
72
|
+
m`:JSON: <String /["']/ />`,
|
|
70
73
|
]);
|
|
71
74
|
}
|
|
72
75
|
|
|
@@ -75,7 +78,7 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
75
78
|
yield eat(m`sigilToken: <*Keyword 'm' />`);
|
|
76
79
|
let quot = buildString(ctx.sourceTextFor(yield match(re`/['"\u0060]/`)));
|
|
77
80
|
yield eat(m`openToken: <*Punctuator ${quot} { balanced: ${quot} } />`);
|
|
78
|
-
yield eat(m`content:
|
|
81
|
+
yield eat(m`content: :Spamex: <_Matcher />`);
|
|
79
82
|
yield eat(m`closeToken: <*Punctuator ${quot} { balancer: true } />`);
|
|
80
83
|
}
|
|
81
84
|
|
|
@@ -84,7 +87,7 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
84
87
|
yield eat(m`sigilToken: <*Keyword 't' />`);
|
|
85
88
|
let quot = buildString(ctx.sourceTextFor(yield match(re`/['"\u0060]/`)));
|
|
86
89
|
yield eat(m`openToken: <*Punctuator ${quot} { balanced: ${quot} } />`);
|
|
87
|
-
yield eat(m`content:
|
|
90
|
+
yield eat(m`content: :CSTML: <_Tag />`);
|
|
88
91
|
yield eat(m`closeToken: <*Punctuator ${quot} { balancer: true } />`);
|
|
89
92
|
}
|
|
90
93
|
|
|
@@ -93,7 +96,7 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
93
96
|
yield eat(m`sigilToken: <*Keyword 're' />`);
|
|
94
97
|
let quot = buildString(ctx.sourceTextFor(yield match(re`/['"\u0060]/`)));
|
|
95
98
|
yield eat(m`openToken: <*Punctuator ${quot} { balanced: ${quot} } />`);
|
|
96
|
-
yield eat(m`content:
|
|
99
|
+
yield eat(m`content: :Regex: <Pattern />`);
|
|
97
100
|
yield eat(m`closeToken: <*Punctuator ${quot} { balancer: true } />`);
|
|
98
101
|
}
|
|
99
102
|
|
|
@@ -110,7 +113,7 @@ export const grammar = class BABLRVMInstructionGrammar {
|
|
|
110
113
|
@CoveredBy('Expression')
|
|
111
114
|
@Node
|
|
112
115
|
*String() {
|
|
113
|
-
yield eat(m
|
|
116
|
+
yield eat(m`:IJSON: <__String />`);
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
@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.10.0",
|
|
4
4
|
"description": "A BABLR language for BABLR VM instructions",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=12.0.0"
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
"clean": "macrome clean"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@babel/runtime": "
|
|
26
|
-
"@bablr/agast-helpers": "0.
|
|
27
|
-
"@bablr/agast-vm-helpers": "0.
|
|
28
|
-
"@bablr/boot": "0.
|
|
29
|
-
"@bablr/helpers": "0.
|
|
30
|
-
"@bablr/language-en-blank-space": "0.
|
|
31
|
-
"@bablr/language-en-cstml": "0.
|
|
32
|
-
"@bablr/language-en-regex-vm-pattern": "0.
|
|
33
|
-
"@bablr/language-en-spamex": "0.
|
|
34
|
-
"@bablr/language-en-cstml-json": "0.
|
|
25
|
+
"@babel/runtime": "7.28.2",
|
|
26
|
+
"@bablr/agast-helpers": "0.9.0",
|
|
27
|
+
"@bablr/agast-vm-helpers": "0.9.0",
|
|
28
|
+
"@bablr/boot": "0.10.0",
|
|
29
|
+
"@bablr/helpers": "0.24.0",
|
|
30
|
+
"@bablr/language-en-blank-space": "0.9.0",
|
|
31
|
+
"@bablr/language-en-cstml": "0.11.0",
|
|
32
|
+
"@bablr/language-en-regex-vm-pattern": "0.11.0",
|
|
33
|
+
"@bablr/language-en-spamex": "0.10.0",
|
|
34
|
+
"@bablr/language-en-cstml-json": "0.4.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@bablr/eslint-config-base": "github:bablr-lang/eslint-config-base#
|
|
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",
|