@bablr/language-en-bablr-cli-verbose-output 0.10.8 → 0.11.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.
Files changed (2) hide show
  1. package/lib/grammar.js +35 -20
  2. package/package.json +8 -9
package/lib/grammar.js CHANGED
@@ -1,34 +1,49 @@
1
- import { re, spam as m } from '@bablr/boot';
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
- export const canonicalURL = 'https://bablr.org/languages/core/en/bablr-cli-verbose-output';
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(re`/[ \t\n]/`)) {
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 const grammar = class VerboseOutputGrammar {
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(re`/./`)) && (yield eat(m`lines[]$: <_Line />`)));
23
+ while ((yield match(m`/./`)) && (yield eat(m`lines[]$: <_Line />`)));
23
24
  }
24
25
 
25
26
  *Line() {
26
- if (yield eatMatch(m`<ExecInstructionLine /(?: )?\>\>\>/ />`)) {
27
- } else if (yield eatMatch(m`<EmitLine '<<<' />`)) {
28
- } else if (yield eatMatch(m`<EnterProductionLine '-->' />`)) {
29
- } else if (yield eatMatch(m`<LeaveProductionLine /[x<]--/ />`)) {
30
- } else {
31
- yield eatMatch(m`<OutputLine /./s />`);
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
- export default { canonicalURL, dependencies, grammar, defaultMatcher };
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.10.8",
3
+ "version": "0.11.1",
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.10.10",
19
- "@bablr/agast-vm-helpers": "0.10.5",
20
- "@bablr/boot": "0.11.4",
21
- "@bablr/helpers": "0.25.5",
22
- "@bablr/language-en-bablr-vm-instruction": "0.11.8",
23
- "@bablr/language-en-blank-space": "0.10.13",
24
- "@bablr/language-en-cstml": "0.12.6"
18
+ "@bablr/agast-helpers": "0.11.4",
19
+ "@bablr/agast-vm-helpers": "0.11.4",
20
+ "@bablr/helpers": "0.26.5",
21
+ "@bablr/language-en-bablr-vm-instruction": "0.12.1",
22
+ "@bablr/language-en-blank-space": "0.11.2",
23
+ "@bablr/language-en-cstml": "0.13.1"
25
24
  },
26
25
  "devDependencies": {
27
- "@bablr/eslint-config-base": "github:bablr-lang/eslint-config-base#c97bfa4b3663f8378e9b3e42bb5a41e685406cf9",
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",