break;
if (token != ',')
- throw std::invalid_argument("Expected ')' or ',' in argument list");
+ Parse_error("expected ')' or ',' in argument list");
get_next_tok();
}
prototype the_prototype = make_pair(name, args.size());
prototype_table::const_iterator reader = funcs.find(the_prototype);
if (reader == funcs.end()) {
- bail_out(std::invalid_argument,
- "no function \"" << name << "\" with " << args.size()
- << " arguments");
+ Parse_error_("no function \"" << name << "\" with " <<
+ args.size() << " arguments");
}
ex ret = reader->second(args);
return ret;
ex e = parse_expression();
if (token != ')')
- throw std::invalid_argument("parser::parse_paren_expr: expected ')'");
+ Parse_error("expected ')'");
get_next_tok(); // eat ).
return e;
}
case '+':
return v;
default:
- throw std::invalid_argument(
- std::string(__func__)
- + ": invalid unary operator \""
- + char(s) + "\"");
+ Parse_error_("invalid unary operator \"" << char(s) << "\"");
}
}
case lexer::token_type::literal:
return parse_literal_expr();
case lexer::token_type::eof:
- bail_out(std::invalid_argument, "got EOF while parsing the expression");
default:
- bail_out(std::invalid_argument, "unknown token " <<
- token << " (\"" <<
- (token ? std::string("") + char(token) : "NULL")
- << "\")");
+ Parse_error("unexpected token");
}
}