Closed clentfort closed 1 month ago
After looking into the types I discovered that I can pass in a bufferSize
as an option to parse
. Setting it to input.length + 3
for any input length seems to solve this problem. The largest input I tried was input = '/'.repeat(Math.pow(2, 28))
.
I just noticed https://github.com/tree-sitter/node-tree-sitter/pull/214 being merged. This might solve this problem. I can't confirm this yet since it has not been released on npm yet.
Should be solved by #214, and a new release is out
I'm trying to parse a file with more than 32767 (2^15-1) chars. This causes the parser to crash with the following error.
If I go down to 32767 chars the input is parsed without problems.
Node version: 18 and 20 node-tree-sitter version: 0.21.1
I tried this with two languages. tree-sitter-hcl and tree-sitter-javascript. Both times with an input of length 2^15-1 and 2^15. Both parsed the string of length 2^15-1 but not the string with 2^15 chars.
A project with the minimal reproduction can be found at https://github.com/clentfort/node-tree-sitter-max-input. It only includes the repo for the javascript grammar since the hcl grammar requires extra steps to work with node-tree-sitter