Robert Anisko [Sat, 25 Aug 2001 15:13:42 +0000 (15:13 +0000)]
* src/reader.c (reader): Remove calls to 'output_headers' and
'output_trailers'. Remove some C output.
(readgram): Disable a piece of code that was writing a default
definition for 'YYSTYPE'.
(reader_output_yylsp): Remove.
(packsymbols): Output token defintions to a macro.
(copy_definition): Disable C output.
* src/reader.c (parse_macro_decl): New function used to parse macro
declarations.
(copy_string2): Put the body of copy_string into this new function.
Add a parameter to let the caller choose whether he wants to copy the
string delimiters or not.
(copy_string): Be a simple call to copy_string2 with the last argument
bound to true.
(read_declarations): Add case for macro definition.
(copy_identifier): New.
(parse_macro_decl): Read macro identifiers using copy_identifier
rather than lex.
Robert Anisko [Sat, 25 Aug 2001 15:07:59 +0000 (15:07 +0000)]
* src/output.c (prepare): Add prefixed names.
(output_parser): Output semantic actions.
(output_parser): Fix bug on '%%line' directives.
* src/output.c (output_headers): Remove. The C code printed by this
function should now be in the skeletons.
(output_trailers): Remove.
(output): Disable call to 'reader_output_yylsp'.
(output_rule_data): Do not output tables to the table obstack.
* src/output.c: Remove some C dedicated output.
Improve the use of macro and output obstacks.
(output_defines): Remove.
* src/output.c (output_token_translations): Associate 'translate'
table with a macro. No output to the table obstack.
(output_gram): Same for 'rhs' and 'prhs'.
(output_stos): Same for 'stos'.
(output_rule_data): Same for 'r1' and 'r2'.
(token_actions): Same for 'defact'.
(goto_actions): Same for 'defgoto'.
(output_base): Same for 'pact' and 'pgoto'.
(output_table): Same for 'table'.
(output_check): Same for 'check'.
* src/output.c (output_table_data): New function.
(output_short_table): Remove.
(output_short_or_char_table): Remove.
* src/output.c (output_parser): Replace most of the skeleton copy code
with something new. Skeletons are now processed character by character
rather than line by line, and Bison looks for '%%' macros. This is the
first step in making Bison's output process (a lot) more flexible.
(output_parser): Use the macro table.
* src/output.c (output_rule_data): Do not output tables to
the table obstack.
* src/reader.c (reader): Remove calls to 'output_headers' and
'output_trailers'. Remove some C output.
(readgram): Disable a piece of code that was writing a default
definition for 'YYSTYPE'.
(reader_output_yylsp): Remove.
(packsymbols): Output token defintions to a macro.
(copy_definition): Disable C output.
* src/output.c (output_headers): Remove. The C code printed by this
function should now be in the skeletons.
(output_trailers): Remove.
(output): Disable call to 'reader_output_yylsp'.
2001-08-18 Robert Anisko <robert.anisko@epita.fr>
* src/output.c: Remove some C dedicated output.
2001-08-18 Robert Anisko <robert.anisko@epita.fr>
* src/output.c (output_defines): Remove.
2001-08-18 Robert Anisko <robert.anisko@epita.fr>
* src/output.c: Improve the use of macro and output obstacks.
2001-08-18 Robert Anisko <robert.anisko@epita.fr>
* src/output.c (output_token_translations): Associate 'translate' table
with a macro. No output to the table obstack.
(output_gram): Same for 'rhs' and 'prhs'.
(output_stos): Same for 'stos'.
(output_rule_data): Same for 'r1' and 'r2'.
(token_actions): Same for 'defact'.
(goto_actions): Same for 'defgoto'.
(output_base): Same for 'pact' and 'pgoto'.
(output_table): Same for 'table'.
(output_check): Same for 'check'.
2001-08-18 Robert Anisko <robert.anisko@epita.fr>
* src/output.c (output_table_data): New function.
(output_short_table): Remove.
(output_short_or_char_table): Remove.
2001-08-17 Robert Anisko <robert.anisko@epita.fr>
* src/main.c (main): Initialize the macro table.
2001-08-17 Robert Anisko <robert.anisko@epita.fr>
* src/output.c (output_parser): Use the macro table.
* src/macrotab.c: New file.
* src/macrotab.h: New file.
2001-08-17 Robert Anisko <robert.anisko@epita.fr>
* lib/xalloc.h (CALLOC, MALLOC, REALLOC): New macros.
2001-08-17 Robert Anisko <robert.anisko@epita.fr>
* lib/hash.c: New file.
* lib/hash.h: New file.
2001-08-16 Robert Anisko <robert.anisko@epita.fr>
* src/reader.c (parse_macro_decl): Read macro identifiers using
copy_identifier rather than lex.
2001-08-16 Robert Anisko <robert.anisko@epita.fr>
* src/reader.c (copy_identifier): New.
2001-08-16 Robert Anisko <robert.anisko@epita.fr>
* src/reader.c (read_declarations): Add case for macro definition.
* src/lex.c (percent_table): Add tok_define.
* src/lex.h: Add tok_define.
2001-08-16 Robert Anisko <robert.anisko@epita.fr>
* src/reader.c (parse_macro_decl): New function used to parse macro
declarations.
(copy_string2): Put the body of copy_string into this new function.
Add a parameter to let the caller choose whether he wants to copy the
string delimiters or not.
(copy_string): Be a simple call to copy_string2 with the last argument
bound to true.
2001-08-15 Robert Anisko <robert.anisko@epita.fr>
* src/output.c (output_parser): Replace most of the skeleton copy code
with something new. Skeletons are now processed character by character
rather than line by line, and Bison looks for '%%' macros. This is the
first step in making Bison's output process (a lot) more flexible.
Marc Autret [Tue, 14 Aug 2001 11:28:48 +0000 (11:28 +0000)]
Turn on %{source,header}_extension features.
* src/lex.c (percent_table): Un-CPP out header_extension and
source_extension.
* src/files.c (compute_exts_from_gf): Compare pointers with NULL.
(compute_exts_from_src): Remove conditions. It restores priorities
between options.
Akim Demaille [Mon, 6 Aug 2001 09:22:33 +0000 (09:22 +0000)]
Automaton VCG graph output.
Using option ``-g'' or long option ``--graph'', you can generate
a gram_filename.vcg file containing a VCG description of the LALR (1)
automaton of your grammar.
* src/main.c: Call to print_graph() function.
* src/getargs.h: Update.
* src/getargs.c (options): Update to catch `-g' and `--graph' options.
(graph_flag): New flag.
(longopts): Update.
(getargs): Add case `g'.
* src/files.c (graph_obstack): New obstack struct.
(open_files): Initialize new obstack.
(output_files): Saves graph_obstack if required.
* src/files.h (graph_obstack): New extern declaration.
* src/Makefile.am: Add new source files.
Akim Demaille [Mon, 6 Aug 2001 08:51:41 +0000 (08:51 +0000)]
Add of %source_extension and %header_extension which specify
the source or/and the header output file extension.
* src/files.c (compute_base_names): Remove initialisation of
src_extension and header_extension.
(compute_exts_from_gf): Update.
(compute_exts_from_src): Update.
(output_files): Update.
* src/reader.c (parse_header_extension_decl): New.
(parse_source_extension_decl): New.
(read_declarations): New case statements for the new tokens.
* src/lex.c (percent_table): Add entries for %source_extension
and %header_extension.
* src/lex.h (token_e): New tokens tok_hdrext and tok_srcext.
Akim Demaille [Wed, 1 Aug 2001 18:08:48 +0000 (18:08 +0000)]
* doc/bison.texinfo: Update.
* doc/bison.1 (mandoc): Update.
* src/system.h (EXT_GUARD_C, EXT_STYPE_H): Remove .c and .h.
* src/files.c: Support output files extensions computing.
(src_extension): New static variable.
(header_extension): New static variable.
(tr): New function.
(get_extension_index): New function, gets the index of an extension
filename in a string.
(compute_exts_from_gf): New function, computes extensions from the
grammar file extension.
(compute_exts_from_src): New functions, computes extensions from the
C source file extension, file given by ``-o'' option.
(compute_base_names): Update.
(output_files): Update.
* src/getargs.h (raw_flag): Remove.
* src/getargs.c: Die on `-r'/`--raw'.
* src/lex.c (parse_percent_token): Die on `%raw'.
* src/reader.c (output_token_defines): Suppress call to `raw_flag'.
* tests/calc.at: Suppress test with option `--raw'.
Akim Demaille [Fri, 16 Mar 2001 15:16:08 +0000 (15:16 +0000)]
* getargs.c (skeleton): New variable.
(longopts): --skeleton is a new option.
(shortopts, getargs): -S is a new option.
* getargs.h: Declare skeleton.
* output.c (output_parser): Use it.
Akim Demaille [Thu, 8 Feb 2001 14:51:33 +0000 (14:51 +0000)]
* src/conflicts.c (conflict_report): Be sure not to append to res
between two calls, which could happen if both first sprintf were
skipped, but not the first cp += strlen.
Akim Demaille [Thu, 8 Feb 2001 14:32:10 +0000 (14:32 +0000)]
* lib/memchr.c, lib/stpcpy.c, lib/strndup.c, lib/strnlen.c:
New, from fileutils 4.0.37.
* configure.in: Require Autoconf 2.49c. I took some time before
making this decision. This is the only way out for portability
issues in Bison, it would mean way too much duplicate effort to
import in Bison features implemented in 2.49c since 2.13.
AC_REPLACE_FUNCS and AC_CHECK_DECLS the functions above.
Akim Demaille [Fri, 19 Jan 2001 18:26:32 +0000 (18:26 +0000)]
Get rid of the ad hoc handling of token_buffer in the scanner: use
the obstacks.
* src/lex.c (token_obstack): New.
(init_lex): Initialize it. No longer call...
(grow_token_buffer): this. Remove it.
Adjust all the places which used it to use the obstack.
Akim Demaille [Fri, 19 Jan 2001 18:10:32 +0000 (18:10 +0000)]
* src/lex.h: Rename all the tokens:
s/bENDFILEb/tok_eof/g;
s/bIDENTIFIERb/tok_identifier/g;
etc.
Let them be enums, not #define, to ease debugging.
Adjust all the code.