Commit graph

1350 commits

Author SHA1 Message Date
Max Brunsfeld
e65403930f Add ts_compile_property_sheet API 2018-10-03 18:12:51 -07:00
Max Brunsfeld
3672da6ac3 🎨 Use NULL_SUBTREE constant in a few more places 2018-09-17 22:24:37 -07:00
Max Brunsfeld
b29d0f622f Cram terminal subtree data into a 64-bit integer when possible 2018-09-17 18:52:34 -07:00
Max Brunsfeld
e00c3bbdb9 Take more parameters in ts_subtree_new_leaf 2018-09-15 00:08:47 -07:00
Max Brunsfeld
c828ca308f Don't store first_leaf field on leaf nodes 2018-09-14 23:08:15 -07:00
Max Brunsfeld
93926fc82e Don't store node_count and dynamic_precedence for leaf nodes 2018-09-14 11:02:11 -07:00
Max Brunsfeld
c7306722dd Use smaller allocations for normal leaf nodes 2018-09-14 00:48:03 -07:00
Max Brunsfeld
78b54810a6 Disable optimizations on windows for parsers w/ large lex functions 2018-09-12 15:01:56 -07:00
Max Brunsfeld
508499bab1 Fix bug where missing token was inserted outside of any included range 2018-09-11 17:41:23 -07:00
Max Brunsfeld
edbdf4b802 Increase maximum pre-allocation size of external scanner state 2018-08-31 13:30:59 -07:00
Max Brunsfeld
234d020957 Fix invalid access of external_scanner_state on non-terminal subtree
Fixes #199
2018-08-31 10:48:46 -07:00
Max Brunsfeld
77e4caef4f Revert "Store trees' children in TreeArrays, not w/ separate pointer and length"
This reverts commit 09be0b6ef5.
2018-08-31 10:41:06 -07:00
Max Brunsfeld
69c815107f Make ts_language_symbol_for_name work for ERROR 2018-08-31 09:46:55 -07:00
Max Brunsfeld
068c9841a1 Fix bug in ts_node_prev_sibling w/ empty nodes 2018-08-30 20:19:26 -07:00
Max Brunsfeld
e56d17a806 Fix symbol type for simple anonymous aliases 2018-08-30 12:40:27 -07:00
Max Brunsfeld
0fe6496b8b Allow version count to temporarily exceed the max during reductions 2018-08-30 10:43:01 -07:00
Max Brunsfeld
7fc64ed25a Account for simple aliases in unit reduction elimination 2018-08-30 09:57:22 -07:00
Max Brunsfeld
5372a81947 Simplify treatment of rules that are always aliased one way 2018-08-30 09:57:22 -07:00
Max Brunsfeld
725314b19e Fix bugs that prevented dynamic precedence from being respected 2018-08-23 16:45:36 -07:00
Max Brunsfeld
d4264d6191 Fix parsing of quantifiers with no upper bound 2018-08-06 13:47:26 -07:00
Max Brunsfeld
acc937b7d7 Handle input chunks that end within multi-byte characters 2018-08-02 15:43:30 -07:00
Max Brunsfeld
126f84aa73 Avoid unnecessary suffixes on external symbol identifiers 2018-08-01 16:11:21 -07:00
Max Brunsfeld
cb784975a4 Add IMMEDIATE_TOKEN rule type, for enforcing no preceding extras 2018-08-01 14:00:57 -07:00
Max Brunsfeld
e88dd223b2 Support {} quantifier syntax in regexes 2018-07-25 11:29:41 -07:00
Max Brunsfeld
87c992a7f0 Add lexer API for detecting boundaries of included ranges
Co-Authored-By: Ashi Krishnan <queerviolet@github.com>
2018-07-17 13:58:26 -07:00
Max Brunsfeld
d54412266e Avoid mutating the root node for out-of-bounds edits 2018-07-13 16:03:01 -07:00
Max Brunsfeld
0f0adfb681 Avoid recursion in ts_subtree_edit
This prevents stack overflows when editing very large trees.

