@bablr/language-en-bablr-cli-verbose-output 0.10.7 → 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 +35 -20
- package/package.json +8 -9
package/lib/grammar.js
CHANGED
|
@@ -1,34 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { eat, eatMatch, match } from '@bablr/helpers/grammar';
|
|
1
|
+
import { m, eat, eatMatch, match } from '@bablr/helpers/grammar';
|
|
3
2
|
import CSTML from '@bablr/language-en-cstml';
|
|
4
3
|
import Instruction from '@bablr/language-en-bablr-vm-instruction';
|
|
5
4
|
import Space from '@bablr/language-en-blank-space';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const dependencies = { Space, CSTML, Instruction };
|
|
10
|
-
|
|
11
|
-
export const defaultMatcher = m`<Output />`;
|
|
5
|
+
import { printSource } from '@bablr/agast-helpers/tree';
|
|
6
|
+
import { freezeRecord, freeze, freezeClass } from '@bablr/agast-helpers/object';
|
|
12
7
|
|
|
13
8
|
export function* eatMatchTrivia() {
|
|
14
|
-
if (yield match(
|
|
9
|
+
if (yield match(m`/[ \t\n]/`)) {
|
|
15
10
|
return yield eat(m`#: :Space: <*Space />`);
|
|
16
11
|
}
|
|
17
12
|
return null;
|
|
18
13
|
}
|
|
19
14
|
|
|
20
|
-
export
|
|
15
|
+
export default class VerboseOutput {
|
|
16
|
+
static canonicalURL = 'https://bablr.org/languages/core/en/bablr-cli-verbose-output';
|
|
17
|
+
static dependencies = freeze({ Space, CSTML, Instruction });
|
|
18
|
+
static defaultMatcher = m`<Output />`;
|
|
19
|
+
static fragmentProduction = null;
|
|
20
|
+
static context = freezeRecord({});
|
|
21
|
+
|
|
21
22
|
*Output() {
|
|
22
|
-
while ((yield match(
|
|
23
|
+
while ((yield match(m`/./`)) && (yield eat(m`lines[]$: <_Line />`)));
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
*Line() {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
let res = yield match(m`/(?: )?[>]{3}|[<]{3}|--[>]|[x<]--/`);
|
|
28
|
+
|
|
29
|
+
switch (printSource(res)) {
|
|
30
|
+
case '<<<':
|
|
31
|
+
yield eat(m`<EmitLine />`);
|
|
32
|
+
break;
|
|
33
|
+
case '>>>':
|
|
34
|
+
case ' >>>':
|
|
35
|
+
yield eat(m`<ExecInstructionLine />`);
|
|
36
|
+
break;
|
|
37
|
+
case '-->':
|
|
38
|
+
yield eat(m`<EnterProductionLine />`);
|
|
39
|
+
break;
|
|
40
|
+
case '<--':
|
|
41
|
+
case 'x--':
|
|
42
|
+
yield eat(m`<LeaveProductionLine />`);
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
yield eat(m`<OutputLine />`);
|
|
46
|
+
break;
|
|
32
47
|
}
|
|
33
48
|
}
|
|
34
49
|
|
|
@@ -74,11 +89,11 @@ export const grammar = class VerboseOutputGrammar {
|
|
|
74
89
|
|
|
75
90
|
yield eatMatch(m`#: :Space: <*Space /[ \t]/ />`);
|
|
76
91
|
|
|
77
|
-
while (yield eatMatch(m`expressions[]: :CSTML: <_Tag />`)) {
|
|
92
|
+
while (yield eatMatch(m`expressions[]: :CSTML: <_Tag /./ />`)) {
|
|
78
93
|
yield eatMatch(m`#: :Space: <*Space /[ \t]/ />`);
|
|
79
94
|
}
|
|
80
95
|
yield eat(m`lineTerminatorToken: <* '\n' />`);
|
|
81
96
|
}
|
|
82
|
-
}
|
|
97
|
+
}
|
|
83
98
|
|
|
84
|
-
|
|
99
|
+
freezeClass(VerboseOutput);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bablr/language-en-bablr-cli-verbose-output",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "A BABLR language for BABLR CLI verbose output",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=12.0.0"
|
|
@@ -15,16 +15,15 @@
|
|
|
15
15
|
],
|
|
16
16
|
"sideEffects": false,
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@bablr/agast-helpers": "0.
|
|
19
|
-
"@bablr/agast-vm-helpers": "0.
|
|
20
|
-
"@bablr/
|
|
21
|
-
"@bablr/
|
|
22
|
-
"@bablr/language-en-
|
|
23
|
-
"@bablr/language-en-
|
|
24
|
-
"@bablr/language-en-cstml": "0.12.5"
|
|
18
|
+
"@bablr/agast-helpers": "0.11.3",
|
|
19
|
+
"@bablr/agast-vm-helpers": "0.11.3",
|
|
20
|
+
"@bablr/helpers": "0.26.4",
|
|
21
|
+
"@bablr/language-en-bablr-vm-instruction": "0.12.0",
|
|
22
|
+
"@bablr/language-en-blank-space": "0.11.1",
|
|
23
|
+
"@bablr/language-en-cstml": "0.13.0"
|
|
25
24
|
},
|
|
26
25
|
"devDependencies": {
|
|
27
|
-
"@bablr/eslint-config-base": "github:bablr-lang/eslint-config-base#
|
|
26
|
+
"@bablr/eslint-config-base": "github:bablr-lang/eslint-config-base#23b94fb3bdfdbc3ac7ed9cb58d7979d8f07dce2b",
|
|
28
27
|
"enhanced-resolve": "^5.12.0",
|
|
29
28
|
"eslint": "^8.47.0",
|
|
30
29
|
"eslint-import-resolver-enhanced-resolve": "^1.0.5",
|