clarity-pattern-parser 10.2.0 → 10.2.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.
@@ -2930,10 +2930,21 @@
2930
2930
  lastBinaryNode = node;
2931
2931
  }
2932
2932
  else if (precedence > lastPrecendece) {
2933
- const root = lastBinaryNode.findRoot();
2933
+ let ancestor = lastBinaryNode.parent;
2934
+ let root = lastBinaryNode;
2935
+ while (ancestor != null) {
2936
+ const nodePrecedence = this._precedenceMap[ancestor.name];
2937
+ if (nodePrecedence > precedence) {
2938
+ break;
2939
+ }
2940
+ root = ancestor;
2941
+ ancestor = ancestor.parent;
2942
+ }
2934
2943
  lastBinaryNode.appendChild(lastUnaryNode);
2935
2944
  if (root != null) {
2936
- const node = createNode(name, [root, delimiterNode]);
2945
+ const node = createNode(name, []);
2946
+ root.replaceWith(node);
2947
+ node.append(root, delimiterNode);
2937
2948
  lastBinaryNode = node;
2938
2949
  }
2939
2950
  else {