diff options
| author | Nagi5Yeq <wu@x-nagi.com> | 2020-05-26 00:26:57 +0800 |
|---|---|---|
| committer | Nagi5Yeq <wu@x-nagi.com> | 2020-05-26 00:26:57 +0800 |
| commit | e83990754f49ec6eba7b9e1a5ff80a6add5de3a1 (patch) | |
| tree | 6308b4d0afa5bde2de82e7aa034058302cb1d193 /Driver.cc | |
| parent | 958a811b18aee04e4795cf003fd8e3db00312c91 (diff) | |
bugfix & test
Diffstat (limited to 'Driver.cc')
| -rw-r--r-- | Driver.cc | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -7,13 +7,18 @@ Driver::Driver(const char* name) Driver::~Driver() {} -void Driver::Parse(std::string& filename) { +std::shared_ptr<ProgramNode> Driver::Parse(std::string& filename) { location_.initialize(&filename); if (StartLexer(filename) != 0) { - return; + return nullptr; } Parser parser(*this, &context_); parser.parse(); StopLexer(); + return root_; } + +void Driver::SetRoot(std::shared_ptr<ProgramNode> root) { root_ = root; } + +Context* Driver::GetContext() { return &context_; } } // namespace pcc |
