X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/0f39aab92ab23bc067a3aa102bb56a600c045775..937fd8646fe9b5646c04d939fbfcb63ab0bed8bb:/tests/calc.at diff --git a/tests/calc.at b/tests/calc.at index c3873e57..d566c1db 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -53,8 +53,8 @@ extern void perror (const char *s); /* Exercise pre-prologue dependency to %union. */ typedef int value_t; -value_t global_result = 0; -int global_count = 0; +static value_t global_result = 0; +static int global_count = 0; %} @@ -146,7 +146,7 @@ exp: ; %% /* The input. */ -FILE *yyin; +static FILE *yyin; static void yyerror (]AT_YYERROR_ARG_LOC_IF([YYLTYPE *yylloc, ])[ @@ -291,8 +291,7 @@ main (int argc, const char **argv) { value_t result = 0; int count = 0; - int status = 0; - yyin = NULL; + int status; if (argc == 2) yyin = fopen (argv[1], "r"); @@ -353,7 +352,7 @@ m4_bmatch([$1], # [NUM-DEBUG-LINES], # [VERBOSE-AND-LOCATED-ERROR-MESSAGE]) # --------------------------------------------------------- -# Run `calc' on INPUT, and expect a `parse error' message. +# Run `calc' on INPUT, and expect a `syntax error' message. # # If INPUT starts with a slash, it is used as absolute input file name, # otherwise as contents. @@ -362,7 +361,7 @@ m4_bmatch([$1], # is correctly output on stderr. # # If BISON-OPTIONS contains `%error-verbose', then make sure the -# IF-YYERROR-VERBOSE message is properly output after `parse error, ' +# IF-YYERROR-VERBOSE message is properly output after `syntax error, ' # on STDERR. # # If BISON-OPTIONS contains `%debug' but not `%glr', then NUM-STDERR-LINES @@ -406,7 +405,7 @@ AT_YYERROR_SEES_LOC_IF([], mv at-expout expout]]) # 4. If error-verbose is not used, strip the`, unexpected....' part. m4_bmatch([$1], [%error-verbose], [], -[[sed 's/parse error, .*$/parse error/' expout >at-expout +[[sed 's/syntax error, .*$/syntax error/' expout >at-expout mv at-expout expout]]) # 5. Check AT_CHECK([cat stderr], 0, [expout]) @@ -497,30 +496,30 @@ _AT_CHECK_CALC([$1], (2^2)^3 = 64], [486]) -# Some parse errors. +# Some syntax errors. _AT_CHECK_CALC_ERROR([$1], [1], [0 0], [11], - [1.3-1.4: parse error, unexpected "number"]) + [1.3-1.4: syntax error, unexpected "number"]) _AT_CHECK_CALC_ERROR([$1], [1], [1//2], [15], - [1.3-1.4: parse error, unexpected '/', expecting "number" or '-' or '(']) + [1.3-1.4: syntax error, unexpected '/', expecting "number" or '-' or '(']) _AT_CHECK_CALC_ERROR([$1], [1], [error], [4], - [1.1-1.2: parse error, unexpected $undefined, expecting "number" or '-' or '\n' or '(']) + [1.1-1.2: syntax error, unexpected $undefined, expecting "number" or '-' or '\n' or '(']) _AT_CHECK_CALC_ERROR([$1], [1], [1 = 2 = 3], [22], - [1.7-1.8: parse error, unexpected '=']) + [1.7-1.8: syntax error, unexpected '=']) _AT_CHECK_CALC_ERROR([$1], [1], [ +1], [14], - [2.1-2.2: parse error, unexpected '+']) + [2.1-2.2: syntax error, unexpected '+']) # Exercise error messages with EOF: work on an empty file. _AT_CHECK_CALC_ERROR([$1], [1], [/dev/null], [4], - [1.1-1.2: parse error, unexpected "end of input", expecting "number" or '-' or '\n' or '(']) + [1.1-1.2: syntax error, unexpected "end of input", expecting "number" or '-' or '\n' or '(']) # Exercise the error token: without it, we die at the first error, # hence be sure i. to have several errors, ii. to test the action # associated to `error'. _AT_CHECK_CALC_ERROR([$1], [0], [(1 ++ 2) + (0 0) = 1], [82], -[1.5-1.6: parse error, unexpected '+', expecting "number" or '-' or '(' -1.15-1.16: parse error, unexpected "number" +[1.5-1.6: syntax error, unexpected '+', expecting "number" or '-' or '(' +1.15-1.16: syntax error, unexpected "number" calc: error: 0 != 1]) AT_CHECK_POPDEFS