summaryrefslogtreecommitdiff
path: root/src/files.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-12-19 00:34:37 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2006-12-19 00:34:37 +0000
commit0e021770cc023c6a2e7ae132a3aab55bc7cbc058 (patch)
treef5ee020ca25db381b651a31316924056f837d75a /src/files.c
parentdb06f0ce72e6a871d57d9e3f0d6c510728fe3e21 (diff)
downloadbison-0e021770cc023c6a2e7ae132a3aab55bc7cbc058.tar.gz
* 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>
Diffstat (limited to 'src/files.c')
-rw-r--r--src/files.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/files.c b/src/files.c
index eaa97c6b..d90c4664 100644
--- a/src/files.c
+++ b/src/files.c
@@ -153,12 +153,20 @@ tr (char *s, char from, char to)
static void
compute_exts_from_gf (const char *ext)
{
- src_extension = xstrdup (ext);
- header_extension = xstrdup (ext);
- tr (src_extension, 'y', 'c');
- tr (src_extension, 'Y', 'C');
- tr (header_extension, 'y', 'h');
- tr (header_extension, 'Y', 'H');
+ if (strcmp (ext, ".y") == 0)
+ {
+ src_extension = xstrdup (language->src_extension);
+ header_extension = xstrdup (language->header_extension);
+ }
+ else
+ {
+ src_extension = xstrdup (ext);
+ header_extension = xstrdup (ext);
+ tr (src_extension, 'y', 'c');
+ tr (src_extension, 'Y', 'C');
+ tr (header_extension, 'y', 'h');
+ tr (header_extension, 'Y', 'H');
+ }
}
/* Compute extensions from the given c source file extension. */
@@ -281,7 +289,10 @@ compute_file_name_parts (void)
xstrndup (base, (strlen (base) - (ext ? strlen (ext) : 0)));
}
- all_but_ext = concat2 (all_but_tab_ext, TAB_EXT);
+ if (language->add_tab)
+ all_but_ext = concat2 (all_but_tab_ext, TAB_EXT);
+ else
+ all_but_ext = xstrdup (all_but_tab_ext);
/* Compute the extensions from the grammar file name. */
if (ext && !yacc_flag)