- Use `globalThis` for `reserved` function export
- Add `reserved` field and function to DSL declarations
- Add `reserved` rule to grammar schema
(cherry picked from commit 07b4c8d05d)
**Problem:** When encountering an invalid symbol at the beginning of the
file, the rust bindings attempt to index the character at position -1 of
the query source, which leads to an overflow and thus invalid character
index which causes a panic.
**Solution:** Bounds check the offset before performing the subtraction.
(cherry picked from commit dff828cdbe)
As the call to `symbol_is_used` does not depend
on the production, it is more efficient to call it
only once outside the loop over productions.
I'm not sure if `rustc` is able to do this optimization
on its own (it would need to know that the function
is pure, which sounds difficult in general).
(cherry picked from commit 36d93aeff3)
The period was dropped in the `thiserror` refactor
(79444e07f9), which caused the
`test_flatten_grammar_with_recursive_inline_variable` test to fail.
Signed-off-by: James McCoy <jamessan@jamessan.com>
(cherry picked from commit a6e530b33d)
* Fix pkgconfig
Init CMAKE_INSTALL_INCLUDEDIR before pc file generation.
Install pc file to CMAKE_INSTALL_LIBDIR/pkgconfig -
it accompanies the architecture-dependent library.
* Include GNUInstallDirs early
The CMake module initializes variables which are used for
exported information (CMake and pkgconfig).
* Change pc file install destination
(cherry picked from commit 0bdf698673)
This reverts commit dc4e232e6e.
Reason: The sha in the generated output (which most distro builds of
tree-sitter, including `cargo install`, strip) produces too many
conflicts when verifying via CI that parsers are regenerated on every
grammar change.
(cherry picked from commit e7f9160867)
It is very common practice to ignore
these lock files for libraries, since they do not apply to applications
that use the libraries. The lock files are especially not useful in
tree-sitter grammar repos, since tree-sitter grammars should not have
dependencies. The lock files are just a source of merge conflicts and
spurious CI failures.
wasn't created.
This fixes an OOB access to `self.steps` when a last child anchor
immediately follows a predicate.
(cherry picked from commit b1d2b7cfb8)
Improve the `NonTokenReservedWord` error message by including the
specific reserved word that was not used as a token.
(cherry picked from commit 92c5d3b8e2)
This makes `parser.c` follow the https://generated.at/ convention for generated files. This potentially allows any compatible IDE to discourage editing it directly.
(cherry picked from commit 52d2865365)