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.js CHANGED
@@ -2964,6 +2964,7 @@ class ExpressionPattern {
2964
2964
  this._firstIndex = cursor.index;
2965
2965
  const node = this._tryToParse(cursor);
2966
2966
  if (node != null) {
2967
+ node.normalize(this._firstIndex);
2967
2968
  cursor.moveTo(node.lastIndex);
2968
2969
  cursor.resolveError();
2969
2970
  this._compactResult(node);
@@ -3053,6 +3054,9 @@ class ExpressionPattern {
3053
3054
  break;
3054
3055
  }
3055
3056
  onIndex = cursor.index;
3057
+ if (prefix != null && this._recursivePatterns.length === 0) {
3058
+ lastAtomNode = createNode(prefixName, [prefix, lastAtomNode]);
3059
+ }
3056
3060
  for (let i = 0; i < this._recursivePatterns.length; i++) {
3057
3061
  const pattern = this._recursivePatterns[i];
3058
3062
  const node = pattern.parse(cursor);
@@ -3067,7 +3071,6 @@ class ExpressionPattern {
3067
3071
  }
3068
3072
  const frontExpression = lastBinaryNode == null ? lastAtomNode : lastBinaryNode.findRoot();
3069
3073
  const recursiveNode = createNode(name, [frontExpression, ...node.children]);
3070
- recursiveNode.normalize(this._firstIndex);
3071
3074
  return recursiveNode;
3072
3075
  }
3073
3076
  else {
@@ -3075,7 +3078,6 @@ class ExpressionPattern {
3075
3078
  lastAtomNode = createNode(prefixName, [prefix, lastAtomNode]);
3076
3079
  }
3077
3080
  const recursiveNode = createNode(name, [lastAtomNode, ...node.children]);
3078
- recursiveNode.normalize(lastAtomNode.startIndex);
3079
3081
  lastAtomNode = recursiveNode;
3080
3082
  if (cursor.hasNext()) {
3081
3083
  cursor.next();
@@ -3184,7 +3186,6 @@ class ExpressionPattern {
3184
3186
  return lastAtomNode;
3185
3187
  }
3186
3188
  }
3187
- root.normalize(this._firstIndex);
3188
3189
  return root;
3189
3190
  }
3190
3191
  }