Add scripts and instructions for switching between tree-sitter versions #81
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This will facilitate regenerating grammar code using the old tree-sitter (0.20.6) as required by many target languages in ocaml-tree-sitter-semgrep. I need to regenerate them because I'm changing the format of the parse results to accommodate the so-called extras.
Changes
tree-sitter-version.default
instead of being in a script.tree-sitter-version
../scripts/switch-tree-sitter-version
for developers of ocaml-tree-sitter-semgrep who need to switch back and forth between tree-sitter versions (without having to recompile everything).Compatibility
Building and installing the tree-sitter and ocaml-tree-sitter runtime libraries - as needed by semgrep - is unchanged. The default destination folder of the tree-sitter binaries and libraries is still
tree-sitter
(except that it's now a symlink).Tests
Test for the default tree-sitter version (0.22.6):
Test for the older tree-sitter version (0.20.6):
Check that re-running
make setup
is faster the second time around for a given tree-sitter version.Documentation
This situation is temporary and hopefully won't happen again. This is due to the recent tree-sitter no longer supporting C++ scanners. I added a minimal paragraph about version management to the readme.
Security