doc: promote YYEOF

* NEWS (Deep overhaul of the symbol and token kinds): New.
* doc/bison.texi: Promote YYEOF over "0" in scanners.
(Token Decl): No longer show YYEOF here, it now works by default.
(Token I18n): More details about YYEOF here.
(Calc++): Just use YYEOF.
This commit is contained in:
Akim Demaille
2020-04-13 09:32:54 +02:00
parent 71e3f6d4da
commit dc1035bada
2 changed files with 56 additions and 38 deletions

35
NEWS
View File

@@ -74,7 +74,6 @@ GNU Bison NEWS
%token
PLUS "+"
MINUS "-"
EOF 0 _("end of file")
<double>
NUM _("double precision number")
<symrec*>
@@ -83,7 +82,7 @@ GNU Bison NEWS
In that case the user must define _() and N_(), and yysymbol_name returns
the translated symbol (i.e., it returns '_("variable")' rather that
'"variable"').
'"variable"'). In Java, the user must provide an i18n() function.
*** List of expected tokens (yacc.c)
@@ -95,6 +94,38 @@ GNU Bison NEWS
It makes little sense to use this feature without enabling LAC (lookahead
correction).
*** Deep overhaul of the symbol and token kinds
To avoid the confusion with typing in programming languages, we now refer
to token and symbol "kinds" instead of token and symbol "types".
**** Token kind
The "token kind" is what is returned by the scanner, e.g., PLUS, NUMBER,
LPAREN, etc. Users are invited to replace their uses of "enum
yytokentype" by "yytoken_kind_t".
This type now also includes tokens that were proviously hidden: YYEOF (end
of input), YYUNDEF (undefined token), and YYERRCODE (error token). They
now have string aliases, internationalized if internationalization is
enabled. Therefore, by default, error messages now refer to "end of file"
(internationalized) rather than the cryptic "$end".
In most case, it is now useless to define the end-of-line token as
follows:
%token EOF 0 _("end of file")
Rather simply use "YYEOF" in your scanner.
**** Symbol kinds
The "symbol kinds" is what the parser actually uses. (Unless the
api.token.raw %define variable was used, the internal symbol kind of a
terminal differs from the corresponding token kind.)
They are now exposed as a enum, "yysymbol_kind_t".
*** Modernize display of explanatory statements in diagnostics
Since Bison 2.7, output was indented four spaces for explanatory