From: Akim Demaille Date: Sun, 22 Jul 2012 16:48:56 +0000 (+0200) Subject: parser: fix %printer usage. X-Git-Tag: v2.7.90~386 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/585a791ef0eb3e9a4720a5c9e7e69a762fde0297 parser: fix %printer usage. * src/parse-gram.y: Instead of stderr, using yyo. --- diff --git a/src/parse-gram.y b/src/parse-gram.y index d84a7dd0..9d9d1a42 100644 --- a/src/parse-gram.y +++ b/src/parse-gram.y @@ -186,30 +186,30 @@ static char const *char_name (char); %token TAG_NONE "<>" %type CHAR -%printer { fputs (char_name ($$), stderr); } CHAR +%printer { fputs (char_name ($$), yyo); } CHAR /* braceless is not to be used for rule or symbol actions, as it calls code_props_plain_init. */ %type STRING "%{...%}" EPILOGUE braceless content.opt %type "{...}" "%?{...}" -%printer { fputs (quotearg_style (c_quoting_style, $$), stderr); } +%printer { fputs (quotearg_style (c_quoting_style, $$), yyo); } STRING -%printer { fprintf (stderr, "{\n%s\n}", $$); } +%printer { fprintf (yyo, "{\n%s\n}", $$); } braceless content.opt "{...}" "%{...%}" EPILOGUE %type BRACKETED_ID ID ID_COLON PERCENT_FLAG TAG tag variable -%printer { fputs ($$, stderr); } -%printer { fprintf (stderr, "[%s]", $$); } BRACKETED_ID -%printer { fprintf (stderr, "%s:", $$); } ID_COLON -%printer { fprintf (stderr, "%%%s", $$); } PERCENT_FLAG -%printer { fprintf (stderr, "<%s>", $$); } TAG tag +%printer { fputs ($$, yyo); } +%printer { fprintf (yyo, "[%s]", $$); } BRACKETED_ID +%printer { fprintf (yyo, "%s:", $$); } ID_COLON +%printer { fprintf (yyo, "%%%s", $$); } PERCENT_FLAG +%printer { fprintf (yyo, "<%s>", $$); } TAG tag %type INT -%printer { fprintf (stderr, "%d", $$); } +%printer { fprintf (yyo, "%d", $$); } %type id id_colon string_as_id symbol symbol.prec -%printer { fprintf (stderr, "%s", $$->tag); } -%printer { fprintf (stderr, "%s:", $$->tag); } id_colon +%printer { fprintf (yyo, "%s", $$->tag); } +%printer { fprintf (yyo, "%s:", $$->tag); } id_colon %type precedence_declarator %type symbols.1 symbols.prec generic_symlist generic_symlist_item @@ -418,7 +418,7 @@ grammar_declaration: %type code_props_type; %union {code_props_type code_type;}; -%printer { fprintf (stderr, "%s", code_props_type_string ($$)); } ; +%printer { fprintf (yyo, "%s", code_props_type_string ($$)); } ; code_props_type: "%destructor" { $$ = destructor; } | "%printer" { $$ = printer; }