/[bison]/bison/src/reader.c
ViewVC logotype

Diff of /bison/src/reader.c

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

revision 1.168 by akim, Mon Apr 22 08:22:11 2002 UTC revision 1.169 by ra, Wed Apr 24 16:22:57 2002 UTC
# Line 591  copy_dollar (FILE *fin, struct obstack * Line 591  copy_dollar (FILE *fin, struct obstack *
591  `-------------------------------------------------------------------*/  `-------------------------------------------------------------------*/
592    
593  static void  static void
594  copy_definition (void)  copy_definition (struct obstack *oout)
595  {  {
596    int c;    int c;
597    /* -1 while reading a character if prev char was %. */    /* -1 while reading a character if prev char was %. */
# Line 599  copy_definition (void) Line 599  copy_definition (void)
599    
600    if (!no_lines_flag)    if (!no_lines_flag)
601      {      {
602        obstack_fgrow2 (&attrs_obstack, muscle_find ("linef"),        obstack_fgrow2 (oout, muscle_find ("linef"),
603                        lineno, quotearg_style (c_quoting_style,                        lineno, quotearg_style (c_quoting_style,
604                                                muscle_find ("filename")));                                                muscle_find ("filename")));
605      }      }
# Line 613  copy_definition (void) Line 613  copy_definition (void)
613        switch (c)        switch (c)
614          {          {
615          case '\n':          case '\n':
616            obstack_1grow (&attrs_obstack, c);            obstack_1grow (oout, c);
617            ++lineno;            ++lineno;
618            break;            break;
619    
# Line 623  copy_definition (void) Line 623  copy_definition (void)
623    
624          case '\'':          case '\'':
625          case '"':          case '"':
626            copy_string (finput, &attrs_obstack, c);            copy_string (finput, oout, c);
627            break;            break;
628    
629          case '/':          case '/':
630            copy_comment (finput, &attrs_obstack);            copy_comment (finput, oout);
631            break;            break;
632    
633          case EOF:          case EOF:
634            fatal ("%s", _("unterminated `%{' definition"));            fatal ("%s", _("unterminated `%{' definition"));
635    
636          default:          default:
637            obstack_1grow (&attrs_obstack, c);            obstack_1grow (oout, c);
638          }          }
639    
640        c = getc (finput);        c = getc (finput);
# Line 643  copy_definition (void) Line 643  copy_definition (void)
643          {          {
644            if (c == '}')            if (c == '}')
645              return;              return;
646            obstack_1grow (&attrs_obstack, '%');            obstack_1grow (oout, '%');
647          }          }
648        after_percent = 0;        after_percent = 0;
649      }      }
# Line 1154  parse_skel_decl (void) Line 1154  parse_skel_decl (void)
1154  /*----------------------------------------------------------------.  /*----------------------------------------------------------------.
1155  | Read from finput until `%%' is seen.  Discard the `%%'.  Handle |  | Read from finput until `%%' is seen.  Discard the `%%'.  Handle |
1156  | any `%' declarations, and copy the contents of any `%{ ... %}'  |  | any `%' declarations, and copy the contents of any `%{ ... %}'  |
1157  | groups to ATTRS_OBSTACK.                                        |  | groups to PRE_PROLOGUE_OBSTACK or POST_PROLOGUE_OBSTACK.        |
1158  `----------------------------------------------------------------*/  `----------------------------------------------------------------*/
1159    
1160  static void  static void
# Line 1174  read_declarations (void) Line 1174  read_declarations (void)
1174                return;                return;
1175    
1176              case tok_percent_left_curly:              case tok_percent_left_curly:
1177                copy_definition ();                if (!typed)
1178                    copy_definition (&pre_prologue_obstack);
1179                  else
1180                    copy_definition (&post_prologue_obstack);
1181                break;                break;
1182    
1183              case tok_token:              case tok_token:
# Line 1854  reader (void) Line 1857  reader (void)
1857    
1858    /* Initialize the obstacks. */    /* Initialize the obstacks. */
1859    obstack_init (&action_obstack);    obstack_init (&action_obstack);
   obstack_init (&attrs_obstack);  
1860    obstack_init (&output_obstack);    obstack_init (&output_obstack);
1861      obstack_init (&pre_prologue_obstack);
1862      obstack_init (&post_prologue_obstack);
1863    
1864    finput = xfopen (infile, "r");    finput = xfopen (infile, "r");
1865    

Legend:
Removed from v.1.168  
changed lines
  Added in v.1.169

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