Co-Authored-By: Ashi Krishnan <queerviolet@github.com>
2018-07-12 13:53:31 -07:00
Max Brunsfeld
9e8bec458d Add ts_node_edit API 2018-07-11 16:17:46 -07:00
Max Brunsfeld
df3969e9d9 Invalidate tree's parent cache after an edit 2018-07-10 14:08:30 -07:00
Max Brunsfeld
83f88164aa Fix end positions of tokens at the end of included ranges
Co-Authored-By: Ashi Krishnan <queerviolet@github.com>
2018-07-09 10:23:25 -07:00
Max Brunsfeld
3169620ce4 Fix ranges of tokens at the beginnings of included ranges 2018-07-06 17:08:36 -07:00
Max Brunsfeld
5ab6401478 Fix TreeCursor bugs
* ts_tree_cursor_goto_first_child_for_byte failed to find the child
  in some cases
* ts_tree_cursor_goto_parent did not handle aliased invisible parent
  nodes

Co-Authored-By: Ashi Krishnan <queerviolet@github.com>
2018-06-28 16:17:16 -07:00
Max Brunsfeld
80cab8fd8a Make the empty chunk 2 bytes long, for UTF16 support 2018-06-25 17:46:23 -07:00
Max Brunsfeld
10c12aaa3b Add ts_language_symbol_for_name function
Co-Authored-By: Ashi Krishnan <queerviolet@github.com>
2018-06-21 12:54:32 -07:00
Max Brunsfeld
fae7460541 Add ts_tree_language function
Co-Authored-By: Ashi Krishnan <queerviolet@github.com>
2018-06-21 12:54:19 -07:00
Max Brunsfeld
89b6a14d9f Allow creating a tree cursor starting at any node, not just the root
Co-Authored-By: Ashi Krishnan <queerviolet@github.com>
2018-06-21 12:54:04 -07:00
Max Brunsfeld
35ed21139c Declare the tree field of TSNode with a type of TSTree
This field doesn't need to be treated as opaque.

Co-Authored-By: Ashi Krishnan <queerviolet@github.com>
2018-06-21 12:53:17 -07:00
Max Brunsfeld
a6451f9b4f Add ts_parser_set_include_ranges function
Co-Authored-By: Ashi Krishnan <queerviolet@github.com>
2018-06-20 13:37:43 -07:00
Max Brunsfeld
6632cb3d5c Include byte offsets in TSRange
Co-Authored-By: Ashi Krishnan <queerviolet@github.com>
2018-06-20 11:46:44 -07:00
Max Brunsfeld
34de822738 Re-enable subtree object pool after accidentally disabling it 2018-06-19 16:33:33 -07:00
Max Brunsfeld
d7c1f84d7b Remove resume method, make parse resume by default
Also, add a `reset` method to explicitly discard an outstanding parse.

Co-Authored-By: Ashi Krishnan <queerviolet@github.com>
2018-06-19 15:33:29 -07:00
Max Brunsfeld
a24f7764d8 Get rid of string_input source file
There's not much in there now.
2018-06-19 11:27:55 -07:00
Max Brunsfeld
b0b3b2e5f3 Consolidate TSInput interface down to one function 2018-06-19 09:34:40 -07:00
Max Brunsfeld
703541e838 Explicitly initialize variable in ts_tree_cursor_goto_next_sibling 2018-06-18 10:48:32 -07:00
Max Brunsfeld
b29c5dbf15 Rephrase ts_subtree_array_copy to avoid conspicuous null case
This avoids a false positive error from the clang static analyzer, which
doesn't understand the invariants of the Array type.
2018-06-15 17:07:35 -07:00
Max Brunsfeld
75cf95bddc Fix double free when an external token is copied 2018-06-15 16:18:08 -07:00
Max Brunsfeld
e130c4ddb5 Add word property to grammar JSON schema 2018-06-15 13:32:41 -07:00
Max Brunsfeld
52a5e4125e Revert "Fix another const mismatch warning"
This reverts commit 776230782b.
2018-06-15 13:22:37 -07:00
Max Brunsfeld
4b5dab2d18 Convert keywords back to word token at runtime if needed 2018-06-15 13:15:02 -07:00
Max Brunsfeld
0dd41f0d74 Restore logic for restricting keyword tokens
Removing this restriction created problems for the Rust grammar, and
possibly others. The proper fix would be to ensure that the 'word
token' matches *every* possible string that a 'keyword token'
matches, as opposed to just matching *some* of the same strings.
This would require us to gather a little more information
about how tokens conflict. For now, I'm just going to put back the
hard-coded logic that we had.
2018-06-15 13:15:02 -07:00