clarity-pattern-parser 11.0.12 → 11.0.15
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 +7 -6
- package/dist/index.browser.js.map +1 -1
- package/dist/index.esm.js +7 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/grammar/Grammar.test.ts +3 -3
- package/src/grammar/Grammar.ts +2 -2
- package/src/patterns/Reference.ts +7 -6
- package/src/query/query.ts +48 -0
- package/src/query/selector_parser.ts +8 -0
package/dist/index.browser.js
CHANGED
|
@@ -861,18 +861,19 @@
|
|
|
861
861
|
}
|
|
862
862
|
parse(cursor) {
|
|
863
863
|
this._firstIndex = cursor.index;
|
|
864
|
-
this.
|
|
864
|
+
const pattern = this.getReferencePatternSafely();
|
|
865
|
+
this._cacheAncestors(pattern.id);
|
|
865
866
|
if (this._isBeyondRecursiveAllowance()) {
|
|
866
867
|
cursor.recordErrorAt(this._firstIndex, this._firstIndex, this);
|
|
867
868
|
return null;
|
|
868
869
|
}
|
|
869
|
-
return
|
|
870
|
+
return pattern.parse(cursor);
|
|
870
871
|
}
|
|
871
|
-
_cacheAncestors() {
|
|
872
|
+
_cacheAncestors(id) {
|
|
872
873
|
if (!this._cachedAncestors) {
|
|
873
874
|
let pattern = this.parent;
|
|
874
875
|
while (pattern != null) {
|
|
875
|
-
if (pattern.
|
|
876
|
+
if (pattern.id === id) {
|
|
876
877
|
this._recursiveAncestors.push(pattern);
|
|
877
878
|
}
|
|
878
879
|
pattern = pattern.parent;
|
|
@@ -3607,7 +3608,7 @@
|
|
|
3607
3608
|
const isNot = n.find(n => n.name === "not") != null;
|
|
3608
3609
|
const isOptional = n.find(n => n.name === "is-optional");
|
|
3609
3610
|
const pattern = this._buildPattern(patternNode);
|
|
3610
|
-
const finalPattern = isOptional ? new Optional(pattern.name
|
|
3611
|
+
const finalPattern = isOptional ? new Optional(`optional-${pattern.name}`, pattern) : pattern;
|
|
3611
3612
|
if (isNot) {
|
|
3612
3613
|
return new Not(`not-${finalPattern.name}`, finalPattern);
|
|
3613
3614
|
}
|
|
@@ -3666,7 +3667,7 @@
|
|
|
3666
3667
|
isOptional = true;
|
|
3667
3668
|
}
|
|
3668
3669
|
}
|
|
3669
|
-
return isOptional ? new Optional(name, new Repeat(name
|
|
3670
|
+
return isOptional ? new Optional(name, new Repeat(`inner-optional-${name}`, pattern, options)) : new Repeat(name, pattern, options);
|
|
3670
3671
|
}
|
|
3671
3672
|
_saveConfigurableAnonymous(node) {
|
|
3672
3673
|
const nameNode = node.find(n => n.name === "name");
|