From: Akim Demaille Date: Mon, 11 Jun 2012 14:43:42 +0000 (+0200) Subject: tests: reorder. X-Git-Tag: v2.6~76 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/3d8082ad27164bc0eb49af394400dbecc275e922?ds=inline tests: reorder. * tests/calc.at (power): Move its definition, as a preparation for forthcoming changes. And space changes. --- 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 NUM "number" %type 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)