diff --git a/Monicelli.lpp b/Monicelli.lpp index 7d725a1..1e189c8 100644 --- a/Monicelli.lpp +++ b/Monicelli.lpp @@ -197,7 +197,7 @@ CHAR [a-zA-Z_] } . { - return -1; + return token::ERROR; } %% diff --git a/Monicelli.ypp b/Monicelli.ypp index 4fa0e33..d8e6bf3 100644 --- a/Monicelli.ypp +++ b/Monicelli.ypp @@ -51,7 +51,7 @@ static int yylex(Parser::semantic_type*, Parser::location_type*, Scanner&); } -%token MAIN +%token MAIN ERROR %token RETURN %token ARTICLE TYPENAME STAR %token VARDECL ASSIGN @@ -401,6 +401,7 @@ simple_expression: void Parser::error(const location_type& loc, const std::string &message) { std::cerr << "line " << loc.begin.line << ", col " << loc.begin.column; std::cerr << ": " << message << std::endl; + std::exit(1); } int yylex(Parser::semantic_type *lval, Parser::location_type *loc, Scanner &scanner) {