@bablr/helpers 0.16.0 → 0.17.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/enhancers.js +3 -3
- package/lib/productions.js +1 -3
- package/lib/source.js +11 -11
- package/lib/trivia.js +1 -1
- package/package.json +6 -6
package/lib/enhancers.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
enhanceStrategyBuilderWithEmittedLogging as logEmitted,
|
|
4
4
|
} from '@bablr/strategy_enhancer-debug-log';
|
|
5
5
|
import { enhanceProductionWithDebugLogging as createProductionLogger } from '@bablr/language_enhancer-debug-log';
|
|
6
|
-
import { getPrototypeOf } from './object.js';
|
|
6
|
+
import { getOwnPropertySymbols, getPrototypeOf } from './object.js';
|
|
7
7
|
|
|
8
8
|
const { getOwnPropertyNames, hasOwn } = Object;
|
|
9
9
|
|
|
@@ -47,8 +47,8 @@ export const mapProductions = (fn, Grammar) => {
|
|
|
47
47
|
|
|
48
48
|
const mapped = MappedGrammar.prototype;
|
|
49
49
|
|
|
50
|
-
while (prototype) {
|
|
51
|
-
for (const key of getOwnPropertyNames(prototype)) {
|
|
50
|
+
while (prototype && prototype !== Object.prototype) {
|
|
51
|
+
for (const key of [...getOwnPropertyNames(prototype), ...getOwnPropertySymbols(prototype)]) {
|
|
52
52
|
if (!hasOwn(mapped, key)) {
|
|
53
53
|
mapped[key] = fn(prototype[key], key);
|
|
54
54
|
}
|
package/lib/productions.js
CHANGED
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
* This file is autogenerated. Please do not edit it directly.
|
|
5
5
|
* When editing run `npx macrome watch` then change the file this is generated from.
|
|
6
6
|
*/
|
|
7
|
-
import { interpolateString as _interpolateString } from "@bablr/agast-helpers/template";
|
|
8
|
-
import { interpolateArrayChildren as _interpolateArrayChildren } from "@bablr/agast-helpers/template";
|
|
9
|
-
import { interpolateArray as _interpolateArray } from "@bablr/agast-helpers/template";
|
|
7
|
+
import { interpolateArray as _interpolateArray, interpolateArrayChildren as _interpolateArrayChildren, interpolateString as _interpolateString } from "@bablr/agast-helpers/template";
|
|
10
8
|
import * as _l from "@bablr/agast-vm-helpers/languages";
|
|
11
9
|
import * as _t from "@bablr/agast-helpers/shorthand";
|
|
12
10
|
export function* List({
|
package/lib/source.js
CHANGED
|
@@ -9,7 +9,7 @@ const escapables = {
|
|
|
9
9
|
0: '\0',
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
function*
|
|
12
|
+
function* __readFromStream(stream) {
|
|
13
13
|
let iter = stream[Symbol.asyncIterator]();
|
|
14
14
|
let step;
|
|
15
15
|
|
|
@@ -26,12 +26,12 @@ function* __sourceFromReadStream(stream) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export const
|
|
29
|
+
export const readFromStream = (stream) => new StreamIterable(__readFromStream(stream));
|
|
30
30
|
|
|
31
31
|
const gapStr = '<//>';
|
|
32
32
|
|
|
33
|
-
function*
|
|
34
|
-
let iter = getStreamIterator(
|
|
33
|
+
function* __embeddedSourceFrom(iterable) {
|
|
34
|
+
let iter = getStreamIterator(iterable);
|
|
35
35
|
let step;
|
|
36
36
|
let escape = false;
|
|
37
37
|
let gapMatchIdx = 0;
|
|
@@ -89,8 +89,7 @@ function* __embeddedSourceFromReadStream(stream) {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
export const
|
|
93
|
-
new StreamIterable(__embeddedSourceFromReadStream(stream));
|
|
92
|
+
export const embeddedSourceFrom = (iterable) => new StreamIterable(__embeddedSourceFrom(iterable));
|
|
94
93
|
|
|
95
94
|
function* __sourceFromTokenStream(terminals) {
|
|
96
95
|
let iter = getStreamIterator(terminals);
|
|
@@ -142,9 +141,9 @@ function* __sourceFromQuasis(quasis) {
|
|
|
142
141
|
|
|
143
142
|
export const sourceFromQuasis = (quasis) => new StreamIterable(__sourceFromQuasis(quasis));
|
|
144
143
|
|
|
145
|
-
export function* fillGapsWith(expressions,
|
|
144
|
+
export function* fillGapsWith(expressions, iterable) {
|
|
146
145
|
let exprIdx = 0;
|
|
147
|
-
let iter = getStreamIterator(
|
|
146
|
+
let iter = getStreamIterator(iterable);
|
|
148
147
|
let holding = false;
|
|
149
148
|
|
|
150
149
|
for (;;) {
|
|
@@ -183,8 +182,8 @@ export function* fillGapsWith(expressions, stream) {
|
|
|
183
182
|
|
|
184
183
|
const none = Symbol('none');
|
|
185
184
|
|
|
186
|
-
function* __stripTrailingNewline(
|
|
187
|
-
const iter = getStreamIterator(
|
|
185
|
+
function* __stripTrailingNewline(iterable) {
|
|
186
|
+
const iter = getStreamIterator(iterable);
|
|
188
187
|
let step = iter.next();
|
|
189
188
|
let lastValue = none;
|
|
190
189
|
|
|
@@ -214,4 +213,5 @@ function* __stripTrailingNewline(stream) {
|
|
|
214
213
|
}
|
|
215
214
|
}
|
|
216
215
|
|
|
217
|
-
export const stripTrailingNewline = (
|
|
216
|
+
export const stripTrailingNewline = (iterable) =>
|
|
217
|
+
new StreamIterable(__stripTrailingNewline(iterable));
|
package/lib/trivia.js
CHANGED
|
@@ -39,7 +39,7 @@ export const triviaEnhancer = ({ triviaIsAllowed, eatMatchTrivia }, grammar) =>
|
|
|
39
39
|
case 'eatMatch':
|
|
40
40
|
case 'match':
|
|
41
41
|
case 'guard': {
|
|
42
|
-
if (matcher &&
|
|
42
|
+
if (matcher && !matcher.flags?.trivia) {
|
|
43
43
|
const previous = lookbehind(ctx, s);
|
|
44
44
|
if (triviaIsAllowed(s) && (!previous || !matchedResults.has(previous))) {
|
|
45
45
|
matchedResults.add(previous);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bablr/helpers",
|
|
3
3
|
"description": "Command helpers for use in writing BABLR grammars",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.17.0",
|
|
5
5
|
"author": "Conrad Buck<conartist6@gmail.com>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"clean": "macrome clean"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@bablr/language_enhancer-debug-log": "0.
|
|
30
|
-
"@bablr/strategy_enhancer-debug-log": "0.
|
|
31
|
-
"@bablr/agast-helpers": "0.
|
|
32
|
-
"@bablr/agast-vm-helpers": "0.
|
|
29
|
+
"@bablr/language_enhancer-debug-log": "0.4.0",
|
|
30
|
+
"@bablr/strategy_enhancer-debug-log": "0.3.0",
|
|
31
|
+
"@bablr/agast-helpers": "0.2.0",
|
|
32
|
+
"@bablr/agast-vm-helpers": "0.2.0",
|
|
33
33
|
"@bablr/coroutine": "0.1.0",
|
|
34
34
|
"iter-tools-es": "^7.5.3"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@bablr/boot": "0.
|
|
37
|
+
"@bablr/boot": "0.3.0",
|
|
38
38
|
"@bablr/eslint-config-base": "github:bablr-lang/eslint-config-base#d834ccc52795d6c3b96ecc6c419960fceed221a6",
|
|
39
39
|
"@bablr/macrome": "0.1.1",
|
|
40
40
|
"@bablr/macrome-generator-bablr": "0.3.1",
|