mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 05:13:04 +00:00
variables: accept dashes.
* 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.
(cherry picked from commit 4f646c3794)
Conflicts:
data/bison.m4
src/parse-gram.y
This commit is contained in:
committed by
Joel E. Denny
parent
379261b3fd
commit
663ce7bb3e
10
src/symtab.c
10
src/symtab.c
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user