]> git.saurik.com Git - bison.git/blobdiff - tests/input.at
skeletons: style changes.
[bison.git] / tests / input.at
index 93ae3de169feead91e4505296c2ffe5be9c8fa0e..0ed8635f9cbc109cb3622de2a6fe7321c95c16e3 100644 (file)
@@ -391,7 +391,7 @@ AT_CLEANUP
 
 AT_SETUP([Torturing the Scanner])
 
 
 AT_SETUP([Torturing the Scanner])
 
-
+AT_BISON_OPTION_PUSHDEFS
 AT_DATA([input.y], [])
 AT_BISON_CHECK([input.y], [1], [],
 [[input.y:1.1: syntax error, unexpected end of file
 AT_DATA([input.y], [])
 AT_BISON_CHECK([input.y], [1], [],
 [[input.y:1.1: syntax error, unexpected end of file
@@ -442,6 +442,7 @@ char apostrophe = '\'';
 
 #include <stdio.h>
 #include <stdlib.h>
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <assert.h>
 %}
 /* %{ and %} can be here too. */
 
 %}
 /* %{ and %} can be here too. */
 
@@ -468,8 +469,8 @@ char quote[] = "@:>@@:>@,";
 %}
 
 %{
 %}
 
 %{
-static void yyerror (const char *s);
-static int yylex (void);
+]AT_YYERROR_DECLARE[
+]AT_YYLEX_DECLARE[
 %}
 
 %type <ival> '@<:@'
 %}
 
 %type <ival> '@<:@'
@@ -501,7 +502,7 @@ value_as_yystype (value val)
   res.ival = val;
   return res;
 }
   res.ival = val;
   return res;
 }
-
+]AT_YYERROR_DEFINE[
 static int
 yylex (void)
 {
 static int
 yylex (void)
 {
@@ -509,20 +510,13 @@ yylex (void)
 #output "; /* "
   */
   static size_t toknum;
 #output "; /* "
   */
   static size_t toknum;
-  if (! (toknum < sizeof input))
-    abort ();
+  assert (toknum < sizeof input);
   yylval = value_as_yystype (input[toknum]);
   return input[toknum++];
 }
   yylval = value_as_yystype (input[toknum]);
   return input[toknum++];
 }
-
-static void
-yyerror (const char *msg)
-{
-  fprintf (stderr, "%s\n", msg);
-}
 ]])
 
 ]])
 
-# Pacify Emacs'font-lock-mode: "
+# Pacify Emacs' font-lock-mode: "
 
 AT_DATA([main.c],
 [[typedef int value;
 
 AT_DATA([main.c],
 [[typedef int value;
@@ -536,10 +530,11 @@ main (void)
   return yyparse ();
 }
 ]])
   return yyparse ();
 }
 ]])
+AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([-d -v -o input.c input.y])
 
 AT_BISON_CHECK([-d -v -o input.c input.y])
-AT_COMPILE([input.o], [-c input.c])
-AT_COMPILE([main.o], [-c main.c])
+AT_COMPILE([input.o])
+AT_COMPILE([main.o])
 AT_COMPILE([input], [input.o main.o])
 AT_PARSER_CHECK([./input], 0,
 [[[@<:@],
 AT_COMPILE([input], [input.o main.o])
 AT_PARSER_CHECK([./input], 0,
 [[[@<:@],
@@ -621,14 +616,15 @@ AT_CLEANUP
 
 AT_SETUP([Symbols])
 
 
 AT_SETUP([Symbols])
 
+AT_BISON_OPTION_PUSHDEFS
 AT_DATA_GRAMMAR([input.y],
 [[%token WITH-DASH
 %token WITHOUT_DASH "WITHOUT-DASH"
 %token WITH.PERIOD
 %token WITHOUT_PERIOD "WITHOUT.PERIOD"
 %code {
 AT_DATA_GRAMMAR([input.y],
 [[%token WITH-DASH
 %token WITHOUT_DASH "WITHOUT-DASH"
 %token WITH.PERIOD
 %token WITHOUT_PERIOD "WITHOUT.PERIOD"
 %code {
-  void yyerror (char const *);
-  int yylex (void);
+  ]AT_YYERROR_DECLARE[
+  ]AT_YYLEX_DECLARE[
 }
 %%
 start: with-dash without_dash with.period without_period;
 }
 %%
 start: with-dash without_dash with.period without_period;
@@ -637,7 +633,10 @@ without_dash: "WITHOUT-DASH";
 with.period: WITH.PERIOD;
 without_period: "WITHOUT.PERIOD";
 %%
 with.period: WITH.PERIOD;
 without_period: "WITHOUT.PERIOD";
 %%
+]AT_YYERROR_DEFINE[
+]AT_YYLEX_DEFINE[
 ]])
 ]])
+AT_BISON_OPTION_POPDEFS
 
 # POSIX Yacc accept periods, but not dashes.
 AT_BISON_CHECK([--yacc input.y], [1], [],
 
 # POSIX Yacc accept periods, but not dashes.
 AT_BISON_CHECK([--yacc input.y], [1], [],
@@ -655,7 +654,7 @@ input.y:18.8-16: warning: POSIX Yacc forbids dashes in symbol names: with-dash
 AT_BISON_CHECK([-o input.c input.y])
 
 # Make sure we don't export silly token identifiers with periods or dashes.
 AT_BISON_CHECK([-o input.c input.y])
 
 # Make sure we don't export silly token identifiers with periods or dashes.
-AT_COMPILE([input.o], [-c input.c])
+AT_COMPILE([input.o])
 
 
 # Periods are genuine letters, they can start identifiers.
 
 
 # Periods are genuine letters, they can start identifiers.