clarity-pattern-parser 10.3.5 → 10.3.7

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.esm.js CHANGED
@@ -2960,6 +2960,7 @@ class ExpressionPattern {
2960
2960
  this._firstIndex = cursor.index;
2961
2961
  const node = this._tryToParse(cursor);
2962
2962
  if (node != null) {
2963
+ node.normalize(this._firstIndex);
2963
2964
  cursor.moveTo(node.lastIndex);
2964
2965
  cursor.resolveError();
2965
2966
  this._compactResult(node);
@@ -3049,6 +3050,9 @@ class ExpressionPattern {
3049
3050
  break;
3050
3051
  }
3051
3052
  onIndex = cursor.index;
3053
+ if (prefix != null && this._recursivePatterns.length === 0) {
3054
+ lastAtomNode = createNode(prefixName, [prefix, lastAtomNode]);
3055
+ }
3052
3056
  for (let i = 0; i < this._recursivePatterns.length; i++) {
3053
3057
  const pattern = this._recursivePatterns[i];
3054
3058
  const node = pattern.parse(cursor);
@@ -3063,7 +3067,6 @@ class ExpressionPattern {
3063
3067
  }
3064
3068
  const frontExpression = lastBinaryNode == null ? lastAtomNode : lastBinaryNode.findRoot();
3065
3069
  const recursiveNode = createNode(name, [frontExpression, ...node.children]);
3066
- recursiveNode.normalize(this._firstIndex);
3067
3070
  return recursiveNode;
3068
3071
  }
3069
3072
  else {
@@ -3071,7 +3074,6 @@ class ExpressionPattern {
3071
3074
  lastAtomNode = createNode(prefixName, [prefix, lastAtomNode]);
3072
3075
  }
3073
3076
  const recursiveNode = createNode(name, [lastAtomNode, ...node.children]);
3074
- recursiveNode.normalize(lastAtomNode.startIndex);
3075
3077
  lastAtomNode = recursiveNode;
3076
3078
  if (cursor.hasNext()) {
3077
3079
  cursor.next();
@@ -3180,7 +3182,6 @@ class ExpressionPattern {
3180
3182
  return lastAtomNode;
3181
3183
  }
3182
3184
  }
3183
- root.normalize(this._firstIndex);
3184
3185
  return root;
3185
3186
  }
3186
3187
  }