mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
tests: reorder.
* tests/calc.at (power): Move its definition, as a preparation for forthcoming changes. And space changes.
This commit is contained in:
@@ -250,7 +250,7 @@ int yylex (]AT_LEX_FORMALS[);
|
||||
%token <ival> NUM "number"
|
||||
%type <ival> exp
|
||||
|
||||
%nonassoc '=' /* comparison */
|
||||
%nonassoc '=' /* comparison */
|
||||
%left '-' '+'
|
||||
%left '*' '/'
|
||||
%left NEG /* negation--unary minus */
|
||||
@@ -289,6 +289,16 @@ exp:
|
||||
;
|
||||
%%
|
||||
|
||||
static int
|
||||
power (int base, int exponent)
|
||||
{
|
||||
int res = 1;
|
||||
assert (0 <= exponent);
|
||||
for (/* Niente */; exponent; --exponent)
|
||||
res *= base;
|
||||
return res;
|
||||
}
|
||||
|
||||
]AT_SKEL_CC_IF(
|
||||
[AT_LOCATION_TYPE_IF([[
|
||||
std::ostream&
|
||||
@@ -334,27 +344,16 @@ AT_YYERROR_SEES_LOC_IF([
|
||||
AT_LOC_FIRST_LINE, AT_LOC_FIRST_COLUMN);
|
||||
if (AT_LOC_FIRST_LINE != AT_LOC_LAST_LINE)
|
||||
fprintf (stderr, "-%d.%d",
|
||||
AT_LOC_LAST_LINE, AT_LOC_LAST_COLUMN - 1);
|
||||
AT_LOC_LAST_LINE, AT_LOC_LAST_COLUMN - 1);
|
||||
else if (AT_LOC_FIRST_COLUMN != AT_LOC_LAST_COLUMN - 1)
|
||||
fprintf (stderr, "-%d",
|
||||
AT_LOC_LAST_COLUMN - 1);
|
||||
AT_LOC_LAST_COLUMN - 1);
|
||||
fprintf (stderr, ": ");])
|
||||
fprintf (stderr, "%s\n", s);
|
||||
}])[
|
||||
|
||||
]AT_DEFINES_IF(, [AT_CALC_LEX])[
|
||||
|
||||
static int
|
||||
power (int base, int exponent)
|
||||
{
|
||||
int res = 1;
|
||||
assert (0 <= exponent);
|
||||
for (/* Niente */; exponent; --exponent)
|
||||
res *= base;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/* A C main function. */
|
||||
int
|
||||
main (int argc, const char **argv)
|
||||
|
||||
Reference in New Issue
Block a user