Commit graph

41 commits

Author SHA1 Message Date
joshvera
8446b657f0 Rename position to offset and point to offset_point 2015-11-18 17:53:38 -08:00
joshvera
cf72f2f0ae ts_node_size_point 2015-11-18 16:47:27 -08:00
joshvera
eb2a18cf16 s/TSLength/TSPoint 2015-11-18 16:46:09 -08:00
joshvera
6485e27d70 add ts_node_end_point 2015-11-18 16:45:10 -08:00
joshvera
b0f6bac3ab replace start and end with padding and size 2015-11-18 16:34:50 -08:00
joshvera
8058500c5b Add source info to TSTree 2015-11-12 15:32:53 -05:00
Max Brunsfeld
36eae5d5e9 Add option to tree_string to include anonymous tokens 2015-10-28 12:09:28 -07:00
Max Brunsfeld
216ce8c80b Rename receiver parameter to 'self' 2015-10-14 22:14:08 -07:00
Max Brunsfeld
f37f73f92f Add ability to edit multiple times between parses 2015-09-18 23:20:06 -07:00
Max Brunsfeld
fe3be2aa53 Optimize Node parent() method 2015-09-09 12:43:35 -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
3e17172f6e Remove unnecessary conditional 2015-08-16 10:54:02 -07:00
Max Brunsfeld
d910a2d0e7 Rename node position to offset 2015-08-16 10:51:34 -07:00
Max Brunsfeld
b853e0f2eb 🎨 node.c 2015-08-16 10:27:26 -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
507b7aef00 Remove recursion in ts_node_child 2015-08-14 16:34:12 -07:00
Max Brunsfeld
25af9a3adf Don't store visible children on trees 2015-08-14 16:11:37 -07:00
Max Brunsfeld
8a9626bfc5 Simplify storage of position on nodes 2015-08-14 14:48:29 -07:00
Max Brunsfeld
da7eb1496b Clean up node.c 2015-08-12 13:41:22 -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
e5ea4efb0b Use stdbool.h 2014-10-03 16:06:08 -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
545e575508 Revert "Remove the separator characters construct"
This reverts commit 5cd07648fd.

The separators construct is useful as an optimization. It turns out that
constructing a node for every chunk of whitespace in a document causes a
significant performance regression.

Conflicts:
	src/compiler/build_tables/build_lex_table.cc
	src/compiler/grammar.cc
	src/runtime/parser.c
2014-09-02 08:03:51 -07:00
Max Brunsfeld
5cd07648fd Remove the separator characters construct
Now, grammars can handle whitespace by making it another ubiquitous
token, like comments.

For now, this has the side effect of whitespace being included in the
tree that precedes it. This was already an issue for other ubiquitous
tokens though, so it needs to be fixed anyway.
2014-09-01 20:19:43 -07:00
Max Brunsfeld
a72b79f7f3 Tweak formatting in node.c 2014-08-28 13:30:02 -07:00
Max Brunsfeld
3430a5edcc Clarify distinction btwn tree padding, tree offset, node position
- Node position is public. It represents the node's first character
  index in the document.
- Tree offset is private. It represents the distance between the tree's
  first character index and it's parent's first character index.
- Tree padding is private. It represents the amount of whitespace
  (or other separator characters) immediately preceding the tree.
2014-08-28 13:22:06 -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
98cc2f2264 Auto-format all source code with clang-format 2014-07-21 13:20:00 -07:00
Max Brunsfeld
df359bc01f Use 2-space indent in c files 2014-07-20 20:27:33 -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
0e11bf7271 Precompute trees' visible children 2014-07-18 13:08:14 -07:00
Max Brunsfeld
b3385f20c8 Hide TSTree, expose TSNode 2014-07-17 23:29:11 -07:00