mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
* src/getargs.c (skeleton_arg): Last arg is now location const *.
Rewrite to simplify the logic. (language_argmatch): Likewise. * doc/bison.texinfo (Decl Summary, Bison Options): Don't claim Java is supported. * src/complain.c (program_name): Remove decl; no longer needed. * src/main.c (program_name): Remove; now belongs to getargs. 2006-12-18 Paolo Bonzini <bonzini@gnu.org> * NEWS: Document %language. * data/Makefile.am (dist_pkgdata_DATA): Add c-skel.m4, c++-skel.m4. * data/c-skel.m4, data/c++-skel.m4: New files. * data/glr.c: Complain on push parsers. * doc/bison.texinfo (C++ Parser Interface): Prefer %language over %skeleton. (Directives): Document %language and %skeleton. (Command line): Document -L. * examples/extexi: Rewrite %require directive. * examples/calc++/Makefile.am: Pass VERSION to extexi. * src/files.c (compute_exts_from_gc): Look in language structure for .y extension. (compute_file_name_parts): Check whether .tab should be added. * src/getargs.c (valid_languages, skeleton_prio, language_prio): (language, skeleton_arg, language_argmatch): New. (long_options): Add --language. (getargs): Use skeleton_arg, add -L/--language. * src/getargs.h: Include location.h. (struct bison_language, language, skeleton_arg, language_argmatch): New. * src/output.c (prepare): Pick default skeleton from struct language. Don't dispatch C skeletons here. * src/parse-gram.y (PERCENT_LANGUAGE): New. (prologue_declaration): Add "%language" rule, use skeleton_arg. * src/scan-gram.l ("%language"): New rule. * tests/calc.at: Test %skeleton and %language. * tests/local.at (AT_SKEL_CC_IF): Look for %language. (AT_GLR_IF): Look for %skeleton "glr.cc". (AT_LALR1_CC_IF, AT_GLR_CC_IF): Rewrite. (AT_YACC_IF): Reject %language. 2006-12-18 Paul Eggert <eggert@cs.ucla.edu>
This commit is contained in:
@@ -628,12 +628,15 @@ AT_CHECK_CALC_GLR([%pure-parser %error-verbose %debug %locations %defines %name-
|
||||
|
||||
AT_BANNER([[Simple LALR(1) C++ Calculator.]])
|
||||
|
||||
# First let's try using %skeleton
|
||||
AT_CHECK_CALC([%skeleton "lalr1.cc" %defines %locations])
|
||||
|
||||
# AT_CHECK_CALC_LALR1_CC([BISON-OPTIONS])
|
||||
# ---------------------------------------
|
||||
# Start a testing chunk which compiles `calc' grammar with
|
||||
# the C++ skeleton, and performs several tests over the parser.
|
||||
m4_define([AT_CHECK_CALC_LALR1_CC],
|
||||
[AT_CHECK_CALC([%skeleton "lalr1.cc" %defines %locations] $@)])
|
||||
[AT_CHECK_CALC([%language "C++" %defines %locations] $@)])
|
||||
|
||||
AT_CHECK_CALC_LALR1_CC([])
|
||||
AT_CHECK_CALC_LALR1_CC([%error-verbose %name-prefix "calc" %verbose %yacc])
|
||||
@@ -652,12 +655,15 @@ AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %
|
||||
|
||||
AT_BANNER([[Simple GLR C++ Calculator.]])
|
||||
|
||||
# Again, we try also using %skeleton.
|
||||
AT_CHECK_CALC([%skeleton "glr.cc" %defines %locations])
|
||||
|
||||
# AT_CHECK_CALC_GLR_CC([BISON-OPTIONS])
|
||||
# -------------------------------------
|
||||
# Start a testing chunk which compiles `calc' grammar with
|
||||
# the GLR C++ skeleton, and performs several tests over the parser.
|
||||
m4_define([AT_CHECK_CALC_GLR_CC],
|
||||
[AT_CHECK_CALC([%skeleton "glr.cc" %defines %locations] $@)])
|
||||
[AT_CHECK_CALC([%language "C++" %glr-parser %defines %locations] $@)])
|
||||
|
||||
AT_CHECK_CALC_GLR_CC([])
|
||||
AT_CHECK_CALC_GLR_CC([%error-verbose %name-prefix "calc" %verbose %yacc])
|
||||
|
||||
@@ -41,17 +41,17 @@ m4_define([AT_BISON_OPTION_PUSHDEFS],
|
||||
m4_define([_AT_BISON_OPTION_PUSHDEFS],
|
||||
[m4_if([$1$2], $[1]$[2], [],
|
||||
[m4_fatal([$0: Invalid arguments: $@])])dnl
|
||||
m4_pushdef([AT_LALR1_CC_IF],
|
||||
[m4_bmatch([$3], ["lalr1.cc"], [$1], [$2])])
|
||||
m4_pushdef([AT_GLR_CC_IF],
|
||||
[m4_bmatch([$3], ["glr.cc"], [$1], [$2])])
|
||||
m4_pushdef([AT_SKEL_CC_IF],
|
||||
[m4_bmatch([$3], ["\(glr\|lalr1\).cc"], [$1], [$2])])
|
||||
[m4_bmatch([$3], [%language "[Cc]\+\+"\|%skeleton "[a-z0-9]+\.cc"], [$1], [$2])])
|
||||
m4_pushdef([AT_GLR_IF],
|
||||
[m4_bmatch([$3], [%glr-parser], [$1], [$2])])
|
||||
[m4_bmatch([$3], [%glr-parser\|%skeleton "glr\.], [$1], [$2])])
|
||||
m4_pushdef([AT_LALR1_CC_IF],
|
||||
[AT_SKEL_CC_IF([AT_GLR_IF([$2], [$1])], [$2])])
|
||||
m4_pushdef([AT_GLR_CC_IF],
|
||||
[AT_SKEL_CC_IF([AT_GLR_IF([$1], [$2])], [$2])])
|
||||
# Using yacc.c?
|
||||
m4_pushdef([AT_YACC_IF],
|
||||
[m4_bmatch([$3], [%glr-parser\|%skeleton], [$2], [$1])])
|
||||
[m4_bmatch([$3], [%language\|%glr-parser\|%skeleton], [$2], [$1])])
|
||||
m4_pushdef([AT_PARAM_IF],
|
||||
[m4_bmatch([$3], [%parse-param], [$1], [$2])])
|
||||
m4_pushdef([AT_LOCATION_IF],
|
||||
|
||||
Reference in New Issue
Block a user