@bablr/agast-helpers 0.10.9 → 0.10.10

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/builders.js CHANGED
@@ -40,13 +40,7 @@ export const deepFreeze = (object) => {
40
40
  export const buildSpan = (name, guard = null, props = {}) => {
41
41
  if (!name) throw new Error();
42
42
  deepFreeze(props);
43
- return freeze({ type: 'Explicit', name, guard, props });
44
- };
45
-
46
- export const buildTypedSpan = (type, name, guard = null, props = {}) => {
47
- if (!type || !name) throw new Error();
48
- deepFreeze(props);
49
- return freeze({ type, name, guard, props });
43
+ return freeze({ name, guard, props });
50
44
  };
51
45
 
52
46
  export const buildProperty = (tags, shift) => {
package/lib/path.js CHANGED
@@ -145,12 +145,12 @@ export const buildBoundsFromTags = (tags) => {
145
145
  openStack = BTree.unshift(gapFrame, openStack);
146
146
  }
147
147
 
148
- if (lastProperty && lastProperty.value.type === TreeNode) {
148
+ if (lastProperty && lastProperty.value.node.type === TreeNode) {
149
149
  if (!lastProperty.value.node) throw new Error();
150
150
 
151
151
  closeStack = lastProperty.value.node.value.bounds[1];
152
152
 
153
- let rootFrame = BTree.getAt(1, openStack);
153
+ let rootFrame = BTree.getAt(1, closeStack);
154
154
 
155
155
  closeStack = BTree.replaceAt(0, closeStack, buildPathFrame(lastProperty));
156
156
  if (rootFrame) {
@@ -639,6 +639,7 @@ export const getOr = (defaultValue, path, node) => {
639
639
  };
640
640
 
641
641
  export function* list(name, node) {
642
+ if (isArray(name)) throw new Error('not supported');
642
643
  let count = countList(name, node);
643
644
 
644
645
  for (let i = 0; i < count; i++) {
@@ -2175,6 +2176,8 @@ export class TagPath {
2175
2176
  ({ node } = tag.value);
2176
2177
  break;
2177
2178
  }
2179
+ case GapNode:
2180
+ case NullNode:
2178
2181
  case TreeNode: {
2179
2182
  node = tag;
2180
2183
  break;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bablr/agast-helpers",
3
3
  "description": "Helper functions for working with agAST trees",
4
- "version": "0.10.9",
4
+ "version": "0.10.10",
5
5
  "author": "Conrad Buck<conartist6@gmail.com>",
6
6
  "type": "module",
7
7
  "files": [
@@ -27,7 +27,7 @@
27
27
  "test": "mocha test/*.test.js"
28
28
  },
29
29
  "dependencies": {
30
- "@bablr/btree": "0.4.4",
30
+ "@bablr/btree": "0.4.5",
31
31
  "@bablr/coroutine": "0.1.0",
32
32
  "@bablr/stream-iterator": "2.0.0",
33
33
  "@iter-tools/imm-stack": "1.2.0"