Commit graph

389 commits

Author SHA1 Message Date
Max Brunsfeld
d7cb48aae7 Fix handling of precedence for repeat rules 2015-11-01 21:00:44 -08:00
Max Brunsfeld
d6ee28abd0 Make precedence more useful within tokens
Choose accept-token actions over advance actions if their rule has a higher precedence.
2015-11-01 12:48:27 -08:00
Max Brunsfeld
998ae533da Make completion_status() a method on LexItem 2015-10-30 16:48:37 -07:00
Max Brunsfeld
c8be143f65 🔥 get_metadata function 2015-10-30 16:22:25 -07:00
Max Brunsfeld
73b3280fbb Include precedence calculation in LexItemSet::transitions 2015-10-30 16:07:29 -07:00
Max Brunsfeld
e9be0ff24e Make completion_status() a method on ParseItem 2015-10-30 14:07:33 -07:00
Max Brunsfeld
4850384b78 Include precedence calculation in ParseItemSet::transitions 2015-10-30 13:54:11 -07:00
Max Brunsfeld
a8ead10d6f In lex error state, don't look for tokens that would match *any* line 2015-10-28 17:45:17 -07:00
Max Brunsfeld
dba0726eef clang format 2015-10-28 12:10:58 -07:00
Max Brunsfeld
b61b27f22f Handle inline ubiquitous that are used elsewhere in the grammar 2015-10-26 17:19:37 -07:00
Max Brunsfeld
b7e0cb1fc6 Revert 'Add reduce-extra actions for all symbols'
It only makes sense to add reduce-extra actions for those symbols that
have actions in the state the will be reduced to
2015-10-26 17:19:04 -07:00
Max Brunsfeld
e543661498 Fix typo: LB -> LF 2015-10-26 16:55:59 -07:00
Max Brunsfeld
bad1bff3bb Sanitize line breaks in symbol names 2015-10-26 13:36:31 -07:00
Max Brunsfeld
1babdc43e1 Add reduce-extra actions for all symbols 2015-10-24 12:49:26 -07:00
Max Brunsfeld
44d3e4228e Show precedences and associativities in parse conflicts 2015-10-24 12:49:04 -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
02e549202f Improve parse conflict reporting 2015-10-14 22:14:08 -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
5c67f58a4b Add helper for dynamic-casting to rule subclasses 2015-10-12 19:21:56 -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
5455fb977f Use PrecedenceRange in build_lex_table 2015-10-05 18:02:59 -07:00
Max Brunsfeld
11a1ea8dfe Reuse separator-rule in LexTableBuilder 2015-10-05 17: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
673ca411b1 Fix lint errors 2015-09-19 13:19:49 -07:00
Max Brunsfeld
296d8cc1e8 clang-format 2015-09-13 19:41:11 -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
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
f9316933ad Refactor logic for marking '_'-prefixed rules as hidden 2015-09-06 16:53:13 -07:00
Max Brunsfeld
9591c88f39 In runtime, distinguish between anonymous and hidden nodes 2015-09-06 00:12:37 -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
e386c634aa Remove unused Grammar methods 2015-09-03 17:19:43 -07:00
Max Brunsfeld
0600f31847 🎨 Remove weird reference variables 2015-09-03 17:13:56 -07:00
Max Brunsfeld
bc0e290c17 Don't use delegating constructor for MetadataRange 2015-09-02 16:49:31 -07:00
Max Brunsfeld
76e2067ee0 Remove unused metadata key 2015-09-02 13:05:54 -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
c18351772a Auto-format: no single-line functions 2015-07-31 16:32:24 -07:00