mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 16:53:02 +00:00
maint: formatting changes.
* NEWS: Fix indentation of code snippets. Untabify.
This commit is contained in:
116
NEWS
116
NEWS
@@ -21,22 +21,22 @@ GNU Bison NEWS
|
|||||||
The generated headers are now guarded, as is already the case for C++
|
The generated headers are now guarded, as is already the case for C++
|
||||||
parsers (lalr1.cc). For intance, with --defines=foo.h:
|
parsers (lalr1.cc). For intance, with --defines=foo.h:
|
||||||
|
|
||||||
#ifndef YY_FOO_H
|
#ifndef YY_FOO_H
|
||||||
# define YY_FOO_H
|
# define YY_FOO_H
|
||||||
...
|
...
|
||||||
#endif /* !YY_FOO_H */
|
#endif /* !YY_FOO_H */
|
||||||
|
|
||||||
*** New declarations
|
*** New declarations
|
||||||
|
|
||||||
The generated header now declares yydebug and yyparse. Both honor
|
The generated header now declares yydebug and yyparse. Both honor
|
||||||
--name-prefix=bar_, and yield
|
--name-prefix=bar_, and yield
|
||||||
|
|
||||||
int bar_parse (void);
|
int bar_parse (void);
|
||||||
|
|
||||||
rather than
|
rather than
|
||||||
|
|
||||||
#define yyparse bar_parse
|
#define yyparse bar_parse
|
||||||
int yyparse (void);
|
int yyparse (void);
|
||||||
|
|
||||||
in order to facilitate the inclusion of several parser headers inside a
|
in order to facilitate the inclusion of several parser headers inside a
|
||||||
single compilation unit.
|
single compilation unit.
|
||||||
@@ -78,10 +78,10 @@ GNU Bison NEWS
|
|||||||
The header files such as "parser.hh", "location.hh", etc. used a constant
|
The header files such as "parser.hh", "location.hh", etc. used a constant
|
||||||
name for preprocessor guards, for instance:
|
name for preprocessor guards, for instance:
|
||||||
|
|
||||||
#ifndef BISON_LOCATION_HH
|
#ifndef BISON_LOCATION_HH
|
||||||
# define BISON_LOCATION_HH
|
# define BISON_LOCATION_HH
|
||||||
...
|
...
|
||||||
#endif // !BISON_LOCATION_HH
|
#endif // !BISON_LOCATION_HH
|
||||||
|
|
||||||
The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
|
The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
|
||||||
case characters are converted to upper case, and series of
|
case characters are converted to upper case, and series of
|
||||||
@@ -89,10 +89,10 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
With "bison -o lang++/parser.cc", "location.hh" would now include:
|
With "bison -o lang++/parser.cc", "location.hh" would now include:
|
||||||
|
|
||||||
#ifndef YY_LANG_LOCATION_HH
|
#ifndef YY_LANG_LOCATION_HH
|
||||||
# define YY_LANG_LOCATION_HH
|
# define YY_LANG_LOCATION_HH
|
||||||
...
|
...
|
||||||
#endif // !YY_LANG_LOCATION_HH
|
#endif // !YY_LANG_LOCATION_HH
|
||||||
|
|
||||||
*** C++ locations:
|
*** C++ locations:
|
||||||
|
|
||||||
@@ -323,33 +323,33 @@ GNU Bison NEWS
|
|||||||
to use it. If, for instance, your location structure has "first"
|
to use it. If, for instance, your location structure has "first"
|
||||||
and "last" members, instead of
|
and "last" members, instead of
|
||||||
|
|
||||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||||
do \
|
do \
|
||||||
if (N) \
|
if (N) \
|
||||||
{ \
|
{ \
|
||||||
(Current).first = (Rhs)[1].location.first; \
|
(Current).first = (Rhs)[1].location.first; \
|
||||||
(Current).last = (Rhs)[N].location.last; \
|
(Current).last = (Rhs)[N].location.last; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
(Current).first = (Current).last = (Rhs)[0].location.last; \
|
(Current).first = (Current).last = (Rhs)[0].location.last; \
|
||||||
} \
|
} \
|
||||||
while (false)
|
while (false)
|
||||||
|
|
||||||
use:
|
use:
|
||||||
|
|
||||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||||
do \
|
do \
|
||||||
if (N) \
|
if (N) \
|
||||||
{ \
|
{ \
|
||||||
(Current).first = YYRHSLOC (Rhs, 1).first; \
|
(Current).first = YYRHSLOC (Rhs, 1).first; \
|
||||||
(Current).last = YYRHSLOC (Rhs, N).last; \
|
(Current).last = YYRHSLOC (Rhs, N).last; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
(Current).first = (Current).last = YYRHSLOC (Rhs, 0).last; \
|
(Current).first = (Current).last = YYRHSLOC (Rhs, 0).last; \
|
||||||
} \
|
} \
|
||||||
while (false)
|
while (false)
|
||||||
|
|
||||||
** YYLLOC_DEFAULT in C++:
|
** YYLLOC_DEFAULT in C++:
|
||||||
|
|
||||||
@@ -968,26 +968,26 @@ GNU Bison NEWS
|
|||||||
if the symbols have destructors. For instance:
|
if the symbols have destructors. For instance:
|
||||||
|
|
||||||
exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
|
exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
|
||||||
| exp "+" exp
|
| exp "+" exp
|
||||||
;
|
;
|
||||||
|
|
||||||
will trigger a warning about $$ and $5 in the first rule, and $3 in
|
will trigger a warning about $$ and $5 in the first rule, and $3 in
|
||||||
the second ($1 is copied to $$ by the default rule). This example
|
the second ($1 is copied to $$ by the default rule). This example
|
||||||
most likely contains three errors, and could be rewritten as:
|
most likely contains three errors, and could be rewritten as:
|
||||||
|
|
||||||
exp: exp "?" exp ":" exp
|
exp: exp "?" exp ":" exp
|
||||||
{ $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
|
{ $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
|
||||||
| exp "+" exp
|
| exp "+" exp
|
||||||
{ $$ = $1 ? $1 : $3; if ($1) free ($3); }
|
{ $$ = $1 ? $1 : $3; if ($1) free ($3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
However, if the original actions were really intended, memory leaks
|
However, if the original actions were really intended, memory leaks
|
||||||
and all, the warnings can be suppressed by letting Bison believe the
|
and all, the warnings can be suppressed by letting Bison believe the
|
||||||
values are used, e.g.:
|
values are used, e.g.:
|
||||||
|
|
||||||
exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
|
exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
|
||||||
| exp "+" exp { $$ = $1; (void) $3; }
|
| exp "+" exp { $$ = $1; (void) $3; }
|
||||||
;
|
;
|
||||||
|
|
||||||
If there are mid-rule actions, the warning is issued if no action
|
If there are mid-rule actions, the warning is issued if no action
|
||||||
uses it. The following triggers no warning: $1 and $3 are used.
|
uses it. The following triggers no warning: $1 and $3 are used.
|
||||||
@@ -1231,16 +1231,16 @@ GNU Bison NEWS
|
|||||||
In agreement with POSIX and with other Yaccs, leaving a default
|
In agreement with POSIX and with other Yaccs, leaving a default
|
||||||
action is valid when $$ is untyped, and $1 typed:
|
action is valid when $$ is untyped, and $1 typed:
|
||||||
|
|
||||||
untyped: ... typed;
|
untyped: ... typed;
|
||||||
|
|
||||||
but the converse remains an error:
|
but the converse remains an error:
|
||||||
|
|
||||||
typed: ... untyped;
|
typed: ... untyped;
|
||||||
|
|
||||||
** Values of mid-rule actions
|
** Values of mid-rule actions
|
||||||
The following code:
|
The following code:
|
||||||
|
|
||||||
foo: { ... } { $$ = $1; } ...
|
foo: { ... } { $$ = $1; } ...
|
||||||
|
|
||||||
was incorrectly rejected: $1 is defined in the second mid-rule
|
was incorrectly rejected: $1 is defined in the second mid-rule
|
||||||
action, and is equal to the $$ of the first mid-rule action.
|
action, and is equal to the $$ of the first mid-rule action.
|
||||||
@@ -1322,9 +1322,9 @@ GNU Bison NEWS
|
|||||||
** Incorrect "Token not used"
|
** Incorrect "Token not used"
|
||||||
On a grammar such as
|
On a grammar such as
|
||||||
|
|
||||||
%token useless useful
|
%token useless useful
|
||||||
%%
|
%%
|
||||||
exp: '0' %prec useful;
|
exp: '0' %prec useful;
|
||||||
|
|
||||||
where a token was used to set the precedence of the last rule,
|
where a token was used to set the precedence of the last rule,
|
||||||
bison reported both "useful" and "useless" as useless tokens.
|
bison reported both "useful" and "useless" as useless tokens.
|
||||||
@@ -1343,9 +1343,9 @@ GNU Bison NEWS
|
|||||||
the user symbol is used in the reports, the graphs, and the verbose
|
the user symbol is used in the reports, the graphs, and the verbose
|
||||||
error messages instead of "$end", which remains being the default.
|
error messages instead of "$end", which remains being the default.
|
||||||
For instance
|
For instance
|
||||||
%token MYEOF 0
|
%token MYEOF 0
|
||||||
or
|
or
|
||||||
%token MYEOF 0 "end of file"
|
%token MYEOF 0 "end of file"
|
||||||
|
|
||||||
** Semantic parser
|
** Semantic parser
|
||||||
This old option, which has been broken for ages, is removed.
|
This old option, which has been broken for ages, is removed.
|
||||||
@@ -1381,9 +1381,9 @@ GNU Bison NEWS
|
|||||||
Previous versions don't complain when there is a type clash on
|
Previous versions don't complain when there is a type clash on
|
||||||
the default action if the rule has a mid-rule action, such as in:
|
the default action if the rule has a mid-rule action, such as in:
|
||||||
|
|
||||||
%type <foo> bar
|
%type <foo> bar
|
||||||
%%
|
%%
|
||||||
bar: '0' {} '0';
|
bar: '0' {} '0';
|
||||||
|
|
||||||
This is fixed.
|
This is fixed.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user