[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / utils / ugen / yyerror.c
1 #include <stdio.h>
2 extern int yylineno;
3
4 void
5 yyerror(s)
6     char *s;
7 {
8         extern int yychar;
9         extern char yytext[1];
10
11         fprintf(stderr, "\n%s", s);
12         if(yylineno)
13                 fprintf(stderr, ", line %d, ", yylineno);
14         fprintf(stderr, "on input: ");
15         if( yychar >= 0400 )
16                 fprintf(stderr, "%s\n", &yytext[0]);
17         else
18                 switch(yychar) {
19                   case '\t' : fprintf(stderr, "\\t\n"); break;
20                   case '\n' : fprintf(stderr, "\\n\n"); break;
21                   case '\0' : fprintf(stderr, "$end\n"); break;
22                   default   : fprintf(stderr, "%c\n", yychar); break;
23                 }
24 }