diff options
Diffstat (limited to 'ghc/utils/ugen/yyerror.c')
-rw-r--r-- | ghc/utils/ugen/yyerror.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ghc/utils/ugen/yyerror.c b/ghc/utils/ugen/yyerror.c new file mode 100644 index 0000000000..4b9a0380d1 --- /dev/null +++ b/ghc/utils/ugen/yyerror.c @@ -0,0 +1,24 @@ +#include <stdio.h> +extern int yylineno; + +void +yyerror(s) + char *s; +{ + extern int yychar; + extern char yytext[1]; + + fprintf(stderr, "\n%s", s); + if(yylineno) + fprintf(stderr, ", line %d, ", yylineno); + fprintf(stderr, "on input: "); + if( yychar >= 0400 ) + fprintf(stderr, "%s\n", &yytext[0]); + else + switch(yychar) { + case '\t' : fprintf(stderr, "\\t\n"); break; + case '\n' : fprintf(stderr, "\\n\n"); break; + case '\0' : fprintf(stderr, "$end\n"); break; + default : fprintf(stderr, "%c\n", yychar); break; + } +} |