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
Max Brunsfeld
9bc7d51074
Always initialize tree node size and offset
2014-06-09 13:12:44 -07:00
Max Brunsfeld
baec9f2c9a
Move computation of tree size/offset into tree constructor
2014-06-02 13:32:36 -07:00
Max Brunsfeld
2988cc5aa2
Show offending lookahead chars when pretty-printing trees w/ errors
2014-05-26 21:50:01 -07:00
Max Brunsfeld
671f1a1ddc
Start work on javascript grammar
2014-03-24 09:14:29 -07:00
Max Brunsfeld
3a7c4bb5b1
Store AST nodes' non-hidden children
2014-03-24 01:03:32 -07:00
Max Brunsfeld
95188d84b6
Make tree struct private
2014-03-24 00:34:13 -07:00
Max Brunsfeld
bdbe69258a
Fix bug in stack breakdown procedure
2014-03-21 12:46:23 -07:00
Max Brunsfeld
cbc66b359e
Cleanup
2014-03-19 23:10:28 -07:00
Max Brunsfeld
fbe8b0a905
Fix incremental parsing
...
Stop collapsing hidden symbols upon reducing them.
Sadly, this messes up the ability to re-use parse
trees. Instead, for now, hide these nodes when
stringifying parse trees
2014-03-19 19:27:31 -07:00
Max Brunsfeld
fbb9b24d7b
Refactor ts_tree_children
2014-03-18 12:47:26 -07:00
Max Brunsfeld
8e7f59db1c
Allow room in parse table for error and EOF entries
2014-03-18 08:04:17 -07:00
Max Brunsfeld
39aa0ccc91
Add script to trim whitespace
2014-03-09 19:49:35 -07:00
Max Brunsfeld
1fd381ae7a
Don't use c++ for runtime
...
Don't really need it, and it makes compilation slightly more
complicated
2014-03-08 16:30:44 -08:00
Max Brunsfeld
1b56832cb7
Use c++ in runtime src file
...
It makes string manipulation easier
2014-02-19 18:58:28 -08:00
Max Brunsfeld
2c56612650
Get makefile working
2014-02-18 09:07:00 -08:00
Max Brunsfeld
dbbb446082
Reorganize runtime header files
2014-02-15 17:00:33 -08:00