@bablr/cli 0.11.0 → 0.11.2

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 +20 -17
  2. package/package.json +1 -1
package/lib/syntax.js CHANGED
@@ -32,7 +32,7 @@ let gapNodeFlags = getFlagsWithGap(nodeFlags);
32
32
  function* __higlightStrategy(tags) {
33
33
  const co = new Coroutine(getStreamIterator(tags));
34
34
 
35
- let types = emptyStack;
35
+ let names = emptyStack;
36
36
 
37
37
  let currentRef;
38
38
 
@@ -49,17 +49,17 @@ function* __higlightStrategy(tags) {
49
49
 
50
50
  if (tag.type === OpenNodeTag) {
51
51
  const tagName = tag.value.name;
52
- const currentType = types.value;
52
+ const currentName = names.value;
53
53
 
54
- types = types.push(tagName);
54
+ names = names.push(tagName);
55
55
 
56
56
  if (
57
57
  tagName === Symbol.for('LiteralTag') ||
58
58
  (tagName === Symbol.for('String') && currentRef.name === 'literalValue')
59
59
  ) {
60
- if (tagName === Symbol.for('LiteralTag') || currentType === Symbol.for('OpenNodeTag')) {
60
+ if (tagName === Symbol.for('LiteralTag') || currentName === Symbol.for('OpenNodeTag')) {
61
61
  yield buildAnsiPushEffect('bold green');
62
- } else if (currentType === Symbol.for('TreeNodeMatcherOpen')) {
62
+ } else if (currentName === Symbol.for('TreeNodeMatcherOpen')) {
63
63
  yield buildAnsiPushEffect('bold orange');
64
64
  } else {
65
65
  yield buildAnsiPushEffect();
@@ -68,16 +68,10 @@ function* __higlightStrategy(tags) {
68
68
  yield buildAnsiPushEffect('bold orange');
69
69
  } else if (tagName === Symbol.for('EscapeSequence')) {
70
70
  yield buildAnsiPushEffect('bold cyan');
71
- } else if (tagName === null && tag.value.flags.token) {
72
- if (currentType === Symbol.for('ReferenceTag')) {
73
- yield buildAnsiPushEffect('bold gray');
74
- } else {
75
- yield buildAnsiPushEffect();
76
- }
77
71
  } else if (tagName === Symbol.for('Identifier')) {
78
- if (currentType === Symbol.for('ReferenceTag')) {
72
+ if (currentName === Symbol.for('ReferenceTag')) {
79
73
  yield buildAnsiPushEffect('bold gray');
80
- } else if (currentType === Symbol.for('Call')) {
74
+ } else if (currentName === Symbol.for('Call')) {
81
75
  yield buildAnsiPushEffect('magenta bold');
82
76
  } else {
83
77
  yield buildAnsiPushEffect();
@@ -89,12 +83,21 @@ function* __higlightStrategy(tags) {
89
83
  yield buildAnsiPushEffect('blue bold');
90
84
  } else if (
91
85
  (currentRef?.name === 'sigilToken' &&
92
- (currentType === Symbol.for('ExecSpamexInstructionLine') ||
93
- currentType === Symbol.for('ExecCSTMLInstructionLine'))) ||
94
- (currentType === Symbol.for('Call') &&
86
+ (currentName === Symbol.for('ExecSpamexInstructionLine') ||
87
+ currentName === Symbol.for('ExecCSTMLInstructionLine'))) ||
88
+ (currentName === Symbol.for('Call') &&
95
89
  (currentRef.name === 'openToken' || currentRef.name === 'closeToken'))
96
90
  ) {
97
91
  yield buildAnsiPushEffect('magenta bold');
92
+ } else if (tagName === null && tag.value.flags.token) {
93
+ if (
94
+ currentName === Symbol.for('ReferenceTag') ||
95
+ currentName === Symbol.for('ReferenceFlags')
96
+ ) {
97
+ yield buildAnsiPushEffect('bold gray');
98
+ } else {
99
+ yield buildAnsiPushEffect();
100
+ }
98
101
  } else {
99
102
  yield buildAnsiPushEffect();
100
103
  }
@@ -113,7 +116,7 @@ function* __higlightStrategy(tags) {
113
116
  yield tag;
114
117
 
115
118
  if (tag.type === CloseNodeTag || (tag.type === OpenNodeTag && tag.value.selfClosing)) {
116
- types = types.pop();
119
+ names = names.pop();
117
120
  yield buildAnsiPopEffect();
118
121
  }
119
122
 
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.0",
4
+ "version": "0.11.2",
5
5
  "author": "Conrad Buck<conartist6@gmail.com>",
6
6
  "type": "module",
7
7
  "files": [