Commit graph

468 commits

Author SHA1 Message Date
Max Brunsfeld
9d0eedc01f Remove stray entry from wasm exported-symbol list 2021-05-20 14:33:25 -07:00
Max Brunsfeld
242e089379 web: 0.19.4 2021-05-20 14:29:39 -07:00
Max Brunsfeld
5664b77535 rust: 0.19.5 2021-05-20 14:29:25 -07:00
Max Brunsfeld
399b5e4daf Remove interior mutability for parent-node caching in Tree
In Rust binding, mark Tree as Sync
2021-05-20 13:56:26 -07:00
Markus F.X.J. Oberhumer
cc519b3121 cli: Improve const-correctness of the generated parsers (part 2 of 2).
This is a follow-up to my previous commit 1badd131f9 .

I've made this an extra patch as it requires a minor
API change in <tree_sitter/parser.h>.

This commit moves the remaining generated tables into
the read-only segment.

Before:
  $ for f in bash c cpp go html java javascript jsdoc json php python ruby rust; do \
       gcc -o $f.o -O2 -Ilib/include -c test/fixtures/grammars/$f/src/parser.c; \
    done
  $ size --totals *.o
      text    data     bss     dec     hex filename
   5353477   24472       0 5377949  520f9d (TOTALS)

After:
  $ for f in bash c cpp go html java javascript jsdoc json php python ruby rust; do \
       gcc -o $f.o -O2 -Ilib/include -c test/fixtures/grammars/$f/src/parser.c; \
    done
  $ size --totals *.o
   5378147       0       0 5378147  521063 (TOTALS)
