Commit graph

638 commits

Author SHA1 Message Date
Max Brunsfeld
3f315f167b
Merge pull request #945 from hvithrafn/update-dependencies
Update dependencies; fix breakage
2021-03-01 09:15:38 -08: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
d56f9ebe4e Re-enable --prev-abi flag to generate command 2021-02-26 14:51:01 -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
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
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
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
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
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
86814ee4d7 In install script, expect 'v' prefix in release name 2021-02-11 16:39:34 -08:00
Max Brunsfeld
f32c7821ba Change expected mac release asset name osx -> macos 2021-02-11 16:15:03 -08:00
Max Brunsfeld
f51026dff1 0.18.1 2021-02-11 14:59:17 -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
6dbe6a3a90 Merge branch 'master' into actions-ci 2021-02-05 10:19:05 -08:00
Max Brunsfeld
2b0de9dfec Fix small bugs in conflict reporting
* Negative precedence values were not displayed
* Rule names were repeated in resolution suggestions
2021-02-01 13:30:06 -08:00
Max Brunsfeld
e3ba701344 Start work on handling unicode property escapes in regexes 2021-01-29 16:37:45 -08:00
Max Brunsfeld
38444ea7f9
Merge pull request #904 from tree-sitter/character-set-ranges
Represent CharacterSet internally as a vector of ranges
2021-01-29 13:35:48 -08:00
Andrew Hlynskyi
2b9e5f6c4b Fix hiding problems in ./build/Debug/tree_sitter_*_binding
In debug building modules also may happen errors and a current implementation
completely hides them, so errors like 'undefined symbol' can't be
easily identified due to wrong traceback and error message.
2021-01-29 15:54:10 +02:00
Max Brunsfeld
ab78ab3f9b Represent CharacterSet internally as a vector of ranges 2021-01-28 16:10:39 -08:00
Max Brunsfeld
1dc127e5da 0.18.0 2021-01-07 17:07:29 -08:00
Yijun Yu
9e08712773 Add --xml option to save the parsed code into XML, using node.start_byte() and node.end_byte() 2021-01-04 22:07:38 +00:00
Max Brunsfeld
d5eb5969f9
Merge pull request #856 from 0xADD1E/master
Update CC for additional target support
2020-12-20 20:13:33 -08:00
Max Brunsfeld
391fc8c340 Update unit tests to expect ruby grammar change 2020-12-20 19:34:45 -08:00
Kája Lišková
915834c113 Update CC to version with better target support
This is just a minimal set of changes to dependencies.
macOS aarch64 support was only introduced in `cc` version 1.0.58, so this now allows tree-sitter to build natively on M1 computers
2020-12-20 16:09:17 -06:00
Max Brunsfeld
96f259d8c5 Run rustfmt 2020-12-03 09:48:20 -08:00
Max Brunsfeld
026231e93d Merge branch 'master' into HEAD 2020-12-03 09:44:33 -08:00
Max Brunsfeld
b661050a61 Simplify setup for enabling/disabling allocation recording in the C lib 2020-12-02 15:35:13 -08:00
Max Brunsfeld
751ffd2ee1 Use new emscripten when building with docker 2020-12-01 11:04:06 -08:00
Patrick Thomson
cc8f978b3b inline this lambda 2020-11-23 12:05:32 -05:00
Patrick Thomson
e1da6e554b Remove fanciful nomenclature. 2020-11-23 12:01:08 -05:00
Patrick Thomson
6764b803a0 Allow overlap in specs. 2020-11-23 11:58:07 -05:00
Patrick Thomson
0b4661e401 Really fix the tests. 2020-11-23 11:41:16 -05:00
Patrick Thomson
f3d16f4770 Fix tests. 2020-11-23 11:34:56 -05:00