X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/ead9e56eb214ad082ef4689afb8600d3e9d24727..2cbd078f5153288a39cbf046231a3870df8170cb:/src/parse-gram.y diff --git a/src/parse-gram.y b/src/parse-gram.y index 5dec642d..6a98d202 100644 --- a/src/parse-gram.y +++ b/src/parse-gram.y @@ -1,6 +1,6 @@ %{/* Bison Grammar Parser -*- C -*- - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA */ #include "system.h" @@ -29,6 +29,7 @@ #include "gram.h" #include "muscle_tab.h" #include "output.h" +#include "quotearg.h" #include "reader.h" #include "symlist.h" @@ -403,25 +404,23 @@ symbol: action: BRACED_CODE - { $$ = $1; } + { $$ = $1; } ; -/* A string used as an ID: we have to keep the quotes. */ +/* A string used as an ID: quote it. */ string_as_id: STRING { - $$ = symbol_get ($1, @1); + $$ = symbol_get (quotearg_style (c_quoting_style, $1), @1); symbol_class_set ($$, token_sym, @1); } ; -/* A string used for its contents. Strip the quotes. */ +/* A string used for its contents. Don't quote it. */ string_content: STRING - { - $$ = $1 + 1; - $$[strlen ($$) - 1] = '\0'; - }; + { $$ = $1; } +; epilogue.opt: @@ -480,7 +479,8 @@ add_param (char const *type, char *decl, location loc) char const *name_start = NULL; char *p; - for (p = decl; *p; p++) + /* Stop on last actual character. */ + for (p = decl; p[1]; p++) if ((p == decl || ! memchr (alphanum, p[-1], sizeof alphanum)) && memchr (alphanum, p[0], sizeof alphanum - 10)) @@ -490,7 +490,7 @@ add_param (char const *type, char *decl, location loc) the braces. */ while (*--p == ' ' || *p == '\t') continue; - *p = '\0'; + p[1] = '\0'; while (*++decl == ' ' || *decl == '\t') continue;