2021-05-19 12:49:57 +02:00
Douglas Creager
6abf77a20c web: 0.19.3 2021-05-13 15:14:56 -04:00
Douglas Creager
04c2aa973b binding_web: Call correct function to reset parser 2021-05-03 14:25:57 -04:00
Douglas Creager
b742e88108 Use TRANSFER_BUFFER for did_exceed_match_limit
This bridges the gap between how the C API reports this for a query
cursor, but the wasm API defines the method on a query.  Whenever you
call a query method that might exceed the match limit, we call the C API
function and transfer the result across the wasm boundary, storing the
result in the JavaScript wrapper class.
2021-04-28 15:46:12 -04:00
Douglas Creager
e8eb3c5d5a binding_web: Add Query.didExceedMatchLimit
This lets wasm clients check whether a query exceeded its maximum number
of in-progress matches.
2021-04-27 09:21:38 -04:00
Max Brunsfeld
b5ec720696
Merge pull request #1071 from ahlinc/feat/rust-binding-additional-error-traits
feat(binding_rust): implement Display and Error traits for TS errors to be convertible
2021-04-22 21:24:07 -07:00
Andrew Hlynskyi
3c0a49289c binding_rust: Improve implementation of fmt::Display for QueryError trait, avoid multiple format!() calls 2021-04-23 06:45:04 +03:00
Max Brunsfeld
0bbacebf67
Merge pull request #1068 from ahlinc/fix/cargo-build-warinings
Resolve syntax warnings for cargo build
2021-04-22 13:38:03 -07:00
Andrew Hlynskyi
de23c9219a binding_rust: Unbind nodes lifitime from a source for QueryCursor.captures 2021-04-22 21:00:58 +03:00
Andrew Hlynskyi
9c91affe56 binding_rust: Unbind nodes lifitime from a source for QueryCursor.matches 2021-04-22 21:00:58 +03:00
Andrew Hlynskyi
e7b1d84a83 binding_rust: implement Display and Error traits for TS errors to be convertible 2021-04-22 17:50:12 +03:00
Andrew Hlynskyi
2094a80022 fix(cli): resolve syntax warnings for cargo build 2021-04-22 16:23:00 +03:00
Max Brunsfeld
72143b17ff Fix handling of queries with field names at the roots of patterns
Fixes #1018
2021-03-27 09:36:13 -07:00
Max Brunsfeld
89e1157a29 Fix handling of repetitions in query analysis
Fixes #1007
2021-03-19 11:00:31 -07:00
Max Brunsfeld
5f313689f0 rust: 0.19.4 2021-03-18 10:36:05 -07:00
Max Brunsfeld
2a99108171 web: 0.19.2 2021-03-18 10:36:05 -07:00
Max Brunsfeld
beaa02331e
Merge pull request #998 from tree-sitter/node-kind-fix
Fix check in ts_language_symbol_type (#997)
2021-03-17 11:49:01 -07:00
Patrick Thomson
3e4cda8353 Fix check in ts_language_symbol_type (#997)
As per Max's advice, this function should only return
`TSSymbolTypeRegular` when the metadata is both visible and named.
2021-03-17 14:12:58 -04:00
Andrew Hlynskyi
1769d1459d fix: don't zeroing provided start position by the end zero position 2021-03-17 19:06:52 +02:00
Jon Bockhorst
1e9481dc48 Web bindings: fix descendantsOfType memory allocation 2021-03-13 22:28:10 -06:00
Max Brunsfeld
48fa4bdb00 rust: 0.19.3 2021-03-12 15:21:47 -08:00
Max Brunsfeld
a7ae7767b4 Add docs for negated field patterns 2021-03-12 15:12:24 -08:00
Max Brunsfeld
bc0ef5f373 Add negated field patterns to queries 2021-03-12 14:38:02 -08:00
Max Brunsfeld
62a61c3540 Fix some doc comments in query.c 2021-03-12 12:45:18 -08:00
Max Brunsfeld
d366356299
Merge pull request #978 from tree-sitter/fix-get-column-at-eof
Fix the behavior of Lexer.get_column
2021-03-11 16:42:39 -08:00
Max Brunsfeld
e1a1006b3d
Merge pull request #866 from rhysd/patch-1
Fix typo in document
2021-03-11 15:21:45 -08:00
Max Brunsfeld
a40045a419 When editing, properly invalidate trees that depend on get_column 2021-03-11 14:46:13 -08:00
Max Brunsfeld
e29d3714f7 Fix behavior of Lexer.get_column when at EOF 2021-03-11 12:11:33 -08:00
Max Brunsfeld
5ecdfce122
Merge pull request #850 from berkus/patch-1
Fix typo
2021-03-09 15:07:48 -08:00
Max Brunsfeld
9dc88061d5 query: Fix last child operator with multiple children
Fixes #806
2021-03-09 13:40:15 -08:00
Max Brunsfeld
841e160898 rust libs: 0.19.2 2021-03-08 10:03:45 -08:00
Max Brunsfeld
6ba11d7778 Fix query analysis with top-level non-terminal extras
Fixes https://github.com/tree-sitter/tree-sitter/issues/968#issuecomment-792314281
2021-03-08 09:33:35 -08:00
Max Brunsfeld
5a2534ac4a Fix crash on unterminated alternation in query
Fixes #968
2021-03-07 08:48:03 -08:00
Max Brunsfeld
f18c36ca62 Fix handling of extra nodes in query analysis
Fixes #967
2021-03-06 14:35:41 -08:00
Max Brunsfeld
0818892a1a libs: 0.19.1 2021-03-05 15:31:48 -08:00
Max Brunsfeld
db6e1d9bdc Add ts_query_cursor_did_exceed_match_limit API 2021-03-05 15:02:49 -08:00
Max Brunsfeld
047d33eecf Remove bad logic for detecting later siblings with the same field
Co-authored-by: Douglas Creager <dcreager@dcreager.net>
2021-03-05 14:50:16 -08:00
Max Brunsfeld
22fb88e89d Bump library versions to 0.19 2021-03-01 14:46:43 -08:00
Max Brunsfeld
592fd8678d Organize TSLanguage fields
Due to the breaking ABI change in #943, this is our chance
to reorder the fields in a more logical way.
2021-03-01 10:27:22 -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
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
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
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