Commit graph

93 commits

Author SHA1 Message Date
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
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
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
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
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
09be0b6ef5 Store trees' children in TreeArrays, not w/ separate pointer and length 2018-04-06 13:26:18 -07:00
Max Brunsfeld
0810971f3e 🔥 symbol iterator API
This idea was never fully baked.
2018-03-08 14:16:37 -08:00
Max Brunsfeld
315dff3285 Add an API for getting a node's child index 2018-01-09 14:01:36 -08:00
Max Brunsfeld
f653f2b3bb Add ts_node_first_{child,named_child}_for_byte methods 2018-01-09 13:44:59 -08:00
Max Brunsfeld
d3c85f288d Start work on repairing errors by inserting missing tokens 2017-12-29 15:11:00 -08:00
Max Brunsfeld
eee3db08d2 Avoid repeated calls to {start,end}_point in descendant_for_point_range 2017-12-27 11:55:52 -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
09f4796f6b Get tests passing w/ new alias API 2017-08-01 14:35:34 -07:00
Max Brunsfeld
cb5fe80348 Rename RENAME rule to ALIAS, allow it to create anonymous nodes 2017-07-31 16:41:11 -07:00
Max Brunsfeld
f33421c53e Fix incorrect node renames in the presence of extra tokens 2017-07-18 21:24:34 -07:00
Max Brunsfeld
afb499bf2e Handle rename symbols in ts_language APIs 2017-07-18 12:01:52 -07:00
Max Brunsfeld
4b40a1ed6c Support anonymous tokens inside of RENAME rules 2017-07-14 10:19:58 -07:00
Max Brunsfeld
b3a72954ff Introduce RENAME rule type 2017-07-13 17:17:22 -07:00
Max Brunsfeld
17bc3dfaf7 Add a benchmark command
This command measures the speed of parsing each grammar's examples.
It also uses each grammar to parse all of the *other* grammars' examples
in order to measure error recovery performance with fairly large files.
2017-07-05 14:14:38 -07:00
Max Brunsfeld
2b3da512a4 Add serialize, deserialize and reset callbacks to external scanners
Signed-off-by: Nathan Sobo <nathan@github.com>
2016-12-20 13:12:01 -08:00
Max Brunsfeld
535879a2bd Represent byte, char and tree counts as 32 bit numbers
The parser spends the majority of its time allocating and freeing trees and stack nodes.
Also, the memory footprint of the AST is a significant concern when using tree-sitter
with large files. This library is already unlikely to work very well with source files
larger than 4GB, so representing rows, columns, byte lengths and child indices as
unsigned 32 bit integers seems like the right choice.
2016-11-14 12:19:13 -08:00
Max Brunsfeld
c9dcb29c6f Remove the TS prefix from some internal type/function names 2016-11-09 20:59:05 -08:00
Max Brunsfeld
eed54d95e1 Merge branch 'master' into changed-ranges 2016-10-16 21:10:25 -07:00
Max Brunsfeld
e149d94ff5 Remove generated parsers' dependency on runtime.h 2016-10-05 14:02:49 -07:00
Max Brunsfeld
cc62fe0375 Represent Lengths in terms of Points 2016-09-09 21:11:02 -07:00
Max Brunsfeld
a6a08dde31 Rename ts_node_name -> ts_node_type 2016-09-06 21:43:59 -07:00
Max Brunsfeld
f6da44fdbb Add ts_node_descendant_for_byte_range 2016-09-06 21:33:19 -07:00
Max Brunsfeld
70756034f1 Allow descendant queries by both 1D and 2D coordinates 2016-09-06 21:17:26 -07:00
Max Brunsfeld
1c66d90203 Mark repeat symbols as anonymous 2016-07-17 10:44:08 -07:00
Max Brunsfeld
1fb6065f02 Move tree sexp function back to tree, for easier use in debugger 2016-04-24 00:09:32 -07:00
Max Brunsfeld
5ba40f15ad Rename stack heads to versions 2016-04-04 12:25:57 -07:00
Max Brunsfeld
eb47edb446 Add static function for stringifying nodes including hidden ones 2016-04-03 23:45:43 -07:00
Max Brunsfeld
e0c24e3be6 Remove old error recovery code 2016-03-02 20:58:39 -08:00
Max Brunsfeld
b36143d7a7 Add flag for logging dot graphs of the stack while parsing 2016-02-23 09:45:27 -08:00
Max Brunsfeld
2b35890bbb Add ts_node_symbols() function 2016-02-19 15:41:30 -08:00
Max Brunsfeld
df1d9b2416 Move sexp-generation code to node.c 2016-02-19 15:41:09 -08:00
Max Brunsfeld
9d0835edbf Return non-const string from ts_node_string
The caller should free the string.
2016-01-18 10:27:23 -08:00
Max Brunsfeld
da1bc038e5 Remove nested options structs in Tree 2015-12-22 14:20:58 -08:00
Max Brunsfeld
08d50c25ae clang-format 2015-12-04 20:56:33 -08:00
Max Brunsfeld
d2bf88d5fe Include rows and columns in TSLength
This way, we don't have to have separate 1D and 2D versions for so many values
2015-12-04 20:20:29 -08:00
Max Brunsfeld
22c76fc71b Remove TSLength from runtime header
Refactor node functions now that character offset and byte offset are stored separately
2015-12-04 10:45:30 -08:00
Max Brunsfeld
b3a6de6dad Replace node pos/size functions with start/end char/byte functions 2015-12-03 22:59:27 -08:00
Max Brunsfeld
f08554e958 Replace NodeType enum with SymbolMetadata bitfield
This will allow storing other metadata about symbols, like if they
only appear as ubiquitous tokens
2015-12-02 15:10:24 -08:00
joshvera
4953182707 add row to node equality 2015-12-02 16:45:20 -05:00
joshvera
7ad82cf684 add const 2015-12-02 16:45:12 -05:00
joshvera
3f9c8b76de Add padding_point.row to ts_node_start_point's row. 2015-12-02 16:41:16 -05:00