@bablr/cli 0.11.7 → 0.11.9
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/bin/index.js +8 -3
- package/lib/syntax.js +10 -3
- package/package.json +9 -9
package/bin/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { spam as m } from '@bablr/boot';
|
|
6
6
|
import { program } from 'commander';
|
|
7
|
-
import {
|
|
7
|
+
import { buildModule } from 'bablr/enhanceable';
|
|
8
8
|
import { embeddedSourceFrom, readFromStream, stripTrailingNewline } from '@bablr/helpers/source';
|
|
9
9
|
import { debugEnhancers } from '@bablr/helpers/enhancers';
|
|
10
10
|
import colorSupport from 'color-support';
|
|
@@ -19,6 +19,8 @@ program
|
|
|
19
19
|
.option('-l, --language [URL]', 'The URL of the top BABLR language')
|
|
20
20
|
.option('-p, --production [name]', 'Shorthand: sets the named node matcher as root matcher')
|
|
21
21
|
.option('-m, --matcher [matcher]', 'Sets the root matcher')
|
|
22
|
+
.option('-s, --shift', 'Allows shifting')
|
|
23
|
+
.option('-S, --no-shift', 'Disallows shifting')
|
|
22
24
|
.option('-f, --format', 'Pretty-format CSTML output', true)
|
|
23
25
|
.option('-F, --no-format')
|
|
24
26
|
.option('-v, --verbose', 'Prints debugging information to stderr')
|
|
@@ -57,6 +59,8 @@ const logStderr = (...args) => {
|
|
|
57
59
|
|
|
58
60
|
const enhancers = options.verbose ? { ...debugEnhancers, agast: null } : {};
|
|
59
61
|
|
|
62
|
+
let { streamParse } = buildModule(enhancers);
|
|
63
|
+
|
|
60
64
|
const rawStream = process.stdin.setEncoding('utf-8');
|
|
61
65
|
|
|
62
66
|
Error.stackTraceLimit = 20;
|
|
@@ -73,8 +77,9 @@ const output = evaluateIO(() =>
|
|
|
73
77
|
{
|
|
74
78
|
enhancers,
|
|
75
79
|
emitEffects: true,
|
|
76
|
-
holdShiftedNodes: !options.
|
|
77
|
-
holdUndefinedAttributes: !options.gaps,
|
|
80
|
+
holdShiftedNodes: !options.shift,
|
|
81
|
+
// holdUndefinedAttributes: !options.gaps,
|
|
82
|
+
tree: false,
|
|
78
83
|
},
|
|
79
84
|
),
|
|
80
85
|
{
|
package/lib/syntax.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import emptyStack from '@iter-tools/imm-stack';
|
|
4
4
|
import cstml from '@bablr/language-en-cstml';
|
|
5
5
|
import verboseOutput from '@bablr/language-en-bablr-cli-verbose-output';
|
|
6
|
-
import { streamParse } from 'bablr
|
|
6
|
+
import { streamParse } from 'bablr';
|
|
7
7
|
import { Coroutine } from '@bablr/coroutine';
|
|
8
8
|
import { StreamIterable, getStreamIterator, hoistTrivia, wait } from '@bablr/agast-helpers/stream';
|
|
9
9
|
import {
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
buildBoundNodeMatcher,
|
|
27
27
|
} from '@bablr/helpers/builders';
|
|
28
28
|
import { getFlagsWithGap, nodeFlags } from '@bablr/agast-helpers/builders';
|
|
29
|
+
import { o } from '@bablr/helpers/grammar';
|
|
29
30
|
|
|
30
31
|
let gapNodeFlags = getFlagsWithGap(nodeFlags);
|
|
31
32
|
|
|
@@ -53,8 +54,12 @@ function* __higlightStrategy(tags) {
|
|
|
53
54
|
|
|
54
55
|
names = names.push(tagName);
|
|
55
56
|
|
|
56
|
-
if (
|
|
57
|
-
|
|
57
|
+
if (tagName === Symbol.for('Alternative')) {
|
|
58
|
+
yield buildAnsiPushEffect('reset');
|
|
59
|
+
} else if (
|
|
60
|
+
tagName === Symbol.for('Character') ||
|
|
61
|
+
(currentName === Symbol.for('Pattern') &&
|
|
62
|
+
['openToken', 'closeToken', 'flags'].includes(currentRef?.name)) ||
|
|
58
63
|
(tagName === Symbol.for('String') && currentName === Symbol.for('TreeNodeMatcherOpen'))
|
|
59
64
|
) {
|
|
60
65
|
yield buildAnsiPushEffect('bold orange');
|
|
@@ -155,6 +160,8 @@ export const generateCSTML = (tags, options = {}) => {
|
|
|
155
160
|
),
|
|
156
161
|
),
|
|
157
162
|
input,
|
|
163
|
+
o({}),
|
|
164
|
+
{ tree: false },
|
|
158
165
|
);
|
|
159
166
|
|
|
160
167
|
return higlightStrategy(hoistTrivia(tags));
|
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.
|
|
4
|
+
"version": "0.11.9",
|
|
5
5
|
"author": "Conrad Buck<conartist6@gmail.com>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
},
|
|
18
18
|
"sideEffects": false,
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@bablr/agast-helpers": "0.10.
|
|
21
|
-
"@bablr/agast-vm-helpers": "0.10.
|
|
22
|
-
"@bablr/io-vm-node": "0.9.
|
|
23
|
-
"@bablr/boot": "0.11.
|
|
20
|
+
"@bablr/agast-helpers": "0.10.2",
|
|
21
|
+
"@bablr/agast-vm-helpers": "0.10.2",
|
|
22
|
+
"@bablr/io-vm-node": "0.9.1",
|
|
23
|
+
"@bablr/boot": "0.11.1",
|
|
24
24
|
"@bablr/coroutine": "0.1.0",
|
|
25
|
-
"@bablr/helpers": "0.25.
|
|
26
|
-
"@bablr/language-en-cstml": "0.12.
|
|
27
|
-
"@bablr/language-en-bablr-cli-verbose-output": "0.10.
|
|
25
|
+
"@bablr/helpers": "0.25.1",
|
|
26
|
+
"@bablr/language-en-cstml": "0.12.2",
|
|
27
|
+
"@bablr/language-en-bablr-cli-verbose-output": "0.10.3",
|
|
28
28
|
"@iter-tools/imm-stack": "1.2.0",
|
|
29
|
-
"bablr": "0.11.
|
|
29
|
+
"bablr": "0.11.2",
|
|
30
30
|
"color-support": "1.1.3",
|
|
31
31
|
"commander": "^12.0.0"
|
|
32
32
|
},
|