summaryrefslogtreecommitdiff
path: root/gen.c
diff options
context:
space:
mode:
authorVern Paxson <vern@ee.lbl.gov>1994-12-04 08:28:09 +0000
committerVern Paxson <vern@ee.lbl.gov>1994-12-04 08:28:09 +0000
commit7a8fd3c9d45920462a2f54b52d6d16c34c756c29 (patch)
tree775cd2311a025690ab685759101a07630b9a5343 /gen.c
parentec53775916c89b4fb767f7f97b0ea758f85dcc3b (diff)
use cerr for C++ diagnostics
Diffstat (limited to 'gen.c')
-rw-r--r--gen.c54
1 files changed, 46 insertions, 8 deletions
diff --git a/gen.c b/gen.c
index 2a2ddb3..eee30f7 100644
--- a/gen.c
+++ b/gen.c
@@ -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( "}" );