X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/0dd1580afc286919586ed21b03c93b035f33c7d8..1e0bab92768860bfecd95f01227df9b1c25da2cb:/tests/calc.at diff --git a/tests/calc.at b/tests/calc.at index ecd4c673..28e16f95 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -1,5 +1,5 @@ # Checking the output filenames. -*- Autotest -*- -# Copyright 2000, 2001 Free Software Foundation, Inc. +# Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -67,6 +67,8 @@ typedef int value_t; %} +/* Exercise M4 quoting: '@:>@@:>@', 0. */ + /* Also exercise %union. */ %union { @@ -76,6 +78,9 @@ typedef int value_t; /* Exercise post-prologue dependency to %union. */ %{ static void id (YYSTYPE *lval); + +/* Exercise quotes in declarations. */ +char quote[] = "@:>@@:>@,"; %} /* Bison Declarations */ @@ -83,6 +88,9 @@ static void id (YYSTYPE *lval); %token NUM "number" %type exp +/* Exercise quotes in strings. */ +%token FAKE "fake @>:@@>:@," + %nonassoc '=' /* comparison */ %left '-' '+' %left '*' '/' @@ -100,9 +108,14 @@ input: line: '\n' -| exp '\n' {} +| exp '\n' + { + /* Exercise quotes in braces. */ + char tmp[] = "@>:@@:>@,"; + } ; +/* Exercise M4 quoting: '@:>@@:>@', 1. */ exp: NUM { $$ = $1; } | exp '=' exp @@ -124,6 +137,7 @@ exp: /* The input. */ FILE *yyin; +/* Exercise M4 quoting: '@:>@@:>@', 2. */ static void yyerror (const char *s) { @@ -392,18 +406,18 @@ _AT_CHECK_CALC([$1], (2^2)^3 = 64], [486]) # Some parse errors. -_AT_CHECK_CALC_ERROR([$1], [0 0], [10], +_AT_CHECK_CALC_ERROR([$1], [0 0], [11], [1.3-1.4: parse error, unexpected "number"]) -_AT_CHECK_CALC_ERROR([$1], [1//2], [13], +_AT_CHECK_CALC_ERROR([$1], [1//2], [15], [1.3-1.4: parse error, unexpected '/', expecting "number" or '-' or '(']) _AT_CHECK_CALC_ERROR([$1], [error], [4], [1.1-1.2: parse error, unexpected $undefined., expecting "number" or '-' or '\n' or '(']) -_AT_CHECK_CALC_ERROR([$1], [1 = 2 = 3], [19], +_AT_CHECK_CALC_ERROR([$1], [1 = 2 = 3], [22], [1.7-1.8: parse error, unexpected '=']) _AT_CHECK_CALC_ERROR([$1], [ +1], - [13], + [14], [2.1-2.2: parse error, unexpected '+']) # Exercise error messages with EOF: work on an empty file. _AT_CHECK_CALC_ERROR([$1], @@ -416,7 +430,7 @@ _AT_CHECK_CALC_ERROR([$1], # associated to `error'. _AT_CHECK_CALC_ERROR([$1], [(1 ++ 2) + (0 0) = 1], - [76], + [82], [1.5-1.6: parse error, unexpected '+', expecting "number" or '-' or '(' 1.15-1.16: parse error, unexpected "number" calc: error: 0 != 1])