Max Brunsfeld
5c95d02bd0
Move ts_tree_compare to the right file
2015-11-20 11:53:03 -08:00
Max Brunsfeld
7aba2a0716
Rename DEBUG macro to LOG
...
DEBUG is already used as the symbol to enable/disable assert() calls
2015-11-20 11:50:50 -08:00
Max Brunsfeld
8d1b9501ab
Fix integer comparison warnings
2015-11-20 11:47:39 -08:00
Max Brunsfeld
c88e9044d5
Make stack popping more robust
2015-11-20 00:04:21 -08:00
Max Brunsfeld
64874449e4
Allow different parse stack heads to lex differently
2015-11-19 20:55:18 -08:00
Max Brunsfeld
484721b0c2
Assign tree parent pointers after parse is complete
2015-11-15 12:21:16 -08:00
Max Brunsfeld
0824d3e1f3
Only use first parse stack path during error recovery
2015-11-14 12:37:21 -08:00
Max Brunsfeld
46e99d3e42
Retrieve the shift action correctly when reducing and recovering
2015-11-11 17:53:45 -08:00
Max Brunsfeld
40a90b551a
Allow error recovery to look all the way to the bottom of the stack
...
Previously, there was a bug where the first node on the stack
would never be popped
2015-11-11 16:59:41 -08:00
Max Brunsfeld
1a5d5b3156
Make ambiguities resolve deterministically
...
In the future, they should resolve according to some kind of dynamic
precedence annotations provided in the grammars. For now, this at least makes
them fully deterministic, so that tests won't fail due to ambiguities resolving
differently after undone edits.
2015-11-11 16:54:03 -08:00
Max Brunsfeld
30b6530fd1
Account for parse stack merges when shifting
...
Previously, when the parse stack was split into 3 or more heads, it was
possible for head 3 to be accidentally skipped if head 2 merged with head 1.
2015-11-05 21:21:18 -08:00
Max Brunsfeld
216ce8c80b
Rename receiver parameter to 'self'
2015-10-14 22:14:08 -07:00
Max Brunsfeld
3ee58461d7
Clean up main parser loop
2015-10-07 13:05:36 -07:00
Max Brunsfeld
8ef25ffef3
Try lexing using each parse stack head's state
...
This fixes the case where the parse stack is split and the top states
have different valid lookahead symbols
2015-10-06 16:22:58 -07:00
Max Brunsfeld
85466a5b22
Clean up and document ts_parser__next function
2015-10-06 11:43:34 -07:00
Max Brunsfeld
03e7fc49fd
Fix bug in parse stack splitting logic for GLR
2015-10-06 10:50:51 -07:00
Max Brunsfeld
aba8af9e5b
Cleanup debug logging in parser
2015-09-22 19:35:13 -07:00
Max Brunsfeld
673ca411b1
Fix lint errors
2015-09-19 13:19:49 -07:00
Max Brunsfeld
f37f73f92f
Add ability to edit multiple times between parses
2015-09-18 23:20:06 -07:00
Max Brunsfeld
6254f45c1b
Rename ParseStack -> Stack
2015-09-18 22:02:06 -07:00
Max Brunsfeld
b3d883e128
Store edits in trees, not by splitting stack
...
This allows for multiple edits per parse, though it is not exposed through
the API yet
2015-09-18 22:02:06 -07:00
Max Brunsfeld
c09947146a
Remove not-necessarily-valid assertion
2015-09-10 16:26:23 -07:00
Max Brunsfeld
252fa7b631
Add Document getter methods for input, language
2015-09-08 23:33:43 -07:00
Max Brunsfeld
ebd60213d9
Drop release functions from callback structs
...
The caller can just as easily take care of the cleanup explicitly
2015-09-08 23:24:33 -07:00
Max Brunsfeld
9591c88f39
In runtime, distinguish between anonymous and hidden nodes
2015-09-06 00:12:37 -07:00
Max Brunsfeld
21258e6a9e
Remove 'document' wrapper node
2015-08-22 10:48:34 -07:00
Max Brunsfeld
6933d7b425
🎨 naming conventions
2015-08-16 20:05:47 -07:00
Max Brunsfeld
25af9a3adf
Don't store visible children on trees
2015-08-14 16:11:37 -07:00
Max Brunsfeld
54e40b8146
Rework AST access API: reduce heap allocation
2015-07-31 15:47:48 -07:00
Max Brunsfeld
f9b057f3a9
clang-format everything
2015-07-27 18:29:48 -07:00
Max Brunsfeld
0b1d70db34
Always resolve ambiguities immediately
...
No more ambiguity nodes.
Also, when merging parse stacks, merge their successors if needed.
2015-07-15 13:15:11 -07:00
Max Brunsfeld
6846b1316e
handle_error: respect head argument
2015-07-10 15:17:54 -07:00
Max Brunsfeld
aff8bc3266
Split parse stack when there are multiple parse actions
2015-07-09 23:09:33 -07:00
Max Brunsfeld
442db56b92
Use graph-structured parse stack in parser
...
Not using the splitting feature yet.
2015-06-18 17:03:17 -07:00
Max Brunsfeld
755894b44d
Allow multiple parse actions in parse table
2015-06-18 17:03:16 -07:00
Max Brunsfeld
25f8ecd85f
🎨 parser.c
2015-06-15 18:21:44 -07:00
Max Brunsfeld
3d0890eecf
Preserve tokens within errors
2015-06-15 15:26:06 -07:00
Max Brunsfeld
d5ce3a9b5a
lexer: in error mode, continue until token is found
2015-06-15 15:26:05 -07:00
Max Brunsfeld
f7e4445358
Handle goto actions after reductions in a more standard way
...
Rather than letting the reduced tree become the new lookahead symbol,
and re-adding it to the stack via a subsequent shift action, just
add it to the stack as part of the reduce action. This is more in
line with the way LR is described traditionally.
2015-05-27 10:53:02 -07:00
Max Brunsfeld
b0a89efb35
Tweak parse debugging output
2015-03-07 16:35:11 -08:00
Max Brunsfeld
2d436cf141
Identify fragile reductions at compile time
2015-02-21 15:11:03 -08:00
Max Brunsfeld
a92067702d
Use a more exact test for reusability of error nodes
...
Based on the concept of node fragility from wagner's incremental
parsing paper
2015-02-21 10:39:58 -08:00
Max Brunsfeld
5dc08ccce9
Include names of in-progress rules in shift/reduce conflicts
2014-11-05 18:39:50 -08:00
Max Brunsfeld
290cbefe6d
Add commas between parameters in debug statements
...
This way, the debug lines can be parsed more unambiguously
2014-10-29 18:16:34 -07:00
Max Brunsfeld
3bc4971fd5
Don't reuse any nodes that contain an error as a child node
2014-10-23 12:50:37 -07:00
Max Brunsfeld
647c3e2010
Add tests for editing all language examples
...
This drove out several fixes to the incremental parsing algorithm.
There are a few examples which still don't work and which have
been explicitly excluded, for now.
2014-10-22 20:10:08 -07:00
Max Brunsfeld
de9a48d11f
Tweak debugging in parser and lexer
2014-10-22 20:10:08 -07:00
Max Brunsfeld
38ad248a53
Inline variable in parser_set_debugger
2014-10-18 18:36:39 -07:00
Max Brunsfeld
c26cee5d18
Remove debugger in parser spec
2014-10-17 23:47:20 -07:00
Max Brunsfeld
0962b21dd3
Fix parse errors with tree-reuse
...
- Don't reuse error nodes
- When re-using nodes, update lexer's token_end_position
2014-10-17 23:20:36 -07:00