Commit graph

226 commits

Author SHA1 Message Date
Max Brunsfeld
b61b27f22f Handle inline ubiquitous that are used elsewhere in the grammar 2015-10-26 17:19:37 -07:00
Max Brunsfeld
1983bcfb60 Fix conflation of finished items w/ different precedence 2015-10-18 12:51:32 -07:00
Max Brunsfeld
8725e96a65 Fix item-set-closure bug w/ empty productions 2015-10-15 23:59:47 -07:00
Max Brunsfeld
3d0253f9b8 Start work on c++ fixture grammar 2015-10-13 11:28:53 -07:00
Max Brunsfeld
9959fe35b0 Allow associativity to be specified in rules w/o precedence 2015-10-13 11:25:28 -07:00
Max Brunsfeld
4b817dc07c Fix linter errors 2015-10-12 19:22:05 -07:00
Max Brunsfeld
82726ad53b Define repeat rule in terms of repeat1 rule 2015-10-12 19:22:05 -07:00
Max Brunsfeld
db9966b57c Simplify lex item set transitions code 2015-10-11 22:51:37 -07:00
Max Brunsfeld
25791085c3 Normalize lexical grammar rules before constructing lex table 2015-10-11 16:56:00 -07:00
Max Brunsfeld
aaafdd4797 Add stream operator for PrecedenceRange in spec helpers 2015-10-06 10:50:09 -07:00
Max Brunsfeld
5455fb977f Use PrecedenceRange in build_lex_table 2015-10-05 18:02:59 -07:00
Max Brunsfeld
5e4bdcbaf8 Simplify handling of precedence & associativity in productions 2015-10-05 16:56:11 -07:00
Max Brunsfeld
6d748a6714 Store parse actions' precedences as ranges, not sets 2015-10-05 16:05:19 -07:00
Max Brunsfeld
ef2acf9496 Make ParseItemSet & LexItemSet classes 2015-10-05 15:13:43 -07:00
Max Brunsfeld
f01972c64e Reorganize ParseItemSet and LexItemSet 2015-10-05 15:09:06 -07:00
Max Brunsfeld
39a0934088 Remove now-unused symbol rule-transition functions 2015-10-04 22:20:34 -07:00
Max Brunsfeld
c4ef228397 Share common lookahead sets between parse item sets 2015-10-04 21:33:54 -07:00
Max Brunsfeld
a0bf3d0bd8 Compute closures of item sets lazily 2015-10-04 00:21:29 -07:00
Max Brunsfeld
ebc52f109d Merge branch 'flatten-rules-into-productions'
This branch had diverged considerably, so merging it required changing a lot
of code.

Conflicts:
	project.gyp
	spec/compiler/build_tables/action_takes_precedence_spec.cc
	spec/compiler/build_tables/build_conflict_spec.cc
	spec/compiler/build_tables/build_parse_table_spec.cc
	spec/compiler/build_tables/first_symbols_spec.cc
	spec/compiler/build_tables/item_set_closure_spec.cc
	spec/compiler/build_tables/item_set_transitions_spec.cc
	spec/compiler/build_tables/rule_can_be_blank_spec.cc
	spec/compiler/helpers/containers.h
	spec/compiler/prepare_grammar/expand_repeats_spec.cc
	spec/compiler/prepare_grammar/extract_tokens_spec.cc
	src/compiler/build_tables/action_takes_precedence.h
	src/compiler/build_tables/build_parse_table.cc
	src/compiler/build_tables/first_symbols.cc
	src/compiler/build_tables/first_symbols.h
	src/compiler/build_tables/item_set_closure.cc
	src/compiler/build_tables/item_set_transitions.cc
	src/compiler/build_tables/parse_item.cc
	src/compiler/build_tables/parse_item.h
	src/compiler/build_tables/rule_can_be_blank.cc
	src/compiler/build_tables/rule_can_be_blank.h
	src/compiler/prepare_grammar/expand_repeats.cc
	src/compiler/prepare_grammar/extract_tokens.cc
	src/compiler/prepare_grammar/extract_tokens.h
	src/compiler/prepare_grammar/prepare_grammar.cc
	src/compiler/rules/built_in_symbols.cc
	src/compiler/rules/built_in_symbols.h
	src/compiler/syntax_grammar.cc
	src/compiler/syntax_grammar.h
2015-10-02 23:46:39 -07:00
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
8ac4b9fc17 Store productions' end rule ids in the vector 2015-02-16 22:11:03 -08:00
Max Brunsfeld
1ba8701ada Compute fewer item set closures in item set transitions function 2015-02-16 22:11:03 -08:00
Max Brunsfeld
52daffb3f3 Separate syntax rules into flat lists of symbols
This way, every ParseItem can be associated with a particular production
for its non-terminal. That lets us keep track of which productions are
involved in shift/reduce conflicts.
2015-02-16 22:11:03 -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