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
Max Brunsfeld
f2dc620610
Extract parser__recover_to_state method
2017-12-29 15:10:59 -08:00
Max Brunsfeld
adf47e2b57
Fix invalid usage of 'extra' field on non-shift parse action
2017-12-29 11:46:41 -08:00
Max Brunsfeld
d9094e8146
Consolidate more logic into do_potential_reductions method
2017-12-28 15:49:48 -08:00
Max Brunsfeld
172cbb2d22
Fix infinite loop due to skipping empty tokens during error recovery
2017-12-27 11:18:06 -08:00
Max Brunsfeld
addeb6c4c1
Allocate and free trees using an object pool
2017-12-27 10:34:29 -08:00
Max Brunsfeld
0e69da37a5
Return a character count from the lexer's get_column method
2017-12-20 16:26:38 -08:00
Max Brunsfeld
fbcefe25f7
Avoid creating external tokens that start after they end
2017-12-07 11:50:27 -08:00
Max Brunsfeld
5d676de051
Remove unnecessary conditional in parser__accept
2017-12-07 11:50:27 -08:00
Max Brunsfeld
48681c3f0e
Initialize error start and end positions at their declarations
...
Fixes #113
Clang doesn't seem to be able to tell that these variables were guaranteed to
be initialized by the time they were read.
2017-10-31 10:06:44 -07:00
Max Brunsfeld
121a6a66ec
Take total dynamic precedence into account in stack version sorting
...
Signed-off-by: Josh Vera <vera@github.com>
2017-10-09 15:51:22 -07:00