Comparing version 0.15.5 to 0.15.6
@@ -200,3 +200,4 @@ import { Parser, NodeSet, NodeType, DefaultBufferLength, NodeProp, Tree } from '@lezer/common'; | ||
} | ||
// Add a prebuilt (reused) node into the buffer. @internal | ||
// Add a prebuilt (reused) node into the buffer. | ||
/// @internal | ||
useNode(value, next) { | ||
@@ -1025,4 +1026,11 @@ let index = this.p.reused.length - 1; | ||
Rec[Rec["MaxRemainingPerStep"] = 3] = "MaxRemainingPerStep"; | ||
Rec[Rec["MinBufferLengthPrune"] = 200] = "MinBufferLengthPrune"; | ||
// When two stacks have been running independently long enough to | ||
// add this many elements to their buffers, prune one. | ||
Rec[Rec["MinBufferLengthPrune"] = 500] = "MinBufferLengthPrune"; | ||
Rec[Rec["ForceReduceLimit"] = 10] = "ForceReduceLimit"; | ||
// Once a stack reaches this depth (in .stack.length) force-reduce | ||
// it back to CutTo to avoid creating trees that overflow the stack | ||
// on recursive traversal. | ||
Rec[Rec["CutDepth"] = 15000] = "CutDepth"; | ||
Rec[Rec["CutTo"] = 9000] = "CutTo"; | ||
})(Rec || (Rec = {})); | ||
@@ -1123,3 +1131,3 @@ class Parse { | ||
if (stack.sameState(other) || | ||
stack.buffer.length > 200 /* MinBufferLengthPrune */ && other.buffer.length > 200 /* MinBufferLengthPrune */) { | ||
stack.buffer.length > 500 /* MinBufferLengthPrune */ && other.buffer.length > 500 /* MinBufferLengthPrune */) { | ||
if (((stack.score - other.score) || (stack.buffer.length - other.buffer.length)) > 0) { | ||
@@ -1182,2 +1190,5 @@ newStacks.splice(j--, 1); | ||
} | ||
if (stack.stack.length >= 15000 /* CutDepth */) { | ||
while (stack.stack.length > 9000 /* CutTo */ && stack.forceReduce()) { } | ||
} | ||
let actions = this.tokens.getActions(stack); | ||
@@ -1184,0 +1195,0 @@ for (let i = 0; i < actions.length;) { |
{ | ||
"name": "@lezer/lr", | ||
"version": "0.15.5", | ||
"version": "0.15.6", | ||
"description": "Incremental parser", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs", |
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
136137
3376