variables: accept dashes.

* data/bison.m4 (b4_percent_define_if_define_): Also map dashes to
	underscores.
	* src/scan-gram.l ({id}): Also accept dashes after the initial
	letter.
	({directive}): Use {id}.
	* src/parse-gram.y: Comment and formatting changes.
	* doc/bison.texinfo (Symbols): Adjust the lexical definitions of
	symbols.
	* src/complain.h, src/complain.c (yacc_at): New.
	* src/symtab.c (symbol_new): Use yacc_at to report inappropriate
	symbol names.
	* src/output.c (token_definitions_output): Do not #define token
	names with dashes.
This commit is contained in:
Akim Demaille
2009-04-20 12:24:23 +02:00
parent 184e317956
commit 4f646c3794
9 changed files with 75 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
/* Symbol table manager for Bison.
Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008
Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004, 2005, 2006, 2007,
2008, 2009
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -58,6 +59,13 @@ symbol_new (uniqstr tag, location loc)
symbol *res = xmalloc (sizeof *res);
uniqstr_assert (tag);
/* If the tag is not a string (starts with a double quote), check
that it is valid for Yacc. */
if (tag[0] != '\"' && tag[0] != '\'' && strchr (tag, '-'))
yacc_at (loc, _("POSIX Yacc forbids dashes in symbol names: %s"),
tag);
res->tag = tag;
res->location = loc;