Comparing version 0.13.2 to 0.13.3
@@ -0,1 +1,7 @@ | ||
## 0.13.3 (2021-02-17) | ||
### New features | ||
Context trackers can now disable strictness in node reuse. | ||
## 0.13.2 (2021-02-17) | ||
@@ -2,0 +8,0 @@ |
@@ -408,5 +408,8 @@ import { DefaultBufferLength, NodeSet, NodeType, stringInput, Tree, TreeBuffer } from 'lezer-tree'; | ||
emitContext() { | ||
let cx = this.curContext; | ||
if (!cx.tracker.strict) | ||
return; | ||
let last = this.buffer.length - 1; | ||
if (last < 0 || this.buffer[last] != -2) | ||
this.buffer.push(this.curContext.hash, this.reducePos, this.reducePos, -2); | ||
this.buffer.push(cx.hash, this.reducePos, this.reducePos, -2); | ||
} | ||
@@ -994,6 +997,6 @@ updateContext(context) { | ||
if (this.fragments) { | ||
let strictCx = stack.curContext && stack.curContext.tracker.strict, cxHash = strictCx ? stack.curContext.hash : 0; | ||
for (let cached = this.fragments.nodeAt(start); cached;) { | ||
let match = this.parser.nodeSet.types[cached.type.id] == cached.type ? parser.getGoto(stack.state, cached.type.id) : -1; | ||
if (match > -1 && cached.length && | ||
(cached.contextHash || 0) == (stack.curContext ? stack.curContext.hash : 0)) { | ||
if (match > -1 && cached.length && (!strictCx || (cached.contextHash || 0) == cxHash)) { | ||
stack.useNode(cached, match); | ||
@@ -1222,2 +1225,3 @@ if (verbose) | ||
this.hash = spec.hash; | ||
this.strict = spec.strict !== false; | ||
} | ||
@@ -1224,0 +1228,0 @@ } |
@@ -83,2 +83,3 @@ import { Tree, TreeBuffer, TreeFragment, NodeSet, NodeType, NodePropSource, Input, PartialParse, ParseContext } from "lezer-tree"; | ||
hash(context: T): number; | ||
strict?: boolean; | ||
}); | ||
@@ -85,0 +86,0 @@ } |
{ | ||
"name": "lezer", | ||
"version": "0.13.2", | ||
"version": "0.13.3", | ||
"description": "Incremental parser", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
370405
3222