clarity-pattern-parser 10.2.7 → 10.2.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.
@@ -2894,11 +2894,11 @@
2894
2894
  const pattern = this._recursivePatterns[i];
2895
2895
  const node = pattern.parse(cursor);
2896
2896
  if (node != null) {
2897
- if (lastBinaryNode != null && lastUnaryNode != null) {
2898
- lastBinaryNode.appendChild(lastUnaryNode);
2899
- }
2900
2897
  const name = this._recursiveNames[i];
2901
2898
  if (this._endsInRecursion[i]) {
2899
+ if (lastBinaryNode != null && lastUnaryNode != null) {
2900
+ lastBinaryNode.appendChild(lastUnaryNode);
2901
+ }
2902
2902
  const frontExpression = lastBinaryNode == null ? lastUnaryNode : lastBinaryNode.findRoot();
2903
2903
  const recursiveNode = createNode(name, [frontExpression, ...node.children]);
2904
2904
  recursiveNode.normalize(this._firstIndex);
@@ -2911,6 +2911,12 @@
2911
2911
  if (cursor.hasNext()) {
2912
2912
  cursor.next();
2913
2913
  }
2914
+ else {
2915
+ if (lastBinaryNode != null) {
2916
+ lastBinaryNode.appendChild(lastUnaryNode);
2917
+ }
2918
+ break outer;
2919
+ }
2914
2920
  break;
2915
2921
  }
2916
2922
  }