/[bison]/bison/tests/cxx-type.at
ViewVC logotype

Diff of /bison/tests/cxx-type.at

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

revision 1.5 by eggert, Mon Oct 14 08:43:36 2002 UTC revision 1.6 by eggert, Fri Oct 25 05:13:24 2002 UTC
# Line 88  declarator : ID                { printf ("\"%s\" ", ]$ Line 88  declarator : ID                { printf ("\"%s\" ", ]$
88    
89  #include <assert.h>  #include <assert.h>
90  #include <ctype.h>  #include <ctype.h>
91    #include <stdlib.h>
92  #include <string.h>  #include <string.h>
93    
94  int  int
# Line 111  yylex () Line 112  yylex ()
112  {  {
113    char buffer[256];    char buffer[256];
114    int c;    int c;
115      unsigned int i;
116    
117  #if YYPURE  #if YYPURE
118  # define yylval (*lvalp)  # define yylval (*lvalp)
119  ]m4_bmatch([$1], [location],[  (void) llocp;])[  ]m4_bmatch([$1], [location],[  (void) llocp;])[
120  #endif  #endif
121    
122    while (1) {    while (1)
123      c = getchar ();      {
124      switch (c) {        c = getchar ();
125      case EOF:        switch (c)
126        return 0;          {
127      case ' ': case '\t': case '\n': case '\f':          case EOF:
128        break;            return 0;
129      default:          case ' ': case '\t': case '\n': case '\f':
130        if (isalpha (c)) {            break;
131          ungetc (c, stdin);          default:
132          scanf ("%[A-Za-z0-9_]", buffer);            if (isalpha (c))
133          yylval = strdup (buffer);              {
134          return isupper ((unsigned char) buffer[0]) ? TYPENAME : ID;                i = 0;
135        }  
136        return c;                do
137                    {
138                      buffer[i++] = c;
139                      if (i == sizeof buffer - 1)
140                        abort ();
141                      c = getchar ();
142                    }
143                  while (isalnum (c) || c == '_');
144    
145                  ungetc (c, stdin);
146                  buffer[i++] = 0;
147                  yylval = strcpy (malloc (i), buffer);
148                  return isupper ((unsigned char) buffer[0]) ? TYPENAME : ID;
149                }
150              return c;
151            }
152      }      }
   }  
153  }  }
154    
155  int  int

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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