Max Brunsfeld
9591c88f39
In runtime, distinguish between anonymous and hidden nodes
2015-09-06 00:12:37 -07:00
Max Brunsfeld
bd77ab1ac9
Move public rule functions out of rule namespace
...
This way, there's only one public namespace: tree_sitter
2015-09-03 17:49:20 -07:00
Max Brunsfeld
e386c634aa
Remove unused Grammar methods
2015-09-03 17:19:43 -07:00
Max Brunsfeld
97bb7a26cf
Fix precedence calculations when building parse table
...
* Recurse into choice rules
* Compute reduction precedence differently than shift precedence
2015-09-02 13:05:54 -07:00
Max Brunsfeld
21258e6a9e
Remove 'document' wrapper node
2015-08-22 10:48:34 -07:00
Max Brunsfeld
d910a2d0e7
Rename node position to offset
2015-08-16 10:51:34 -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
c9a482bbf3
Add expected_conflicts field to grammar
2015-06-26 16:14:08 -05:00
Max Brunsfeld
381f89f8ba
Create ambiguity nodes when joining stack heads
2015-06-18 17:03:16 -07:00
Max Brunsfeld
755894b44d
Allow multiple parse actions in parse table
2015-06-18 17:03:16 -07:00
Max Brunsfeld
d5ce3a9b5a
lexer: in error mode, continue until token is found
2015-06-15 15:26:05 -07:00
Max Brunsfeld
b1f8ba6202
Replace {left,right}_assoc w/ prec, with an associativity argument
2015-03-23 21:06:31 -07:00
Max Brunsfeld
a19b0e75ac
🔥 keyword and keypattern functions
...
Just make strings have higher precedence than regexps.
2015-03-22 16:00:26 -07:00
Max Brunsfeld
80ec303b10
Replace prec rule w/ left_assoc and right_assoc
...
Consider shift/reduce conflicts to be compilation errors unless
they are resolved by a specified associativity.
2015-03-16 23:12:34 -07:00
Max Brunsfeld
9a198562e0
Treat parse conflicts as errors in grammar compilation
...
For now, only reduce/reduce conflicts w/ no tie-breaking precedence
are treated as errors. The rest are dropped, because shift/reduce
conflicts are currently very common because we don't have a way
of specifying associativity along w/ precedence.
2015-03-15 20:31:41 -07:00
Max Brunsfeld
2d436cf141
Identify fragile reductions at compile time
2015-02-21 15:11:03 -08:00
Max Brunsfeld
8cf800ef5d
Unify debugging API for parsing and lexing
2014-10-17 17:52:54 -07:00
Max Brunsfeld
7498725d7f
Move lexer debugging logic out of public header
2014-10-17 16:20:01 -07:00
Max Brunsfeld
5c600942df
Inline some helper functions for lexer
2014-10-17 15:22:01 -07:00
Max Brunsfeld
c594208ab8
Allow callbacks to be specified for debug output
2014-10-13 01:02:18 -07:00
Max Brunsfeld
6d37877e49
Tweak debugging output
2014-10-05 16:56:29 -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
d1603e298f
bytes_{inserted,removed} -> chars_{inserted,removed}
2014-09-28 18:47:29 -07:00
Max Brunsfeld
444188cb5f
Display characters > 255 as numbers in debug output
2014-09-27 16:00:27 -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
f2e2102a25
Add missing import of stdint.h
2014-09-13 00:25:12 -07:00
Max Brunsfeld
141cbcfa02
Read unicode characters using utf8proc
2014-09-13 00:24:10 -07:00
Max Brunsfeld
68d6e242ee
Fix parsing of wildcard patterns at the ends of documents
...
- Remove special EOF handling from lexer
- Explicitly exclude the EOF character from all-inclusive character sets.
2014-09-11 13:10:23 -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
1ff7cedf40
Unify ubiquitous tokens and lexical separators in API
2014-09-07 22:16:45 -07:00
Max Brunsfeld
43ecac2a1d
Expose debug flag on document
2014-09-06 17:56:00 -07:00
Max Brunsfeld
c0a3f8d39c
Remove some macros from public parser header
2014-09-05 23:47:38 -07:00
Max Brunsfeld
9c0b5b5571
clang-format
2014-09-03 18:53:38 -07:00
Max Brunsfeld
77529ace3d
Fix infinite loop in certain cases w/ unterminated tokens
2014-09-03 00:38:44 -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
2985a98150
Build error nodes in lexer again, not in parser
2014-08-31 16:59:01 -07:00
Max Brunsfeld
226ffd6b5b
Fix initializer list deduction warnings in specs
2014-08-27 22:23:45 -07:00
Max Brunsfeld
e0a53b9f14
Make parse and lex debug output more readable
2014-08-27 18:27:53 -07:00
Max Brunsfeld
bd145d2c6a
Preserve the initial error node in handle_error function
2014-08-26 23:22:18 -07:00
Max Brunsfeld
37d5db6fee
Move newline in lexer debugging output
2014-08-26 22:21:21 -07:00
Max Brunsfeld
346cf4fe5d
Remove LEX_PANIC macro
2014-08-26 13:12:12 -07:00
Max Brunsfeld
77941c85ff
Avoid building incomplete error nodes during lexing
...
The lexer doesn't know the expected symbols, so it doesn't have enough
information to construct error nodes. Now, when it encounters an invalid
character, it returns NULL and the parser builds a correct error node.
2014-08-25 23:35:00 -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
1e79ed794b
Allow multiple top-level nodes
...
Now, the root node of a document is always a document node.
It will often have only one child node which corresponds to the grammar's
start symbol, but not always. Currently, it may have more than one child
if there are ubiquitous tokens such as comments at the beginning of the
document. In the future, it will also be possible be possible to have multiple
for the document to have multiple children if the document is partially parsed.
2014-08-09 00:00:20 -07:00