clarity-pattern-parser
Advanced tools
Comparing version 11.0.20 to 11.0.21
{ | ||
"name": "clarity-pattern-parser", | ||
"version": "11.0.20", | ||
"version": "11.0.21", | ||
"description": "Parsing Library for Typescript and Javascript.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -13,2 +13,3 @@ import { Sequence } from "../patterns/Sequence"; | ||
import { patterns } from "./patterns"; | ||
import { Expression } from "../patterns/Expression"; | ||
@@ -521,3 +522,3 @@ describe("Grammar", () => { | ||
), | ||
new Options("anonymous", [ | ||
new Expression("anonymous", [ | ||
new Reference("pattern"), | ||
@@ -524,0 +525,0 @@ new Reference("pattern") |
@@ -283,2 +283,6 @@ import { Node } from "../ast/Node"; | ||
private _isRecursivePattern(name: string, pattern: Pattern) { | ||
if (pattern.type === "reference") { | ||
return true; | ||
} | ||
if (pattern.children.length === 0) { | ||
@@ -291,6 +295,5 @@ return false; | ||
const isLongEnough = pattern.children.length >= 2; | ||
return pattern.type === "reference" || | ||
(pattern.type === "sequence" && isLongEnough && | ||
(firstChild.name === name) || | ||
(lastChild.name === name)); | ||
return (pattern.type === "sequence" && isLongEnough && | ||
(firstChild.name === name) || | ||
(lastChild.name === name)); | ||
} | ||
@@ -297,0 +300,0 @@ |
@@ -236,3 +236,5 @@ import { Node } from "../ast/Node"; | ||
if (pattern.type === "reference") { | ||
pattern.parent = this; | ||
pattern = (pattern as Reference).getReferencePatternSafely(); | ||
pattern.parent = null; | ||
} | ||
@@ -239,0 +241,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1311541
22616