@@ -2461,9 +2461,15 @@ while_control(A) ::= TOK_WHILE expression(B).
24612461}
24622462
24632463%syntax_error {
2464+ Symbol sym;
2465+
24642466 yyerrstatus++;
2465- fprintf (stderr, " Express parser experienced syntax error at line %d.\n " , yylineno);
2466- fprintf (stderr, " Last token (type %d) had value %x\n " , yymajor, yyminor.yy0 .val );
2467+
2468+ sym.line = yylineno;
2469+ sym.filename = current_filename;
2470+
2471+ ERRORreport_with_symbol (ERROR_syntax, &sym, " " ,
2472+ CURRENT_SCOPE_TYPE_PRINTABLE, CURRENT_SCOPE_NAME);
24672473}
24682474
24692475%stack_size 0
@@ -2472,29 +2478,3 @@ while_control(A) ::= TOK_WHILE expression(B).
24722478 fprintf (stderr, " Express parser experienced stack overflow.\n " );
24732479 fprintf (stderr, " Last token had value %x\n " , yypMinor->yy0 .val );
24742480}
2475-
2476- %include {
2477- static void
2478- yyerror (const char *yytext, char *string)
2479- {
2480- char buf[200 ];
2481- Symbol sym;
2482-
2483- strcpy (buf, string);
2484-
2485- if (yyeof) {
2486- strcat (buf, " at end of input" );
2487- } else if (yytext[0 ] == 0 ) {
2488- strcat (buf, " at null character" );
2489- } else if (yytext[0 ] < 040 || yytext[0 ] >= 0177 ) {
2490- sprintf (buf + strlen (buf), " before character 0%o" , yytext[0 ]);
2491- } else {
2492- sprintf (buf + strlen (buf), " before `%s'" , yytext);
2493- }
2494-
2495- sym.line = yylineno;
2496- sym.filename = current_filename;
2497- ERRORreport_with_symbol (ERROR_syntax, &sym, buf,
2498- CURRENT_SCOPE_TYPE_PRINTABLE, CURRENT_SCOPE_NAME);
2499- }
2500- }
0 commit comments