From e6eef2bda79dcf2abde080943cb8f9808941e331 Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 11 Sep 2021 16:52:25 +0800 Subject: ... --- include/cru/parse/Production.hpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/cru/parse/Production.hpp') 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& GetRight() const { return right_; } void SetRight(std::vector right); + bool IsLeftRecursion() const { + return !right_.empty() && left_ == right_.front(); + } + private: Grammar* grammar_; String name_; -- cgit v1.2.3