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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clarity-pattern-parser",
3
- "version": "10.3.5",
3
+ "version": "10.3.7",
4
4
  "description": "Parsing Library for Typescript and Javascript.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.esm.js",
@@ -257,6 +257,8 @@ export class ExpressionPattern implements Pattern {
257
257
  const node = this._tryToParse(cursor);
258
258
 
259
259
  if (node != null) {
260
+ node.normalize(this._firstIndex);
261
+
260
262
  cursor.moveTo(node.lastIndex);
261
263
  cursor.resolveError();
262
264
  this._compactResult(node);
@@ -360,6 +362,10 @@ export class ExpressionPattern implements Pattern {
360
362
 
361
363
  onIndex = cursor.index;
362
364
 
365
+ if (prefix != null && this._recursivePatterns.length === 0) {
366
+ lastAtomNode = createNode(prefixName, [prefix, lastAtomNode]);
367
+ }
368
+
363
369
  for (let i = 0; i < this._recursivePatterns.length; i++) {
364
370
  const pattern = this._recursivePatterns[i];
365
371
  const node = pattern.parse(cursor);
@@ -378,7 +384,6 @@ export class ExpressionPattern implements Pattern {
378
384
  const frontExpression = lastBinaryNode == null ? lastAtomNode as Node : lastBinaryNode.findRoot();
379
385
  const recursiveNode = createNode(name, [frontExpression, ...node.children]);
380
386
 
381
- recursiveNode.normalize(this._firstIndex);
382
387
 
383
388
  return recursiveNode;
384
389
  } else {
@@ -387,7 +392,6 @@ export class ExpressionPattern implements Pattern {
387
392
  }
388
393
 
389
394
  const recursiveNode = createNode(name, [lastAtomNode, ...node.children]);
390
- recursiveNode.normalize(lastAtomNode.startIndex);
391
395
  lastAtomNode = recursiveNode;
392
396
 
393
397
  if (cursor.hasNext()) {
@@ -511,7 +515,6 @@ export class ExpressionPattern implements Pattern {
511
515
  }
512
516
  }
513
517
 
514
- root.normalize(this._firstIndex);
515
518
  return root;
516
519
  }
517
520
  }