summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJoel E. Denny <joeldenny@joeldenny.org>2011-01-29 12:54:28 -0500
committerJoel E. Denny <joeldenny@joeldenny.org>2011-02-05 19:15:51 -0500
commiteb8c66bbda06f71d107e2780503f2de9ba814ddd (patch)
tree1338374d18e8ef9a33bd1dadc4fe290aedb1ca49 /doc
parent448dc38bc4a5396809f0987fd4e93488498122a4 (diff)
downloadbison-eb8c66bbda06f71d107e2780503f2de9ba814ddd.tar.gz
Do not allow identifiers that start with a dash.
This cleans up our previous fixes for a bug whereby Bison discarded `.field' in `$-1.field'. The previous fixes were less restrictive about where a dash could appear in an identifier, but the restrictions were hard to explain. That bug was reported and this final fix was originally suggested by Paul Hilfinger. This also fixes a remaining bug reported by Paul Eggert whereby Bison parses `%token ID -123' as `%token ID - 123' and handles `-' as an identifier. Now, `-' cannot be an identifier. Discussed in threads beginning at <http://lists.gnu.org/archive/html/bug-bison/2011-01/msg00000.html>, <http://lists.gnu.org/archive/html/bug-bison/2011-01/msg00004.html>. * NEWS (2.5): Update entry describing the dash extension to grammar symbol names. Also, move that entry before the named references entry because the latter mentions the former. * doc/bison.texinfo (Symbol): Update documentation for symbol names. As suggested by Paul Eggert, mention the effect of periods and dashes on named references. (Decl Summary): Update documentation for unquoted %define values, which, as a side effect, can no longer start with dashes either. * src/scan-code.l (id): Implement. * src/scan-gram.l (id): Implement. * tests/actions.at (Exotic Dollars): Extend test group to exercise bug reported by Paul Hilfinger. * tests/input.at (Symbols): Update test group, and extend to exercise bug reported by Paul Eggert. * tests/named-refs.at (Stray symbols in brackets): Update test group. ($ or @ followed by . or -): Likewise. * tests/regression.at (Invalid inputs): Likewise. (cherry picked from commit 82f3355eaf8d5988391021262dc9acfa6485c098)
Diffstat (limited to 'doc')
-rw-r--r--doc/bison.texinfo18
1 files changed, 9 insertions, 9 deletions
diff --git a/doc/bison.texinfo b/doc/bison.texinfo
index dfd3a140..eb80f00b 100644
--- a/doc/bison.texinfo
+++ b/doc/bison.texinfo
@@ -3049,12 +3049,13 @@ A @dfn{nonterminal symbol} stands for a class of syntactically
equivalent groupings. The symbol name is used in writing grammar rules.
By convention, it should be all lower case.
-Symbol names can contain letters, underscores, periods, dashes, and (not
-at the beginning) digits. Dashes in symbol names are a GNU
-extension, incompatible with POSIX Yacc. Terminal symbols
-that contain periods or dashes make little sense: since they are not
-valid symbols (in most programming languages) they are not exported as
-token names.
+Symbol names can contain letters, underscores, periods, and non-initial
+digits and dashes. Dashes in symbol names are a GNU extension, incompatible
+with POSIX Yacc. Periods and dashes make symbol names less convenient to
+use with named references, which require brackets around such names
+(@pxref{Named References}). Terminal symbols that contain periods or dashes
+make little sense: since they are not valid symbols (in most programming
+languages) they are not exported as token names.
There are three ways of writing terminal symbols in the grammar:
@@ -4959,9 +4960,8 @@ Define a variable to adjust Bison's behavior.
It is an error if a @var{variable} is defined by @code{%define} multiple
times, but see @ref{Bison Options,,-D @var{name}[=@var{value}]}.
-@var{value} must be placed in quotation marks if it contains any
-character other than a letter, underscore, period, dash, or non-initial
-digit.
+@var{value} must be placed in quotation marks if it contains any character
+other than a letter, underscore, period, or non-initial dash or digit.
Omitting @code{"@var{value}"} entirely is always equivalent to specifying
@code{""}.