From b7e7424918853627bff4e037dbb053a91dd93b26 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 16 Jan 2012 00:17:58 +1000 Subject: Report line and column in syntax errors, and stack overflows. --- LuaSL/src/LuaSL_lemon_yaccer.y | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'LuaSL') diff --git a/LuaSL/src/LuaSL_lemon_yaccer.y b/LuaSL/src/LuaSL_lemon_yaccer.y index 045c997..5cffb73 100644 --- a/LuaSL/src/LuaSL_lemon_yaccer.y +++ b/LuaSL/src/LuaSL_lemon_yaccer.y @@ -84,12 +84,11 @@ script ::= statement(A). { A->left = param->ast; param->ast = A; } %parse_accept {printf("Parsing complete.\n");} -// TODO - Alledgedly this gets passed some sort of apparently useful information. shrug -%syntax_error {fprintf(stderr,"Syntax error!\n");} +%parse_failure {fprintf(stderr,"Giving up. Parser is hopelessly lost!\n");} -%parse_failure {fprintf(stderr,"Giving up. Parser is hopelessly lost...\n");} +%stack_overflow {fprintf(stderr,"Giving up. Parser stack overflow @ line %04d column %04d\n", yypMinor->yy0->line, yypMinor->yy0->column);} // Gotta love consistancy, if it ever happens. -%stack_overflow {fprintf(stderr,"Giving up. Parser stack overflow!\n");} +%syntax_error {fprintf(stderr,"Syntax error @ line %04d column %04d\n", yyminor.yy0->line, yyminor.yy0->column);} /* Undocumented shit that might be useful later. Pffft -- cgit v1.1