From 14c04d94e6d6638128c64d7dde018ea6919f4807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Thu, 26 Jan 2017 16:15:57 +0100 Subject: [PATCH] Constructor updates for Rule and Grammar --- include/Parsodus/grammar.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/Parsodus/grammar.h b/include/Parsodus/grammar.h index 23dd707..018e974 100644 --- a/include/Parsodus/grammar.h +++ b/include/Parsodus/grammar.h @@ -35,11 +35,11 @@ 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) {} + Rule() : Rule("", {}, ""){} + Rule(const std::string& h, const std::vector& t) : Rule(h, t, "") {} + Rule(const std::string& h, const std::vector& t, const std::string& name) : head(h), tail(t), name(name), precedence{false, {0, PrecedenceType::RIGHT}} {} + Rule(const std::string& h, const std::vector& t, const std::string& name, std::pair precedence) : + head(h), tail(t), name(name), precedence{true, precedence} {} }; /** @@ -56,7 +56,7 @@ namespace pds { std::unique_ptr first; std::unique_ptr follow; - Grammar() : start(""), variables(), terminals(), rules(), first(nullptr), follow(nullptr) + Grammar() : start(""), variables(), terminals(), rules(), precedence(), first(nullptr), follow(nullptr) {} Grammar(const Grammar& rhs)