@bablr/helpers 0.20.4 → 0.20.5

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 CHANGED
@@ -59,6 +59,18 @@ export const mapProductions = (fn, Grammar) => {
59
59
  return MappedGrammar;
60
60
  };
61
61
 
62
+ export function* generateProductions(Grammar) {
63
+ let { prototype } = Grammar;
64
+
65
+ while (prototype && prototype !== Object.prototype) {
66
+ for (const key of [...getOwnPropertyNames(prototype), ...getOwnPropertySymbols(prototype)]) {
67
+ let value = prototype[key];
68
+ if (key !== 'constructor') yield [key, value];
69
+ }
70
+ prototype = getPrototypeOf(prototype);
71
+ }
72
+ }
73
+
62
74
  export const debugEnhancers = {
63
75
  // agast: (strategy) => logEmitted(strategy, '<<< '),
64
76
  createBablrStrategy: (strategy) => logStrategy(strategy, ' >>> '),
package/lib/stream.js CHANGED
@@ -1,9 +1,8 @@
1
1
  import { Coroutine } from '@bablr/coroutine';
2
2
  import {
3
- generatePrettyCSTMLStrategy as generatePrettyCSTML,
4
- generateCSTMLStrategy as generateCSTML,
3
+ generatePrettyCSTML as generatePrettyCSTMLStream,
4
+ generateCSTML as generateCSTMLStream,
5
5
  stringFromStream,
6
- generateStandardOutput,
7
6
  getStreamIterator,
8
7
  StreamIterable,
9
8
  } from '@bablr/agast-helpers/stream';
@@ -67,22 +66,22 @@ export const resolveTags = (ctx, tags) => {
67
66
  return new StreamIterable(__resolveTags(ctx, tags));
68
67
  };
69
68
 
70
- export const generatePrettyCSTMLStrategy = (tags, options = {}) => {
69
+ export const generatePrettyCSTML = (tags, options = {}) => {
71
70
  const { ctx } = options;
72
71
 
73
- return generatePrettyCSTML(ctx ? resolveTags(ctx, tags) : tags, options);
72
+ return generatePrettyCSTMLStream(ctx ? resolveTags(ctx, tags) : tags, options);
74
73
  };
75
74
 
76
75
  export const printPrettyCSTML = (tags, options = {}) => {
77
- return stringFromStream(generateStandardOutput(generatePrettyCSTMLStrategy(tags, options)));
76
+ return stringFromStream(generatePrettyCSTMLStream(tags, options));
78
77
  };
79
78
 
80
- export const generateCSTMLStrategy = (tags, options = {}) => {
79
+ export const generateCSTML = (tags, options = {}) => {
81
80
  const { ctx } = options;
82
81
 
83
- return generateCSTML(ctx ? resolveTags(ctx, tags) : tags, options);
82
+ return generateCSTMLStream(ctx ? resolveTags(ctx, tags) : tags, options);
84
83
  };
85
84
 
86
85
  export const printCSTML = (tags, options = {}) => {
87
- return stringFromStream(generateStandardOutput(generateCSTMLStrategy(tags, options)));
86
+ return stringFromStream(generateCSTMLStream(tags, options));
88
87
  };
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "@bablr/helpers",
3
3
  "description": "Command helpers for use in writing BABLR grammars",
4
- "version": "0.20.4",
4
+ "version": "0.20.5",
5
5
  "author": "Conrad Buck<conartist6@gmail.com>",
6
6
  "type": "module",
7
- "files": ["lib"],
7
+ "files": [
8
+ "lib"
9
+ ],
8
10
  "exports": {
9
11
  "./builders": "./lib/builders.js",
10
12
  "./decorators": "./lib/decorators.js",