50 |
grammar_start_symbol_set (symbol_t *s, location_t l) |
grammar_start_symbol_set (symbol_t *s, location_t l) |
51 |
{ |
{ |
52 |
if (start_flag) |
if (start_flag) |
53 |
complain (_("multiple %s declarations"), "%start"); |
complain_at (l, _("multiple %s declarations"), "%start"); |
54 |
else |
else |
55 |
{ |
{ |
56 |
start_flag = 1; |
start_flag = 1; |
200 |
++nvars; |
++nvars; |
201 |
} |
} |
202 |
else if (lhs->class == token_sym) |
else if (lhs->class == token_sym) |
203 |
complain (_("rule given for %s, which is a token"), lhs->tag); |
complain_at (location, _("rule given for %s, which is a token"), lhs->tag); |
204 |
} |
} |
205 |
|
|
206 |
/* Check that the last rule (CURRENT_RULE) is properly defined. For |
/* Check that the last rule (CURRENT_RULE) is properly defined. For |
224 |
const char *lhs_type = lhs->type_name ? lhs->type_name : ""; |
const char *lhs_type = lhs->type_name ? lhs->type_name : ""; |
225 |
const char *rhs_type = first_rhs->type_name ? first_rhs->type_name : ""; |
const char *rhs_type = first_rhs->type_name ? first_rhs->type_name : ""; |
226 |
if (strcmp (lhs_type, rhs_type)) |
if (strcmp (lhs_type, rhs_type)) |
227 |
complain (_("type clash (`%s' `%s') on default action"), |
complain_at (current_rule->location, |
228 |
lhs_type, rhs_type); |
_("type clash (`%s' `%s') on default action"), |
229 |
|
lhs_type, rhs_type); |
230 |
} |
} |
231 |
/* Warn if there is no default for $$ but we need one. */ |
/* Warn if there is no default for $$ but we need one. */ |
232 |
else |
else |
233 |
{ |
{ |
234 |
if (lhs->type_name) |
if (lhs->type_name) |
235 |
complain (_("empty rule for typed nonterminal, and no action")); |
complain_at (current_rule->location, |
236 |
|
_("empty rule for typed nonterminal, and no action")); |
237 |
} |
} |
238 |
} |
} |
239 |
|
|
301 |
/* Set the precedence symbol of the current rule to PRECSYM. */ |
/* Set the precedence symbol of the current rule to PRECSYM. */ |
302 |
|
|
303 |
void |
void |
304 |
grammar_current_rule_prec_set (symbol_t *precsym) |
grammar_current_rule_prec_set (symbol_t *precsym, location_t location) |
305 |
{ |
{ |
306 |
if (current_rule->ruleprec) |
if (current_rule->ruleprec) |
307 |
complain (_("two @prec's in a row")); |
complain_at (location, _("two @prec's in a row")); |
308 |
current_rule->ruleprec = precsym; |
current_rule->ruleprec = precsym; |
309 |
} |
} |
310 |
|
|