/[bison]/bison/tests/regression.at
ViewVC logotype

Diff of /bison/tests/regression.at

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.27 by akim, Tue Jan 22 10:29:28 2002 UTC revision 1.1.2.28 by akim, Fri Jan 25 16:24:21 2002 UTC
# Line 19  Line 19 
19  AT_BANNER([[Regression tests.]])  AT_BANNER([[Regression tests.]])
20    
21    
22    ## ------------------- ##
23    ## %nonassoc and eof.  ##
24    ## ------------------- ##
25    
26    AT_SETUP([%nonassoc and eof])
27    
28    AT_DATA([input.y],
29    [[
30    %{
31    #include <stdio.h>
32    #include <stdlib.h>
33    #include <string.h>
34    #include <error.h>
35    #define YYERROR_VERBOSE 1
36    #define yyerror(Msg) \
37    do { \
38      fprintf (stderr, "%s\n", Msg); \
39      exit (1); \
40    } while (0)
41    
42    /* The current argument. */
43    static const char *input = NULL;
44    
45    static int
46    yylex (void)
47    {
48      /* No token stands for end of file. */
49      if (input && *input)
50        return *input++;
51      else
52        return 0;
53    }
54    
55    %}
56    
57    %nonassoc '<' '>'
58    
59    %%
60    expr: expr '<' expr
61        | expr '>' expr
62        | '0'
63        ;
64    %%
65    int
66    main (int argc, const char *argv[])
67    {
68      if (argc > 1)
69        input = argv[1];
70      return yyparse ();
71    }
72    ]])
73    
74    # Specify the output files to avoid problems on different file systems.
75    AT_CHECK([bison input.y -o input.c])
76    AT_CHECK([$CC $CFLAGS $CPPFLAGS input.c -o input], 0, [], [ignore])
77    
78    AT_CHECK([input '0<0'])
79    # FIXME: This is an actual bug, but a new one, in the sense that
80    # no one has ever spotted it!  The messages are *wrong*: there should
81    # be nothing there, it should be expected eof.
82    AT_CHECK([input '0<0<0'], [1], [],
83             [parse error, unexpected '<', expecting '<' or '>'
84    ])
85    
86    AT_CHECK([input '0>0'])
87    AT_CHECK([input '0>0>0'], [1], [],
88             [parse error, unexpected '>', expecting '<' or '>'
89    ])
90    
91    AT_CHECK([input '0<0>0'], [1], [],
92             [parse error, unexpected '>', expecting '<' or '>'
93    ])
94    
95    AT_CLEANUP
96    
97  ## ---------------- ##  ## ---------------- ##
98  ## Braces parsing.  ##  ## Braces parsing.  ##
99  ## ---------------- ##  ## ---------------- ##

Legend:
Removed from v.1.1.2.27  
changed lines
  Added in v.1.1.2.28

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26