%printer: promote yyo rather than yyoutput

* doc/bison.texi: Promote yyo rather than yyoutput.

* data/c.m4, data/glr.cc, tests/types.at, tests/calc.at,
tests/regression.at: Adjust.
This commit is contained in:
Akim Demaille
2018-10-20 10:36:09 +02:00
parent 35068fbe66
commit e7b709ab0b
6 changed files with 40 additions and 39 deletions

View File

@@ -247,8 +247,8 @@ AT_SKEL_CC_IF(
{
semantic_value ival;
};
%printer { ]AT_SKEL_CC_IF([[yyoutput << $$]],
[[fprintf (yyoutput, "%d", $$)]])[; } <ival>;
%printer { ]AT_SKEL_CC_IF([[yyo << $$]],
[[fprintf (yyo, "%d", $$)]])[; } <ival>;
%code provides
{

View File

@@ -1012,7 +1012,7 @@ start:
;
%destructor { fprintf (stderr, "DESTRUCTOR\n"); } 'a';
%printer { fprintf (yyoutput, "PRINTER"); } 'a';
%printer { fprintf (yyo, "PRINTER"); } 'a';
%%
]AT_YYERROR_DEFINE[

View File

@@ -175,7 +175,7 @@ m4_foreach([b4_skel], [[yacc.c], [glr.c], [lalr1.cc], [glr.cc]],
};
}
%token <up->ival> '1' '2'
%printer { ]AT_SKEL_CC_IF([[yyoutput << $$]],
%printer { ]AT_SKEL_CC_IF([[yyo << $$]],
[[fprintf (yyo, "%d", $$)]])[; } <up->ival>
],
['1' '2'
@@ -231,9 +231,9 @@ m4_foreach([b4_skel], [[yacc.c], [glr.c], [lalr1.cc], [glr.cc]],
%define api.value.type union],
[%token <int> ONE 101;
%token <float> TWO 102 THREE 103;
%printer { ]AT_SKEL_CC_IF([[yyoutput << $$]],
%printer { ]AT_SKEL_CC_IF([[yyo << $$]],
[[fprintf (yyo, "%d", $$)]])[; } <int>
%printer { ]AT_SKEL_CC_IF([[yyoutput << $$]],
%printer { ]AT_SKEL_CC_IF([[yyo << $$]],
[[fprintf (yyo, "%f", $$)]])[; } <float>
],
[ONE TWO THREE { printf ("%d %2.1f %2.1f\n", $1, $2, $3); }],
@@ -255,9 +255,9 @@ m4_foreach([b4_skel], [[yacc.c], [glr.c], [lalr1.cc], [glr.cc]],
['1' '2' { std::cout << $1 << ", " << $2 << '\n'; }],
["12"],
[if (res == '1')
AT_VAL.build(10);
AT_VAL.build (10);
else if (res == '2')
AT_VAL.build<std::string>("two");],
AT_VAL.build<std::string> ("two");],
[10, two])])
])