@bablr/cli 0.11.2 → 0.11.4

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/syntax.js +12 -7
  2. package/package.json +1 -1
package/lib/syntax.js CHANGED
@@ -5,7 +5,7 @@ import cstml from '@bablr/language-en-cstml';
5
5
  import verboseOutput from '@bablr/language-en-bablr-cli-verbose-output';
6
6
  import { streamParse } from 'bablr/enhanceable';
7
7
  import { Coroutine } from '@bablr/coroutine';
8
- import { StreamIterable, getStreamIterator, wait } from '@bablr/agast-helpers/stream';
8
+ import { StreamIterable, getStreamIterator, hoistTrivia, wait } from '@bablr/agast-helpers/stream';
9
9
  import {
10
10
  generateAllOutput,
11
11
  writeCSTMLStrategy,
@@ -54,22 +54,26 @@ function* __higlightStrategy(tags) {
54
54
  names = names.push(tagName);
55
55
 
56
56
  if (
57
+ tagName === Symbol.for('Pattern') ||
58
+ (tagName === Symbol.for('String') && currentName === Symbol.for('TreeNodeMatcherOpen'))
59
+ ) {
60
+ yield buildAnsiPushEffect('bold orange');
61
+ } else if (
57
62
  tagName === Symbol.for('LiteralTag') ||
58
63
  (tagName === Symbol.for('String') && currentRef.name === 'literalValue')
59
64
  ) {
60
65
  if (tagName === Symbol.for('LiteralTag') || currentName === Symbol.for('OpenNodeTag')) {
61
66
  yield buildAnsiPushEffect('bold green');
62
- } else if (currentName === Symbol.for('TreeNodeMatcherOpen')) {
63
- yield buildAnsiPushEffect('bold orange');
64
67
  } else {
65
68
  yield buildAnsiPushEffect();
66
69
  }
67
- } else if (tagName === Symbol.for('Pattern')) {
68
- yield buildAnsiPushEffect('bold orange');
69
70
  } else if (tagName === Symbol.for('EscapeSequence')) {
70
71
  yield buildAnsiPushEffect('bold cyan');
71
72
  } else if (tagName === Symbol.for('Identifier')) {
72
- if (currentName === Symbol.for('ReferenceTag')) {
73
+ if (
74
+ currentName === Symbol.for('ReferenceTag') ||
75
+ currentName === Symbol.for('ReferenceMatcher')
76
+ ) {
73
77
  yield buildAnsiPushEffect('bold gray');
74
78
  } else if (currentName === Symbol.for('Call')) {
75
79
  yield buildAnsiPushEffect('magenta bold');
@@ -92,6 +96,7 @@ function* __higlightStrategy(tags) {
92
96
  } else if (tagName === null && tag.value.flags.token) {
93
97
  if (
94
98
  currentName === Symbol.for('ReferenceTag') ||
99
+ currentName === Symbol.for('ReferenceMatcher') ||
95
100
  currentName === Symbol.for('ReferenceFlags')
96
101
  ) {
97
102
  yield buildAnsiPushEffect('bold gray');
@@ -154,7 +159,7 @@ export const generateCSTML = (tags, options = {}) => {
154
159
  input,
155
160
  );
156
161
 
157
- return higlightStrategy(tags);
162
+ return higlightStrategy(hoistTrivia(tags));
158
163
  } else {
159
164
  return outputInstructions;
160
165
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bablr/cli",
3
3
  "description": "CLI for running BABLR parsers",
4
- "version": "0.11.2",
4
+ "version": "0.11.4",
5
5
  "author": "Conrad Buck<conartist6@gmail.com>",
6
6
  "type": "module",
7
7
  "files": [