clarity-pattern-parser
Advanced tools
Comparing version 10.3.0 to 10.3.1
{ | ||
"name": "clarity-pattern-parser", | ||
"version": "10.3.0", | ||
"version": "10.3.1", | ||
"description": "Parsing Library for Typescript and Javascript.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -99,2 +99,30 @@ import { Options } from "./Options"; | ||
function createTailExpression() { | ||
const a = new Literal("a", "a"); | ||
const b = new Literal("b", "b"); | ||
const c = new Literal("c", "c"); | ||
const variable = new Options("variable", [a, b, c]); | ||
const period = new Literal(".", "."); | ||
const refinement = new Sequence("refinement", [period, variable]); | ||
const refinementExpression = new Sequence("refinement-expression", [ | ||
new Reference("expression"), | ||
refinement | ||
]); | ||
const invocation = new Literal("invocation", "()"); | ||
const invocationExpression = new Sequence("invocation-expression", [ | ||
new Reference("expression"), | ||
invocation | ||
]); | ||
const expression = new ExpressionPattern("expression", [ | ||
refinementExpression, | ||
invocationExpression, | ||
variable | ||
]); | ||
return expression; | ||
} | ||
describe("Expression Pattern", () => { | ||
@@ -117,2 +145,12 @@ test("Single Expression", () => { | ||
test("Tail", () => { | ||
const expression = createTailExpression(); | ||
let result = expression.exec("a"); | ||
result = expression.exec("a.b"); | ||
result = expression.exec("a.b.c"); | ||
result = expression.exec("a.b.c()()()"); | ||
expect(result).toBe(result); | ||
}); | ||
test("Options like", () => { | ||
@@ -119,0 +157,0 @@ const expression = createOptionsExpression(); |
@@ -214,3 +214,2 @@ import { Node } from "../ast/Node"; | ||
parse(cursor: Cursor): Node | null { | ||
// This is a cache to help with speed | ||
this._firstIndex = cursor.index; | ||
@@ -334,3 +333,5 @@ depthCache.incrementDepth(this._id, this._firstIndex); | ||
} | ||
break; | ||
onIndex = cursor.index; | ||
i = -1; | ||
continue; | ||
} | ||
@@ -337,0 +338,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
1263262
21524