const Lisp*
Parser::parse(const std::string& filename)
{
- Unison::VFS::istream in(filename);
- //IFileStreambuf ins(filename);
- //std::istream in(&ins);
+ IFileStreambuf ins(filename);
+ std::istream in(&ins);
if(!in.good()) {
std::stringstream msg;
{
std::stringstream emsg;
emsg << "Parse Error at '" << filename << "' line " << lexer->getLineNumber()
- << ": " << msg;
+ << ": " << msg;
throw std::runtime_error(emsg.str());
}
Lisp* result;
switch(token) {
case Lexer::TOKEN_EOF: {
- parse_error("Unexpected EOF.");
+ parse_error("Unexpected EOF.");
}
case Lexer::TOKEN_CLOSE_PAREN: {
parse_error("Unexpected ')'.");
// evaluate translation function (_ str) in place here
token = lexer->getNextToken();
if(token != Lexer::TOKEN_STRING)
- parse_error("Expected string after '(_'");
+ parse_error("Expected string after '(_'");
result = new(obst) Lisp(Lisp::TYPE_STRING);
if(dictionary) {
}
token = lexer->getNextToken();
if(token != Lexer::TOKEN_CLOSE_PAREN)
- parse_error("Expected ')' after '(_ string'");
+ parse_error("Expected ')' after '(_ string'");
break;
}