Commit graph

2752 commits

Author SHA1 Message Date
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
Max Brunsfeld
dc7997fdbb node-types: Rework the approach to computing multiple and required 2019-10-11 13:59:02 -07:00
Rob Rix
20bb99249b Fix a typo in the docs. (#457) 2019-10-04 14:49:19 -07:00
dependabot[bot]
10c6144e83 Bump rubyzip from 1.2.1 to 2.0.0 in /docs (#459)
Bumps [rubyzip](https://github.com/rubyzip/rubyzip) from 1.2.1 to 2.0.0.
- [Release notes](https://github.com/rubyzip/rubyzip/releases)
- [Changelog](https://github.com/rubyzip/rubyzip/blob/master/Changelog.md)
- [Commits](https://github.com/rubyzip/rubyzip/compare/v1.2.1...v2.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
2019-10-04 14:48:53 -07:00
Max Brunsfeld
6b322c5c28
Merge pull request #453 from ikatyang/docs/add-markdown-parser
docs: add Markdown and Vue parser
2019-10-04 09:58:52 -07:00
Max Brunsfeld
262c7f1e58
Merge pull request #460 from ikatyang/fix/web-tree-sitter/add-missing-types
fix(web-tree-sitter): add missing types
2019-10-04 09:57:33 -07:00
Ika
825a816ee7 docs: add Vue parser 2019-10-04 20:38:01 +08:00
Ika
979b46e297 fix(web-tree-sitter): add missing types 2019-10-04 20:16:13 +08:00
Max Brunsfeld
02b6397aa3 Add test for advancing query cursor after has already finished 2019-10-03 12:55:10 -07:00
Max Brunsfeld
015be68c94 rust: Generalize text_callback type for query methods 2019-10-03 12:53:14 -07:00
Max Brunsfeld
9872a083b7 rust: Change QueryCursor::captures to expose the full match 2019-10-03 12:45:58 -07:00
Max Brunsfeld
3e040b8951 0.15.10 2019-10-02 14:13:20 -07:00
Max Brunsfeld
fb7a5369fe Fix regression in node-types for rules with simple aliases 2019-10-02 14:11:21 -07:00
Max Brunsfeld
754cfd42bf Respect nodes' aliases when generating node types
Fixes #455
2019-10-02 13:59:00 -07:00
Max Brunsfeld
cb87b7b76e Fix invalid read by query cursor on error nodes
🎩 @bfredl

Refs https://github.com/tree-sitter/tree-sitter/pull/448#issuecomment-536337749
2019-10-01 11:28:51 -07:00
Max Brunsfeld
d40f3b96b6
Merge pull request #454 from bfredl/symboltype
fix compiler warning for comparing `char` with `TSSymbolType'
2019-09-30 11:19:32 -07:00
Björn Linse
1d2d043390 fix compiler warning with comparing char with `TSSymbolType' 2019-09-30 19:24:40 +02:00
Ika
d54fe98334 docs: add Markdown parser 2019-09-30 20:10:37 +08:00
Max Brunsfeld
27149902f8 Handle is?, is-not?, and set! predicate functions in queries 2019-09-25 10:21:20 -07:00
Max Brunsfeld
b15e90bd26 Handle set! predicate function in queries 2019-09-24 11:54:24 -07:00
Max Brunsfeld
ff9a2c1f53 Make queries work in languages with simple aliases 2019-09-24 11:54:24 -07:00
Max Brunsfeld
9ce3a53427 Precompute tree edits in playground script 2019-09-23 17:01:35 -07:00
Max Brunsfeld
070f11b8bf Use ptr::NonNull in Rust bindings 2019-09-23 17:00:52 -07:00
Max Brunsfeld
887b4a4f76
Merge pull request #450 from bfredl/warnings
Fix some compiler warnings regarding function prototypes
2019-09-22 09:14:26 -07:00
Björn Linse
15e3bc7fd2 Fix some compiler warnings regarding function prototypes 2019-09-22 11:49:44 +02:00
Max Brunsfeld
598e4e4cf4 Add a unit test to verify captures are sorted by start and end position 2019-09-20 10:12:45 -07:00