Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
compiled parser produces different result than tree sitter cli parse command #447
So I'm developing a tree-sitter grammar for Lux. I've come across an issue where running the parser from node produces a different result than from the tree-sitter cli
Steps to reproduce
Contrast this to parsing the same file from within the tree-sitter-lux repository via the tree-sitter cli
This seems like a bug to me. Regardless of whether the grammar I wrote actually correctly parses Lux code I would still expect the same results from the compiled parser and the
And btw: tree-sitter is awesome! Makes it a lot easier to write proper parsers for language tooling
Ok, so I think it's not a problem with tree-sitter but there was a problem in how I packaged the tree-sitter-lux module. I originally only included the build folder that is produced by node-gyp. And apparently in the build folder there was an parser of the grammar that would allow the erroneous file. It didn't occur to me that the build folder only gets updated on the second call to npm install.
Since then I changed the way how I package the tree-sitter-lux module by including the generated src folder and the binding.gyp file and excluding the build folder. As I understand it, this way the parser gets compiled when a user installs the tree-sitter-lux module.