bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

%define: accept unquoted values


From: Joel E. Denny
Subject: %define: accept unquoted values
Date: Fri, 28 Aug 2009 04:27:24 -0400 (EDT)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

Instead of this:

  %define lr.type "LALR"
  %define lr.type "IELR"
  %define lr.type "canonical LR"

I'd like to be able to write this:

  %define lr.type lalr
  %define lr.type ielr
  %define lr.type canonical-lr

There are two changes: (1) lr.type values are renamed so that they're 
spelled like lowercase IDs (which also look better with -D on the command 
line), and (2) quotation marks on all %define values are optional when the 
values are spelled like IDs.  I'm not sure why I didn't do this 
originally.

The following two patches implement this.  Any objections?

>From c84d40444a7cd3c7ccaa35e8e133dd214df914cd Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Fri, 28 Aug 2009 00:57:06 -0400
Subject: [PATCH] %define lr.type: make values lowercase IDs.

That is, "LALR" => "lalr", "IELR" => "ielr", and
"canonical LR" => "canonical-lr".
* NEWS (2.5): Update documentation.
* doc/bison.texinfo (Decl Summary): Likewise.
* src/ielr.c (ielr): Use new values.
* src/ielr.h (ielr): Update documentation.
* src/reader.c (prepare_percent_define_front_end_variables): Use
and validate new values.
* tests/existing.at (AT_TEST_EXISTING_GRAMMAR): Update test
grammars.
* tests/reduce.at (AT_TEST_LR_TYPE): Likewise.
---
 ChangeLog         |   15 +++++++++++++++
 NEWS              |    6 +++---
 doc/bison.texinfo |   10 +++++-----
 src/ielr.c        |    6 +++---
 src/ielr.h        |    6 +++---
 src/parse-gram.c  |    4 ++--
 src/parse-gram.h  |    2 +-
 src/reader.c      |    6 +++---
 tests/existing.at |    6 +++---
 tests/reduce.at   |   12 ++++++------
 10 files changed, 44 insertions(+), 29 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index aaeb444..465a23e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2009-08-28  Joel E. Denny  <address@hidden>
+
+       %define lr.type: make values lowercase IDs.
+       That is, "LALR" => "lalr", "IELR" => "ielr", and
+       "canonical LR" => "canonical-lr".
+       * NEWS (2.5): Update documentation.
+       * doc/bison.texinfo (Decl Summary): Likewise.
+       * src/ielr.c (ielr): Use new values.
+       * src/ielr.h (ielr): Update documentation.
+       * src/reader.c (prepare_percent_define_front_end_variables): Use
+       and validate new values.
+       * tests/existing.at (AT_TEST_EXISTING_GRAMMAR): Update test
+       grammars.
+       * tests/reduce.at (AT_TEST_LR_TYPE): Likewise.
+
 2009-08-27  Joel E. Denny  <address@hidden>
 
        tests: use perl for printing special sequences to files.
diff --git a/NEWS b/NEWS
index 7a5009c..6bfe53a 100644
--- a/NEWS
+++ b/NEWS
@@ -55,9 +55,9 @@ Bison News
   default.  You can specify the type of parser tables in the grammar
   file with these directives:
 
