Commit graph

2777 commits

Author SHA1 Message Date
Max Brunsfeld
39ceff1908 Restore json corpus tests, which accidentally weren't running 2019-10-31 14:32:50 -07:00
Max Brunsfeld
d765332c61 Don't rely on new eof ABI in parsers unless --next-abi is passed 2019-10-31 14:32:50 -07:00
Max Brunsfeld
d3b7caa565 Add a TSLexer.eof() API, use it in generated parsers 2019-10-31 14:11:52 -07:00
Max Brunsfeld
a62b7a70f3 Lexer: track EOF state without relying on null character as lookahead 2019-10-31 14:11:52 -07:00
Max Brunsfeld
5a3a672e30 Expand on query docs 2019-10-30 10:26:10 -07:00
Max Brunsfeld
9e765ceba6 highlight: Skip injection codepath if there are no ranges found 2019-10-29 13:49:07 -07:00
Max Brunsfeld
077cd4970c Handle empty list of included ranges w/ non-null pointer 2019-10-29 13:45:04 -07:00
Max Brunsfeld
d5dc4bbcaa Fix some errors in new query docs 2019-10-28 17:32:10 -07:00
Max Brunsfeld
6146c39b0a Add information about queries on the docs site 2019-10-28 17:19:57 -07:00
Max Brunsfeld
4b7c36a40b
Merge pull request #473 from bfredl/oldtree
fix invalid docs for ts_tree_get_changed_ranges
2019-10-28 15:51:45 -07:00
Max Brunsfeld
42dfba29c6 Make ts_tree_get_changed_ranges less confusing 2019-10-28 15:33:41 -07:00
Björn Linse
124ae30138 fix invalid docs for ts_tree_get_changed_ranges 2019-10-25 21:19:33 +02:00
Max Brunsfeld
9b4b46ae11
Merge pull request #472 from tree-sitter/query-fuzz
Run highlighting logic in fuzzer
2019-10-24 10:35:51 -07:00
Phil Turnbull
81756a8414
Simplify filename logic
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2019-10-24 13:19:51 -04:00
Phil Turnbull
1a9c68aebf
Run highlighting logic in fuzzer 2019-10-24 10:44:34 -04:00
Phil Turnbull
f019cb2f0e
Handle non-ascii characters when generating fuzzing dictionary
This caused a failure when generating the dictionary for `tree-sitter-agda`.
2019-10-24 10:16:25 -04:00
Max Brunsfeld
71d8d79425 Add missing error codes to C highlight API 2019-10-23 10:57:11 -07:00
George Fraser
1346929e66 Parser.Language.load takes a path (#471) 2019-10-23 08:53:15 -07:00
Max Brunsfeld
4af16dc0ac web: 0.15.10 2019-10-22 13:00:51 -07:00
Max Brunsfeld
f736cb3896 web: Implement TreeCursor.nodeText
Refs #466
2019-10-22 12:58:27 -07:00
Max Brunsfeld
80008b0bcc 0.15.12 2019-10-21 18:48:29 -07:00
Max Brunsfeld
6cd82574a3
Merge pull request #469 from tree-sitter/non-terminal-extras
Allow non-terminal extras
2019-10-21 18:47:45 -07:00
Max Brunsfeld
0cceca7b4e Rename extra_tokens -> extra_symbols 2019-10-21 17:26:01 -07:00
Max Brunsfeld
ddd3dc2d6d Use emscripten 1.39.0 on mac CI 2019-10-21 16:40:44 -07:00
Max Brunsfeld
7ccec8c0e2 Tweak wasm binding to work with new upstream LLVM backend 2019-10-21 16:10:29 -07:00
Max Brunsfeld
fcaabea0cf Allow non-terminal extras 2019-10-21 16:08:59 -07:00
Max Brunsfeld
49c632ae90 Fix error in test command when queries folder does not exist
Fixes #468
2019-10-21 09:22:24 -07:00
Max Brunsfeld
8b1fe78bf6 0.15.11 2019-10-18 17:32:39 -07:00
Max Brunsfeld
1bc6204870 Handle local.definition-value captures in queries
This lets you indicate, when matching a variable definition, that
another later syntax node represents the value of the variable definition,
and so any references to the same variable name within that value node
must be referring to some earlier definition.
2019-10-18 15:56:47 -07:00
Max Brunsfeld
e14e285a10 cli: Check queries when running tree-sitter test 2019-10-18 14:44:16 -07:00
Max Brunsfeld
b73b31356d Respect local.scope-inherits property in local variable queries 2019-10-18 14:12:20 -07:00
Max Brunsfeld
64c6cf4473 Implicitly reset parser's state if language is changed after a timeout 2019-10-18 11:28:59 -07:00
Max Brunsfeld
c49afd5536 Return to using master branches of grammar repos for testing 2019-10-17 15:27:03 -07:00
Max Brunsfeld
3d6f2822e9
Merge pull request #448 from tree-sitter/highlight-with-queries
Reimplement syntax highlighting with tree queries instead of property sheets
2019-10-17 13:49:11 -07:00
Max Brunsfeld
084406148b Tweak highlight name matching semantics, add doc comments 2019-10-17 12:03:34 -07:00
Max Brunsfeld
b79295e1a0 🔥 Everything related to property sheets 2019-10-17 11:00:31 -07:00
Max Brunsfeld
075a552430 Tweak how highlight query paths are specified in package.json 2019-10-17 10:14:05 -07:00
Max Brunsfeld
fa43ce01a6 Allow queries to capture ERROR nodes 2019-10-16 11:54:32 -07:00
Max Brunsfeld
40408fe6bb Update tree-sitter-highlight readme 2019-10-14 21:39:56 -07:00
Max Brunsfeld
060e00463d Implement include-children directive in injection queries 2019-10-14 17:38:42 -07:00
Max Brunsfeld
b3809274f0 Load highlight queries correctly in highlight unit tests 2019-10-14 17:24:16 -07:00
Max Brunsfeld
7c8216c692 highlight: Handle injections correctly, using a separate query cursor 2019-10-14 12:30:22 -07:00
Max Brunsfeld
324c259cbb rust: Create readable messages for query syntax errors 2019-10-14 12:30:22 -07:00
Max Brunsfeld
a45dc67390 Loosen unnecessary lifetime restriction in rust QueryCursor APIs 2019-10-14 12:30:22 -07:00
Max Brunsfeld
f490befcde Add ts_query_disable_capture API 2019-10-14 12:30:22 -07:00
Max Brunsfeld
4c17af3ecd Allow queries with no patterns 2019-10-14 12:30:22 -07:00
Max Brunsfeld
c153711539 query: Avoid splitting states on nodes that don't contain captures 2019-10-14 12:30:22 -07:00
Max Brunsfeld
f4903578f8 Start reimplementing highlight crate with tree queries 2019-10-14 12:30:22 -07:00
Matthew Krupcale
5ae89f5133 docs: fix lookahead type (#462)
The `TSLexer` struct uses signed integer `int32_t` for the `lookahead` Unicode code point.

 * docs/section-3-creating-parsers.md: fix `lookahead` type
2019-10-14 12:08:24 -07:00
Matthew Krupcale
ee9a3c0ebb lib: remove utf8proc dependency (#436)
* Remove dependency on utf8proc

This removes the only external dependency on utf8proc for UTF-8 decoding. It does so by implementing its own UTF-8 decoder. This decoder is both faster and has a simpler API.

 * .gitmodules: remove utf8proc submodule
 * docs/section-2-using-parsers.md: remove requirement for utf8proc submodule
 * docs/section-6-contributing.md: likewise
 * lib/Cargo.toml: remove utf8proc subdirectory package include
 * lib/README.md: remove utf8proc subdirectory description
 * lib/binding_rust/build.rs: remove utf8proc compiler include directory
 * lib/src/lexer.c: remove utf8proc dependencies and types
 * lib/src/lib.c: remove utf8proc dependency
 * lib/src/unicode.h: define types for Unicode decoders
 * lib/src/utf16.{c,h}: implement more readable UTF-16 decoder
 * lib/src/utf8.{c,h}: implement fast UTF-8 decoder
 * lib/utf8proc: remove utf8proc submodule directory
 * script/build-lib: remove utf8proc compiler include directory
 * script/build-wasm: likewise

* Optimize ts_lexer__get_lookahead.

Try to favor non-failure code path and assign lookahead values directly to lexer

 * lib/src/lexer.c: optimize for non-failure code path

* Fix some compiler errors

 * lib/src/lexer.c: cast from signed to unsigned for decode_next result
 * lib/src/utf16.c: fix non-constant initializers for older compilers

* Remove some missed remnants of utf8proc

 * docs/section-2-using-parsers.md: only two include paths necessary now
 * lib/src/lib.c: no need to define UTF8PROC_STATIC

* Use ICU's utf8 and utf16 decoding routines

* Remove unnecessary casts when calling icu macros

* Check buffer length before attempting to decode a unicode character

* Use new unicode function when parsing Queries

Co-Authored-By: Matthew Krupcale <mkrupcale@matthewkrupcale.com>

* Mark libicu files as vendored for GitHub's stats
2019-10-14 11:18:39 -07:00