tests: remove useless feature

* tests/calc.at (read_signed_integer): Rename as...
(read_integer): this.
We never read signs here.
This commit is contained in:
Akim Demaille
2019-04-17 08:43:53 +02:00
parent 9ad7524659
commit 2f3d9717ee

View File

@@ -220,28 +220,21 @@ unget_char (]AT_YYLEX_PRE_FORMALS[ int c)
} }
static int static int
read_signed_integer (]AT_YYLEX_FORMALS[) read_integer (]AT_YYLEX_FORMALS[)
{ {
int c = get_char (]AT_YYLEX_ARGS[); int c = get_char (]AT_YYLEX_ARGS[);
int sign = 1; int res = 0;
int n = 0;
]AT_USE_LEX_ARGS[; ]AT_USE_LEX_ARGS[;
if (c == '-')
{
c = get_char (]AT_YYLEX_ARGS[);
sign = -1;
}
while (isdigit (c)) while (isdigit (c))
{ {
n = 10 * n + (c - '0'); res = 10 * res + (c - '0');
c = get_char (]AT_YYLEX_ARGS[); c = get_char (]AT_YYLEX_ARGS[);
} }
unget_char (]AT_YYLEX_PRE_ARGS[ c); unget_char (]AT_YYLEX_PRE_ARGS[ c);
return sign * n; return res;
} }
@@ -268,7 +261,7 @@ read_signed_integer (]AT_YYLEX_FORMALS[)
if (c == '.' || isdigit (c)) if (c == '.' || isdigit (c))
{ {
unget_char (]AT_YYLEX_PRE_ARGS[ c); unget_char (]AT_YYLEX_PRE_ARGS[ c);
]AT_VAL[.ival = read_signed_integer (]AT_YYLEX_ARGS[); ]AT_VAL[.ival = read_integer (]AT_YYLEX_ARGS[);
return ]AT_TOKEN_PREFIX[NUM; return ]AT_TOKEN_PREFIX[NUM;
} }