Commit Graph

876 Commits

Author SHA1 Message Date
Akim Demaille
3f3eed2770 * data/bison.c++: Adjust to the M4 back end.
More is certainly needed.
2002-02-05 10:09:49 +00:00
Akim Demaille
be2a1a68ef Give a try to M4 as a back end.
* lib/readpipe.c: New, from wdiff.
* src/Makefile.am (DEFS): Define PKGDATADIR, not BISON_SIMPLE and
BISON_HAIRY.
* src/system.h (BISON_HAIRY, BISON_SIMPLE): Remove the DOS and VMS
specific values.  Now it is m4 that performs the lookup.
* src/parse-skel.y: Remove.
* src/muscle_tab.c, src/muscle_tab.h (muscles_m4_output): New.
* src/output.c (actions_output, guards_output)
(token_definitions_output): No longer keeps track of the output
line number, hence remove the second argument.
(guards_output): Check against the guard member of a rule, not the
action member.
Adjust callers.
(output_skeleton): Don't look for the skeleton location, let m4 do
that.
Create `/tmp/muscles.m4'.  This is temporary, a proper temporary
file will be used.
Invoke `m4' on m4sugar.m4, muscles.m4, and the skeleton.
(prepare): Given that for the time being changesyntax is not
usable in M4, rename the muscles using `-' to `_'.
Define `defines_flag', `output_parser_name' and `output_header_name'.
* src/output.h (actions_output, guards_output)
(token_definitions_output): Adjust prototypes.
* src/scan-skel.l: Instead of scanning the skeletons, it now
processes the output of m4: `__oline__' and `#output'.
* data/bison.simple: Adjust to be used by M4(sugar).
* tests/Makefile.am: Use check_SCRIPTS to make sure `bison' is up
to date.
* tests/bison.in: Use the secrete envvar `BISON_PKGDATADIR'
instead of the dead `BISON_SIMPLE' and `BISON_HAIRY'.
* data/m4sugar/m4sugar.m4, data/m4sugar/version.m4: New,
shamelessly stolen from CVS Autoconf.
2002-02-05 10:08:59 +00:00
Akim Demaille
8e86444744 Revert the previous patch. before-m4-back-end 2002-02-05 10:04:24 +00:00
Akim Demaille
beda758b1f * lib/hash.c, lib/hash.h: Replace with Fileutils 4.1's version.
* configure.in: Check for the declarations of free and malloc.
* src/muscle_tab.c: Adjust.
2002-02-05 10:00:47 +00:00
Akim Demaille
5ece6d436f * src/muscle_tab.c (muscle_init): Don't default to NULL muscle
which have no values.
2002-02-05 09:58:57 +00:00
Akim Demaille
5bb18f9a19 * src/bison.simple, src/bison.hairy, src/bison.c++: Move to...
* data/: here.
2002-02-05 09:57:52 +00:00
Paul Eggert
894dd62eb2 * src/bison.simple (YYSIZE_T): Do not define merely because
YYSTACK_USE_ALLOCA is nonzero or alloca or _ALLOCA_H are defined.
On some platforms, <alloca.h> does not declare YYSTD (size_t).
2002-01-29 13:58:06 +00:00
Paul Eggert
2992e1e967 (YYSIZE_T): Do not define merely because YYSTACK_USE_ALLOCA is nonzero
or alloca or _ALLOCA_H are defined.  On some platforms, <alloca.h>
does not declare YYSTD (size_t).
2002-01-29 13:55:32 +00:00
Akim Demaille
82841af7d0 Fix `%nonassoc and eof'.
* src/state.c (errs_dup): Aaaah!  The failure was due to bytes
which were not properly copied!  Replace
memcpy (res->errs, src->errs, src->nerrs);
with
memcpy (res->errs, src->errs, src->nerrs * sizeof (src->errs[0]));
!!!
* tests/regression.at (%nonassoc and eof): Adjust to newest
Autotest: `.' is not in the PATH.
2002-01-27 13:57:17 +00:00
Akim Demaille
318b76e913 * tests/sets.at (AT_EXTRACT_SETS): New.
(Nullable): Use it.
(Firsts): New.
2002-01-27 13:57:03 +00:00
Akim Demaille
30d2f3d50f * tests/actions.at, tests/calc.at, tests/headers.at,
* tests/torture.at: Adjust to the newest Autotest which no longer
forces `.' in the PATH.
2002-01-27 10:59:15 +00:00
Akim Demaille
30f8c3953f * tests/regression.at (%nonassoc and eof): New.
Suggested by Robert Anisko.
2002-01-25 16:24:40 +00:00
Akim Demaille
29ae55f112 Bison dumps core when trying to complain about broken input files.
Reported by Cris van Pelt.
* src/lex.c (parse_percent_token): Be sure to set token_buffer.
* tests/regression.at (Invalid input: 1, Invalid input: 2): Merge
into...
(Invalid inputs): Strengthen: exercise parse_percent_token.
2002-01-24 17:09:34 +00:00
Robert Anisko
2b548aa648 * src/Makefile.am: Add bison.c++.
* src/bison.c++: New skeleton.
2002-01-24 16:50:07 +00:00
Akim Demaille
bb0146c2a9 * po/it.po: New. 2002-01-21 19:29:04 +00:00
Akim Demaille
4518a4baae Adjust. 2002-01-21 19:27:55 +00:00
Akim Demaille
bec30531f7 * src/files.c (skeleton_find) [MSDOS]: Fix cp definition. 2002-01-21 15:50:39 +00:00
Marc Autret
fc6edc45c0 * src/files.c (compute_output_file_names): Fix 2002-01-20 15:59:34 +00:00
Marc Autret
5e5d541531 * tests/output.at: New test.
* src/files.c (compute_base_names): Don't map extensions when
the YACC flag is set, use defaults.
Reported by Evgeny Stambulchik.
2002-01-20 15:46:19 +00:00
Marc Autret
52d1aeee3d Update. 2002-01-20 14:37:39 +00:00
Marc Autret
44ea3fbdf5 * src/system.h: Need to define __attribute__ away for non-GCC
compilers as well (i.e.	the vendor C compiler).
Suggested by Albert Chin-A-Young.
2002-01-20 11:34:02 +00:00
Tim Van Holder
338963d177 * src/system.h, lib/hash.h, lib/hash.c: PARAMS fixes. 2002-01-11 15:32:06 +00:00
Tim Van Holder
e1dd105c0a * src/system.h: Use canonical definition for PARAMS (avoids clash with macro from hash.h). 2002-01-11 15:27:54 +00:00
Tim Van Holder
a10778dc32 * lib/hash.h, lib/hash.c (__P): Renamed to PARAMS; canonical definition used. 2002-01-11 15:26:56 +00:00
Akim Demaille
d9e9746c06 More thanks. 2002-01-11 13:37:39 +00:00
Akim Demaille
c57b2479ff * configure.in: Use AC_FUNC_STRNLEN. 2002-01-11 13:33:05 +00:00
Akim Demaille
b85810aec0 * src/files.c, src/files.h (output_infix): New.
(tab_extension): Remove.
(compute_base_names): Compute the former, drop the latter.
* src/output.c (prepare): Insert the muscles `output-infix', and
`output-suffix'.
* src/parse-skel.y (string, string.1): New.
(section.header): Use it.
(section.yacc): Remove.
(prefix): Remove too.
* src/scan-skel.l: Adjust.
* src/bison.simple, src/bison.hairy: Adjust.
2002-01-09 13:03:45 +00:00
Akim Demaille
cae601224e * configure.in (WERROR_CFLAGS): Compute it.
* src/Makefile.am (CFLAGS): Pass it.
* tests/atlocal.in (CFLAGS): Idem.
* src/files.c: Fix a few warnings.
(get_extension_index): Remove, unused.
2002-01-09 13:03:20 +00:00
Akim Demaille
ae40480115 * src/getargs.c (AS_FILE_NAME): New.
(getargs): Use it to convert DOSish file names.
* src/files.c (base_name): Rename as full_base_name to avoid
clashes with `base_name ()'.
(filename_split): New.
(compute_base_names): N-th rewrite, using filename_split.
2002-01-08 17:28:18 +00:00
Akim Demaille
22312b71e0 * lib/basename.c, lib/dirname.h, lib/dirname.c, lib/memrchr.c:
New, stolen from the Fileutils 4.1.
* lib/Makefile.am (libbison_a_SOURCES): Adjust.
* configure.in: Check for the presence of memrchr, and of its
prototype.
2002-01-08 17:27:46 +00:00
Tim Van Holder
a67cef01b1 * lib/hash.h (__P): Added definition for this macro.
* src/Makefile.am: Add parse-skel.c and scan-skel.c to BUILT_SOURCES, to ensure they are generated first.
* src/parse-skel.y: Use YYERROR_VERBOSE instead of %error-verbose to allow bootstrapping with bison 1.30x.
2002-01-07 23:00:39 +00:00
Akim Demaille
e9f87b5b7d Regen. 2002-01-07 08:44:08 +00:00
Akim Demaille
2b25d624f6 * src/reader.c (parse_braces): Don't fetch the next char, the
convention is to fetch on entry.
* tests/torture.at (GNU Cim Grammar): Reintroduce their weird
'switch' without a following semicolon.
* tests/regression.at (braces parsing): New.
2002-01-06 20:50:08 +00:00
Akim Demaille
3460813bdb Bison is dead wrong in its RR conflict reports.
* tests/torture.at (GNU Cim Grammar): New.
* src/conflicts.c (count_rr_conflicts): Fix.
2002-01-06 20:49:53 +00:00
Akim Demaille
73784c645d Creating package.m4 from configure.ac causes too many problems.
* tests/Makefile.am (package.m4): Create it by hand,
AC_CONFIG_TESTDIR no longer does in the most recent CVS Autoconf.
2002-01-06 20:49:40 +00:00
Akim Demaille
25d810906c * src/Makefile.am (bison_SOURCES): Add parse-skel.h and
skeleton.h.
2002-01-06 20:49:27 +00:00
Paul Eggert
a9b8959efa * doc/bison.texinfo (Debugging):
Remove YYSTDERR; it's no longer defined or used.
Also, s/cstdio.h/cstdio/.
2002-01-05 01:26:32 +00:00
Paul Eggert
e2742e46ba (Debugging): Remove YYSTDERR; it's no longer defined or used.
Also, s/cstdio.h/cstdio/.
2002-01-05 01:25:38 +00:00
Akim Demaille
1109455ce9 * src/parse-skel.y (process_skeleton): Don't bind the parser's
tracing code to --trace, wait for a better --trace option, with
args.
2002-01-03 09:56:04 +00:00
Akim Demaille
7ea5e9779b * src/bison.simple (YYSTDERR): Remove, replace `stderr'.
The ISO C++ standard is extremely clear about it: stderr is
considered a macro, not a regular symbol (see table 94 `Header
<cstdio> synopsis', [lib.c.files] 27.8.2 C Library files).
Therefore std:: does not apply to it.  It still does with fprintf.
Also, s/cstdio.h/cstdio/.
2002-01-03 09:55:49 +00:00
Akim Demaille
fab5b110fb * lib/quotearg.c: Use #include "..."' instead of #include <...>'
for non system headers.
2002-01-03 09:55:33 +00:00
Akim Demaille
aed7fd9b97 Equip the skeleton chain with location tracking, runtime trace,
pure parser and scanner.
* src/parse-skel.y: Request a pure parser, locations, and prefix
renaming.
(%union): Having several members with the same type does not help
type mismatches, simplify.
(YYPRINT, yyprint): New.
(yyerror): ``Rename'' (there is a #define yyerror skel_error) as...
(skel_error): this.
Handle locations.
* src/scan-skel.l: Adjust to these changes.
* src/skeleton.h (LOCATION_RESET, LOCATION_LINES, LOCATION_STEP)
(LOCATION_PRINT, skel_control_t): New.
2002-01-02 14:56:12 +00:00
Akim Demaille
24fad99e2b * src/parse-skel.y: Get rid of the shift/reduce conflict:
replace `gb' with BLANKS.
* src/scan-skel.l: Adjust.
2001-12-30 21:06:36 +00:00
Akim Demaille
a4b36db458 * src/system.h: We don't need nor want bcopy.
Throw away MS-DOS crap: we don't need getpid.
* configure.in: We don't need strndup.  It was even causing
problems: because Flex includes the headers *before* us,
_GNU_SOURCE is not defined by config.h, and therefore strndup was
not visible.
* lib/xstrndup.c: New.
* src/scan-skel.l: Use it.
Be sure to initialize yylval.muscle member when scanning a MUSCLE.
* src/parse-skel.y: Use %directives instead of #defines.
2001-12-30 21:06:22 +00:00
Akim Demaille
1239777d4f * src/skeleton.h: New.
* src/output.c (output_parser, output_master_parser): Remove, dead
code.
* src/output.h (get_lines_number, actions_output, guards_output)
(token_definitions_output): Prototype them.
* src/parse-skel.y: Add the license notice.
Include output.h and skeleton.h.
(process_skeleton): Returns void, and takes a single parameter.
* src/scan-skel.l: Add the license notice.
Include skeleton.h.
Don't use %option yylineno: it seems that then Flex imagines
REJECT has been used, and therefore it won't reallocate its
buffers (which makes no other sense to me than a bug).  It results
in warnings for `unused: yy_flex_realloc'.
to guess if the generated parsers should have '.tab' in their
* src/Makefile.am (bison_SOURCES): Add scan-skel.l and
2001-12-30 21:05:12 +00:00
Robert Anisko
9b3add5beb * src/muscle_tab.h (MUSCLE_INSERT_INT, MUSCLE_INSERT_STRING)
(MUSCLE_INSERT_PREFIX): ...to there.
* src/output.c (MUSCLE_INSERT_INT, MUSCLE_INSERT_STRING)
(MUSCLE_INSERT_PREFIX): Move from here...
* src/bison.hairy: Add a section directive.  Put braces around muscle
names.  This parser skeleton is still broken, but Bison should not
choke on a bad muscle 'syntax'.
* src/bison.simple: Add a section directive.  Put braces around muscle
names.
* src/files.h (strsuffix, stringappend): Add declarations.
(tab_extension): Add declaration.
(short_base_name): Add declaration.
* src/files.c (strsuffix, stringappend): No longer static.  These
functions are used in the skeleton parser.
(tab_extension): New.
(compute_base_names): Use the computations done in this function
to guess if the generated parsers should have '.tab' in their
names.
(short_base_name): No longer static.
* src/output.c (output_skeleton): New.
(output): Disable call to output_master_parser, and give a try to
a new skeleton handling system.
(guards_output, actions_output): No longer static.
(token_definitions_output, get_lines_number): No longer static.
* configure.in: Use AM_PROG_LEX and AC_PROG_YACC.
* src/Makefile.am (bison_SOURCES): Add scan-skel.l and
parse-skel.y.
* src/parse-skel.y: New file.
* src/scan-skel.l: New file.
2001-12-30 15:01:06 +00:00
Akim Demaille
3cd5bcdd19 Regen. 2001-12-29 14:46:03 +00:00
Akim Demaille
b5b61c616b %name-prefix is broken.
* src/files.c (spec_name_prefix): Initialize to NULL, not to "yy".
Adjust all dependencies.
* tests/headers.at (export YYLTYPE): Strengthen this test: use
%name-prefix.
Renaming yylval but not yylloc is not consistent.  Now we do.
* src/bison.simple: Prefix yylloc if used.
* doc/bison.texinfo (Decl Summary): Document that.
2001-12-29 14:27:45 +00:00
Akim Demaille
8c9a50bee1 * doc/bison.texinfo: Promote `%long-directive' over
`%long_directive'.
Remove all references to fixed-output-files, yacc is enough.
2001-12-29 14:27:20 +00:00
Akim Demaille
d99361e657 * src/bison.simple: Define YYDEBUG and YYERROR_VERBOSE *after* the
user prologue.  These are defaults.
* tests/actions.at (Mid-rule actions): Make sure the user can
define YYDEBUG and YYERROR_VERBOSE.
2001-12-29 14:27:01 +00:00