clarity-pattern-parser 11.0.11 → 11.0.14

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.
@@ -737,7 +737,7 @@
737
737
  }
738
738
  tryToParse(cursor) {
739
739
  const result = this._regex.exec(this._substring);
740
- if (result != null && result.length > 0 && result.index === 0) {
740
+ if (result != null && result[0].length > 0 && result.index === 0) {
741
741
  this.processResult(cursor, result);
742
742
  }
743
743
  else {
@@ -3607,7 +3607,7 @@
3607
3607
  const isNot = n.find(n => n.name === "not") != null;
3608
3608
  const isOptional = n.find(n => n.name === "is-optional");
3609
3609
  const pattern = this._buildPattern(patternNode);
3610
- const finalPattern = isOptional ? new Optional(pattern.name, pattern) : pattern;
3610
+ const finalPattern = isOptional ? new Optional(`optional-${pattern.name}`, pattern) : pattern;
3611
3611
  if (isNot) {
3612
3612
  return new Not(`not-${finalPattern.name}`, finalPattern);
3613
3613
  }
@@ -3666,7 +3666,7 @@
3666
3666
  isOptional = true;
3667
3667
  }
3668
3668
  }
3669
- return isOptional ? new Optional(name, new Repeat(name, pattern, options)) : new Repeat(name, pattern, options);
3669
+ return isOptional ? new Optional(name, new Repeat(`inner-optional-${name}`, pattern, options)) : new Repeat(name, pattern, options);
3670
3670
  }
3671
3671
  _saveConfigurableAnonymous(node) {
3672
3672
  const nameNode = node.find(n => n.name === "name");