Commit Graph

3469 Commits

Author SHA1 Message Date
Joel E. Denny
9ce405ce1d Simplify last patch slightly.
* src/getargs.c (getargs): Here.
2008-11-17 10:51:17 -05:00
Joel E. Denny
a8beef7e6a Fix last warning from --enable-gcc-warnings.
* src/getargs.c (getargs): Don't assign const address to non-const
pointer.
2008-11-17 10:36:28 -05:00
Joel E. Denny
d50eea6df5 Don't let maintainer-*-check targets force a version update.
* cfg.mk (_is-dist-target): Implement.  maintainer-check* was already
handled.
2008-11-17 09:50:11 -05:00
Di-an Jan
f5f419debe Fix formatting and content of bison.texinfo menus
* doc/bison.texinfo: Synchronize ``Detail Node Listing''.
Align menus.  Adjust word wrapping.  Use node names for menu names.
(Examples): Don't abbreviate node names.
(LocalWords): Remove abbreviations.
(Copying): Make description a sentence.
(Java Action Features): Remove period to match the rest of menu.
2008-11-17 11:08:26 +01:00
Di-an Jan
d73e55e022 Handles several --enable-gcc-warnings.
* src/getargs.c (command_line_location): Set parameters to void.
* src/output.c (symbol_type_name_cmp): Make static.
(symbols_by_type_name): Set parameters to void.
(symbol_definitions_output): Remove unused parameter.  Rename as...
(prepare_symbol_definitions): this.
(muscles_output): Move symbol_definitions_output to...
(output): here as prepare_symbol_definitions.
* tests/c++.at (AT_CHECK_VARIANTS): Remove unused parameters of main.
(AT_CHECK_NAMESPACE): Make unused parameter lloc unnamed.
2008-11-17 11:01:41 +01:00
Di-an Jan
68c989dea9 Use AT_DATA_GRAMMAR for C++ variants compiled tests.
* tests/c++.at (AT_CHECK_VARIANTS): Fixes tests 198-202.
Use AT_DATA_GRAMMAR instead of AT_DATA for compiled tests.
2008-11-17 11:00:07 +01:00
Akim Demaille
90290ce5dd Fix ChangeLog. 2008-11-16 19:52:33 +01:00
Akim Demaille
23ce6f4cb3 Add missing $(EXEEXT).
* doc/local.mk ($(CROSS_OPTIONS_TEXI)): The target is
	"src/bison$(EXEEXT)".
	Reported by Di-an Jan.
2008-11-16 19:49:35 +01:00
Akim Demaille
c5fc95d688 Update ignores.
* data/.cvsignore, data/.gitignore, examples/.cvsignore,
	* examples/.gitignore:
	Remove.
	* build-aux/.cvsignore, build-aux/.gitignore, doc/.cvsignore,
	* doc/.gitignore, etc/.cvsignore, etc/.gitignore, src/.cvsignore,
	* src/.gitignore, tests/.cvsignore, tests/.gitignore:
	Remove MAkefile and Makefile.in.
2008-11-16 19:46:16 +01:00
Akim Demaille
dd704c3561 Update TODO.
* TODO: Update.
2008-11-15 15:03:31 +01:00
Akim Demaille
dab244d548 Formatting changes.
* tests/input.at: here.
2008-11-15 14:47:02 +01:00
Akim Demaille
4b4da9fb83 Remove duplicate header inclusion.
* src/LR0.c: here.
2008-11-15 14:43:39 +01:00
Akim Demaille
4ea3f53d26 Regen.
* src/parse-gram.h, src/parse-gram.c: Regen.
2008-11-15 14:42:37 +01:00
Akim Demaille
b06df3c2c7 Fixes. 2008-11-15 14:41:58 +01:00
Akim Demaille
cb823b6f0c Support parametric types.
There are two issues to handle: first scanning nested angle bracket pairs
to support types such as std::pair< std::string, std::list<std::string> > >.

