clarity-pattern-parser 11.0.14 → 11.0.16
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 +6 -5
- package/dist/index.browser.js.map +1 -1
- package/dist/index.esm.js +6 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/patterns/Reference.ts +8 -7
- package/src/query/query.ts +48 -0
- package/src/query/selector_parser.ts +8 -0
package/dist/index.esm.js
CHANGED
|
@@ -855,18 +855,19 @@ class Reference {
|
|
|
855
855
|
}
|
|
856
856
|
parse(cursor) {
|
|
857
857
|
this._firstIndex = cursor.index;
|
|
858
|
-
this.
|
|
858
|
+
const pattern = this.getReferencePatternSafely();
|
|
859
|
+
this._cacheAncestors(pattern.id);
|
|
859
860
|
if (this._isBeyondRecursiveAllowance()) {
|
|
860
861
|
cursor.recordErrorAt(this._firstIndex, this._firstIndex, this);
|
|
861
862
|
return null;
|
|
862
863
|
}
|
|
863
|
-
return
|
|
864
|
+
return pattern.parse(cursor);
|
|
864
865
|
}
|
|
865
|
-
_cacheAncestors() {
|
|
866
|
+
_cacheAncestors(id) {
|
|
866
867
|
if (!this._cachedAncestors) {
|
|
867
868
|
let pattern = this.parent;
|
|
868
869
|
while (pattern != null) {
|
|
869
|
-
if (pattern.
|
|
870
|
+
if (pattern.id === id) {
|
|
870
871
|
this._recursiveAncestors.push(pattern);
|
|
871
872
|
}
|
|
872
873
|
pattern = pattern.parent;
|
|
@@ -878,7 +879,7 @@ class Reference {
|
|
|
878
879
|
for (let pattern of this._recursiveAncestors) {
|
|
879
880
|
if (pattern._firstIndex === this._firstIndex) {
|
|
880
881
|
depth++;
|
|
881
|
-
if (depth >
|
|
882
|
+
if (depth > 1) {
|
|
882
883
|
return true;
|
|
883
884
|
}
|
|
884
885
|
}
|