-    %define lr.type "LALR"
-    %define lr.type "IELR"
-    %define lr.type "canonical LR"
+    %define lr.type "lalr"
+    %define lr.type "ielr"
+    %define lr.type "canonical-lr"
 
   The default reduction optimization in the parser tables can also be
   adjusted using `%define lr.default-reductions'.  See the documentation
diff --git a/doc/bison.texinfo b/doc/bison.texinfo
index ccff9d5..6dd6037 100644
--- a/doc/bison.texinfo
+++ b/doc/bison.texinfo
@@ -5061,7 +5061,7 @@ without performing any extra reductions.
 
 @item Default Value:
 @itemize
address@hidden @code{"accepting"} if @code{lr.type} is @code{"canonical LR"}.
address@hidden @code{"accepting"} if @code{lr.type} is @code{"canonical-lr"}.
 @item @code{"all"} otherwise.
 @end itemize
 @end itemize
@@ -5126,7 +5126,7 @@ More user feedback will help to stabilize it.)
 
 @item Accepted Values:
 @itemize
address@hidden @code{"LALR"}.
address@hidden @code{"lalr"}.
 While Bison generates @acronym{LALR} parser tables by default for
 historical reasons, @acronym{IELR} or canonical @acronym{LR} is almost
 always preferable for deterministic parsers.
@@ -5155,7 +5155,7 @@ investigate such problems while ignoring the more subtle 
differences
 from @acronym{IELR} and canonical @acronym{LR}.
 @end itemize
 
address@hidden @code{"IELR"}.
address@hidden @code{"ielr"}.
 @acronym{IELR} is a minimal @acronym{LR} algorithm.
 That is, given any grammar (@acronym{LR} or address@hidden),
 @acronym{IELR} and canonical @acronym{LR} always accept exactly the same
@@ -5169,7 +5169,7 @@ grammars, the number of conflicts for @acronym{IELR} is 
often an order
 of magnitude less as well.
 This can significantly reduce the complexity of developing of a grammar.
 
address@hidden @code{"canonical LR"}.
address@hidden @code{"canonical-lr"}.
 @cindex delayed syntax errors
 @cindex syntax errors delayed
 The only advantage of canonical @acronym{LR} over @acronym{IELR} is
@@ -5185,7 +5185,7 @@ Even when canonical @acronym{LR} behavior is ultimately 
desired,
 facilitate the development of a grammar.
 @end itemize
 
address@hidden Default Value: @code{"LALR"}
address@hidden Default Value: @code{"lalr"}
 @end itemize
 
 
diff --git a/src/ielr.c b/src/ielr.c
index cdab6b8..dfe981a 100644
--- a/src/ielr.c
+++ b/src/ielr.c
@@ -1095,11 +1095,11 @@ ielr (void)
   /* Examine user options.  */
   {
     char *type = muscle_percent_define_get ("lr.type");
-    if (0 == strcmp (type, "LALR"))
+    if (0 == strcmp (type, "lalr"))
       lr_type = LR_TYPE__LALR;
-    else if (0 == strcmp (type, "IELR"))
+    else if (0 == strcmp (type, "ielr"))
       lr_type = LR_TYPE__IELR;
-    else if (0 == strcmp (type, "canonical LR"))
+    else if (0 == strcmp (type, "canonical-lr"))
       lr_type = LR_TYPE__CANONICAL_LR;
     else
       aver (false);
diff --git a/src/ielr.h b/src/ielr.h
index 27b3a44..feab49a 100644
--- a/src/ielr.h
+++ b/src/ielr.h
@@ -33,9 +33,9 @@
  *   - \c ::states is of size \c ::nstates (which might be greater than
  *     <tt>::nstates address@hidden</tt>) and defines the type of parser 
specified by
  *     the value of the \c \%define variable \c lr.type.  Its value can be:
- *     - \c "LALR".
- *     - \c "IELR".
- *     - \c "canonical LR".
+ *     - \c "lalr".
+ *     - \c "ielr".
+ *     - \c "canonical-lr".
  */
 void ielr (void);
 
diff --git a/src/reader.c b/src/reader.c
index 05fa9ee..8a292b8 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -608,9 +608,9 @@ prepare_percent_define_front_end_variables (void)
     char *lr_type;
     /* IELR would be a better default, but LALR is historically the
        default.  */
-    muscle_percent_define_default ("lr.type", "LALR");
+    muscle_percent_define_default ("lr.type", "lalr");
     lr_type = muscle_percent_define_get ("lr.type");
-    if (0 != strcmp (lr_type, "canonical LR"))
+    if (0 != strcmp (lr_type, "canonical-lr"))
       muscle_percent_define_default ("lr.default-reductions", "all");
     else
       muscle_percent_define_default ("lr.default-reductions", "accepting");
@@ -620,7 +620,7 @@ prepare_percent_define_front_end_variables (void)
   /* Check %define front-end variables.  */
   {
     static char const * const values[] = {
-      "lr.type", "LALR", "IELR", "canonical LR", NULL,
+      "lr.type", "lalr", "ielr", "canonical-lr", NULL,
       "lr.default-reductions", "all", "consistent", "accepting", NULL,
       NULL
     };
diff --git a/tests/existing.at b/tests/existing.at
index 976ab0c..5a89732 100644
--- a/tests/existing.at
+++ b/tests/existing.at
@@ -42,18 +42,18 @@ AT_CHECK([[diff -u input-lalr.output input.output \
          [[0]], [$1])])
 
 AT_TEST_TABLES_AND_PARSE([$2[: LALR(1)]], [[LALR]], [[last-state]],
-                         [[%define lr.type "LALR"
+                         [[%define lr.type "lalr"
 ]$3],
                          [$4], [$5], [$6], [$7],
                          [AT_LALR1_DIFF_CHECK([$8])$9], [$10], [$11], [$12])
 AT_TEST_TABLES_AND_PARSE([$2[: IELR(1)]], [[IELR]], [[last-state]],
-                         [[%define lr.type "IELR"
+                         [[%define lr.type "ielr"
 ]$3],
                          [$4], [$5], [$6], [$7],
                          [AT_LALR1_DIFF_CHECK([$8])$9], [$10], [$11], [$12])
 AT_TEST_TABLES_AND_PARSE([$2[: Canonical LR(1)]], [[canonical LR]],
                          [[last-state,no-xml]],
-                         [[%define lr.type "canonical LR"
+                         [[%define lr.type "canonical-lr"
 ]$3],
                          [$4], [$5], [$6], [$7],
                          [$9], [$10], [$11], [$12])
diff --git a/tests/reduce.at b/tests/reduce.at
index 0db3830..45a856a 100644
--- a/tests/reduce.at
+++ b/tests/reduce.at
@@ -375,19 +375,19 @@ m4_define([AT_TEST_LR_TYPE],
 AT_TEST_TABLES_AND_PARSE([[no %define lr.type: ]$1],
                          [[LALR]], [[]],
                          [$2], m4_shiftn(2, $@))
-AT_TEST_TABLES_AND_PARSE([[%define lr.type "LALR": ]$1],
+AT_TEST_TABLES_AND_PARSE([[%define lr.type "lalr": ]$1],
                          [[LALR]], [[]],
-                         [[%define lr.type "LALR"
+                         [[%define lr.type "lalr"
 ]$2],
                          m4_shiftn(2, $@))
-AT_TEST_TABLES_AND_PARSE([[%define lr.type "IELR": ]$1],
+AT_TEST_TABLES_AND_PARSE([[%define lr.type "ielr": ]$1],
                          [[IELR]], [[]],
-                         [[%define lr.type "IELR"
+                         [[%define lr.type "ielr"
 ]$2],
                          m4_shiftn(2, $@))
-AT_TEST_TABLES_AND_PARSE([[%define lr.type "canonical LR": ]$1],
+AT_TEST_TABLES_AND_PARSE([[%define lr.type "canonical-lr": ]$1],
                          [[canonical LR]], [[]],
-                         [[%define lr.type "canonical LR"
+                         [[%define lr.type "canonical-lr"
 ]$2],
                          m4_shiftn(2, $@))
 ])
-- 
1.5.4.3


>From 7910a93815b51bc358c64aeffe6ac28da42c64d4 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Fri, 28 Aug 2009 03:46:37 -0400
Subject: [PATCH] %define: accept unquoted values.

* NEWS (2.5): Group all %define changes together, and document
this one.  Remove quotes in IELR and canonical LR entry.
* doc/bison.texinfo: Remove quotes in most examples throughout.
(Decl Summary): Update %define documentation.
(Table of Symbols): Likewise.
* src/parse-gram.y (content.opt): Add production for ID.
---
 ChangeLog         |   10 +++
 NEWS              |   27 +++++--
 doc/bison.texinfo |   86 ++++++++++++-----------
 src/parse-gram.c  |  200 +++++++++++++++++++++++++++-------------------------
 src/parse-gram.y  |    1 +
 5 files changed, 181 insertions(+), 143 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 465a23e..0ce4e81 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2009-08-28  Joel E. Denny  <address@hidden>
 
+       %define: accept unquoted values.
+       * NEWS (2.5): Group all %define changes together, and document
+       this one.  Remove quotes in IELR and canonical LR entry.
+       * doc/bison.texinfo: Remove quotes in most examples throughout.
+       (Decl Summary): Update %define documentation.
+       (Table of Symbols): Likewise.
+       * src/parse-gram.y (content.opt): Add production for ID.
+
+2009-08-28  Joel E. Denny  <address@hidden>
+
        %define lr.type: make values lowercase IDs.
        That is, "LALR" => "lalr", "IELR" => "ielr", and
        "canonical LR" => "canonical-lr".
diff --git a/NEWS b/NEWS
index 6bfe53a..ca458c7 100644
--- a/NEWS
+++ b/NEWS
@@ -55,9 +55,9 @@ Bison News
   default.  You can specify the type of parser tables in the grammar
   file with these directives:
 
-    %define lr.type "lalr"
-    %define lr.type "ielr"
-    %define lr.type "canonical-lr"
+    %define lr.type lalr
+    %define lr.type ielr
+    %define lr.type canonical-lr
 
   The default reduction optimization in the parser tables can also be
   adjusted using `%define lr.default-reductions'.  See the documentation
