clarity-pattern-parser 11.0.9 → 11.0.11

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": "11.0.9",
3
+ "version": "11.0.11",
4
4
  "description": "Parsing Library for Typescript and Javascript.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.esm.js",
@@ -419,7 +419,7 @@ export class Grammar {
419
419
  const anonymousNode = node.find(n => n.name === "configurable-anonymous-pattern") as Node;
420
420
  const isOptional = node.children[1] != null;
421
421
 
422
- const anonymous = isOptional ? new Optional(name, this._buildPattern(anonymousNode)) : this._buildPattern(anonymousNode);
422
+ const anonymous = isOptional ? new Optional(name, this._buildPattern(anonymousNode.children[0])) : this._buildPattern(anonymousNode.children[0]);
423
423
  this._parseContext.patternsByName.set(name, anonymous);
424
424
  }
425
425
 
@@ -108,7 +108,7 @@ export class Regex implements Pattern {
108
108
  private tryToParse(cursor: Cursor) {
109
109
  const result = this._regex.exec(this._substring);
110
110
 
111
- if (result != null && result.index === 0) {
111
+ if (result != null && result.length > 0 && result.index === 0) {
112
112
  this.processResult(cursor, result);
113
113
  } else {
114
114
  this.processError(cursor);