clarity-pattern-parser 10.2.0 → 10.2.2
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/dist/index.browser.js +15 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.esm.js +15 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/patterns/ExpressionPattern.test.ts +11 -11
- package/src/patterns/ExpressionPattern.ts +20 -5
package/dist/index.js
CHANGED
|
@@ -2788,11 +2788,11 @@ class ExpressionPattern {
|
|
|
2788
2788
|
}
|
|
2789
2789
|
_isBinaryPattern(pattern) {
|
|
2790
2790
|
return pattern.type === "sequence" &&
|
|
2791
|
+
pattern.children.length === 3 &&
|
|
2791
2792
|
pattern.children[0].type === "reference" &&
|
|
2792
2793
|
pattern.children[0].name === this.name &&
|
|
2793
2794
|
pattern.children[2].type === "reference" &&
|
|
2794
|
-
pattern.children[2].name === this.name
|
|
2795
|
-
pattern.children.length === 3;
|
|
2795
|
+
pattern.children[2].name === this.name;
|
|
2796
2796
|
}
|
|
2797
2797
|
_extractDelimiter(pattern) {
|
|
2798
2798
|
if (pattern.type === "right-associated") {
|
|
@@ -2928,10 +2928,21 @@ class ExpressionPattern {
|
|
|
2928
2928
|
lastBinaryNode = node;
|
|
2929
2929
|
}
|
|
2930
2930
|
else if (precedence > lastPrecendece) {
|
|
2931
|
-
|
|
2931
|
+
let ancestor = lastBinaryNode.parent;
|
|
2932
|
+
let root = lastBinaryNode;
|
|
2933
|
+
while (ancestor != null) {
|
|
2934
|
+
const nodePrecedence = this._precedenceMap[ancestor.name];
|
|
2935
|
+
if (nodePrecedence > precedence) {
|
|
2936
|
+
break;
|
|
2937
|
+
}
|
|
2938
|
+
root = ancestor;
|
|
2939
|
+
ancestor = ancestor.parent;
|
|
2940
|
+
}
|
|
2932
2941
|
lastBinaryNode.appendChild(lastUnaryNode);
|
|
2933
2942
|
if (root != null) {
|
|
2934
|
-
const node = createNode(name, [
|
|
2943
|
+
const node = createNode(name, []);
|
|
2944
|
+
root.replaceWith(node);
|
|
2945
|
+
node.append(root, delimiterNode);
|
|
2935
2946
|
lastBinaryNode = node;
|
|
2936
2947
|
}
|
|
2937
2948
|
else {
|