@@ -68,9 +68,11 @@ Bison News
   These features are experimental.  More user feedback will help to
   stabilize them.
 
-** Multiple %define's for any variable is now an error not a warning.
+** %define improvements.
 
-** %define can now be invoked via the command line.
+*** Multiple invocations for any variable is now an error not a warning.
+
+*** Can now be invoked via the command line.
 
   Each of these command-line options
 
@@ -89,7 +91,7 @@ Bison News
   quietly override %define, but -D and --define do not.  For further
   details, see the section "Bison Options" in the Bison manual.
 
-** %define variables renamed.
+*** Variables renamed.
 
   The following %define variables
 
@@ -104,7 +106,18 @@ Bison News
   The old names are now deprecated but will be maintained indefinitely
   for backward compatibility.
 
-** Symbols names
+*** Values no longer need to be quoted in grammar file.
+
+  If a %define value is an identifier, it no longer needs to be placed
+  within quotations marks.  For example,
+
+    %define api.push-pull "push"
+
+  can be rewritten as
+
+    %define api.push-pull push
+
+** Symbol names.
 
   Consistently with directives (such as %error-verbose) and variables
   (e.g. push-pull), symbol names may include dashes in any position,
diff --git a/doc/bison.texinfo b/doc/bison.texinfo
index 6dd6037..4cc5a77 100644
--- a/doc/bison.texinfo
+++ b/doc/bison.texinfo
@@ -4588,7 +4588,7 @@ The following Bison declaration says that you want the 
parser to be a push
 parser (@pxref{Decl Summary,,%define api.push-pull}):
 
 @example
