]> git.saurik.com Git - bison.git/blobdiff - src/gram.h
Renaming file to glr.c.
[bison.git] / src / gram.h
index a5079e379042718345766ec8d3652d75b7b0e420..b0f9daefcea4fcccd8d9348bbb544faaebfe28db 100644 (file)
 
    Associativities are recorded similarly in SYMBOLS[I]->assoc.  */
 
-#include "symtab.h"
+# include "location.h"
+# include "symtab.h"
 
-#define        ISTOKEN(s)      ((s) < ntokens)
-#define        ISVAR(s)        ((s) >= ntokens)
+# define ISTOKEN(s)    ((s) < ntokens)
+# define ISVAR(s)      ((s) >= ntokens)
 
 extern int nrules;
 extern int nsyms;
 extern int ntokens;
 extern int nvars;
 
-#define ITEM_NUMBER_MAX INT_MAX
+# define ITEM_NUMBER_MAX INT_MAX
 typedef int item_number_t;
 extern item_number_t *ritem;
 extern unsigned int nritems;
@@ -118,8 +119,8 @@ extern unsigned int nritems;
 
    Therefore, an symbol_number_t must be a valid item_number_t, and we
    sometimes have to perform the converse transformation.  */
-#define symbol_number_as_item_number(Tok) ((item_number_t) (Tok))
-#define item_number_as_symbol_number(Ite) ((symbol_number_t) (Ite))
+# define symbol_number_as_item_number(Tok) ((item_number_t) (Tok))
+# define item_number_as_symbol_number(Ite) ((symbol_number_t) (Ite))
 
 extern symbol_number_t start_symbol;
 
@@ -143,11 +144,11 @@ typedef struct rule_s
   /* This symbol was attached to the rule via %prec. */
   symbol_t *precsym;
 
-  int line;
+  location_t location;
   bool useful;
 
   const char *action;
-  int action_line;
+  location_t action_location;
 } rule_t;
 
 extern struct rule_s *rules;
@@ -167,15 +168,29 @@ extern int max_user_token_number;
 
 extern int pure_parser;
 
-/* Report the length of the RHS. */
+/* Return the length of the RHS.  */
 int rule_rhs_length PARAMS ((rule_t *rule));
 
+/* Print this RULE's RHS on OUT.  */
+void rule_rhs_print PARAMS ((rule_t *rule, FILE *out));
+
+/* Print this RULE on OUT.  */
+void rule_print PARAMS ((rule_t *rule, FILE *out));
+
 /* Dump RITEM for traces. */
 void ritem_print PARAMS ((FILE *out));
 
 /* Return the size of the longest rule RHS.  */
 size_t ritem_longest_rhs PARAMS ((void));
 
+/* Print the grammar's rules numbers from BEGIN (inclusive) to END
+   (exclusive) on OUT under TITLE.  */
+void grammar_rules_partial_print PARAMS ((FILE *out, const char *title,
+                                         int begin, int end));
+
+/* Print the grammar's rules on OUT.  */
+void grammar_rules_print PARAMS ((FILE *out));
+
 /* Dump the grammar. */
 void grammar_dump PARAMS ((FILE *out, const char *title));