X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/39fb7e623967922da2fc0a6908dc94ed6e9f4488..20cc714980c65f0035ae8dc60a562d6f86530af1:/src/scan-gram.l diff --git a/src/scan-gram.l b/src/scan-gram.l index 9aec298e..2f264f5f 100644 --- a/src/scan-gram.l +++ b/src/scan-gram.l @@ -1,7 +1,6 @@ /* Bison Grammar Scanner -*- C -*- - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free - Software Foundation, Inc. + Copyright (C) 2002-2011 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -104,8 +103,8 @@ static void unexpected_newline (boundary, char const *); /* Bracketed identifiers support. */ %x SC_BRACKETED_ID SC_RETURN_BRACKETED_ID -letter [-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_] -id {letter}({letter}|[0-9])* +letter [.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_] +id {letter}({letter}|[-0-9])* directive %{id} int [0-9]+ @@ -560,12 +559,9 @@ splice (\\[ \f\t\v]*\n)* } \\(.|\n) { char const *p = yytext + 1; - char quoted_ws[] = "` '"; - if (isspace (*p) && isprint (*p)) - { - quoted_ws[1] = *p; - p = quoted_ws; - } + /* Quote only if escaping won't make the character visible. */ + if (isspace ((unsigned char) *p) && isprint ((unsigned char) *p)) + p = quote (p); else p = quotearg_style_mem (escape_quoting_style, p, 1); complain_at (*loc, _("invalid character after \\-escape: %s"), p);