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/dist/index.browser.js +2 -2
- package/dist/index.browser.js.map +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/grammar/Grammar.ts +1 -1
- package/src/patterns/Regex.ts +1 -1
package/package.json
CHANGED
package/src/grammar/Grammar.ts
CHANGED
|
@@ -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
|
|
package/src/patterns/Regex.ts
CHANGED
|
@@ -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);
|