Commit graph

184 commits

Author SHA1 Message Date
Phil Turnbull
c41841f4e9 Assert ts_parser_set_language in fuzz driver 2018-05-22 08:40:36 -07:00
Phil Turnbull
c56c4affb2 Use ts_tree_root_node in fuzz driver 2018-05-22 08:19:56 -07:00
Max Brunsfeld
1fece241aa Add ts_parser_set_enabled API 2018-05-21 17:28:12 -07:00
Max Brunsfeld
78f28b14ce Remove unused field 2018-05-18 14:27:52 -07:00
Max Brunsfeld
074c051094 Change the TSInputEdit struct to work with old/new start and end positions 2018-05-17 11:14:51 -07:00
Max Brunsfeld
e3670be42f Avoid one heap allocation when instantiating a TSTreeCursor 2018-05-16 16:05:08 -07:00
Max Brunsfeld
6fc8d9871c Hide the details of TSNode's fields in the public API 2018-05-16 15:44:04 -07:00
Max Brunsfeld
ebddb1a0b5 Add ts_tree_cursor_goto_first_child_for_byte method
Atom needs this for efficiently seeking to the leaf node at a given position,
visiting all of its ancestors along the way.
2018-05-16 13:51:21 -07:00
Max Brunsfeld
32c06b9b59 Make multi-threaded test work on windows
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2018-05-11 17:10:05 -07:00
Max Brunsfeld
043a2fc0d9 Assert absence of memory leaks in randomized multi-threaded tree test 2018-05-11 16:53:47 -07:00
Max Brunsfeld
a3e08e7c31 Add randomized multi-threaded tests on parse trees
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2018-05-11 16:10:36 -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
f0c7295d27 Update fuzz driver to use new API 2018-05-11 12:48:51 -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
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
a53d0b43a1 Remove unnecessary include 2018-05-09 22:55:54 -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
b06747b6ca Remove stale unit tests
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2018-05-09 14:14:42 -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
d5cfc06fa2 Fix unit test for invalid utf8 at EOF 2018-04-17 17:33:45 -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
3c737d8295 Respect -D flag in fuzzing examples 2018-04-06 16:09:17 -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
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
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
Axel Hecht
345e344377 Tests for issue 158 2018-04-05 14:39:25 +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
Max Brunsfeld
ee995c3d6b Avoid redundant retains/releases by giving ts_stack_push move semantics 2018-03-29 17:18:43 -07:00
Max Brunsfeld
186f70649c Consolidate the unify for detecting conflicting tokens 2018-03-28 10:03:09 -07:00
Max Brunsfeld
a8bc67ac42 Allow LookaheadSet::for_each to terminate early 2018-03-28 10:03:09 -07:00
Max Brunsfeld
43e14332ed Avoid creating duplicate metadata rules 2018-03-28 10:03:09 -07:00
Max Brunsfeld
b7d0606fbd Be less conservative in merging parse states with external tokens
Also, clean up the internal representation of external tokens
2018-03-16 16:00:40 -07:00
Max Brunsfeld
fe29173d5f
Merge pull request #142 from tree-sitter/fuzz-halt-recover
Add 'halt' and 'recover' modes to fuzzer
2018-03-14 09:28:58 -07:00
Phil Turnbull
269b1a0864 Update repo for libFuzzer
libFuzzer has now been broken out from LLVM and can be built separately
2018-03-12 13:08:58 -07:00
Max Brunsfeld
7183f8d3e7 Fix unit reduction elimination bugs
* Handle 'chains' of unit reductions starting in a single state
* Avoid eliminating rules which will later receive aliases
2018-03-12 07:54:18 -07:00
Max Brunsfeld
df2430b94c Remove a C error recovery test temporarily 2018-03-08 14:18:12 -08:00
Max Brunsfeld
0810971f3e 🔥 symbol iterator API
This idea was never fully baked.
2018-03-08 14:16:37 -08:00
Max Brunsfeld
e927d02f43 Allow reusing leaf nodes unless the next leaf has changes 2018-03-07 17:44:54 -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