]> git.saurik.com Git - bison.git/blobdiff - src/reader.c
* src/reader.c (reader): Calling symbols_output once is enough.
[bison.git] / src / reader.c
index ac160aed449b93d59814299a2e1eee7a009374f2..cb013b207b3e4eef56b403e9d90f402d6247a041 100644 (file)
@@ -964,24 +964,60 @@ parse_muscle_decl (void)
 }
 
 
-/*----------------------------------.
-| Parse what comes after %skeleton. |
-`----------------------------------*/
 
-void
-parse_skel_decl (void)
+/*---------------------------------.
+| Parse a double quoted parameter. |
+`---------------------------------*/
+
+static const char *
+parse_dquoted_param (const char *from)
 {
-  /* Complete with parse_dquoted_param () on the CVS branch 1.29.  */
+  struct obstack param_obstack;
+  const char *param = NULL;
+  int c;
+
+  obstack_init (&param_obstack);
+  c = skip_white_space ();
+
+  if (c != '"')
+    {
+      complain (_("invalid %s declaration"), from);
+      ungetc (c, finput);
+      skip_to_char ('%');
+      return NULL;
+    }
+
+  for (;;)
+    {
+      if (literalchar (NULL, &c, '\"'))
+       obstack_1grow (&param_obstack, c);
+      else
+       break;
+    }
+
+  obstack_1grow (&param_obstack, '\0');
+  param = obstack_finish (&param_obstack);
+
+  if (c != '"' || strlen (param) == 0)
+    {
+      complain (_("invalid %s declaration"), from);
+      if (c != '"')
+       ungetc (c, finput);
+      skip_to_char ('%');
+      return NULL;
+    }
+
+  return param;
 }
 
-/*---------------------------------------.
-| Parse what comes after %skeleton_path. |
-`---------------------------------------*/
+/*----------------------------------.
+| Parse what comes after %skeleton. |
+`----------------------------------*/
 
-void
-parse_include_decl (void)
+static void
+parse_skel_decl (void)
 {
-  /* Complete with parse_dquoted_param () on the CVS branch 1.29.  */
+  skeleton = parse_dquoted_param ("%skeleton");
 }
 
 /*----------------------------------------------------------------.
@@ -1058,10 +1094,6 @@ read_declarations (void)
              parse_skel_decl ();
              break;
 
-           case tok_include:
-             parse_include_decl ();
-             break;
-             
            case tok_noop:
              break;
 
@@ -1101,7 +1133,6 @@ copy_action (symbol_list *rule, int stack_offset)
 {
   int c;
   int count;
-  char buf[4096];
 
   /* offset is always 0 if parser has already popped the stack pointer */
   if (semantic_parser)
@@ -1939,6 +1970,7 @@ packgram (void)
       rule_table[ruleno].lhs = p->sym->value;
       rule_table[ruleno].rhs = itemno;
       rule_table[ruleno].line = p->line;
+      rule_table[ruleno].useful = TRUE;
 
       p = p->next;
       while (p && p->sym)
@@ -1972,6 +2004,9 @@ packgram (void)
     }
 
   ritem[itemno] = 0;
+
+  if (trace_flag)
+    ritem_print (stderr);
 }
 \f
 /*-------------------------------------------------------------------.
@@ -2038,7 +2073,6 @@ reader (void)
   /* Assign the symbols their symbol numbers.  Write #defines for the
      token symbols into FDEFINES if requested.  */
   packsymbols ();
-  symbols_output ();
   /* Convert the grammar into the format described in gram.h.  */
   packgram ();
   /* Output the headers. */