]> git.saurik.com Git - bison.git/blobdiff - src/reader.c
Adjust to new location_t layout.
[bison.git] / src / reader.c
index 5c65d020f47715648e90b64be7acdd7bb95f39d9..52808c039ccdc109963e5ac5ff7d2a240411fd2e 100644 (file)
@@ -1,4 +1,4 @@
-/* Input parser for bison
+/* Input parser for Bison
    Copyright (C) 1984, 1986, 1989, 1992, 1998, 2000, 2001, 2002
    Free Software Foundation, Inc.
 
@@ -70,8 +70,9 @@ prologue_augment (const char *prologue, location_t location)
     !typed ? &pre_prologue_obstack : &post_prologue_obstack;
 
   obstack_fgrow1 (oout, "]b4_syncline([[%d]], [[",
-                 location.first_line);
-  MUSCLE_OBSTACK_SGROW (oout, quotearg_style (c_quoting_style, location.file));
+                 location.start.line);
+  MUSCLE_OBSTACK_SGROW (oout, quotearg_style (c_quoting_style,
+                                             location.start.file));
   obstack_sgrow (oout, "]])[\n");
   obstack_sgrow (oout, prologue);
 }
@@ -88,9 +89,9 @@ epilogue_augment (const char *epilogue, location_t location)
 {
   char *extension = NULL;
   obstack_fgrow1 (&muscle_obstack, "]b4_syncline([[%d]], [[",
-                 location.first_line);
+                 location.start.line);
   MUSCLE_OBSTACK_SGROW (&muscle_obstack,
-                       quotearg_style (c_quoting_style, location.file));
+                       quotearg_style (c_quoting_style, location.start.file));
   obstack_sgrow (&muscle_obstack, "]])[\n");
   obstack_sgrow (&muscle_obstack, epilogue);
   obstack_1grow (&muscle_obstack, 0);
@@ -260,14 +261,14 @@ grammar_current_rule_check (void)
     {
       const char *rhs_type = first_rhs->type_name ? first_rhs->type_name : "";
       if (!STRUNIQ_EQ (lhs_type, rhs_type))
-       complain_at (current_rule->location,
-                    _("type clash on default action: <%s> != <%s>"),
-                    lhs_type, rhs_type);
+       warn_at (current_rule->location,
+                _("type clash on default action: <%s> != <%s>"),
+                lhs_type, rhs_type);
     }
   /* Warn if there is no default for $$ but we need one.  */
   else
-    complain_at (current_rule->location,
-                _("empty rule for typed nonterminal, and no action"));
+    warn_at (current_rule->location,
+            _("empty rule for typed nonterminal, and no action"));
 }
 
 
@@ -452,7 +453,8 @@ packgram (void)
        p = p->next;
     }
 
-  assert (itemno == nritems);
+  if (itemno != nritems)
+    abort ();
 
   if (trace_flag & trace_sets)
     ritem_print (stderr);
@@ -468,8 +470,6 @@ packgram (void)
 void
 reader (void)
 {
-  gram_control_t gram_control;
-
   /* Initialize the symbol table.  */
   symbols_new ();
 
@@ -499,7 +499,7 @@ reader (void)
   gram__flex_debug = trace_flag & trace_scan;
   gram_debug = trace_flag & trace_parse;
   scanner_initialize ();
-  gram_parse (&gram_control);
+  gram_parse ();
 
   /* If something went wrong during the parsing, don't try to
      continue.  */
@@ -539,8 +539,8 @@ reader (void)
     grammar = p;
   }
 
-  assert (nsyms <= SYMBOL_NUMBER_MAX);
-  assert (nsyms == ntokens + nvars);
+  if (! (nsyms <= SYMBOL_NUMBER_MAX && nsyms == ntokens + nvars))
+    abort ();
 
   xfclose (finput);