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
c7306722dd
Use smaller allocations for normal leaf nodes
2018-09-14 00:48:03 -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
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
0fe6496b8b
Allow version count to temporarily exceed the max during reductions
2018-08-30 10:43:01 -07:00
Max Brunsfeld
725314b19e
Fix bugs that prevented dynamic precedence from being respected
2018-08-23 16:45:36 -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
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
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
4b5dab2d18
Convert keywords back to word token at runtime if needed
2018-06-15 13:15:02 -07:00
Max Brunsfeld
69d8c6f5e6
Check that language is present in both parse() and resume()
2018-05-23 15:41:16 -07:00
Max Brunsfeld
e16f0338d6
Add APIs for pausing a parse after N operations and resuming later
2018-05-23 15:02:39 -07:00
Max Brunsfeld
1fece241aa
Add ts_parser_set_enabled API
2018-05-21 17:28:12 -07:00
Max Brunsfeld
39c3de3fc8
Don't reuse nodes within ambiguities
2018-05-21 16:04:10 -07:00
Max Brunsfeld
fe53506175
Declare subtrees as const wherever possible
...
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2018-05-11 15:06:13 -07:00
Max Brunsfeld
20c183b7cd
Rename ts_subtree_make_* -> ts_subtree_new_*
2018-05-11 13:02:12 -07:00
Max Brunsfeld
bf1bb1604f
Rename TSExternalTokenState -> ExternalScannerState
2018-05-11 12:57:41 -07:00
Max Brunsfeld
199a94cc26
Allow the parser to print dot graphs to any file
2018-05-11 12:48:51 -07:00
Max Brunsfeld
e75ecd1bb1
Rework API completely
2018-05-11 10:46:13 -07:00
Max Brunsfeld
33f7643040
Rename Parser -> TSParser
...
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2018-05-10 15:16:24 -07:00
Max Brunsfeld
35510a612d
Rename Tree -> Subtree
2018-05-10 15:11:14 -07:00
Max Brunsfeld
59694e60fa
Rename ts_tree_assign_parents -> ts_tree_balance
2018-05-10 09:13:46 -07:00
Max Brunsfeld
973e4a44f0
Start work on removing parent pointers
...
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2018-05-09 12:22:19 -07:00
Max Brunsfeld
f620843591
Remove unused ReusableNode function
2018-05-08 11:42:15 -07:00
Max Brunsfeld
b0b8279c14
Preallocate tree arrays when popping from the stack
2018-04-09 18:14:17 -07:00
Max Brunsfeld
33820253e8
Make stack_print_dot_graph function take a language as an argument
2018-04-09 12:29:22 -07:00
Max Brunsfeld
379a2fd121
Incrementally build a tree of skipped tokens
...
Rather than pushing them to the stack individually
2018-04-09 12:29:22 -07:00
Max Brunsfeld
94ed1b6964
Make array_splice take an array, not a pointer and length
2018-04-06 13:29:43 -07:00
Max Brunsfeld
09be0b6ef5
Store trees' children in TreeArrays, not w/ separate pointer and length
2018-04-06 13:26:18 -07:00
Max Brunsfeld
34349f9cbb
Put back limit on error handling based on accepted tree count
2018-04-06 13:26:18 -07:00
Max Brunsfeld
0ec7e5ce42
Remove ts_stack_force_merge function
2018-04-06 13:26:18 -07:00
Max Brunsfeld
80f856cef5
Maintain a total node count on every tree
...
This simplifies (and fixes bugs in) the parse stack's tracking of its
total node count since the last error, which is needed for error
recovery.
2018-04-06 13:26:18 -07:00
Max Brunsfeld
e59558c83b
Allow stack versions to be temporarily paused
...
This way, when detecting an error, we can defer the decision about
whether to bail or recover until all stack versions are processed.
2018-04-06 13:26:18 -07:00
Max Brunsfeld
5520983144
Clean up Stack API
...
* Remove StackPopResult
* Rename top_state() -> state()
* Rename top_position() -> position()
* Improve docs
2018-03-29 17:37:54 -07:00
Max Brunsfeld
ee995c3d6b
Avoid redundant retains/releases by giving ts_stack_push move semantics
2018-03-29 17:18:43 -07:00
Max Brunsfeld
e917756ad1
Remove depends_on_lookahead field from parse table entries
...
This simplifies the logic for determining whether a token is reusable
and makes it more conservative. It should fix some incremental parsing
bugs that are being caught by the randomized tests on CI.
2018-03-28 10:58:33 -07:00
Max Brunsfeld
e927d02f43
Allow reusing leaf nodes unless the next leaf has changes
2018-03-07 17:44:54 -08:00
Max Brunsfeld
c0cc35ff07
Create separate lexer function for keywords
2018-03-07 12:00:26 -08:00
Max Brunsfeld
f96969738b
Don't remove mergeable stack versions so aggressively during condense
2018-03-05 10:40:05 -08:00
Max Brunsfeld
dbc0c208f4
Add missing initialization of parser's in_ambiguity state
2018-03-02 15:25:39 -08:00
Max Brunsfeld
52087de4f0
Remove the concept of fragile reductions
...
They were a vestige of when Tree-sitter did sentential form-based
incremental parsing (as opposed to simply state matching). This was
elegant but not compatible with GLR as far as I could tell.
2018-03-02 14:51:54 -08:00
Max Brunsfeld
299a146b66
Balance repetition trees after parsing
2018-02-12 11:41:56 -08:00
Max Brunsfeld
8c29841adf
Represent repetitions with associative structure
2018-02-12 11:41:56 -08:00
Max Brunsfeld
46dcd53090
Do not insert missing tokens if halt_on_error option is passed
2018-01-24 14:04:55 -08:00
Max Brunsfeld
dafa897021
Bail on error recovery if too many alternative parses have already completed
2018-01-09 17:08:36 -08:00
Max Brunsfeld
21a88b1731
Don't count less-far-along versions in better_version_exists method
2017-12-29 16:10:43 -08:00
Max Brunsfeld
d3c85f288d
Start work on repairing errors by inserting missing tokens
2017-12-29 15:11:00 -08:00