Commit graph

3436 commits

Author SHA1 Message Date
Max Brunsfeld
a6b267201f
Merge pull request #952 from lazytype/master
Support highlighting in truecolor, falling back to the closest xterm …
2021-03-01 09:19:31 -08:00
Max Brunsfeld
3f315f167b
Merge pull request #945 from hvithrafn/update-dependencies
Update dependencies; fix breakage
2021-03-01 09:15:38 -08:00
lazytype
5de649b7aa Support highlighting in truecolor, falling back to the closest xterm color if the terminal does not support it
Fixes #758
2021-02-28 16:22:45 -05:00
Max Brunsfeld
c98dc566d5 In npm install, use x64 on ARM macs for now
Fixes #942
2021-02-26 15:57:18 -08:00
Max Brunsfeld
41e9af2456 Avoid including undefined in return value of Query.matches
Fixes #932
2021-02-26 15:16:07 -08:00
Max Brunsfeld
e710a14244 Simplify ts_language_has_actions so it allows non-terminals
Fixes #933
2021-02-26 14:52:41 -08:00
Max Brunsfeld
d56f9ebe4e Re-enable --prev-abi flag to generate command 2021-02-26 14:51:01 -08:00
Max Brunsfeld
dc20540136
Merge pull request #948 from tree-sitter/generate-rust-bindings
In the generate command, create rust binding files
2021-02-26 14:05:55 -08:00
Max Brunsfeld
075bf2bd5c In generate, create rust bindings
Also, migrate node binding files into the same 'bindings' folder.
2021-02-26 13:24:21 -08:00
hvithrafn
05f79f0f90 Update dependencies; fix breakage 2021-02-26 10:55:20 -07:00
Max Brunsfeld
c25fa9910e Fix query match failure when indefinite steps have no captures
Fixes #937
2021-02-25 21:41:49 -08:00
Max Brunsfeld
48584c7cad
Merge pull request #943 from tree-sitter/new-parse-table-repr
Clean up parse table representation, use 16 bits for production_id
2021-02-25 20:21:22 -08:00
Max Brunsfeld
c1639cc456 Add production_id_count field to Language objects
I think this is the last additional field that's needed so
that every array member of TSLanguage has a length that
can be calculated at runtime.
2021-02-25 16:32:05 -08:00
Max Brunsfeld
774ae5e3d5 In parse tables, store production ids as 16 bits
Also remove the use of bitfields from the parse table format.
In all cases, bitfields were not necessary to achieve the
current binary sizes. Avoiding them makes the binaries more
portable.

There was no way to make this change backward-compatible,
so we have finally dropped support for parsers generated
with an earlier version of Tree-sitter.

At some point, when Atom adopts this version of Tree-sitter,
this change will affect Atom users who have installed packages
using third-party Tree-sitter parsers. The packages will need
to be updated to use a regenerated version of the parsers.
2021-02-25 16:12:31 -08:00
Patrick Thomson
63616289dd
Merge pull request #941 from tree-sitter/walk-query-files-recursively
Walk query files recursively in `tree-sitter test`.
2021-02-25 16:33:05 -05:00
Max Brunsfeld
e49a56ea4c
Merge pull request #939 from tree-sitter/partial-order-precedence
Allow precedences to be specified using strings and a partial ordering relation
2021-02-25 13:16:01 -08:00
Max Brunsfeld
d8a235faa1 Add further static validation of named precedences 2021-02-25 11:54:21 -08:00
Patrick Thomson
44010d69ea Walk query files recursively in tree-sitter test.
We were only walking one level of depth into the `queries/` folder
during invocations of `test`, which made us attempt to open folders
rather than recurse into them.

We have to pull in the `walkdir` crate, which is required for
cross-platform walking of directories.

