]> git.saurik.com Git - bison.git/blobdiff - tests/calc.at
Update from TP.
[bison.git] / tests / calc.at
index ddc86464cdf823626e2a82a53742060457d59bf3..2cc0757f3a5f51e1ae7b7c569c93c93a38b4d9cb 100644 (file)
@@ -61,19 +61,36 @@ static int yygetc (void);
 static void yyungetc (int c);
 
 extern void perror (const char *s);
+
+/* Exercise pre-prologue dependency to %union.  */
+typedef int value_t;
+
 %}
 
+/* Exercise M4 quoting: '@:>@@:>@', 0.  */
+
 /* Also exercise %union. */
 %union
 {
-  int ival; /* A comment to exercise an old bug. */
+  value_t ival; /* A comment to exercise an old bug. */
 };
 
+/* Exercise post-prologue dependency to %union.  */
+%{
+static void id (YYSTYPE *lval);
+
+/* Exercise quotes in declarations.  */
+char quote[] = "@:>@@:>@,";
+%}
+
 /* Bison Declarations */
 %token CALC_EOF 0 "end of file"
 %token <ival> NUM "number"
 %type  <ival> exp
 
+/* Exercise quotes in strings.  */
+%token "fake @>:@@>:@,"
+
 %nonassoc '=' /* comparison           */
 %left '-' '+'
 %left '*' '/'
@@ -91,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
@@ -115,6 +137,7 @@ exp:
 /* The input. */
 FILE *yyin;
 
+/* Exercise M4 quoting: '@:>@@:>@', 2.  */
 static void
 yyerror (const char *s)
 {
@@ -236,6 +259,11 @@ power (int base, int exponent)
   return res;
 }
 
+void
+id (YYSTYPE* lval)
+{
+}
+
 int
 main (int argc, const char **argv)
 {