For associating token numbers with token names for "yacc.c", don't use

#define statements unless `--yacc' is specified; always use enum
yytokentype.  Most important discussions start at:
<http://lists.gnu.org/archive/html/bison-patches/2005-09/msg00053.html>,
<http://lists.gnu.org/archive/html/bison-patches/2005-12/msg00052.html>,
and
<http://lists.gnu.org/archive/html/bison-patches/2006-06/msg00043.html>.
* NEWS (2.3+): Mention.
* data/c.m4 (b4_yacc_if): New.
(b4_token_enums_defines): Use b4_yacc_if to decide whether to add the
token #define's.
* doc/bison.texinfo (Bison Options): Describe the effect of `--yacc'
on token name definitions.
* src/getargs.c (usage): Capitalize `Yacc' in English.
* src/output.c (prepare): Define b4_yacc_flag.
* tests/regression.at (Early token definitions): Test that tokens names
are defined before the pre-prologue not just before the post-prologue.
Remove this test case and copy to...
(Early token definitions with --yacc): ... this to test #define's.
(Early token definitions without --yacc): ... and this to test enums.
This commit is contained in:
Joel E. Denny
2006-06-11 18:27:44 +00:00
parent 9e6e7ed2b2
commit b931235eb9
7 changed files with 88 additions and 14 deletions

View File

@@ -207,6 +207,7 @@ b4_define_flag_if([defines]) # Whether headers are requested.
b4_define_flag_if([error_verbose]) # Wheter error are verbose.
b4_define_flag_if([locations]) # Whether locations are tracked.
b4_define_flag_if([pure]) # Whether the interface is pure.
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
@@ -260,9 +261,10 @@ m4_map_sep([ b4_token_enum], [,
# b4_token_enums_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
# -------------------------------------------------------------
# Output the definition of the tokens (if there are) as enums and #defines.
# Output the definition of the tokens (if there are any) as enums and, if POSIX
# Yacc is enabled, as #defines.
m4_define([b4_token_enums_defines],
[b4_token_enums($@)b4_token_defines($@)
[b4_token_enums($@)b4_yacc_if([b4_token_defines($@)], [])
])