Another issue is to address idiosyncracies of C++: do not glue two closing
angle brackets together (otherwise it's operator>>), and avoid sticking
blindly a TYPE to the opening <, as it can result in '<:' which is a
digraph for '['.

	* src/scan-gram.l (brace_level): Rename as...
	(nesting): this.
	(SC_TAG): New.
	Implement support for complex tags.
	(tag): Accept \n, but not <.
	* data/lalr1.cc (b4_symbol_value, b4_symbol_value_template)
	(b4_symbol_variant): Leave space around types as parameters.
	* examples/variant.yy: Use nested template types and leading ::.
	* src/parse-gram.y (TYPE, TYPE_TAG_ANY, TYPE_TAG_NONE, type.opt):
	Rename as...
	(TAG, TAG_ANY, TAG_NONE, tag.opt): these.
	* tests/c++.at: Test parametric types.
2008-11-15 14:30:05 +01:00
Akim Demaille
7b6e67533e Test token.prefix.
This is not sufficient, but we test at least that the make_SYMBOL
interface is not affected by token.prefix.  A more general test
will be implemented when the support of token.prefix is generalized
to more skeletons.

	* tests/c++.at: One more variant test, using token.prefix.
2008-11-15 14:26:46 +01:00
Akim Demaille
dddec53788 Test the make_TOKEN interface.
* tests/c++.at (AT_CHECK_VARIANTS): Require and use locations.
	Factor the common code in yylex.
	Use it to test "%define lex_symbol".
2008-11-15 14:23:27 +01:00
Akim Demaille
7d3e21ba7b Formatting change. 2008-11-15 14:20:28 +01:00
Akim Demaille
4fc55348e5 Simplify code for variants bench marks.
* etc/bench.pl.in (&generate_grammar_list): Define and use
	location_type.
	Factor the common code in yylex.
2008-11-15 14:17:15 +01:00
Akim Demaille
070e650956 Better error message.
* bootstrap (find_tool): Fix the error message.
2008-11-15 11:33:00 +01:00
Akim Demaille
0078681b6b Update variant.yy to newest interface.
* examples/variant.yy: Define lex_symbol.
	Adjust.
2008-11-15 11:29:57 +01:00
Akim Demaille
ff084799a3 Don't use locations in variant.yy.
* examples/variant.yy: Adjust to not using locations.
2008-11-15 11:26:58 +01:00
Akim Demaille
b0d79ec65d Comment changes.
* data/local.mk, etc/local.mk, examples/local.mk: Use Automake
	comments for the license.
2008-11-15 11:23:53 +01:00
Akim Demaille
d4977ce3e7 Remove tests/Makefile.am.
* tests/Makefile.am: Rename as...
	* tests/local.mk: this.
	* Makefile.am, configure.ac: Adjust.
	* Makefile.am (DISTCLEANFILES): Define.
	(maintainer-check, maintainer-xml-check, maintainer-push-check):
	Remove, we no longer need to bounce to the real targets.
2008-11-15 11:20:20 +01:00
Akim Demaille
87f1149ae2 Comment changes. 2008-11-15 11:17:14 +01:00
Akim Demaille
3641590697 djgpp/local.mk.
* Makefile.am (EXTRA_DIST): Move djgpp related part to...
	* djgpp/local.mk: this new file.
2008-11-15 11:13:57 +01:00
Akim Demaille
e2c2f69650 Remove doc/Makefile.am.
* doc/Makefile.am: Rename as...
	* doc/local.mk: this.
	Adjust paths
	* Makefile.am, configure.ac: Adjust.
	* Makefile.am (MOSTLYCLEANFILES): New.
	* src/local.mk: Adjust.
2008-11-15 11:10:03 +01:00
Akim Demaille
2ead32e61c Move sc_tight_scope into maint.mk.
It does not work, and I don't know how it was supposed to work: it seems
to be looking for sources in the build tree.  I just moved it at a better
place, fixing it is still required.

	* src/local.mk (echo): Remove.
	(sc_tight_scope): Move to...
	* maint.mk: here.
2008-11-15 11:06:45 +01:00
Akim Demaille
2df9ec3774 Regen.
* src/parse-gram.h, src/parse-gram.c: Regen.
2008-11-15 11:05:29 +01:00
Akim Demaille
0305d25eb0 Remove src/Makefile.am.
* src/Makefile.am: Rename as...
	* src/local.mk: this.
	Prefix all the paths with src/.
	(AUTOMAKE_OPTIONS): Build object files in the sub dirs.
	(AM_CPPFLAGS): Find find in builddir/src.
	(YACC): Move the flags into...
	(AM_YFLAGS): here.
	* maint.mk (sc_tight_scope): Disable.
	It used to bounce to the version in src/Makefile.am which is now
	part of this very Makefile.
	* Makefile.am, configure.ac: Adjust.
	* src/scan-code-c.c, src/scan-code.l: We can no longer rely on
	include "..." to find files "here": we are no longer in src/, so
	qualify the includes with src/.
	* doc/Makefile.am (PREPATH): No longer include the top_builddir
	prefix.
	(.x.1): Adjust to be able to create src/foo from the top level
	Makefile, instead of going bounce to src/Makefile the creation of
	foo.
2008-11-15 10:47:15 +01:00
Akim Demaille
5277c0a304 Remove useless variable.
* doc/Makefile.am (srcsrcdir): Remove.
2008-11-15 10:44:06 +01:00
Akim Demaille
6a5aa0cdbb Remove data/Makefile.am.
* data/Makefile.am: Rename as...
	* data/local.mk: this.
	Adjust paths.
	* Makefile.am, configure.ac: Adjust.
2008-11-15 10:39:38 +01:00
Akim Demaille
7cb794dcdd Remove etc/Makefile.am.
* etc/Makefile.am: Rename as...
	* etc/local.mk: this.
	Adjust.
	* Makefile.am, configure.ac: Adjust.
2008-11-15 10:34:53 +01:00
Akim Demaille
cd409e3b50 Remove examples/local.mk.
examples/calc++/Makefile.am might be interesting to keep as is, since
it is an example in itself.

	* examples/Makefile.am: Rename as...
	* examples/local.mk: this.
	Adjust.
	* Makefile.am, configure.ac: Adjust.
2008-11-15 10:31:05 +01:00
Akim Demaille
9a1e42148a Remove build-aux/Makefile.am.
Recursive Makefiles are really way too slow, let's get rid of some of
them.

	* build-aux/Makefile.am: Rename as...
	* build-aux/local.mk: this.
	Adjust paths.
	* Makefile.am, configure.ac: Adjust.
2008-11-15 10:27:05 +01:00
Akim Demaille
0634493cdd Provide convenience constructors for locations and positions.
* data/location.cc (position::position): Accept file, line and
	column as arguments with default values.
	Always qualify initial line and column literals as unsigned.
	(location::location): Provide convenience constructors.
2008-11-15 10:23:51 +01:00
Akim Demaille
fe1b448ada Instead of using make_symbol<TOK_FOO>, generate make_FOO for each token type.
Using template buys us nothing, and makes it uselessly complex to
construct a symbol.  Besides, it could not be generalized to other
languages, while make_FOO would work in C/Java etc.

	* data/lalr1.cc (b4_symbol_): New.
	(b4_symbol): Use it.
	(b4_symbol_constructor_declaration_)
	(b4_symbol_constructor_definition_): Instead of generating
	specializations of an overloaded template function, just generate
	several functions whose names are forged from the token names
	without the token.prefix.
	(b4_symbol_constructor_declarations): Generate them for all the
	symbols, not just by class of symbol type, now that instead of
	specializing a function template by the token, we generate a
	function named after the token.
	(b4_symbol_constructor_specialization_)
	(b4_symbol_constructor_specializations): Remove.
	* etc/bench.pl.in: Adjust to this new API.
2008-11-15 10:20:02 +01:00
Akim Demaille
5679f31101 %define token.prefix.
Provide a means to add a prefix to the name of the tokens as output in the
generated files.  Because of name clashes, it is good to have such a
prefix such as TOK_ that protects from names such as EOF, FILE etc.
But it clutters the grammar itself.

	* data/bison.m4 (token.prefix): Empty by default.
	* data/c.m4 (b4_token_enum, b4_token_define): Use it.
	* data/lalr1.cc (b4_symbol): Ditto.
2008-11-13 07:08:24 +01:00
Akim Demaille
3204049e31 Compute at M4 time some of the subtractions.
* data/lalr1.cc (b4_substract): New.
	(b4_rhs_data): Use it.
2008-11-13 07:04:47 +01:00
Akim Demaille
202598d3ab symbol::token.
This is allows the user to get the type of a token return by
yylex.

	* data/lalr1.cc (symbol::token): New.
	(yytoknum_): Define when %define lex_symbol, independently of
	%debug.
	(yytoken_number_): Move into...
	(symbol::token): here, since that's the only use.
	The other one is YYPRINT which was not officially supported
	by lalr1.cc, and anyway it did not work since YYPRINT uses this
	array under a different name (yytoknum).
2008-11-13 07:01:41 +01:00
Akim Demaille
fc2476c7cd YYERRCODE.
* TODO (YYERRCODE): Mention the case of $undef.
2008-11-13 06:58:34 +01:00
Akim Demaille
865f1e9f85 TODO: YYPRINT.
* TODO (YYPRINT): New.
2008-11-13 06:55:23 +01:00
Akim Demaille
cb0b136a63 Comment changes.
* data/lalr1.cc, data/yacc.c: Fix the description of the
	yytranslate and yytoknum tables.
2008-11-13 06:52:05 +01:00
Akim Demaille
2c086d2959 Define make_symbol in the header.
To reach good performances these functions should be inlined (yet this is
to measure precisely).  To this end they must be available to the caller.

	* data/lalr1.cc (b4_symbol_constructor_definition_): Qualify
	location_type with the class name.
	Since will now be output in the header, declare "inline".
	No longer use b4_symbol_constructor_specializations, but
	b4_symbol_constructor_definitions in the header.
	Don't call it in the *.cc file.
2008-11-13 06:48:22 +01:00
Akim Demaille
1c4af3813e Define yytranslate in the header for lex_symbol.
* data/lalr1.cc: Move the invocation of b4_yytranslate_definition
	into the header file when using %define lex_symbol.
	(yytranslate_): Declare inline.
2008-11-13 06:44:50 +01:00
Akim Demaille
e51b0a82be Define the constructors of symbol_type in b4_symbol_constructor_definitions.
The constructors are called by the make_symbol functions, which a
forthcoming patch will move elsewhere.  Hence the interest of putting them
together.

The stack_symbol_type does not need to be moved, it is used only by the
parser.

	* data/lalr1.cc: Move symbol_type and symbol_base_type
	constructors into...
	(b4_symbol_constructor_definitions): here.
	Adjust.
2008-11-13 06:41:42 +01:00
Akim Demaille
788355718f Make it easier to move the definition of yytranslate_.
Forthcoming changes will make it possible to use yytranslate_
from outside the parser implementation file.

	* data/lalr1.cc (b4_yytranslate_definition): New.
	Use it.
2008-11-13 06:36:51 +01:00
Akim Demaille
c1e6c88ca3 Remove useless class specification.
* data/lalr1.cc (b4_symbol_constructor_specialization_): No need
	to refer to the class name to use a type defined by the class for
	arguments of member functions.
2008-11-13 06:33:51 +01:00
Akim Demaille
4654b0c0a8 Finer input type for yytranslate.
This patch is debatable: the tradition expects yylex to return an int
which happens to correspond to token_number (which is an enum).  This
allows for instance to return characters (such as '*' etc.).  But this
goes against the stronger typing I am trying to have with the new
lex interface which return a symbol_type.  So in this case, feed
yytranslate_ with a token_type.

	* data/lalr1.cc (yytranslate_): When in %define lex-symbol,
	expect a token_type.
2008-11-13 06:30:35 +01:00
Akim Demaille
dd735e4ee6 Honor lex-params in %define lex_symbol mode.
* data/lalr1.cc: Use b4_lex_param.
2008-11-13 06:27:15 +01:00