diff options
author | crupest <crupest@outlook.com> | 2021-09-10 20:56:46 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-09-10 20:56:46 +0800 |
commit | 7ba941d5a55213f763686ef367d72c90ad85ef78 (patch) | |
tree | bf92fe1fd5374a2ef6a52dc72c843c7cd616a285 /include/cru/parse/Production.hpp | |
parent | 819b582849e8f5c40d1dbcac6c0cf26b265d36b0 (diff) | |
download | cru-7ba941d5a55213f763686ef367d72c90ad85ef78.tar.gz cru-7ba941d5a55213f763686ef367d72c90ad85ef78.tar.bz2 cru-7ba941d5a55213f763686ef367d72c90ad85ef78.zip |
...
Diffstat (limited to 'include/cru/parse/Production.hpp')
-rw-r--r-- | include/cru/parse/Production.hpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/cru/parse/Production.hpp b/include/cru/parse/Production.hpp index e69de29b..bd05a8c4 100644 --- a/include/cru/parse/Production.hpp +++ b/include/cru/parse/Production.hpp @@ -0,0 +1,36 @@ +#pragma once +#include "cru/common/String.hpp" + +#include "Nonterminal.hpp" +#include "Terminal.hpp" + +#include <vector> + +namespace cru::parse { +class Production : public Object { + public: + Production(Grammar* grammar, String name, Nonterminal* left, + std::vector<Symbol*> right); + + CRU_DELETE_COPY(Production) + CRU_DELETE_MOVE(Production) + + ~Production() override; + + public: + Grammar* GetGrammar() const { return grammar_; } + + Nonterminal* GetLeft() const { return left_; } + void SetLeft(Nonterminal* left); + + const std::vector<Symbol*>& GetRight() const { return right_; } + void SetRight(std::vector<Symbol*> right); + + private: + Grammar* grammar_; + String name_; + + Nonterminal* left_; + std::vector<Symbol*> right_; +}; +} // namespace cru::parse |