clarity-pattern-parser 10.1.11 → 10.1.13
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 +14 -2
- package/dist/index.browser.js.map +1 -1
- package/dist/index.esm.js +14 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/dist/patterns/Options.d.ts +1 -0
- package/package.json +1 -1
- package/src/patterns/Options.ts +19 -2
package/dist/index.browser.js
CHANGED
|
@@ -1027,11 +1027,12 @@
|
|
|
1027
1027
|
return null;
|
|
1028
1028
|
}
|
|
1029
1029
|
_tryToParse(cursor) {
|
|
1030
|
+
const shouldReverseOrder = this._shouldReverseOrder();
|
|
1030
1031
|
let children = this._children;
|
|
1031
|
-
if (
|
|
1032
|
+
if (shouldReverseOrder) {
|
|
1032
1033
|
children = this._children.slice().reverse();
|
|
1033
1034
|
}
|
|
1034
|
-
|
|
1035
|
+
if (depthCache$1.getDepth(this._id, this._firstIndex) > 2) {
|
|
1035
1036
|
cursor.recordErrorAt(this._firstIndex, this._firstIndex, this);
|
|
1036
1037
|
return null;
|
|
1037
1038
|
}
|
|
@@ -1052,6 +1053,17 @@
|
|
|
1052
1053
|
nonNullResults.sort((a, b) => b.endIndex - a.endIndex);
|
|
1053
1054
|
return nonNullResults[0] || null;
|
|
1054
1055
|
}
|
|
1056
|
+
_shouldReverseOrder() {
|
|
1057
|
+
let count = 0;
|
|
1058
|
+
let pattern = this._parent;
|
|
1059
|
+
while (pattern != null) {
|
|
1060
|
+
if (pattern.id === this.id) {
|
|
1061
|
+
count++;
|
|
1062
|
+
}
|
|
1063
|
+
pattern = pattern.parent;
|
|
1064
|
+
}
|
|
1065
|
+
return count % 2 === 1;
|
|
1066
|
+
}
|
|
1055
1067
|
getTokens() {
|
|
1056
1068
|
const tokens = [];
|
|
1057
1069
|
for (const child of this._children) {
|