-%define api.push-pull "push"
+%define api.push-pull push
 @end example
 
 In almost all cases, you want to ensure that your push parser is also
@@ -4599,7 +4599,7 @@ what you are doing, your declarations should look like 
this:
 
 @example
 %define api.pure
-%define api.push-pull "push"
+%define api.push-pull push
 @end example
 
 There is a major notable functional difference between the pure push parser
@@ -4648,14 +4648,14 @@ for use by the next invocation of the 
@code{yypush_parse} function.
 
 Bison also supports both the push parser interface along with the pull parser
 interface in the same generated parser.  In order to get this functionality,
-you should replace the @samp{%define api.push-pull "push"} declaration with the
address@hidden api.push-pull "both"} declaration.  Doing this will create all of
+you should replace the @samp{%define api.push-pull push} declaration with the
address@hidden api.push-pull both} declaration.  Doing this will create all of
 the symbols mentioned earlier along with the two extra symbols, @code{yyparse}
 and @code{yypull_parse}.  @code{yyparse} can be used exactly as it normally
 would be used.  However, the user should note that it is implemented in the
 generated parser by calling @code{yypull_parse}.
 This makes the @code{yyparse} function that is generated with the
address@hidden api.push-pull "both"} declaration slower than the normal
address@hidden api.push-pull both} declaration slower than the normal
 @code{yyparse} function.  If the user
 calls the @code{yypull_parse} function it will parse the rest of the input
 stream.  It is possible to @code{yypush_parse} tokens to select a subgrammar
