Commit graph

46 commits

Author SHA1 Message Date
Max Brunsfeld
ac4167fdc9 Restructure integration tests to use separate JSON and corpus files
This makes these tests way easier to write and read.
2017-03-09 11:49:36 -08:00
Max Brunsfeld
3014101104 Fix inconsistencies in nodes sizes after edits 2016-09-19 13:35:08 -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
64a6c9db0e Rename ts_document_make -> ts_document_new 2016-09-06 17:26:18 -07:00
Max Brunsfeld
bc8df9f5c5 Avoid recompiling test languages when possible 2016-03-03 12:05:04 -08:00
Max Brunsfeld
17db46eded Add test for node that has only one symbol 2016-02-20 13:38:39 -08:00
Max Brunsfeld
2b35890bbb Add ts_node_symbols() function 2016-02-19 15:41:30 -08:00
Max Brunsfeld
7c44b0e387 Fix leaked lookahead trees in normal parsing 2016-01-29 17:31:43 -08:00
Max Brunsfeld
0f7dbea9a3 Unify test targets, use externally defined languages as fixtures 2016-01-15 11:19:24 -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
883bb87e29 add asserts for points in language_specs 2015-12-02 17:29:10 -05:00
joshvera
14bc05b8ac Fix some names and add more tests 2015-12-02 17:12:00 -05:00
joshvera
da8e48bf09 fix test names 2015-12-02 16:45:08 -05:00
joshvera
94a46d9ae1 Add more start_point and end_point tests 2015-12-02 16:40:56 -05:00
joshvera
cc4bd82e8a Fix failing tests using find 2015-12-02 16:06:55 -05:00
joshvera
9da4aeaeff columns start at 0 for sanity's sake 2015-11-30 17:22:47 -05:00
joshvera
3d9a44d880 Calculate the column and offset separately in TSNode 2015-11-25 13:36:19 -05:00
Max Brunsfeld
f37f73f92f Add ability to edit multiple times between parses 2015-09-18 23:20:06 -07:00
Max Brunsfeld
7ee5eaa16a Rename node accessor methods
Instead of child() vs concrete_child(), next_sibling() vs next_concrete_sibling(), etc,
the default is switched: child() refers to the concrete syntax tree, and named_child()
refers to the AST. Because the AST is abstract through exclusion of some nodes, the
names are clearer if the qualifier goes on the AST operations
2015-09-08 23:16:24 -07:00
Max Brunsfeld
245daffbc4 Add {next,prev}_concrete_sibling Node methods 2015-09-08 21:43:37 -07:00
Max Brunsfeld
c3f3f19ea8 Add concrete_child and concrete_child_count Node methods 2015-09-08 09:53:26 -07:00
Max Brunsfeld
21258e6a9e Remove 'document' wrapper node 2015-08-22 10:48:34 -07:00
Max Brunsfeld
a5d73ed676 Store indices on nodes to speed up traversal methods 2015-08-15 23:35:20 -07:00
Max Brunsfeld
d70a7227a1 Don't return invisible nodes from ts_node_find_for_range 2015-08-14 20:10:09 -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
766e3bab2c Use 2-space continuation indent consistently in specs 2015-07-27 18:18:58 -07:00
Max Brunsfeld
c1565c1aae Track AST nodes' sizes in characters as well as bytes
The `pos` and `size` functions for Nodes now return TSLength structs,
which contain lengths in both characters and bytes. This is important
for knowing the number of unicode characters in a Node.
2014-09-26 16:15:07 -07:00
Max Brunsfeld
c5ac02c571 Fix size calculation for error nodes 2014-08-29 13:22:03 -07:00
Max Brunsfeld
604b149c4b Assign sizes to error nodes in handle_error 2014-08-28 18:35:30 -07:00
Max Brunsfeld
117869e49a Fix position calculation in node_find_for_range 2014-08-25 15:52:17 -07:00
Max Brunsfeld
1535ebd21c Handle null parent in {next,prev}_sibling 2014-08-25 11:28:09 -07:00
Max Brunsfeld
cef6827182 Add find_for_range function for Nodes 2014-08-25 09:31:27 -07:00
Max Brunsfeld
b1a7886225 Rename node_leaf_at_pos -> node_find_pos
It doesn't always return a leaf node, just the smallest node
that spans the given position.
2014-08-25 09:06:51 -07:00
Max Brunsfeld
1e79ed794b Allow multiple top-level nodes
Now, the root node of a document is always a document node.
It will often have only one child node which corresponds to the grammar's
start symbol, but not always. Currently, it may have more than one child
if there are ubiquitous tokens such as comments at the beginning of the
document. In the future, it will also be possible be possible to have multiple
for the document to have multiple children if the document is partially parsed.
2014-08-09 00:00:20 -07:00
Max Brunsfeld
8da9219c3a Remove redundant functions for Documents
There's no need for a `string` function since one already
exists for Nodes.

Now the root node is always stored on the document. This
means callers of `ts_document_root_node` don't need to release
its return value.
2014-08-08 12:58:51 -07:00
Max Brunsfeld
b155994491 Fix indentation in specs 2014-08-07 08:11:21 -07:00
Max Brunsfeld
0d6d09cbd9 In generated parsers, export language as a function 2014-07-31 13:04:46 -07:00
Max Brunsfeld
eecbcccee0 Remove generated parsers' dependency on the runtime library
Generated parsers no longer export a parser constructor function.
They now export an opaque Language object which can be set on
Documents directly. This way, the logic for constructing parsers
lives entirely in the runtime. The Languages are just structs which
have no load-time dependency on the runtime
2014-07-30 23:40:02 -07:00
Max Brunsfeld
af5a118000 Add ts_node_child_count function 2014-07-20 17:57:20 -07:00
Max Brunsfeld
466daeaf99 Add function for retrieving a leaf node by position 2014-07-18 18:52:08 -07:00
Max Brunsfeld
1ecafb874e Add functions to retrieve nodes' siblings and parents 2014-07-18 13:24:03 -07:00
Max Brunsfeld
b3385f20c8 Hide TSTree, expose TSNode 2014-07-17 23:29:11 -07:00