[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bison 3.3.1 released [stable]
From: |
Akim Demaille |
Subject: |
Re: Bison 3.3.1 released [stable] |
Date: |
Sun, 27 Jan 2019 19:32:45 +0100 |
> Le 27 janv. 2019 à 18:26, Hans Åberg <address@hidden> a écrit :
>
>
>> On 27 Jan 2019, at 16:43, Akim Demaille <address@hidden> wrote:
>>
>> In Bison 3.3, the new option --update replaces deprecated features with
>> their modern spelling, but also applies fixes such as eliminating duplicate
>> directives, etc.
>
> This is nice feature. You might add info about along with the warnings when
> it discovers something it can fix.
I think what you mean is done, and documented in the NEWS too.
*** Generation of fix-its for IDEs/Editors
When given the new option -ffixit (aka -fdiagnostics-parseable-fixits),
bison now generates machine readable editing instructions to fix some
issues. Currently, this is mostly limited to updating deprecated
directives and removing duplicates. For instance:
$ cat foo.y
%error-verbose
%define parser_class_name "Parser"
%define api.parser.class "Parser"
%%
exp:;
See the "fix-it:" lines below:
$ bison -ffixit foo.y
foo.y:1.1-14: warning: deprecated directive, use '%define parse.error
verbose' [-Wdeprecated]
%error-verbose
^~~~~~~~~~~~~~
fix-it:"foo.y":{1:1-1:15}:"%define parse.error verbose"
foo.y:2.1-34: warning: deprecated directive, use '%define api.parser.class
{Parser}' [-Wdeprecated]
%define parser_class_name "Parser"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fix-it:"foo.y":{2:1-2:35}:"%define api.parser.class {Parser}"
foo.y:3.1-33: error: %define variable 'api.parser.class' redefined
%define api.parser.class "Parser"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foo.y:2.1-34: previous definition
%define parser_class_name "Parser"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fix-it:"foo.y":{3:1-3:34}:""
foo.y: warning: fix-its can be applied. Rerun with option '--update'.
[-Wother]
This uses the same output format as GCC and Clang.
*** Updating grammar files
Fixes can be applied on the fly. The previous example ends with the
suggestion to re-run bison with the option -u/--update, which results in a
cleaner grammar file.
$ bison --update foo.y
[...]
bison: file 'foo.y' was updated (backup: 'foo.y~')
$ cat foo.y
%define parse.error verbose
%define api.parser.class {Parser}
%%
exp:;