@@ -4672,8 +4672,8 @@ yypstate_delete (ps);
 @end example
 
 Adding the @samp{%define api.pure} declaration does exactly the same thing to
-the generated parser with @samp{%define api.push-pull "both"} as it did for
address@hidden api.push-pull "push"}.
+the generated parser with @samp{%define api.push-pull both} as it did for
address@hidden api.push-pull push}.
 
 @node Decl Summary
 @subsection Bison Declaration Summary
@@ -4842,6 +4842,7 @@ parse.trace}.
 @end deffn
 
 @deffn {Directive} %define @var{variable}
address@hidden {Directive} %define @var{variable} @var{value}
 @deffnx {Directive} %define @var{variable} "@var{value}"
 Define a variable to adjust Bison's behavior.
 The possible choices for @var{variable}, as well as their meanings, depend on
@@ -4851,7 +4852,11 @@ Summary,,%language}, @pxref{Decl Summary,,%skeleton}).
 It is an error if a @var{variable} is defined by @code{%define} multiple
 times, but see @ref{Bison Options,,-D @address@hidden
 
-Omitting @code{"@var{value}"} is always equivalent to specifying it as
address@hidden must be placed in quotation marks if it contains any
+character other than a letter, underscore, period, dash, or non-initial
+digit.
+
+Omitting @code{"@var{value}"} entirely is always equivalent to specifying
 @code{""}.
 
 Some @var{variable}s may be used as Booleans.
@@ -4859,12 +4864,12 @@ In this case, Bison will complain if the variable 
definition does not meet one
 of the following four conditions:
 
 @enumerate
address@hidden @code{"@var{value}"} is @code{"true"}
address@hidden @address@hidden is @code{true}
 
address@hidden @code{"@var{value}"} is omitted (or is @code{""}).
-This is equivalent to @code{"true"}.
address@hidden @address@hidden is omitted (or @code{""} is specified).
+This is equivalent to @code{true}.
 
address@hidden @code{"@var{value}"} is @code{"false"}.
address@hidden @address@hidden is @code{false}.
 
 @item @var{variable} is never defined.
 In this case, Bison selects a default value, which may depend on the selected
@@ -4940,7 +4945,7 @@ The parser namespace is @code{foo} and @code{yylex} is 
referenced as
 
 @item Accepted Values: Boolean
 
address@hidden Default Value: @code{"false"}
address@hidden Default Value: @code{false}
 @end itemize
 @c api.pure
 
@@ -4958,9 +4963,9 @@ The parser namespace is @code{foo} and @code{yylex} is 
referenced as
 (The current push parsing interface is experimental and may evolve.
 More user feedback will help to stabilize it.)
 
address@hidden Accepted Values: @code{"pull"}, @code{"push"}, @code{"both"}
address@hidden Accepted Values: @code{pull}, @code{push}, @code{both}
 
address@hidden Default Value: @code{"pull"}
address@hidden Default Value: @code{pull}
 @end itemize
 @c api.push-pull
 
@@ -5025,7 +5030,7 @@ More user feedback will help to stabilize it.)
 
 @item Accepted Values:
 @itemize
address@hidden @code{"all"}.
address@hidden @code{all}.
 For @acronym{LALR} and @acronym{IELR} parsers (@pxref{Decl
 Summary,,lr.type}) by default, all states are permitted to contain
 default reductions.
@@ -5037,7 +5042,7 @@ That is, unlike in a canonical @acronym{LR} state, the 
lookahead sets of
 reductions in an @acronym{LALR} or @acronym{IELR} state can contain
 tokens that are syntactically incorrect for some left contexts.
 
address@hidden @code{"consistent"}.
address@hidden @code{consistent}.
 @cindex consistent states
 A consistent state is a state that has only one possible action.
 If that action is a reduction, then the parser does not need to request
@@ -5049,7 +5054,7 @@ states, then a canonical @acronym{LR} parser reports a 
syntax error as
 soon as it @emph{needs} the syntactically unacceptable token from the
 scanner.
 
address@hidden @code{"accepting"}.
address@hidden @code{accepting}.
 @cindex accepting state
 By default, the only default reduction permitted in a canonical
 @acronym{LR} parser is the accept action in the accepting state, which
