#include "scan-gram.h"
#include "scan-code.h"
+static void prepare_percent_define_front_end_variables (void);
static void check_and_convert_grammar (void);
static symbol_list *grammar = NULL;
gram_debug = trace_flag & trace_parse;
gram_scanner_initialize ();
gram_parse ();
+ prepare_percent_define_front_end_variables ();
- /* Set front-end %define variable defaults. */
+ if (! complaint_issued)
+ check_and_convert_grammar ();
+
+ xfclose (gram_in);
+}
+
+static void
+prepare_percent_define_front_end_variables (void)
+{
+ /* Set %define front-end variable defaults. */
muscle_percent_define_default ("lr.keep-unreachable-states", "false");
{
char *lr_type;
/* IELR would be a better default, but LALR is historically the
default. */
- muscle_percent_define_default ("lr.type", "LALR");
+ muscle_percent_define_default ("lr.type", "lalr");
lr_type = muscle_percent_define_get ("lr.type");
- if (0 != strcmp (lr_type, "canonical LR"))
+ if (0 != strcmp (lr_type, "canonical-lr"))
muscle_percent_define_default ("lr.default-reductions", "all");
else
muscle_percent_define_default ("lr.default-reductions", "accepting");
free (lr_type);
}
- /* Check front-end %define variables. */
+ /* Check %define front-end variables. */
{
static char const * const values[] = {
- "lr.type", "LALR", "IELR", "canonical LR", NULL,
+ "lr.type", "lalr", "ielr", "canonical-lr", NULL,
"lr.default-reductions", "all", "consistent", "accepting", NULL,
NULL
};
muscle_percent_define_check_values (values);
}
-
- if (! complaint_issued)
- check_and_convert_grammar ();
-
- xfclose (gram_in);
}
if (nrules == 0)
fatal (_("no rules in the input grammar"));
- /* Report any undefined symbols and consider them nonterminals. */
- symbols_check_defined ();
-
/* If the user did not define her ENDTOKEN, do it now. */
if (!endtoken)
{
endtoken->user_token_number = 0;
}
+ /* Report any undefined symbols and consider them nonterminals. */
+ symbols_check_defined ();
+
/* Find the start symbol if no %start. */
if (!start_flag)
{