Commit graph

3847 commits

Author SHA1 Message Date
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
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
3ac53cb645 Add link to Lua bindings 2021-11-19 13:58:46 -08:00
Max Brunsfeld
a0c085bbec Return an error when trying to inline a token
Fixes #1420
2021-11-19 13:02:04 -08:00
Max Brunsfeld
4e2e059865 Ensure 'extra' bit is set correctly when reusing a node
Fixes #1444
2021-11-19 12:43:55 -08:00
Max Brunsfeld
2f9b7ac465 Fix logging of seed in randomized test 2021-11-19 12:16:54 -08:00
Max Brunsfeld
1fe0420f0f Avoid unnecessary stack entries in query analysis
When descending into a hidden child rule, the current stack entry
can be reused if it is currently at the end of its rule.

This fixes a test failure when analyzing a Ruby query. The
failure was introduced due to some changes to the Ruby grammar.
This optimization allows us to impose a _smaller_ limit on
the stack size, which should make query analysis faster and
more memory-efficient.
2021-11-19 11:04:36 -08:00
Max Brunsfeld
52b4b65adc Convert more test grammars from JSON to JS 2021-11-19 10:35:53 -08:00
Max Brunsfeld
67d58d3ca2
Merge pull request #1487 from mattmassicotte/patch-1
Add link to swift bindings package
2021-11-18 11:42:52 -08:00
Matt Massicotte
af2c692711
Add link to swift bindings package 2021-11-17 11:30:32 -05:00
furunkel
f78ad7162f
Don't use zero maxlen for snprintf in ts_subtree__write_to_string
It seems that (some implementations of?) `snprintf` returns -1 and sets `errno` to `EINVAL` if a `maxlen` of zero is passed. This causes the count to underflow and `ts_subtree__write_to_string` returns a gigantic size which the succeeding malloc will refuse to allocate.
2021-11-12 20:52:15 +01:00