diff options
author | Vern Paxson <vern@ee.lbl.gov> | 1994-12-04 08:28:09 +0000 |
---|---|---|
committer | Vern Paxson <vern@ee.lbl.gov> | 1994-12-04 08:28:09 +0000 |
commit | 7a8fd3c9d45920462a2f54b52d6d16c34c756c29 (patch) | |
tree | 775cd2311a025690ab685759101a07630b9a5343 /gen.c | |
parent | ec53775916c89b4fb767f7f97b0ea758f85dcc3b (diff) |
use cerr for C++ diagnostics
Diffstat (limited to 'gen.c')
-rw-r--r-- | gen.c | 54 |
1 files changed, 46 insertions, 8 deletions
@@ -1347,38 +1347,76 @@ void make_tables() indent_puts( "{" ); indent_puts( "if ( yy_act == 0 )" ); indent_up(); - indent_puts( + indent_puts( C_plus_plus ? + "cerr << \"--scanner backing up\\n\";" : "fprintf( stderr, \"--scanner backing up\\n\" );" ); indent_down(); do_indent(); out_dec( "else if ( yy_act < %d )\n", num_rules ); indent_up(); - indent_puts( + + if ( C_plus_plus ) + { + indent_puts( + "cerr << \"--accepting rule at line \" << yy_rule_linenum[yy_act] <<" ); + indent_puts( + " \"(\\\"\" << yytext << \"\\\")\\n\";" ); + } + else + { + indent_puts( "fprintf( stderr, \"--accepting rule at line %d (\\\"%s\\\")\\n\"," ); - indent_puts( " yy_rule_linenum[yy_act], yytext );" ); + + indent_puts( + " yy_rule_linenum[yy_act], yytext );" ); + } + indent_down(); do_indent(); out_dec( "else if ( yy_act == %d )\n", num_rules ); indent_up(); - indent_puts( + + if ( C_plus_plus ) + { + indent_puts( +"cerr << \"--accepting default rule (\\\"\" << yytext << \"\\\")\\n\";" ); + } + else + { + indent_puts( "fprintf( stderr, \"--accepting default rule (\\\"%s\\\")\\n\"," ); - indent_puts( " yytext );" ); + indent_puts( " yytext );" ); + } + indent_down(); do_indent(); out_dec( "else if ( yy_act == %d )\n", num_rules + 1 ); indent_up(); - indent_puts( - "fprintf( stderr, \"--(end of buffer or a NUL)\\n\" );" ); + + indent_puts( C_plus_plus ? + "cerr << \"--(end of buffer or a NUL)\\n\";" : + "fprintf( stderr, \"--(end of buffer or a NUL)\\n\" );" ); + indent_down(); do_indent(); outn( "else" ); indent_up(); - indent_puts( + + if ( C_plus_plus ) + { + indent_puts( + "cerr << \"--EOF (start condition \" << YY_START << \")\\n\";" ); + } + else + { + indent_puts( "fprintf( stderr, \"--EOF (start condition %d)\\n\", YY_START );" ); + } + indent_down(); indent_puts( "}" ); |