clarity-pattern-parser 11.5.0 → 11.5.1
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 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.esm.js +7 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/patterns/Expression.d.ts +1 -0
- package/package.json +1 -1
- package/src/patterns/Expression.ts +8 -1
package/dist/index.browser.js
CHANGED
|
@@ -2903,6 +2903,7 @@
|
|
|
2903
2903
|
this._name = name;
|
|
2904
2904
|
this._originalName = name;
|
|
2905
2905
|
this._parent = null;
|
|
2906
|
+
this._cachedParent = null;
|
|
2906
2907
|
this._firstIndex = 0;
|
|
2907
2908
|
this._atomPatterns = [];
|
|
2908
2909
|
this._prefixPatterns = [];
|
|
@@ -3053,7 +3054,8 @@
|
|
|
3053
3054
|
return pattern.name === this._originalName;
|
|
3054
3055
|
}
|
|
3055
3056
|
build() {
|
|
3056
|
-
if (!this._hasOrganized) {
|
|
3057
|
+
if (!this._hasOrganized || this._cachedParent !== this.parent) {
|
|
3058
|
+
this._cachedParent = this.parent;
|
|
3057
3059
|
this._hasOrganized = true;
|
|
3058
3060
|
this._organizePatterns(this._originalPatterns);
|
|
3059
3061
|
this._cacheAncestors();
|
|
@@ -3224,11 +3226,13 @@
|
|
|
3224
3226
|
return execPattern(this, text, record);
|
|
3225
3227
|
}
|
|
3226
3228
|
getTokens() {
|
|
3229
|
+
this.build();
|
|
3227
3230
|
const atomTokens = this._atomPatterns.map(p => p.getTokens()).flat();
|
|
3228
3231
|
const prefixTokens = this.prefixPatterns.map(p => p.getTokens()).flat();
|
|
3229
3232
|
return [...prefixTokens, ...atomTokens];
|
|
3230
3233
|
}
|
|
3231
3234
|
getTokensAfter(childReference) {
|
|
3235
|
+
this.build();
|
|
3232
3236
|
if (this._prefixPatterns.includes(childReference) || this._binaryPatterns.includes(childReference)) {
|
|
3233
3237
|
const atomTokens = this._atomPatterns.map(p => p.getTokens()).flat();
|
|
3234
3238
|
const prefixTokens = this.prefixPatterns.map(p => p.getTokens()).flat();
|
|
@@ -3255,11 +3259,13 @@
|
|
|
3255
3259
|
return this._parent.getTokensAfter(this);
|
|
3256
3260
|
}
|
|
3257
3261
|
getPatterns() {
|
|
3262
|
+
this.build();
|
|
3258
3263
|
const atomPatterns = this._atomPatterns.map(p => p.getPatterns()).flat();
|
|
3259
3264
|
const prefixPatterns = this.prefixPatterns.map(p => p.getPatterns()).flat();
|
|
3260
3265
|
return [...prefixPatterns, ...atomPatterns];
|
|
3261
3266
|
}
|
|
3262
3267
|
getPatternsAfter(childReference) {
|
|
3268
|
+
this.build();
|
|
3263
3269
|
if (this._prefixPatterns.includes(childReference) || this._binaryPatterns.includes(childReference)) {
|
|
3264
3270
|
const atomPatterns = this._atomPatterns.map(p => p.getPatterns()).flat();
|
|
3265
3271
|
const prefixPatterns = this.prefixPatterns.map(p => p.getPatterns()).flat();
|