diff --git a/include/Parsodus/grammar.h b/include/Parsodus/grammar.h index 73b1a9f..23dd707 100644 --- a/include/Parsodus/grammar.h +++ b/include/Parsodus/grammar.h @@ -38,6 +38,8 @@ namespace pds { Rule() : head(""), tail(), name("") {} Rule(const std::string& h, const std::vector& t) : head(h), tail(t), name("") {} Rule(const std::string& h, const std::vector& t, const std::string& name) : head(h), tail(t), name(name) {} + Rule(const std::string& h, const std::vector& t, const std::string& name, std::pair> precedence) : + head(h), tail(t), name(name), precedence(precedence) {} }; /** @@ -59,7 +61,7 @@ namespace pds { Grammar(const Grammar& rhs) : start(rhs.start), variables(rhs.variables), terminals(rhs.terminals) - , rules(rhs.rules), first(nullptr), follow(nullptr) { + , rules(rhs.rules), precedence(rhs.precedence), first(nullptr), follow(nullptr) { if (rhs.first) first = std::make_unique(*rhs.first); if (rhs.follow)