* src/reader.c (grammar_current_rule_prec_set): Make the %prec symbol a
token.
* tests/input.at (%prec takes a token): New test checking that %prec
won't take a nonterminal.
+2006-11-17 Joel E. Denny <jdenny@ces.clemson.edu>
+
+ Don't let %prec take a nonterminal.
+ * src/reader.c (grammar_current_rule_prec_set): Make the %prec symbol a
+ token.
+ * tests/input.at (%prec takes a token): New test checking that %prec
+ won't take a nonterminal.
+
2006-11-10 Joel E. Denny <jdenny@ces.clemson.edu>
* tests/testsuite.at (AT_CHECK): Don't miss an exit value of 0 because
2006-11-10 Joel E. Denny <jdenny@ces.clemson.edu>
* tests/testsuite.at (AT_CHECK): Don't miss an exit value of 0 because
void
grammar_current_rule_prec_set (symbol *precsym, location loc)
{
void
grammar_current_rule_prec_set (symbol *precsym, location loc)
{
+ symbol_class_set (precsym, token_sym, loc, false);
if (current_rule->ruleprec)
complain_at (loc, _("only one %s allowed per rule"), "%prec");
current_rule->ruleprec = precsym;
if (current_rule->ruleprec)
complain_at (loc, _("only one %s allowed per rule"), "%prec");
current_rule->ruleprec = precsym;
AT_CHECK([bison -o input.c input.y])
AT_CLEANUP
AT_CHECK([bison -o input.c input.y])
AT_CLEANUP
+
+
+## --------------------- ##
+## %prec takes a token. ##
+## --------------------- ##
+
+AT_SETUP([%prec takes a token])
+
+# Bison once allowed %prec sym where sym was a nonterminal.
+
+AT_DATA([input.y],
+[[%%
+start: PREC %prec PREC ;
+PREC: ;
+]])
+
+AT_CHECK([bison input.y], [1], [],
+[[input.y:3.1-4: rule given for PREC, which is a token
+]])
+
+AT_CLEANUP