@bablr/bablr-vm 0.23.0 → 0.23.1

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/match.js +15 -4
  2. package/package.json +1 -1
package/lib/match.js CHANGED
@@ -679,9 +679,18 @@ export class Match extends WeakStackFrame {
679
679
  let finishedMatch = m;
680
680
  m = m.parent;
681
681
 
682
- let parentNextTagPath = Path.from(m.rootNode)
683
- .tagPathAt(getCloseTag(m.rootNode) ? -2 : -1)
684
- .inner?.tagPathAt(finishedMatch.parentPreviousTagPath.tagsIndex + 2);
682
+ let parentRoot = Path.from(m.rootNode);
683
+
684
+ if (m.type !== '__') {
685
+ parentRoot = parentRoot.tagPathAt(getCloseTag(m.rootNode) ? -2 : -1).inner;
686
+ }
687
+
688
+ let finishedChildren =
689
+ finishedMatch.type !== '__' ? 1 : Tags.getSize(finishedMatch.rootNode.value.children);
690
+
691
+ let parentNextTagPath = parentRoot?.tagPathAt(
692
+ finishedMatch.parentPreviousTagPath.tagsIndex + finishedChildren + 1,
693
+ );
685
694
 
686
695
  tagPath = parentNextTagPath;
687
696
 
@@ -750,7 +759,9 @@ export class Match extends WeakStackFrame {
750
759
  do {
751
760
  if (m.running) {
752
761
  m = m.running;
753
- tagPath = TagPath.fromNode(m.rootNode, 0);
762
+ // TODO is -1 ok
763
+ let shiftIndex = m.didShift ? -1 : 0;
764
+ tagPath = TagPath.fromNode(m.rootNode, shiftIndex);
754
765
  } else if (m.parent && (!m.parent.running || m.parent.running !== m)) {
755
766
  tagPath = m.parentPreviousTagPath;
756
767
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bablr/bablr-vm",
3
3
  "description": "A VM for parsing using BABLR languages",
4
- "version": "0.23.0",
4
+ "version": "0.23.1",
5
5
  "author": "Conrad Buck<conartist6@gmail.com>",
6
6
  "type": "module",
7
7
  "files": [