Max Brunsfeld
df1d9b2416
Move sexp-generation code to node.c
2016-02-19 15:41:09 -08:00
Max Brunsfeld
b80a330a74
Fix assorted memory leaks in test code
2016-02-05 12:23:54 -08:00
Max Brunsfeld
0cf59913ae
Fix double retain of child trees
2016-01-28 23:15:22 -08:00
Max Brunsfeld
0f7dbea9a3
Unify test targets, use externally defined languages as fixtures
2016-01-15 11:19:24 -08:00
Max Brunsfeld
da1bc038e5
Remove nested options structs in Tree
2015-12-22 14:20:58 -08:00
Max Brunsfeld
e6f933a21f
Add missing symbol metadata field initializers in specs
2015-12-17 12:06:43 -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
863cabc827
Don't include trailing ubiquitous tokens as children when reducing
2015-12-02 15:31:15 -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
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
0467d190fe
Add ts_tree_edit function
2015-09-18 22:02:06 -07:00
Max Brunsfeld
a2d817f0f0
Remove unnecessary include from runtime spec-helper
2015-09-09 12:59:27 -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
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