Commit graph

3834 commits

Author SHA1 Message Date
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
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
Max Brunsfeld
67de9435b1
Merge pull request #1457 from josteink/bugfix-whitespace
Fix whitespace issues when using paths-file.
2021-10-25 16:37:13 -07:00
Jostein Kjønigsen
d0559ca43f Fix whitespace issues when using paths-file. 2021-10-25 23:51:01 +02: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
Max Brunsfeld
e78413832b Restructure test suite's allocation recording so that tests can run in parallel 2021-10-11 17:24:37 -07:00
Max Brunsfeld
fe29bc8c19 Tweak comment formatting in api.h so bindgen doesn't create a doctest 2021-10-11 17:23:44 -07:00
Max Brunsfeld
3d554ecf6b
Merge pull request #1434 from razzeee/unicode-14
Update to unicode standard 14
2021-10-10 10:47:41 -07:00
Razze
956705a23d Update to unicode standard 14 2021-10-10 16:40:31 +02:00
Max Brunsfeld
0288dd4acc
Merge pull request #1295 from nokome/master
docs(Using parsers): Fix spelling, remove unusual keyword
2021-10-05 14:15:23 -07:00
Max Brunsfeld
ec87df2021
Merge pull request #1416 from Wilfred/patch-1
Add link to elisp parser
2021-10-05 14:14:13 -07:00
Max Brunsfeld
21fd9ee36c
Merge pull request #1412 from ahelwer/windows-test-failures
Fixed some test failures due to CRLF line endings
2021-10-05 14:13:26 -07:00
Max Brunsfeld
15860392c5
Merge pull request #1427 from aminya/serde
Use serde's derive feature
2021-10-05 10:01:16 -07:00
Amin Yahyaabadi
8a5620ce15 Use serde's derive feature 2021-10-05 02:38:18 -05:00