Fixes #938.
2021-02-25 10:24:54 -05:00
Max Brunsfeld
344797c110 Implement named precedence comparison 2021-02-24 16:02:56 -08:00
Himujjal Upadhyaya
225e15cb9f
Updated docs for tree-sitter-svelte (#936)
* updated docs & tests for tree-sitter-svelte

* added svelte to official docs

* final commit before adding svelte to the docs
2021-02-24 09:35:42 -08:00
Max Brunsfeld
d40f118370 Generalize precedence datatype to include strings
Right now, the strings are not used in comparisons, but they
are passed through the grammar processing pipeline, and are
available to the parse table construction algorithm.

This also cleans up a confusing aspect of the parse table
construction, in which precedences and associativities were
temporarily stored in the parse table data structure itself.
2021-02-23 20:48:39 -08:00
Patrick Thomson
84a34f46bc
Merge pull request #935 from fwouts/patch-1
Fix broken link to Ruby's Percent Strings
2021-02-23 17:03:42 -05:00
François Wouts
b7f99d45f0
Revert back to 2.5.0 to minimise changes 2021-02-24 07:56:26 +11:00
François Wouts
86d4be4ea7
Link to Ruby 3 docs instead 2021-02-24 07:55:48 +11:00
François Wouts
9437973b3e
Fix broken link to Ruby's Percent Strings
The current link fails with a 404.
2021-02-24 07:52:24 +11:00
Douglas Creager
85847b936a
Merge pull request #934 from tree-sitter/move-allocation-tracking
Move allocation tracking into lib crate
2021-02-23 12:45:45 -05:00
Douglas Creager
a7e2b6a8b2 Remove allocations_stubs
These were used to provide the `ts_record_*` functions regardless of
whether the `allocation-tracking` feature is enabled.  The allocation
tracking code is now implemented entirely in the `lib` crate, and only
when the feature is enabled, and so these stubs are no longer needed.
2021-02-23 09:39:39 -05:00
Douglas Creager
a29c8d9264 Move allocation tracking into lib crate
We have several test cases defined in the `cli` crate that depend on the
`lib` crate's `allocation-tracking` feature.  The implementation of the
actual allocation tracker used to live in the `cli` crate, close to the
test cases that use it.  The `allocation-tracking` feature in the `lib`
crate was just used to tell the tree-sitter implementation to expect
that the allocation tracker exists, and to use it.

That pattern meant that we had a circular dependency: `cli` depends on
`lib`, but `lib` required some code that was implemented in `cli`.
That, in turn, caused linker errors — but only when compiling in certain
configurations! [1]

This patch moves all of the allocation tracking implementation into the
`lib` crate, gated on the existing `allocation-tracking` feature, which
fixes the circular dependency.

Note that this patch does **not** fix the fact that feature unification
causes the `lib` crate to be built with the `allocation-tracking`
feature enabled, even though it's not a default.  Fixing that depends on
the forthcoming version 2 feature resolver [2], or using the `dev_dep`
workaround [3] in the meantime.

[1] https://github.com/tree-sitter/tree-sitter/issues/919
[2] https://doc.rust-lang.org/nightly/cargo/reference/features.html#feature-resolver-version-2
[3] https://github.com/tree-sitter/tree-sitter/issues/919#issuecomment-777107086
2021-02-23 09:16:37 -05:00
Max Brunsfeld
2f28a35e1b Handle unicode property escapes inside bracketed char classes
Refs #906
2021-02-18 22:27:44 -08:00
Max Brunsfeld
29bc26ecd5 Fix test failure after non-terminal extras change 2021-02-18 15:43:01 -08:00
Max Brunsfeld
796f655b03 0.18.2 2021-02-18 14:33:03 -08:00
Max Brunsfeld
86a891fa63 Fix bugs in parser generation for non-terminal extras
Previously, we attempted to completely separate the parse states
for item sets with non-terminal extras from the parse states
for other rules. But there was not a complete separation.

It actually isn't necessary to separate the parse states in this way.
The only special behavior for parse states with non-terminal extra rules
is what happens at the *end* of the rule: these parse states need to
perform an unconditional reduction.

Luckily, it's possible to distinguish these *non-terminal extra ending*
states from other states just based on their normal structure, with
no additional state.
2021-02-18 14:14:22 -08:00
Max Brunsfeld
b46d51f224 Add a unit test for all unicode character escape forms 2021-02-17 17:49:01 -08:00
Max Brunsfeld
5b630054c6 Handle negated unicode property escapes in regexes
Refs #380
2021-02-17 17:22:33 -08:00
Max Brunsfeld
6ae04051e7 Tweak whitespace in generated character set functions 2021-02-17 16:32:49 -08:00
Max Brunsfeld
9d9eb2234f
Merge pull request #906 from tree-sitter/unicode-property-escapes
Handle simple unicode property escapes in regexes
2021-02-17 16:14:42 -08:00
Max Brunsfeld
dad8546776 Generate more compact code for character set binary search 2021-02-17 13:52:23 -08:00
Max Brunsfeld
9abad258c3 Expand tests for unicode property escapes 2021-02-17 13:29:30 -08:00
Max Brunsfeld
6132a10b1c Use binary search in generated character set functions 2021-02-17 13:08:56 -08:00
Max Brunsfeld
f5a4c14dbe Add some doc comments to CharacterSet 2021-02-16 21:37:52 -08:00
Max Brunsfeld
699af84259 Don't rely on bash 4.0 to lowercase platform name on CI 2021-02-11 17:08:14 -08:00
Max Brunsfeld
86814ee4d7 In install script, expect 'v' prefix in release name 2021-02-11 16:39:34 -08:00
Max Brunsfeld
894357d1d1 In version script, add 'v' prefix to version tags 2021-02-11 16:16:19 -08:00
Max Brunsfeld
f32c7821ba Change expected mac release asset name osx -> macos 2021-02-11 16:15:03 -08:00
Max Brunsfeld
457c565266 Lowercase the OS in release asset filenames 2021-02-11 16:14:28 -08:00
Max Brunsfeld
0943dc27a2 Run CI for version tags 2021-02-11 15:21:04 -08:00
Max Brunsfeld
f51026dff1 0.18.1 2021-02-11 14:59:17 -08:00
Max Brunsfeld
28fd8b3371 web: 0.18.1 2021-02-10 16:22:51 -08:00
Max Brunsfeld
73e252e39b Add unit test for child_by_field_name w/ hidden nodes 2021-02-10 16:14:24 -08:00
Max Brunsfeld
038f4fcef8
Merge pull request #890 from wkordalski/fix-child-by-field
Fix getting node by field name or ID.
2021-02-10 15:58:31 -08:00