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)
* Rename corpus test functions to allow easy filtering by language
* Use usize for seed argument
* Avoid retaining useless stack versions when reductions merge
We found this problem when debugging an infinite loop that happened
during error recovery when using the Zig grammar. The large number of
unnecessary paused stack versions were preventing the correct recovery
strategy from being tried.
* Fix leaked lookahead token when reduction results in a merged stack
* Enable running PHP tests in CI
* Fix possible infinite loop during error recovery at EOF
* Account for external scanner state changes when detecting changed ranges in subtrees
(cherry picked from commit 066fd77d39)
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Problem: Linking different parsers into one executable fails due to duplicate symbols.
Solution: Mark `TSCharacterRange` as `static` when generating parsers.
fixes#4209
(cherry picked from commit 8138dba800)
Instead of having users declare the extern function themselves, they can
pass in the language to `Language.create` in the zig bindings. If they
really want, they can always opt into the `extern fn tree_sitter_LANG()
*const ts.Language` approach.
**Problem:** When resetting the parser during subtree balancing, an
error is thrown:
```
parser.c:2198: ts_parser_parse: Assertion `self->finished_tree.ptr' failed.
```
**Solution:** Reset `canceled_balancing` to false in
`ts_parser_reset()`.
This allows users to bail parsing if an error was *definitely* detected
using the progress callback, as all possible stack versions have a
non-zero error cost.
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
This patch allows users to include the parser by the same path from
local build as well as installed location. Previously it was not
possible to include the header prior to installing the built parser.