Commit graph

32 commits

Author SHA1 Message Date
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
c3f3f19ea8 Add concrete_child and concrete_child_count Node methods 2015-09-08 09:53:26 -07:00
Max Brunsfeld
9591c88f39 In runtime, distinguish between anonymous and hidden nodes 2015-09-06 00:12:37 -07:00
Max Brunsfeld
21258e6a9e Remove 'document' wrapper node 2015-08-22 10:48:34 -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
766e3bab2c Use 2-space continuation indent consistently in specs 2015-07-27 18:18:58 -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
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
26ac5788b6 Don't use struct literal syntax for TSLength 2014-09-26 16:31:36 -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
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
7b0a52ec26 Pretty-print single hidden tree nodes correctly 2014-08-27 12:56:36 -07:00
Max Brunsfeld
b155994491 Fix indentation in specs 2014-08-07 08:11:21 -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
5f59de72a8 Rename type ts_tree -> TSTree 2014-06-28 18:48:07 -07:00
Max Brunsfeld
81880e000e Tweak header include paths in tests 2014-06-23 18:50:03 -07:00
Max Brunsfeld
8d48c3e48a Fix integer type incompatibility warnings in specs 2014-06-09 21:35:41 -07:00
Max Brunsfeld
1b1f53a5e7 Fix memory leaks in tests 2014-06-09 21:16:33 -07:00
Max Brunsfeld
21c259df9c Clean up lint errors 2014-06-09 21:14:38 -07:00
Max Brunsfeld
652fa2f8a5 Fix stack spec on gcc 2014-06-04 18:24:54 -07:00
Max Brunsfeld
63cde3967c Add unit test for stack
- Also, fix bug where trees pushed onto the stack were not retained
2014-06-03 13:19:49 -07:00
Max Brunsfeld
baec9f2c9a Move computation of tree size/offset into tree constructor 2014-06-02 13:32:36 -07:00
Max Brunsfeld
80b19cbb83 Construct entire parse table statically
This removes the need for the 'init_parse_table' function,
which was not really thread safe
2014-03-25 19:34:17 -07:00
Max Brunsfeld
3a7c4bb5b1 Store AST nodes' non-hidden children 2014-03-24 01:03:32 -07:00
Max Brunsfeld
a411e43484 Rename source files: .cpp -> .cc 2014-03-09 22:13:08 -07:00
Renamed from spec/runtime/tree_spec.cpp (Browse further)