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