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
_("result type clash on merge function %s: <%s> != <%s>"),
quote (merge_function->name), type, merge_function->type);
complain_at (merge_function->type_declaration_location,
_("result type clash on merge function %s: <%s> != <%s>"),
quote (merge_function->name), type, merge_function->type);
complain_at (merge_function->type_declaration_location,
}
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;
}
/*--------------------------------------.
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))
+ warn_at (r->location,
+ _("type clash on default action: <%s> != <%s>"),
+ lhs_type, rhs_type);
+ }
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] != '"'
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,
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)
+ fatal_at (rules[ruleno].location, _("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);
default. */
muscle_percent_define_default ("lr.type", "lalr");
lr_type = muscle_percent_define_get ("lr.type");
default. */
muscle_percent_define_default ("lr.type", "lalr");
lr_type = muscle_percent_define_get ("lr.type");
muscle_percent_define_default ("lr.default-reductions", "most");
else
muscle_percent_define_default ("lr.default-reductions", "accepting");
muscle_percent_define_default ("lr.default-reductions", "most");
else
muscle_percent_define_default ("lr.default-reductions", "accepting");
/*-------------------------------------------------------------.
| Check the grammar that has just been read, and convert it to |
/*-------------------------------------------------------------.
| Check the grammar that has just been read, and convert it to |