Max Brunsfeld
216ce8c80b
Rename receiver parameter to 'self'
2015-10-14 22:14:08 -07:00
Max Brunsfeld
e7838d520a
Remove invalid assertion in ts_tree_edit
2015-09-22 21:02:25 -07:00
Max Brunsfeld
b3d883e128
Store edits in trees, not by splitting stack
...
This allows for multiple edits per parse, though it is not exposed through
the API yet
2015-09-18 22:02:06 -07:00
Max Brunsfeld
0467d190fe
Add ts_tree_edit function
2015-09-18 22:02: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
f9316933ad
Refactor logic for marking '_'-prefixed rules as hidden
2015-09-06 16:53:13 -07:00
Max Brunsfeld
9591c88f39
In runtime, distinguish between anonymous and hidden nodes
2015-09-06 00:12:37 -07:00
Max Brunsfeld
53926c467e
Don't automatically hide singleton nodes
2015-09-02 16:36:29 -07:00
Max Brunsfeld
21258e6a9e
Remove 'document' wrapper node
2015-08-22 10:48:34 -07:00
Max Brunsfeld
6933d7b425
🎨 naming conventions
2015-08-16 20:05:47 -07:00
Max Brunsfeld
553ef6674f
Rename TreeOptionsWrapper -> TreeOptionsSingleton
2015-08-16 10:32:12 -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
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
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
0b1d70db34
Always resolve ambiguities immediately
...
No more ambiguity nodes.
Also, when merging parse stacks, merge their successors if needed.
2015-07-15 13:15:11 -07:00
Max Brunsfeld
aff8bc3266
Split parse stack when there are multiple parse actions
2015-07-09 23:09:33 -07:00
Max Brunsfeld
aaaa1c8a5d
Encapsulate ParseStackNodes
2015-06-18 17:03:17 -07:00
Max Brunsfeld
381f89f8ba
Create ambiguity nodes when joining stack heads
2015-06-18 17:03:16 -07:00
Max Brunsfeld
3d0890eecf
Preserve tokens within errors
2015-06-15 15:26:06 -07:00
Max Brunsfeld
59fd190695
Don't store lookahead_char field for non-error nodes
2015-05-24 14:43:54 -07:00
Max Brunsfeld
a92067702d
Use a more exact test for reusability of error nodes
...
Based on the concept of node fragility from wagner's incremental
parsing paper
2015-02-21 10:39:58 -08:00
Max Brunsfeld
3bc4971fd5
Don't reuse any nodes that contain an error as a child node
2014-10-23 12:50:37 -07:00
Max Brunsfeld
e5ea4efb0b
Use stdbool.h
2014-10-03 16:06:08 -07:00
Max Brunsfeld
78c5fe8e02
clang-format
2014-10-03 15:44:21 -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
2e7ffb4d14
Tweak auto-format settings
...
Prefer lines that exceed 80 characters by a small margin to
line breaks in argument lists
2014-09-09 13:15:40 -07:00
Max Brunsfeld
9c0b5b5571
clang-format
2014-09-03 18:53:38 -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
d38f095f01
Clean up Tree code
2014-09-01 14:08:07 -07:00
Max Brunsfeld
16d5cf1d04
Remove expected symbols from error nodes
2014-08-31 16:39:16 -07:00
Max Brunsfeld
25a254a732
Comment and format
2014-08-31 16:24:27 -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
226ffd6b5b
Fix initializer list deduction warnings in specs
2014-08-27 22:23:45 -07:00
Max Brunsfeld
0193be166b
Fix overridden initializer warning in tree constructor
2014-08-27 22:06:27 -07:00
Max Brunsfeld
7b0a52ec26
Pretty-print single hidden tree nodes correctly
2014-08-27 12:56:36 -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
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
Max Brunsfeld
779bf0d745
Don't store tree's hidden children in a separate array
...
Just mark hidden trees as such, and skip them when
pretty-printing a tree
2014-07-17 13:36:53 -07:00
Max Brunsfeld
25f927e321
Remove unnecessary accessor functions for tree
2014-07-14 21:11:15 -07:00
Max Brunsfeld
d7449bf5ea
Rename type ts_symbol -> TSSymbol
2014-06-28 18:53:32 -07:00
Max Brunsfeld
5f59de72a8
Rename type ts_tree -> TSTree
2014-06-28 18:48:07 -07:00
Max Brunsfeld
9686c57e90
Allow ubiquitous tokens to also be used in grammar rules
2014-06-26 08:52:42 -07:00