diff options
Diffstat (limited to 'include/cru/parse/Production.hpp')
-rw-r--r-- | include/cru/parse/Production.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/cru/parse/Production.hpp b/include/cru/parse/Production.hpp index bd05a8c4..8a1331b9 100644 --- a/include/cru/parse/Production.hpp +++ b/include/cru/parse/Production.hpp @@ -20,12 +20,19 @@ class Production : public Object { public: Grammar* GetGrammar() const { return grammar_; } + String GetName() const { return name_; } + void SetName(String name) { name_ = std::move(name); } + Nonterminal* GetLeft() const { return left_; } void SetLeft(Nonterminal* left); const std::vector<Symbol*>& GetRight() const { return right_; } void SetRight(std::vector<Symbol*> right); + bool IsLeftRecursion() const { + return !right_.empty() && left_ == right_.front(); + } + private: Grammar* grammar_; String name_; |