diff options
| author | Marius Nita <marius@cs.pdx.edu> | 2002-09-03 08:57:35 +0000 |
|---|---|---|
| committer | Marius Nita <marius@cs.pdx.edu> | 2002-09-03 08:57:35 +0000 |
| commit | 18f704edd0938355622049d853c1ce3cdfaee168 (patch) | |
| tree | 05a0ffff1be3a3287e63367d94ab5290c7710b07 /util/epist/epist.y | |
| parent | 37ccfef89546e38fe8c0ab1e039a8abdff8bd588 (diff) | |
better error reporting. epist now reports the line number and token a parser error occurs at, as well as invalid actions.
Diffstat (limited to 'util/epist/epist.y')
| -rw-r--r-- | util/epist/epist.y | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/util/epist/epist.y b/util/epist/epist.y index d187e96f..243e4168 100644 --- a/util/epist/epist.y +++ b/util/epist/epist.y @@ -9,7 +9,10 @@ #define YYPARSE_PARAM parser_obj #define YYSTYPE char* - + +extern int yylineno; +extern char *yytext; + extern "C" { int yylex(); int yywrap() { @@ -17,14 +20,15 @@ extern "C" { } } -void yyerror(const char *c) { - printf("ERROR: %s\n", c); +void yyerror(const char *c) +{ + printf("ERROR: %s, on line %d, near %s\n", c, yylineno, yytext); } - %} %token OBRACE EBRACE SEMICOLON DASH NUMBER QUOTES WORD BINDING OPTIONS TRUE FALSE +%expect 1 %% |
