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.browser.js
CHANGED
|
@@ -2790,11 +2790,11 @@
|
|
|
2790
2790
|
}
|
|
2791
2791
|
_isBinaryPattern(pattern) {
|
|
2792
2792
|
return pattern.type === "sequence" &&
|
|
2793
|
+
pattern.children.length === 3 &&
|
|
2793
2794
|
pattern.children[0].type === "reference" &&
|
|
2794
2795
|
pattern.children[0].name === this.name &&
|
|
2795
2796
|
pattern.children[2].type === "reference" &&
|
|
2796
|
-
pattern.children[2].name === this.name
|
|
2797
|
-
pattern.children.length === 3;
|
|
2797
|
+
pattern.children[2].name === this.name;
|
|
2798
2798
|
}
|
|
2799
2799
|
_extractDelimiter(pattern) {
|
|
2800
2800
|
if (pattern.type === "right-associated") {
|
|
@@ -2930,10 +2930,21 @@
|
|
|
2930
2930
|
lastBinaryNode = node;
|
|
2931
2931
|
}
|
|
2932
2932
|
else if (precedence > lastPrecendece) {
|
|
2933
|
-
|
|
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, [
|
|
2945
|
+
const node = createNode(name, []);
|
|
2946
|
+
root.replaceWith(node);
|
|
2947
|
+
node.append(root, delimiterNode);
|
|
2937
2948
|
lastBinaryNode = node;
|
|
2938
2949
|
}
|
|
2939
2950
|
else {
|