- complain_at (loc, _("multiple %s declarations"), "%start");
+ complain (&loc, complaint, _("multiple %s declarations"), "%start");
syms->next = xmalloc (sizeof syms->next[0]);
syms->next->name = uniqstr_new (name);
/* After all symbol type declarations have been parsed, packgram invokes
syms->next = xmalloc (sizeof syms->next[0]);
syms->next->name = uniqstr_new (name);
/* After all symbol type declarations have been parsed, packgram invokes
- complain_at_indent (declaration_loc, &indent,
- _("result type clash on merge function %s: "
- "<%s> != <%s>"),
- quote (merge_function->name), type,
- merge_function->type);
+ complain_indent (&declaration_loc, complaint, &indent,
+ _("result type clash on merge function %s: "
+ "<%s> != <%s>"),
+ quote (merge_function->name), type,
+ merge_function->type);
- complain_at_indent (merge_function->type_declaration_location, &indent,
- _("previous declaration"));
- }
+ complain_indent (&merge_function->type_declaration_location, complaint,
+ &indent,
+ _("previous declaration"));
+ }
merge_function->type = uniqstr_new (type);
merge_function->type_declaration_location = declaration_loc;
}
/*--------------------------------------.
merge_function->type = uniqstr_new (type);
merge_function->type_declaration_location = declaration_loc;
}
/*--------------------------------------.
- warn_at (name->loc,
- _("duplicated symbol name for %s ignored"),
- quote (sym->tag));
+ complain (&name->loc, Wother,
+ _("duplicated symbol name for %s ignored"),
+ quote (sym->tag));
- complain_at (loc, _("rule given for %s, which is a token"), lhs->tag);
+ complain (&loc, complaint, _("rule given for %s, which is a token"),
+ lhs->tag);
symbol *first_rhs = r->next->content.sym;
/* If $$ is being set in default way, report if any type mismatch. */
if (first_rhs)
symbol *first_rhs = r->next->content.sym;
/* If $$ is being set in default way, report if any type mismatch. */
if (first_rhs)
- {
- char const *lhs_type = r->content.sym->type_name;
- const char *rhs_type =
- first_rhs->type_name ? first_rhs->type_name : "";
- if (!UNIQSTR_EQ (lhs_type, rhs_type))
- warn_at (r->location,
- _("type clash on default action: <%s> != <%s>"),
- lhs_type, rhs_type);
- }
+ {
+ char const *lhs_type = r->content.sym->type_name;
+ const char *rhs_type =
+ first_rhs->type_name ? first_rhs->type_name : "";
+ if (!UNIQSTR_EQ (lhs_type, rhs_type))
+ complain (&r->location, Wother,
+ _("type clash on default action: <%s> != <%s>"),
+ lhs_type, rhs_type);
+ }
- warn_at (r->location,
- _("empty rule for typed nonterminal, and no action"));
+ complain (&r->location, Wother,
+ _("empty rule for typed nonterminal, and no action"));
/* The default action, $$ = $1, `uses' both. */
&& (r->action_props.code || (n != 0 && n != 1)))
{
/* The default action, $$ = $1, `uses' both. */
&& (r->action_props.code || (n != 0 && n != 1)))
{
- warn_at_ptr (r->location, _("unused value: $%d"), n);
+ complain (&l->location, warn_flag, _("unused value: $%d"), n);
it for char literals and strings, which are always tokens. */
if (r->ruleprec
&& r->ruleprec->tag[0] != '\'' && r->ruleprec->tag[0] != '"'
it for char literals and strings, which are always tokens. */
if (r->ruleprec
&& r->ruleprec->tag[0] != '\'' && r->ruleprec->tag[0] != '"'
- && !r->ruleprec->declared && !r->ruleprec->prec)
- warn_at (r->location, _("token for %%prec is not defined: %s"),
- r->ruleprec->tag);
+ && r->ruleprec->status != declared && !r->ruleprec->prec)
+ complain (&r->location, Wother,
+ _("token for %%prec is not defined: %s"), r->ruleprec->tag);
code_props_rule_action_init (&midrule->action_props,
current_rule->action_props.code,
current_rule->action_props.location,
code_props_rule_action_init (&midrule->action_props,
current_rule->action_props.code,
current_rule->action_props.location,
token. */
symbol_class_set (precsym, token_sym, loc, false);
if (current_rule->ruleprec)
token. */
symbol_class_set (precsym, token_sym, loc, false);
if (current_rule->ruleprec)
- complain_at (loc, _("only one %s allowed per rule"), "%prec");
+ complain (&loc, complaint, _("only one %s allowed per rule"), "%prec");
- warn_at (loc, _("%s affects only GLR parsers"), "%dprec");
+ complain (&loc, Wother, _("%s affects only GLR parsers"),
+ "%dprec");
- complain_at (loc, _("%s must be followed by positive number"), "%dprec");
+ complain (&loc, complaint, _("%s must be followed by positive number"),
+ "%dprec");
- complain_at (loc, _("only one %s allowed per rule"), "%dprec");
+ complain (&loc, complaint, _("only one %s allowed per rule"), "%dprec");
- warn_at (loc, _("%s affects only GLR parsers"), "%merge");
+ complain (&loc, Wother, _("%s affects only GLR parsers"),
+ "%merge");
- complain_at (loc, _("only one %s allowed per rule"), "%merge");
+ complain (&loc, complaint, _("only one %s allowed per rule"), "%merge");
p = grammar_symbol_append (sym, loc);
if (name)
assign_named_ref(p, name);
p = grammar_symbol_append (sym, loc);
if (name)
assign_named_ref(p, name);
}
/* Attach an ACTION to the current rule. */
void
grammar_current_rule_action_append (const char *action, location loc,
}
/* Attach an ACTION to the current rule. */
void
grammar_current_rule_action_append (const char *action, location loc,
{
if (current_rule->action_props.code)
grammar_midrule_action ();
/* After all symbol declarations have been parsed, packgram invokes
code_props_translate_code. */
code_props_rule_action_init (¤t_rule->action_props, action, loc,
{
if (current_rule->action_props.code)
grammar_midrule_action ();
/* After all symbol declarations have been parsed, packgram invokes
code_props_translate_code. */
code_props_rule_action_init (¤t_rule->action_props, action, loc,
int rule_length = 0;
symbol *ruleprec = p->ruleprec;
record_merge_function_type (p->merger, p->content.sym->type_name,
int rule_length = 0;
symbol *ruleprec = p->ruleprec;
record_merge_function_type (p->merger, p->content.sym->type_name,
rules[ruleno].user_number = ruleno;
rules[ruleno].number = ruleno;
rules[ruleno].lhs = p->content.sym;
rules[ruleno].user_number = ruleno;
rules[ruleno].number = ruleno;
rules[ruleno].lhs = p->content.sym;
rules[ruleno].useful = true;
rules[ruleno].action = p->action_props.code;
rules[ruleno].action_location = p->action_props.location;
rules[ruleno].useful = true;
rules[ruleno].action = p->action_props.code;
rules[ruleno].action_location = p->action_props.location;
- symbol name so that it's a user-defined symbol so that the default
- %destructor and %printer apply. */
+ symbol name so that it's a user-defined symbol so that the default
+ %destructor and %printer apply. */
- || symbol_list_n_get (p->midrule_parent_rule,
- p->midrule_parent_rhs_index)
+ || symbol_list_n_get (p->midrule_parent_rule,
+ p->midrule_parent_rhs_index)
- symbols may appear unused, but the parsing algorithm ensures that
- %destructor's are invoked appropriately. */
+ symbols may appear unused, but the parsing algorithm ensures that
+ %destructor's are invoked appropriately. */
- /* Don't allow rule_length == INT_MAX, since that might
- cause confusion with strtol if INT_MAX == LONG_MAX. */
- if (rule_length == INT_MAX)
- fatal_at (rules[ruleno].location, _("rule is too long"));
+ /* Don't allow rule_length == INT_MAX, since that might
+ cause confusion with strtol if INT_MAX == LONG_MAX. */
+ if (rule_length == INT_MAX)
+ complain (&rules[ruleno].location, fatal, _("rule is too long"));
- /* A rule gets by default the precedence and associativity
- of its last token. */
- if (p->content.sym->class == token_sym && default_prec)
- rules[ruleno].prec = p->content.sym;
- }
+ /* A rule gets by default the precedence and associativity
+ of its last token. */
+ if (p->content.sym->class == token_sym && default_prec)
+ rules[ruleno].prec = p->content.sym;
+ }
/* If this rule has a %prec,
the specified symbol's precedence replaces the default. */
if (ruleprec)
/* If this rule has a %prec,
the specified symbol's precedence replaces the default. */
if (ruleprec)
/* An item ends by the rule number (negated). */
ritem[itemno++] = rule_number_as_item_number (ruleno);
aver (itemno < ITEM_NUMBER_MAX);
/* An item ends by the rule number (negated). */
ritem[itemno++] = rule_number_as_item_number (ruleno);
aver (itemno < ITEM_NUMBER_MAX);
{
char *lr_type;
/* IELR would be a better default, but LALR is historically the
default. */
muscle_percent_define_default ("lr.type", "lalr");
lr_type = muscle_percent_define_get ("lr.type");
{
char *lr_type;
/* IELR would be a better default, but LALR is historically the
default. */
muscle_percent_define_default ("lr.type", "lalr");
lr_type = muscle_percent_define_get ("lr.type");
- if (0 != strcmp (lr_type, "canonical-lr"))
- muscle_percent_define_default ("lr.default-reductions", "most");
+ if (STRNEQ (lr_type, "canonical-lr"))
+ muscle_percent_define_default ("lr.default-reduction", "most");
{
static char const * const values[] = {
"lr.type", "lalr", "ielr", "canonical-lr", NULL,
{
static char const * const values[] = {
"lr.type", "lalr", "ielr", "canonical-lr", NULL,
- "lr.default-reductions", "most", "consistent", "accepting", NULL,
+ "lr.default-reduction", "most", "consistent", "accepting", NULL,
/*-------------------------------------------------------------.
| Check the grammar that has just been read, and convert it to |
/*-------------------------------------------------------------.
| Check the grammar that has just been read, and convert it to |