49 lines
755 B
C++
49 lines
755 B
C++
#include "Parser.hh"
|
|
|
|
#include <iostream>
|
|
|
|
namespace Parser
|
|
{
|
|
Parser::Parser()
|
|
{
|
|
|
|
}
|
|
|
|
bool Parser::Parse(char *path)
|
|
{
|
|
char ch;
|
|
std::fstream fin(path, std::fstream::in);
|
|
|
|
if(!fin.is_open()){
|
|
std::cout << "Could not open file " << path << "\n";
|
|
return false;
|
|
}
|
|
|
|
while (fin >> std::noskipws >> ch)
|
|
{
|
|
Parser::Consume(ch);
|
|
|
|
}
|
|
fin.close();
|
|
|
|
return true;
|
|
}
|
|
|
|
Parser::~Parser()
|
|
{
|
|
}
|
|
|
|
void Parser::Consume(char c)
|
|
{
|
|
switch (c)
|
|
{
|
|
case '<':
|
|
|
|
break;
|
|
|
|
default:
|
|
std::cout << c;
|
|
break;
|
|
}
|
|
}
|
|
} |