Commit graph

204 commits

Author SHA1 Message Date
Max Brunsfeld
32536665f9 Remove weak build_parse_table spec
This is best covered by integration tests
2015-09-22 20:03:00 -07:00
Max Brunsfeld
e6f3239bef Move stream operator definitions to spec helpers
This is one less thing for users to worry about when compiling and linking
the library itself
2015-09-10 10:12:11 -07:00
Max Brunsfeld
67241e3052 Don't use std::set in public compiler header
Just use vectors
2015-09-08 23:43:45 -07:00
Max Brunsfeld
557c8c7f28 Remove unnecessary test helpers 2015-09-06 17:07:04 -07:00
Max Brunsfeld
f9316933ad Refactor logic for marking '_'-prefixed rules as hidden 2015-09-06 16:53:13 -07:00
Max Brunsfeld
5982b77c97 In compiler, distinguish between anonymous tokens and hidden rules 2015-09-05 22:28:55 -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
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
93259435c8 Handle tokens that appear both anonymously and as named rules 2015-07-30 17:24:08 -07:00
Max Brunsfeld
a7729c42c9 Whitespace 2015-07-29 21:47:48 -07:00
Max Brunsfeld
766e3bab2c Use 2-space continuation indent consistently in specs 2015-07-27 18:18:58 -07:00
Max Brunsfeld
31b2db12d2 Remove custom LexicalGrammar and SyntaxGrammar constructors 2015-07-19 16:12:11 -07:00
Max Brunsfeld
aabcb10cfb Respect expected_conflicts field when building parse table 2015-06-28 16:22:31 -05:00
Max Brunsfeld
c9a482bbf3 Add expected_conflicts field to grammar 2015-06-26 16:14:08 -05:00
Max Brunsfeld
fd97b8a237 Dedup auxiliary repeat rules from different source rules 2015-05-02 20:42:47 -07:00
Max Brunsfeld
a54d293317 Include 'goal' non-terminal names in conflict description 2015-04-16 17:43:30 -07:00
Max Brunsfeld
e8db35af6b Avoid creating redundant auxiliary repeat rules 2015-04-16 17:42:22 -07:00
Max Brunsfeld
9ef52ce2fb Include precedences in unresolved conflict messages 2015-03-23 22:56:17 -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
7872ddd21b Improve reduce/reduce conflict error message 2015-03-16 11:59:45 -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
3458fa6e50 Fix non-deterministic order in conflict description 2015-03-07 11:02:21 -08:00
Max Brunsfeld
2d436cf141 Identify fragile reductions at compile time 2015-02-21 15:11:03 -08:00
Max Brunsfeld
ccb0d0d043 Store parse items' list of consumed symbols
Not just the consumed symbol count.
2015-02-20 22:53:27 -08:00
Max Brunsfeld
109b5616d3 Remove unused arg to action_takes_precedence 2015-01-17 14:14:49 -08:00
Max Brunsfeld
160fca6579 Refactor avoidance of redundant repeat rules 2015-01-14 21:11:19 -08:00
Max Brunsfeld
a0d9da9d5c Rename static 'Build' methods to 'build' 2015-01-14 21:11:05 -08:00
Max Brunsfeld
34d96909d1 Move {Syntax,Lexical}Grammar into separate files 2015-01-14 21:10:41 -08:00
Max Brunsfeld
0d267e41aa Replace LexConflictManager class with action_takes_precedence function 2015-01-11 19:50:58 -08:00
Max Brunsfeld
5dc08ccce9 Include names of in-progress rules in shift/reduce conflicts 2014-11-05 18:39:50 -08:00
Max Brunsfeld
eaeb51a96f Don't open parser C file until code is generated 2014-10-21 08:49:42 -07:00
Max Brunsfeld
3bcb221379 Include non-terminal lookahead symbols for reduction actions
This is necessary for re-using the right subtree after an edit
2014-10-10 12:06:16 -07:00
Max Brunsfeld
070dc76050 Generate correct C literals for non-ascii characters 2014-09-28 18:40:15 -07:00
Max Brunsfeld
cb5ecbd491 Handle string and regex rules w/ non-ascii chars 2014-09-28 18:21:22 -07:00
Max Brunsfeld
a2b80098b2 Fix destination directory in compile_examples spec 2014-09-11 12:46:46 -07:00
Max Brunsfeld
cd8a683229 Improve error messages for invalid ubiquitous tokens 2014-09-10 13:02:16 -07:00
Max Brunsfeld
e9dad529f5 Make descriptions more consistent in compiler specs 2014-09-09 13:01:18 -07:00
Max Brunsfeld
1ff7cedf40 Unify ubiquitous tokens and lexical separators in API 2014-09-07 22:16:45 -07:00
Max Brunsfeld
a46f9d950c Handle '\s' correctly in regexps 2014-09-07 16:05:43 -07:00
Max Brunsfeld
ed11ef557a Fix expansion of repeat rules into recursive rules
Previously, the way repeat rules were expanded, the auxiliary
rule always needed to be reduced, even if the repeating content
was empty. This caused problems in parse states where some items
contained the repeat rule and some did not. To make those cases
work, the repeat rule had to explicitly be marked as optional.
With this change, that is no longer necessary.
2014-09-07 09:39:14 -07:00
Max Brunsfeld
d3204d3526 Include '_' in '\w' regex character class 2014-09-05 18:41:12 -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
226ffd6b5b Fix initializer list deduction warnings in specs 2014-08-27 22:23:45 -07:00
Max Brunsfeld
9338249075 Remove implicit CharacterRange constructors
Also fix misc smaller lint errors
2014-08-23 14:52:44 -07:00
Max Brunsfeld
0bb5663f0f Refactor - represent char sets in terms of inclusions and exclusions 2014-08-23 14:25:45 -07:00
Max Brunsfeld
6f374fddff Tweak format for pretty printing some classes 2014-08-23 13:52:00 -07:00
Max Brunsfeld
2963b08f79 Eliminate duplicates when constructing choice rules 2014-08-21 20:04:42 -07:00