@@ -5061,8 +5066,8 @@ without performing any extra reductions.
 
 @item Default Value:
 @itemize
address@hidden @code{"accepting"} if @code{lr.type} is @code{"canonical-lr"}.
address@hidden @code{"all"} otherwise.
address@hidden @code{accepting} if @code{lr.type} is @code{canonical-lr}.
address@hidden @code{all} otherwise.
 @end itemize
 @end itemize
 
@@ -5083,7 +5088,7 @@ are useless in the generated parser.
 
 @item Accepted Values: Boolean
 
address@hidden Default Value: @code{"false"}
address@hidden Default Value: @code{false}
 
 @item Caveats:
 
@@ -5126,7 +5131,7 @@ More user feedback will help to stabilize it.)
 
 @item Accepted Values:
 @itemize
address@hidden @code{"lalr"}.
address@hidden @code{lalr}.
 While Bison generates @acronym{LALR} parser tables by default for
 historical reasons, @acronym{IELR} or canonical @acronym{LR} is almost
 always preferable for deterministic parsers.
@@ -5155,7 +5160,7 @@ investigate such problems while ignoring the more subtle 
differences
 from @acronym{IELR} and canonical @acronym{LR}.
 @end itemize
 
address@hidden @code{"ielr"}.
address@hidden @code{ielr}.
 @acronym{IELR} is a minimal @acronym{LR} algorithm.
 That is, given any grammar (@acronym{LR} or address@hidden),
 @acronym{IELR} and canonical @acronym{LR} always accept exactly the same
@@ -5169,7 +5174,7 @@ grammars, the number of conflicts for @acronym{IELR} is 
often an order
 of magnitude less as well.
 This can significantly reduce the complexity of developing of a grammar.
 
address@hidden @code{"canonical-lr"}.
address@hidden @code{canonical-lr}.
 @cindex delayed syntax errors
 @cindex syntax errors delayed
 The only advantage of canonical @acronym{LR} over @acronym{IELR} is
@@ -5185,7 +5190,7 @@ Even when canonical @acronym{LR} behavior is ultimately 
desired,
 facilitate the development of a grammar.
 @end itemize
 
address@hidden Default Value: @code{"lalr"}
address@hidden Default Value: @code{lalr}
 @end itemize
 
 
@@ -5226,10 +5231,10 @@ function.  @xref{Error Reporting, ,The Error Reporting 
Function
 @code{yyerror}}.
 @item Accepted Values:
 @itemize
address@hidden @code{"simple"}
address@hidden @code{simple}
 Error messages passed to @code{yyerror} are simply @address@hidden"syntax
 error"}}.
address@hidden @code{"verbose"}
address@hidden @code{verbose}
 Error messages report the unexpected token, and possibly the expected
 ones.
 @end itemize
@@ -5585,8 +5590,8 @@ exp: @dots{}    @{ @dots{}; *randomness += 1; @dots{} @}
 More user feedback will help to stabilize it.)
 
 You call the function @code{yypush_parse} to parse a single token.  This
-function is available if either the @samp{%define api.push-pull "push"} or
address@hidden api.push-pull "both"} declaration is used.
+function is available if either the @samp{%define api.push-pull push} or
address@hidden api.push-pull both} declaration is used.
 @xref{Push Decl, ,A Push Parser}.
 
 @deftypefun int yypush_parse (yypstate *yyps)
@@ -5603,7 +5608,7 @@ is required to finish parsing the grammar.
 More user feedback will help to stabilize it.)
 
 You call the function @code{yypull_parse} to parse the rest of the input
-stream.  This function is available if the @samp{%define api.push-pull "both"}
+stream.  This function is available if the @samp{%define api.push-pull both}
 declaration is used.
 @xref{Push Decl, ,A Push Parser}.
 
@@ -5619,8 +5624,8 @@ The value returned by @code{yypull_parse} is the same as 
for @code{yyparse}.
 More user feedback will help to stabilize it.)
 
 You call the function @code{yypstate_new} to create a new parser instance.
-This function is available if either the @samp{%define api.push-pull "push"} or
address@hidden api.push-pull "both"} declaration is used.
+This function is available if either the @samp{%define api.push-pull push} or
address@hidden api.push-pull both} declaration is used.
 @xref{Push Decl, ,A Push Parser}.
 
 @deftypefun yypstate *yypstate_new (void)
