diff options
author | Akim Demaille <akim@lrde.epita.fr> | 2012-06-11 16:43:42 +0200 |
---|---|---|
committer | Akim Demaille <akim@lrde.epita.fr> | 2012-06-15 13:36:01 +0200 |
commit | 3d8082ad27164bc0eb49af394400dbecc275e922 (patch) | |
tree | 151b8f5724f0b5e6d69313e9f5c4a04b270c62d2 | |
parent | 9d67a52ad6f9aa1241d64b9766525362715b16e8 (diff) | |
download | bison-3d8082ad27164bc0eb49af394400dbecc275e922.tar.gz |
tests: reorder.
* tests/calc.at (power): Move its definition, as a preparation for
forthcoming changes.
And space changes.
-rw-r--r-- | tests/calc.at | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/tests/calc.at b/tests/calc.at index c5040083..790c4e63 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -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) |