]> git.saurik.com Git - bison.git/commit
diagnostics: factor and enhance messages about duplicate rule directives
authorAkim Demaille <akim@lrde.epita.fr>
Sun, 17 Feb 2013 11:47:35 +0000 (12:47 +0100)
committerAkim Demaille <akim@lrde.epita.fr>
Mon, 18 Feb 2013 09:01:29 +0000 (10:01 +0100)
commit0fe5a72a262cd4680513d135e1161f345fc3afb1
tree9ddd2df24a469cd31606981e5eeab528329fca6f
parent4c9b8f1318c68238074ee19e7ab976a22924540e
diagnostics: factor and enhance messages about duplicate rule directives

When reporting a duplicate directive on a rule, point to its first
occurrence:

one.y:11.10-15: error: only one %empty allowed per rule
   %empty {} %empty
             ^^^^^^
one.y:11.3-8: previous declaration
   %empty {} %empty
   ^^^^^^

And consistently discard the second one.

* src/complain.h, src/complain.c (duplicate_directive): New.
* src/reader.c: Use it where appropriate.
* src/symlist.h, src/symlist.c (symbol_list): Add a dprec_location member.
* tests/actions.at: Adjust expected output.
src/complain.c
src/complain.h
src/reader.c
src/symlist.c
src/symlist.h
tests/actions.at