From da4f74e2c331169825b5e1b32a50baf7c9c0f039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Fri, 20 Jan 2017 23:33:10 +0100 Subject: [PATCH] Added new constructor for Rule + updated copy constructor Grammar --- include/Parsodus/grammar.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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)