mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 23:03:04 +00:00
diagnostics: improve them for %name-prefix
Currently the diagnostics for %name-prefix are not precise enough. In
particular, they does not show that braces must be used instead of
quotes.
Before:
foo.y:3.1-14: warning: deprecated directive, use '%define api.prefix' [-Wdeprecated]
%name-prefix = "foo"
^^^^^^^^^^^^^^
After:
foo.y:3.1-20: warning: deprecated directive, use '%define api.prefix {foo}' [-Wdeprecated]
%name-prefix = "foo"
^^^^^^^^^^^^^^^^^^^^
To do this we need the value passed to %name-prefix, so move the
warning from the scanner to the parser.
Accuracy will be very important for the forthcoming changes.
* src/parse-gram.y (do_name_prefix): New.
(PERCENT_NAME_PREFIX): Have a semantic value: the raw source, with
possibly underscores, equal sign, and spaces. This is used to provide
a more accurate message. It does not take comments into account,
but...
* src/scan-gram.l (%name-prefix): Delegate the warnings to the parser.
* tests/headers.at, tests/input.at: Adjust expectations.
This commit is contained in:
@@ -85,7 +85,7 @@ exp: %empty;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([--defines -o input.c input.y], [], [],
|
||||
[[input.y:11.1-12: warning: deprecated directive: '%name-prefix', use '%define api.prefix' [-Wdeprecated]
|
||||
[[input.y:11.1-18: warning: deprecated directive: '%name-prefix "my_"', use '%define api.prefix {my_}' [-Wdeprecated]
|
||||
]])
|
||||
|
||||
# YYLTYPE should be defined, and MY_LLOC declared.
|
||||
|
||||
Reference in New Issue
Block a user