Commit graph

3858 commits

Author SHA1 Message Date
Hendrik van Antwerpen
1d513bcf67 Rewrite quantifier oeprations
- Simplify control flow by having a single return at the end of the function.
- Follow enum order for case order.
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
Hendrik van Antwerpen
9bac066330 Deal with quantifiers appearing on capture's enclosing patterns
- Use a proper enum type for quantifiers.
- Drop quantifiers from `TSQueryStep`, which was not used.
- Keep track of the captures introduced during a pattern parse, and
  apply the quantifier for the pattern to the captures that were
  introduced by the pattern or any sub patterns.
- Use 'quantifier' instead of 'suffix'.
2022-01-11 18:33:36 +01:00
Hendrik van Antwerpen
ae7869d1a6 Expose capture suffixes in queries 2022-01-11 18:33:36 +01:00
Max Brunsfeld
e81976d27a
Merge pull request #1570 from hickford/patch-1
Add link to Protocol Buffers grammar
2022-01-03 09:41:21 -08:00
Max Brunsfeld
b2fe125213
Merge pull request #1571 from 414owen/add-realloc-to-wasm-exports
Add realloc to wasm exports
2022-01-03 09:01:13 -08:00
Owen Shepherd
1aa6541476
Add realloc to wasm exports 2022-01-03 16:07:39 +00:00
M Hickford
4c6175b70a
Add link to Protocol Buffers grammar 2022-01-02 21:18:12 +00:00
Max Brunsfeld
4ee52ee99e 0.20.2 2021-12-31 17:23:08 -08:00
Max Brunsfeld
5d8a1ace56 web: 0.20.2 2021-12-30 17:14:04 -08:00
Max Brunsfeld
f010781efa lib: 0.20.2 2021-12-30 16:35:21 -08:00
Max Brunsfeld
3b7c4e62d2 🎨 subtree.h 2021-12-30 16:33:26 -08:00
Max Brunsfeld
8df0b8de7e Convert more fixture grammars from JSON to JS 2021-12-30 16:27:02 -08:00
Max Brunsfeld
622359b400 Simplify allocation-recording in test suite using new ts_set_allocator API 2021-12-30 16:09:07 -08:00
Max Brunsfeld
e01ea9ff51
Merge pull request #1544 from mkvoya/dynamic-allocator
Allow to change the allocator dynamically
2021-12-28 13:39:11 -08:00
Max Brunsfeld
0a85746cc4
Merge pull request #1473 from thestr4ng3r/big-endian
Make SubtreeInlineData work on Big-Endian
2021-12-26 21:03:26 -08:00
Florian Märkl
d5d99e0bfb Address feedback 2021-12-24 17:07:32 +01:00
Florian Märkl
2024f27534 Make SubtreeInlineData work on Big-Endian 2021-12-24 16:47:10 +01:00
Mingkai Dong
8e4d4ef8b9 Replace allocator struct with function pointers 2021-12-24 09:28:23 +08:00
Max Brunsfeld
1d77b9ea47 cli: Fix parsing of test files with newlines in test names
Fixes #1527
2021-12-23 14:14:27 -08:00
Max Brunsfeld
ddeaa0c7f5
Merge pull request #1483 from furunkel/patch-1
Don't use zero maxlen for snprintf in ts_subtree__write_to_string
2021-12-23 10:52:20 -08:00
Mingkai Dong
486ea2569d Avoid allocator from being switched more than once 2021-12-18 16:45:18 +08:00
Mingkai Dong
b9b051e933 Remove ts_allocator from api.h
Since we have exposed the function to set allocator, we don't need to
expose the global variable in `api.h`.
2021-12-18 11:26:37 +08:00
Mingkai Dong
578bf74bf3 Add TSAllocator and ts_set_allocator in api.h 2021-12-18 09:53:58 +08:00
Mingkai Dong
b516f96f37 Fix declaration of ts_toggle_allocation_recording 2021-12-18 00:33:49 +08:00
Mingkai Dong
e742186c25 Allow to change the allocator dynamically 2021-12-17 20:16:20 +08:00
Patrick Thomson
7bac34c925
Merge pull request #1539 from tree-sitter/tag-modules
Support @module as a highlight key.
2021-12-16 10:56:05 -05:00
Patrick Thomson
f5d1c0b860 Support @module as a highlight key.
Some languages have the notion of modules, and to represent those
we've started to use a `@module` tag, as discussed in
https://github.com/elixir-lang/tree-sitter-elixir/issues/15.
Because historically we've used the constructor highlight color for
modules in JS/Ruby, it's defined to map to the same color.
2021-12-15 17:33:57 -05:00
Max Brunsfeld
8bbf75a067
Merge pull request #1538 from rski/master
fix crash on empty sexp in test, ()
2021-12-15 11:59:30 -08:00
Romanos Skiadas
4784ecaf0a fix crash on empty sexp in test, ()
Now this no longer crashes:

=====
a test
=====
-----
()

...

tree-sitter test:

1 failure:

expected / actual

  1. a test:

    (source_file)

    ()

fixes #1537
2021-12-15 19:10:26 +02:00
Max Brunsfeld
836d753c73 Fix include_bytes error when building cli outside of source tree
Refs #1523
2021-12-13 14:22:33 -08:00
Max Brunsfeld
2032133f8a
Merge pull request #1532 from oxisto/patch-1
Added bindings for Java and Kotlin to `index.md`
2021-12-13 13:23:27 -08:00
Max Brunsfeld
f8583f50a5
Merge pull request #1534 from maco/add_elixir
add link to in-development Elixir parser
2021-12-13 10:31:17 -08:00
Mackenzie Morgan
4238c6c7dc add link to in-development Elixir parser 2021-12-13 13:25:17 -05:00
Christian Banse
0a1dbdd340
Added bindings for Java and Kotlin to index.md 2021-12-11 13:26:06 +01:00
Max Brunsfeld
b9b77f4375 tags: Remove unused field 2021-12-09 22:39:27 -08:00
Max Brunsfeld
25f64e1eb6 Place tighter limits on the work done during query analysis 2021-12-09 22:18:21 -08:00
Max Brunsfeld
8de8c64c95 Remove unnecessary types from binding.rs 2021-12-09 21:02:15 -08:00
Max Brunsfeld
9f535f95bd Always include playground.html in the CLI binary
Fixes #1523
2021-12-06 16:52:14 -08:00
Max Brunsfeld
65746afeff playground: Make query error underlines render in safari 2021-11-22 16:04:45 -08:00
Max Brunsfeld
224e79ca27 web: Fix script directory that's passed to locateFile 2021-11-22 15:56:26 -08:00
Max Brunsfeld
775ec76908 Update loader dependency in cli 2021-11-21 13:56:22 -08:00
Max Brunsfeld
cc66e07a6e loader: 0.20.0 2021-11-21 13:40:33 -08:00
Max Brunsfeld
86b408412c Use serde's derive feature everywhere 2021-11-21 13:39:30 -08:00
Max Brunsfeld
c432739a65 tags: 0.20.1 2021-11-21 13:31:01 -08:00
Max Brunsfeld
062421dece 0.20.1 2021-11-21 12:33:27 -08:00
Max Brunsfeld
42360fc003 Bump library versions to 0.20.1 2021-11-21 12:33:12 -08:00
Max Brunsfeld
862fe9eff5
Merge pull request #1496 from tree-sitter/query-randomized-tests
Introduce randomized testing for queries, fix the revealed bugs
2021-11-21 12:27:48 -08: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
fea3eca312 Improve query execution logging 2021-11-21 11:39:29 -08:00