Allow associativity to be specified in rules w/o precedence
This commit is contained in:
parent
4b817dc07c
commit
9959fe35b0
17 changed files with 78 additions and 56 deletions
|
|
@ -11,12 +11,6 @@ namespace tree_sitter {
|
|||
class Rule;
|
||||
typedef std::shared_ptr<Rule> rule_ptr;
|
||||
|
||||
enum Associativity {
|
||||
AssociativityNone,
|
||||
AssociativityLeft,
|
||||
AssociativityRight,
|
||||
};
|
||||
|
||||
rule_ptr blank();
|
||||
rule_ptr choice(const std::vector<rule_ptr> &);
|
||||
rule_ptr repeat(const rule_ptr &);
|
||||
|
|
@ -27,7 +21,10 @@ rule_ptr pattern(const std::string &);
|
|||
rule_ptr str(const std::string &);
|
||||
rule_ptr err(const rule_ptr &);
|
||||
rule_ptr prec(int precedence, const rule_ptr &);
|
||||
rule_ptr prec(int precedence, const rule_ptr &, Associativity);
|
||||
rule_ptr prec_left(const rule_ptr &);
|
||||
rule_ptr prec_left(int precedence, const rule_ptr &);
|
||||
rule_ptr prec_right(const rule_ptr &);
|
||||
rule_ptr prec_right(int precedence, const rule_ptr &);
|
||||
rule_ptr token(const rule_ptr &rule);
|
||||
|
||||
class Grammar {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue