mirror of
https://github.com/avinal/The-VM-to-HACK-Translator.git
synced 2026-01-09 22:58:33 +05:30
made slight changes
This commit is contained in:
15
parser.cpp
15
parser.cpp
@@ -75,4 +75,19 @@ void parser::parse()
|
||||
std::vector<vmcommand> parser::get_commands()
|
||||
{
|
||||
return this->parsed;
|
||||
}
|
||||
|
||||
bool parser::change_file(std::string name)
|
||||
{
|
||||
this->parsed.clear();
|
||||
this->input_file = name;
|
||||
|
||||
if (this->parsed.size() == 0 && input_file == name)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ private:
|
||||
std::vector<vmcommand> parsed;
|
||||
|
||||
public:
|
||||
parser(std::string file) : input_file(file) {}
|
||||
bool change_file(std::string name);
|
||||
std::vector<vmcommand> get_commands();
|
||||
c_type command_type(std::string com);
|
||||
void parse();
|
||||
|
||||
Reference in New Issue
Block a user