Commit graph

1859 commits

Author SHA1 Message Date
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
61327b627a Add a unit test asserting that ts_tree_edit doesn't mutate the tree
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2018-05-10 12:28:16 -07:00
Max Brunsfeld
09e663c7d1 Make ts_tree_edit return a new tree rather than mutating its argument
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2018-05-10 12:23:05 -07:00
Max Brunsfeld
df79ff5997 Refactor ts_tree_edit
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2018-05-10 12:04:18 -07:00
Max Brunsfeld
eff7283325 Add assertion to satisfy clang static analyzer
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2018-05-10 09:48:50 -07:00
Max Brunsfeld
59694e60fa Rename ts_tree_assign_parents -> ts_tree_balance 2018-05-10 09:13:46 -07:00
Max Brunsfeld
a53d0b43a1 Remove unnecessary include 2018-05-09 22:55:54 -07:00
Max Brunsfeld
78d158899e Use atomic operations for updating syntax tree reference counts
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2018-05-09 17:36:03 -07:00
Max Brunsfeld
666dfb76d2 Remove document parameter from ts_node_type, ts_node_string
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2018-05-09 16:47:47 -07:00
Max Brunsfeld
92255bbfdd Remove document parameter from ts_node_type, ts_node_string
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2018-05-09 15:28:28 -07:00
Max Brunsfeld
8d805feab1 Allow ReusableNode to advance off the end of the tree
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2018-05-09 14:15:11 -07:00
Max Brunsfeld
5fa6d39578 Fix alias handling in ts_tree_string
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2018-05-09 14:14:56 -07:00
Max Brunsfeld
b06747b6ca Remove stale unit tests
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2018-05-09 14:14:42 -07:00
Max Brunsfeld
19e3750f13 Make ts_node_next_sibling work more like ts_node_prev_sibling
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2018-05-09 13:46:46 -07:00
Max Brunsfeld
f857d64d54 Avoid recursion in ts_node__prev_sibling 2018-05-09 13:23:47 -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
8300f24fec Avoid slow test setup if seed flag is set to -1 2018-05-08 16:34:20 -07:00
Max Brunsfeld
f620843591 Remove unused ReusableNode function 2018-05-08 11:42:15 -07:00
Max Brunsfeld
d5cfc06fa2 Fix unit test for invalid utf8 at EOF 2018-04-17 17:33:45 -07:00
Max Brunsfeld
e8cfb9ced0 Remove incorrect return statement
This prevented conflicts between some tokens from being recorded
properly. In the case of JavaScript, it prevented tree-sitter from
recognizing the conflict between the forward slash operator and the
regex token, allowing regexes to be merged into parse states containing
'/' incorrectly.

Refs tree-sitter/tree-sitter-javascript#71
2018-04-17 17:14:36 -07:00
Max Brunsfeld
f00d2ade46 Remove unused function 2018-04-09 19:37:53 -07:00
Max Brunsfeld
b0b8279c14 Preallocate tree arrays when popping from the stack 2018-04-09 18:14:17 -07:00
Max Brunsfeld
ff70f8d881
Merge pull request #155 from tree-sitter/error-recovery-improvements
Fix some error recovery problems
2018-04-09 12:44:02 -07:00
Max Brunsfeld
3672a8ad87 Remove unused tree method 2018-04-09 12:29:22 -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
1eafcf0ba7 Make test script generate debug graphs even when assertions fail 2018-04-06 16:11:01 -07:00
Max Brunsfeld
a79a8c216f Include each node count and error cost in stack dot graphs 2018-04-06 16:10:36 -07:00
Max Brunsfeld
3c737d8295 Respect -D flag in fuzzing examples 2018-04-06 16:09:17 -07:00
Max Brunsfeld
87098760de 🎨 2018-04-06 13:51:31 -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
a6cf2e87e7 Fix halt_on_error tests 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
1d9d6f37ad Introduce an error cost per error instance to favor fewer errors 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
f3bbf045b7 Avoid unnecessary stack node retain and release on every push 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
1109a565fc
Merge pull request #159 from Pike/test-escape-brackets
Tests for issue 158
2018-04-06 13:19:36 -07:00
Max Brunsfeld
1ca261c79b Fix some regex parsing bugs
* Allow escape sequences to be used in ranges
* Don't give special meaning to dashes outside of character classes
2018-04-06 12:46:06 -07:00
Max Brunsfeld
65e654ea9b Remove overly conservative check for the validity of keyword capture tokens 2018-04-05 13:25:16 -07:00
Axel Hecht
345e344377 Tests for issue 158 2018-04-05 14:39:25 +02:00
Max Brunsfeld
d2019cd12c Ignore log file 2018-04-02 09:15:11 -07:00
Max Brunsfeld
89d0d1dd0e
Merge pull request #154 from 314eter/invalidtokencontents
Add error message for TSCompileErrorTypeInvalidTokenContents
2018-03-30 12:32:33 -07:00
Pieter Goetschalckx
3d0ca31cf1 Add error message for TSCompileErrorTypeInvalidTokenContents 2018-03-30 21:12:09 +02:00
Max Brunsfeld
dbe77e7199 Simplify testing-only ts_stack_iterate function 2018-03-29 17:50:07 -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