@@ -5638,8 +5643,8 @@ allocated.
 More user feedback will help to stabilize it.)
 
 You call the function @code{yypstate_delete} to delete a parser instance.
-function is available if either the @samp{%define api.push-pull "push"} or
address@hidden api.push-pull "both"} declaration is used.
+function is available if either the @samp{%define api.push-pull push} or
address@hidden api.push-pull both} declaration is used.
 @xref{Push Decl, ,A Push Parser}.
 
 @deftypefun void yypstate_delete (yypstate *yyps)
@@ -5913,7 +5918,7 @@ receives one argument.  For a syntax error, the string is 
normally
 @address@hidden"syntax error"}}.
 
 @findex %define parse.error
-If you invoke @samp{%define parse.error "verbose"} in the Bison
+If you invoke @samp{%define parse.error verbose} in the Bison
 declarations section (@pxref{Bison Declarations, ,The Bison Declarations
 Section}), then Bison provides a more verbose and specific error message
 string instead of just plain @address@hidden"syntax error"}}.
@@ -8837,7 +8842,7 @@ error messages.
 @comment file: calc++-parser.yy
 @example
 %define parse.trace
-%define parse.error "verbose"
+%define parse.error verbose
 @end example
 
 @noindent
@@ -9226,7 +9231,7 @@ in a file; Bison itself defines a class representing a 
@dfn{location},
 a range composed of a pair of positions (possibly spanning several
 files).  The location class is an inner class of the parser; the name
 is @code{Location} by default, and may also be renamed using
address@hidden location_type "@var{class-name}}.
address@hidden location_type "@var{class-name}"}.
 
 The location class treats the position as a completely opaque value.
 By default, the class name is @code{Position}, but this can be changed
@@ -9325,7 +9330,7 @@ Run the syntactic analysis, and return @code{true} on 
success,
 @deftypemethod {YYParser} {boolean} getErrorVerbose ()
 @deftypemethodx {YYParser} {void} setErrorVerbose (boolean @var{verbose})
 Get or set the option to produce verbose error messages.  These are only
-available with @samp{%define parse.error "verbose"}, which also turns on
+available with @samp{%define parse.error verbose}, which also turns on
 verbose error messages.
 @end deftypemethod
 
@@ -10212,6 +10217,7 @@ Precedence}.
 
 @deffn {Directive} %define @var{define-variable}
 @deffnx {Directive} %define @var{define-variable} @var{value}
address@hidden {Directive} %define @var{define-variable} "@var{value}"
 Define a variable to adjust Bison's behavior.
 @xref{Decl Summary,,%define}.
 @end deffn
@@ -10254,7 +10260,7 @@ token is reset to the token that originally caused the 
violation.
 @end deffn
 
 @deffn {Directive} %error-verbose
-An obsolete directive standing for @samp{%define parse.error "verbose"}.
+An obsolete directive standing for @samp{%define parse.error verbose}.
 @end deffn
 
 @deffn {Directive} %file-prefix "@var{prefix}"
@@ -10460,7 +10466,7 @@ An obsolete macro used in the @file{yacc.c} skeleton, 
that you define
 with @code{#define} in the prologue to request verbose, specific error
 message strings when @code{yyerror} is called.  It doesn't matter what
 definition you use for @code{YYERROR_VERBOSE}, just whether you define
-it.  Using @samp{%define parse.error "verbose"} is preferred
+it.  Using @samp{%define parse.error verbose} is preferred
 (@pxref{Error Reporting, ,The Error Reporting Function @code{yyerror}}).
 @end deffn
 
diff --git a/src/parse-gram.y b/src/parse-gram.y
index 6f9ac83..62c5659 100644
--- a/src/parse-gram.y
+++ b/src/parse-gram.y
@@ -563,6 +563,7 @@ variable:
 /* Some content or empty by default. */
 content.opt:
   /* Nothing. */   { $$ = ""; }
+| ID { $$ = $1; }
 | STRING
 ;
 
-- 
1.5.4.3





reply via email to

[Prev in Thread] Current Thread [Next in Thread]