Commit graph

823 commits

Author SHA1 Message Date
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
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 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 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 062421dece 0.20.1 2021-11-21 12:33:27 -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 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 a0c085bbec Return an error when trying to inline a token
Fixes #1420
2021-11-19 13:02:04 -08:00
Max Brunsfeld 2f9b7ac465 Fix logging of seed in randomized test 2021-11-19 12:16:54 -08: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
Razze 956705a23d Update to unicode standard 14 2021-10-10 16:40:31 +02: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
Amin Yahyaabadi 8a5620ce15 Use serde's derive feature 2021-10-05 02:38:18 -05:00
Andrew Helwer 993e93eeee Fix linux build 2021-09-28 19:06:05 -04:00
Andrew Helwer 3b5f9cb642 Fixed cargo fmt 2021-09-28 18:53:24 -04:00
Andrew Helwer 8eef790a61 Build rust with warnings=errors 2021-09-28 18:51:09 -04:00
Andrew Helwer e8e4dafa92 Fixed cargo fmt suggestions 2021-09-28 18:31:04 -04:00
Andrew Helwer 3d1f760e31 Simplified corpus test output comparisons 2021-09-28 18:27:25 -04:00
Andrew Helwer 0c3fb6e6a2 Fixed cargo fmt issues 2021-09-24 22:49:25 -04:00
Andrew Helwer 0dc1bd806f Fixed some test failures due to CRLF line endings 2021-09-24 22:42:38 -04:00
Max Brunsfeld 0e3a2780cd Avoid dynamic regex construction when parsing test files 2021-09-21 21:35:14 -07:00
Andrew Hlynskyi 16470bc0b1 chore(cli): Rename all internal web_ui stuff to playground 2021-09-22 04:28:08 +03:00
Andrew Hlynskyi 2abd6bc318 fix(cli): Fix playground opening in a browser, regression in #1304 2021-09-22 01:38:52 +03:00
Andrew Hlynskyi 28a121b532 chore(docs): Fix misprints 2021-09-22 00:24:36 +03:00
Andrew Hlynskyi e2de738026 cli(query): Improve and unify query subcommand output 2021-09-21 23:10:00 +03:00
Andrew Hlynskyi 62d79b80e1 feat(cli): add a flag to compile a parser in debug mode with -O0 C/C++ compiler flag 2021-09-13 13:48:02 +03:00
Max Brunsfeld 4fa5ab8a52
Merge pull request #1348 from tlaplus-community/testfile-separator
Add support for arbitrary suffixes in test file headers and separators
2021-09-07 22:58:05 -07:00
Max Brunsfeld 4d64c2b939 Put emscripten-version file in cli directory
This lets the CLI crate build without relying on sibling directories.
2021-09-03 13:57:45 -07:00
Max Brunsfeld b938486ebe In CLI, get tree-sitter binding version from CLI's Cargo.toml 2021-09-03 13:54:47 -07:00
Max Brunsfeld 23b28f6f36 Fix 'include!' error when building the CLI outside of the repo 2021-09-03 13:45:13 -07:00
Max Brunsfeld e22b42c9e6 Bump lib tree-sitter dependency versions in loader crate 2021-09-03 13:29:03 -07:00
Andrew Hlynskyi 52e6c900c3 fix(lib): fix segfault on ts_query_new with incompatible grammar version, close #1318 2021-09-03 14:24:18 +03:00
Max Brunsfeld 8fa875b1a4 Fix possible infinite loop when running syntax highlighting tests
Fixes #1347
2021-08-29 15:04:23 -07:00
Andrew Hlynskyi 88601000a2 chore(cli): Add the LICENSE file to the tree-sitter-cli npm package 2021-08-22 03:13:46 +03:00
Andrew Helwer 03b6a00bb8 Support for suffixes in test file separators
Some languages use the non-suffixed separators in their syntax
Fixes #982
2021-08-19 09:42:46 -04:00
FnControlOption e030434ca7 Handle aliases in unicode property escapes in regexes 2021-08-18 22:22:46 -07:00
Paul Gey a533e4d7bb Remove unnecessary borrows
This produces an `unused_must_use` warning on nightly:
https://github.com/rust-lang/rust/pull/86426
2021-08-14 15:44:24 +02:00
Max Brunsfeld c6dd5da5e6
Merge pull request #1329 from narpfel/improve-performance
Improve performance of `tree-sitter generate`
2021-08-11 16:08:23 -07:00
Paul Gey f34c13d2a7 Update smallbitvec dependency 2021-08-08 21:45:43 +02:00
Paul Gey 965e3c9e5e Generator::add_parse_table: Store entries in hash map
This avoids a quadratic behaviour due to repeatedly using `find` on a
growing `Vec`.
2021-08-08 21:45:43 +02:00
Paul Gey cf69a2c94c Use IndexMap and FxHash for some hot hash maps 2021-08-08 21:45:43 +02:00
Andrew Hlynskyi 533073cdb5 fix(cli): Remove tree-sitter grammar ./... call limitation 2021-08-06 02:11:35 +03:00