clarity-pattern-parser 10.3.4 → 10.3.6
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 +12 -6
- package/dist/index.browser.js.map +1 -1
- package/dist/index.esm.js +12 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/dist/patterns/ExpressionPattern.d.ts +2 -1
- package/package.json +1 -1
- package/src/patterns/ExpressionPattern.ts +14 -6
package/dist/index.browser.js
CHANGED
|
@@ -2802,7 +2802,10 @@
|
|
|
2802
2802
|
get children() {
|
|
2803
2803
|
return this._patterns;
|
|
2804
2804
|
}
|
|
2805
|
-
get
|
|
2805
|
+
get unaryPrefixPatterns() {
|
|
2806
|
+
return this._unaryPrefixPatterns;
|
|
2807
|
+
}
|
|
2808
|
+
get atomPatterns() {
|
|
2806
2809
|
return this._atomPatterns;
|
|
2807
2810
|
}
|
|
2808
2811
|
get binaryPatterns() {
|
|
@@ -2847,7 +2850,7 @@
|
|
|
2847
2850
|
this._shouldCompactPatternsMap[pattern.name] = pattern.shouldCompactAst;
|
|
2848
2851
|
if (this._isUnary(pattern)) {
|
|
2849
2852
|
const unaryPrefix = this._extractUnaryPrefixPattern(pattern).clone();
|
|
2850
|
-
this._unaryPrefixPatterns.push(
|
|
2853
|
+
this._unaryPrefixPatterns.push(unaryPrefix);
|
|
2851
2854
|
this._unaryPrefixNames.push(pattern.name);
|
|
2852
2855
|
unaryPrefix.parent = this;
|
|
2853
2856
|
finalPatterns.push(unaryPrefix);
|
|
@@ -3052,6 +3055,9 @@
|
|
|
3052
3055
|
break;
|
|
3053
3056
|
}
|
|
3054
3057
|
onIndex = cursor.index;
|
|
3058
|
+
if (prefix != null && this._recursivePatterns.length === 0) {
|
|
3059
|
+
lastAtomNode = createNode(prefixName, [prefix, lastAtomNode]);
|
|
3060
|
+
}
|
|
3055
3061
|
for (let i = 0; i < this._recursivePatterns.length; i++) {
|
|
3056
3062
|
const pattern = this._recursivePatterns[i];
|
|
3057
3063
|
const node = pattern.parse(cursor);
|
|
@@ -3216,10 +3222,10 @@
|
|
|
3216
3222
|
};
|
|
3217
3223
|
}
|
|
3218
3224
|
getTokens() {
|
|
3219
|
-
return this.
|
|
3225
|
+
return this.atomPatterns.map(p => p.getTokens()).flat();
|
|
3220
3226
|
}
|
|
3221
3227
|
getTokensAfter(childReference) {
|
|
3222
|
-
if (this.
|
|
3228
|
+
if (this.atomPatterns.indexOf(childReference)) {
|
|
3223
3229
|
const recursiveTokens = this._recursivePatterns.map(p => p.getTokens()).flat();
|
|
3224
3230
|
const binaryTokens = this._binaryPatterns.map(p => p.getTokens()).flat();
|
|
3225
3231
|
return [...recursiveTokens, ...binaryTokens];
|
|
@@ -3244,10 +3250,10 @@
|
|
|
3244
3250
|
return this._parent.getTokensAfter(this);
|
|
3245
3251
|
}
|
|
3246
3252
|
getPatterns() {
|
|
3247
|
-
return this.
|
|
3253
|
+
return this.atomPatterns.map(p => p.getPatterns()).flat();
|
|
3248
3254
|
}
|
|
3249
3255
|
getPatternsAfter(childReference) {
|
|
3250
|
-
if (this.
|
|
3256
|
+
if (this.atomPatterns.indexOf(childReference)) {
|
|
3251
3257
|
const recursivePatterns = this._recursivePatterns.map(p => p.getPatterns()).flat();
|
|
3252
3258
|
const binaryPatterns = this._binaryPatterns.map(p => p.getPatterns()).flat();
|
|
3253
3259
|
return [...recursivePatterns, ...binaryPatterns];
|