/[bison]/bison/src/scan-gram.l
ViewVC logotype

Diff of /bison/src/scan-gram.l

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

revision 1.2 by akim, Tue Jun 11 21:43:18 2002 UTC revision 1.3 by akim, Tue Jun 11 21:45:49 2002 UTC
# Line 59  char *last_string; Line 59  char *last_string;
59    do {                                                  \    do {                                                  \
60      obstack_1grow (&string_obstack, '\0');              \      obstack_1grow (&string_obstack, '\0');              \
61      last_string = obstack_finish (&string_obstack);     \      last_string = obstack_finish (&string_obstack);     \
     yylval->string = last_string;                       \  
62    } while (0)    } while (0)
63    
64  #define YY_OBS_FREE                                             \  #define YY_OBS_FREE                                             \
# Line 67  char *last_string; Line 66  char *last_string;
66      obstack_free (&string_obstack, last_string);                \      obstack_free (&string_obstack, last_string);                \
67    } while (0)    } while (0)
68    
69    void
70    scanner_last_string_free (void)
71    {
72      YY_OBS_FREE;
73    }
74    
75    
76  /* This is only to avoid GCC warnings. */  /* This is only to avoid GCC warnings. */
77  #define YY_USER_INIT    if (yycontrol) {;};  #define YY_USER_INIT    if (yycontrol) {;};
78    
# Line 148  blanks   [ \t\f]+ Line 154  blanks   [ \t\f]+
154    {eols}      YY_LINES; YY_STEP;    {eols}      YY_LINES; YY_STEP;
155    {blanks}    YY_STEP;    {blanks}    YY_STEP;
156    {id}        {    {id}        {
157      YY_OBS_INIT; YY_OBS_GROW; YY_OBS_FINISH;      yylval->symbol = getsym (yytext);
     yylval->symbol = getsym (last_string);  
     YY_OBS_FREE;  
158      return ID;      return ID;
159    }    }
160    
# Line 173  blanks   [ \t\f]+ Line 177  blanks   [ \t\f]+
177    "{"         YY_OBS_INIT; YY_OBS_GROW; ++braces_level; yy_push_state (SC_BRACED_CODE);    "{"         YY_OBS_INIT; YY_OBS_GROW; ++braces_level; yy_push_state (SC_BRACED_CODE);
178    
179    /* A type. */    /* A type. */
180    "<"[^>]+">" YY_OBS_INIT; obstack_grow (&string_obstack, yytext + 1, yyleng - 2); YY_OBS_FINISH; return TYPE;    "<"[^>]+">" {
181        YY_OBS_INIT;
182        obstack_grow (&string_obstack, yytext + 1, yyleng - 2);
183        YY_OBS_FINISH;
184        yylval->string = last_string;
185        return TYPE;
186      }
187    
188    
189    "%%"   {    "%%"   {
190      if (++percent_percent_count == 2)      if (++percent_percent_count == 2)
# Line 244  blanks   [ \t\f]+ Line 255  blanks   [ \t\f]+
255      assert (yy_top_state () == INITIAL);      assert (yy_top_state () == INITIAL);
256      YY_OBS_GROW;      YY_OBS_GROW;
257      YY_OBS_FINISH;      YY_OBS_FINISH;
258        yylval->string = last_string;
259      yy_pop_state ();      yy_pop_state ();
260      return STRING;      return STRING;
261    }    }
# Line 257  blanks   [ \t\f]+ Line 269  blanks   [ \t\f]+
269      fprintf (stderr, ": unexpected end of file in a string\n");      fprintf (stderr, ": unexpected end of file in a string\n");
270      assert (yy_top_state () == INITIAL);      assert (yy_top_state () == INITIAL);
271      YY_OBS_FINISH;      YY_OBS_FINISH;
272        yylval->string = last_string;
273      yy_pop_state ();      yy_pop_state ();
274      return STRING;      return STRING;
275    }    }
# Line 292  blanks   [ \t\f]+ Line 305  blanks   [ \t\f]+
305      fprintf (stderr, ": unexpected end of file in a character\n");      fprintf (stderr, ": unexpected end of file in a character\n");
306      assert (yy_top_state () == INITIAL);      assert (yy_top_state () == INITIAL);
307      YY_OBS_FINISH;      YY_OBS_FINISH;
308        yylval->string = last_string;
309      yy_pop_state ();      yy_pop_state ();
310      return CHARACTER;      return CHARACTER;
311    }    }
# Line 421  blanks   [ \t\f]+ Line 435  blanks   [ \t\f]+
435        {        {
436          yy_pop_state ();          yy_pop_state ();
437          YY_OBS_FINISH;          YY_OBS_FINISH;
438            yylval->string = last_string;
439          return BRACED_CODE;          return BRACED_CODE;
440        }        }
441    }    }
# Line 441  blanks   [ \t\f]+ Line 456  blanks   [ \t\f]+
456      fprintf (stderr, ": unexpected end of file in a braced code\n");      fprintf (stderr, ": unexpected end of file in a braced code\n");
457      yy_pop_state ();      yy_pop_state ();
458      YY_OBS_FINISH;      YY_OBS_FINISH;
459      return PROLOGUE;      yylval->string = last_string;
460        return BRACED_CODE;
461    }    }
462    
463  }  }
# Line 456  blanks   [ \t\f]+ Line 472  blanks   [ \t\f]+
472    "%}" {    "%}" {
473      yy_pop_state ();      yy_pop_state ();
474      YY_OBS_FINISH;      YY_OBS_FINISH;
475        yylval->string = last_string;
476      return PROLOGUE;      return PROLOGUE;
477    }    }
478    
# Line 468  blanks   [ \t\f]+ Line 485  blanks   [ \t\f]+
485      fprintf (stderr, ": unexpected end of file in a prologue\n");      fprintf (stderr, ": unexpected end of file in a prologue\n");
486      yy_pop_state ();      yy_pop_state ();
487      YY_OBS_FINISH;      YY_OBS_FINISH;
488        yylval->string = last_string;
489      return PROLOGUE;      return PROLOGUE;
490    }    }
491    
# Line 486  blanks   [ \t\f]+ Line 504  blanks   [ \t\f]+
504    <<EOF>> {    <<EOF>> {
505      yy_pop_state ();      yy_pop_state ();
506      YY_OBS_FINISH;      YY_OBS_FINISH;
507        yylval->string = last_string;
508      return EPILOGUE;      return EPILOGUE;
509    }    }
510  }  }
# Line 607  handle_at (char *cp) Line 626  handle_at (char *cp)
626        complain (_("%s is invalid"), quote (buf));        complain (_("%s is invalid"), quote (buf));
627      }      }
628  }  }
629    
630    void
631    scanner_free (void)
632    {
633      obstack_free (&string_obstack, 0);
634    }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

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