Max Brunsfeld
9dd725b4e3
Start work on exposing APIs for node descendant counts and indices
2023-06-09 08:51:47 -07:00
Andrew Hlynskyi
da269ac350
test: add a test case to demonstrate the #2107 issue
2023-05-13 19:40:49 +03:00
Andrew Hlynskyi
ceac2380ed
chore(test): reorganize test helpers
2023-05-12 19:29:51 +03:00
Andrew Hlynskyi
85a588b5b0
Fix tests, adapt to tree-sitter-json 40a81c01a40ac48744e0c8ccabbaba1920441199
2023-04-22 12:08:50 +03:00
Andrew Hlynskyi
d4d5e29c91
feat(lib): ts_query_cursor_set_max_start_depth - use 0 to reset
2023-04-17 11:16:04 +03:00
Lewis Russell
1e81a1b67f
feat(lib): add ts_query_cursor_set_max_start_depth query API
...
This allows configuring cursors from traversing too deep into a tree.
2023-04-17 11:15:13 +03:00
Andrew Hlynskyi
0d326824d2
test: add a reproducing test for #2162
2023-04-06 04:49:39 +03:00
Andrew Hlynskyi
c1f784498f
chore: nit picking in internal proc_macro crate
2023-04-04 13:51:10 +03:00
Andrew Hlynskyi
da894afef5
cargo: specify minimum supported Rust version
2023-04-04 03:42:55 +03:00
Andrew Hlynskyi
ddb0af9509
test: use random SEED numbers
...
This is needed to omit occurrences of the same seed in a sequence of
following seeds due to the reason of that two initial seed are very
close if based on unix epoch seconds.
2023-03-16 15:17:21 +02:00
Andrew Hlynskyi
3aeef44eb6
test: run all corpus tests with 10 retries
2023-03-16 15:17:21 +02:00
Andrew Hlynskyi
588549c093
test: run test_parsing_with_a_timeout with 10 retries
2023-03-16 15:17:21 +02:00
Andrew Hlynskyi
62f8c431ae
test: add retry and test_with_seed proc macros
2023-03-16 15:17:21 +02:00
Andrew Hlynskyi
ca152a93dd
ci: fix tests
2023-03-14 20:06:31 +02:00
Max Brunsfeld
8dcf851739
Add unit test for querying within a range of a long top-level repetition
2023-02-16 12:03:51 -08:00
Max Brunsfeld
837899e456
Add API for checking if a pattern in a query is non-local
2023-02-16 11:59:34 -08:00
Max Brunsfeld
40703f110c
Fix bug in maintenance of query cursor's tree depth
2023-02-16 11:59:34 -08:00
Max Brunsfeld
bd63fb2a0d
Tweak query tests
2023-02-16 11:59:34 -08:00
Max Brunsfeld
8e3dc7cd7a
Add tests that randomly edit files with disjoint included ranges
2022-11-14 16:04:37 -08:00
Max Brunsfeld
d07f864815
Fix parse error when reusing a node at the end of an included range
2022-11-11 16:34:57 -08:00
Max Brunsfeld
da6e24de17
Fix adjustment of trees' included ranges on edits
...
Previously, when an included range started or ended *inside* of
an edit, that range did not get updated correctly.
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2022-11-07 16:52:19 -08:00
Max Brunsfeld
f0177f216e
Use library-configured allocator to free intermediate included ranges
2022-11-07 10:48:32 -08:00
Max Brunsfeld
1b86ccecc8
Merge pull request #1845 from tree-sitter/root-node-with-offset
...
Add API for applying a positional offset when accessing a tree's nodes
2022-08-25 10:51:20 -07:00
Max Brunsfeld
6b87326470
Merge pull request #1787 from kianmeng/fix-typos
...
Fix typos
2022-08-25 10:25:39 -07:00
Max Brunsfeld
53ed4cf037
Tolerate tree edits whose old range extends beyond the end of the tree
2022-08-25 10:20:40 -07:00
Max Brunsfeld
477b667753
Add ts_tree_root_node_with_offset API
2022-08-18 13:48:47 -07:00
Max Brunsfeld
548c12fb88
Fix bug where patterns with top-level alternatives were not considered 'rooted'
2022-07-07 17:53:54 -07:00
Max Brunsfeld
1401767689
query: Don't attempt to match top-level sibling patterns directly in ERROR nodes
...
Co-authored-by: Keith Simmons <keith@zed.dev>
2022-07-07 15:27:00 -07:00
Kian-Meng Ang
b8552ec6c4
Fix typos
2022-06-28 19:57:42 +08:00
Max Brunsfeld
8b5ff2ec8f
Loosen randomized changed range assertions on newline characters
...
For now, don't error if the scope changes for a newline character.
2022-06-25 17:13:46 -07:00
Max Brunsfeld
58b719541b
Fix failure to match queries with wildcard at root with range restrictions
2022-06-22 15:54:06 -07:00
Aleksei Bavshin
b27b4665ac
test: fix incorrect uses of i8 instead of c_char
...
Fixes build on aarch64, ppc64le and other platforms that have c_char
defined as u8.
2022-03-23 00:00:26 -07:00
Max Brunsfeld
7170ec7c96
Improve randomized testing setup
...
* Allow iterations to be specified via an env var
* Randomly decide the edit count, with a maximum
specified via an env var.
* Instead of separate env vars for starting seed + trial, just accept a seed
* Remove some noisy output
2022-03-02 17:12:25 -08:00
Max Brunsfeld
a494d6aa28
Merge pull request #1668 from tree-sitter/remember-lookahead-bytes-on-error-detection
...
Remember lookahead bytes on error detection
2022-02-26 14:59:40 -08:00
Max Brunsfeld
c697ebfb27
Add explicit unit test for error detection lookahead bug
2022-02-26 14:33:09 -08:00
Max Brunsfeld
5eb0a3090f
Merge pull request #1547 from the-mikedavis/md-test-tags
...
test tags queries in 'tree-sitter test'
2022-02-24 15:22:15 -08:00
Max Brunsfeld
cb4317ba8e
Change goto_first_child_for_{byte,point} to compare nodes' ranges inclusively
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-04 12:38:33 -08:00
Michael Davis
02abc2a063
add test for removals in eager query matches
2022-01-18 20:54:55 -06:00
Hendrik van Antwerpen
ec9b00e5c6
Handle multiple top-level alternations correctly
2022-01-11 18:33:36 +01:00
Hendrik van Antwerpen
a1a241b013
Expose quantifiers per pattern, instead of merging for all patterns in a query
2022-01-11 18:33:36 +01:00
Hendrik van Antwerpen
1f1a449c76
Improve capture quantifier computation
...
Compute quantifiers in a bottom-up manner, which allows more precise
results for alternations, where the quantifiers are now precisly joined.
2022-01-11 18:33:36 +01:00
Max Brunsfeld
622359b400
Simplify allocation-recording in test suite using new ts_set_allocator API
2021-12-30 16:09:07 -08:00
Michael Davis
e7f0cc4e24
add python test case for tag testing
2021-12-18 11:07:46 -06:00
Michael Davis
47dc88b647
add tags config fixture test helper
2021-12-18 11:07:18 -06:00
Max Brunsfeld
26dac9b2dd
Fix query bugs revealed by randomized tests
...
* Fix bugs related to named wildcard patterns vs regular wildcard patterns.
* Fix handling of extra nodes during query analysis. Previously, the
expected child_index was updated incorrectly after an extra node,
leading to false "impossible pattern" errors.
* Refine logic for avoiding unnecessary state-splitting due to fallible steps.
Compute *two* different analysis results related to step fallibility:
* `root_pattern_guaranteed` which, like before, summarizes whether the
entire pattern is guaranteed to match once this step is reached.
* `parent_pattern_guaranteed` - which just indicates whether the
immediate parent pattern is guaranteed. This is now used when
deciding whether it's necessary to split a match state.
2021-11-21 12:02:58 -08:00
Max Brunsfeld
142f4b6438
Rename Query::step_is_definite -> is_pattern_guaranteed_at_step
2021-11-21 11:37:52 -08:00
Max Brunsfeld
f69c4861c3
Add a randomized test for query matching
2021-11-21 11:29:36 -08:00
Max Brunsfeld
2f9b7ac465
Fix logging of seed in randomized test
2021-11-19 12:16:54 -08:00
Max Brunsfeld
d05c665863
Convert some of the fixture grammars from JSON to JS
...
These tests are easier to write and maintain if the grammars are just JS,
like grammars normally are. It doesn't slow the tests down significantly
to shell out to `node` for each of these grammars.
2021-10-22 18:47:23 -06:00
Max Brunsfeld
ddb12dc0c6
query: Return error on unclosed tree pattern in alternation
...
Fixes #1436
2021-10-12 09:20:43 -07:00