X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=binutils%2Frclex.c;h=945ab8b26bf6925d6c26c7e036cf57d1355eb5e5;hb=3499769a6a6d3acb48d4d7eef5f656b22fecaeb8;hp=ef0961b61ca69297b5a6f1d695fa977524a9127b;hpb=d856f2ddfa3d037987610ecc0edbf75f31296971;p=deliverable%2Fbinutils-gdb.git diff --git a/binutils/rclex.c b/binutils/rclex.c index ef0961b61c..945ab8b26b 100644 --- a/binutils/rclex.c +++ b/binutils/rclex.c @@ -1,7 +1,6 @@ /* rclex.c -- lexer for Windows rc files parser */ -/* Copyright 1997, 1998, 1999, 2001, 2002, 2003, 2005, 2006, 2007 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2015 Free Software Foundation, Inc. Written by Kai Tietz, Onevision. @@ -9,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -22,6 +21,7 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + /* This is a lexer used by the Windows rc file parser. It basically just recognized a bunch of keywords. */ @@ -147,7 +147,7 @@ cpp_line (void) ++s; while (ISSPACE (*s)) ++s; - + /* Check for #pragma code_page ( DEFAULT | ). */ len = strlen (s); mlen = strlen ("pragma"); @@ -389,9 +389,9 @@ handle_quotes (rc_uint_type *len) } else { - rcparse_warning ("unexpected character after '\"'"); ++t; - assert (ISSPACE (*t)); + if (! ISSPACE (*t)) + rcparse_warning ("unexpected character after '\"'"); while (ISSPACE (*t)) { if ((*t) == '\n') @@ -678,7 +678,7 @@ static void rclex_string (void) { int c; - + while ((c = rclex_peekch ()) != -1) { if (c == '\n') @@ -692,6 +692,18 @@ rclex_string (void) } else if (rclex_readch () == '"') { + /* PR 6714 + Skip any whitespace after the end of the double quotes. */ + do + { + c = rclex_peekch (); + if (ISSPACE (c)) + rclex_readch (); + else + c = -1; + } + while (c != -1); + if (rclex_peekch () == '"') rclex_readch (); else @@ -769,7 +781,7 @@ yylex (void) /* Clear token. */ rclex_tok_pos = 0; rclex_tok[0] = 0; - + if ((ch = rclex_readch ()) == -1) return -1; if (ch == '\n') @@ -785,15 +797,15 @@ yylex (void) cpp_line (); ch = IGNORED_TOKEN; break; - + case '{': ch = IGNORE_CPP (BEG); break; - + case '}': ch = IGNORE_CPP (END); break; - + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': yylval.i.val = read_digit (ch); @@ -843,7 +855,11 @@ yylex (void) default: if (ISIDST (ch) || ch=='$') { - while ((ch = rclex_peekch ()) != -1 && (ISIDNUM (ch) || ch == '$' || ch == '.')) + while ((ch = rclex_peekch ()) != -1 + && (ISIDNUM (ch) || ch == '$' || ch == '.' + || ch == ':' || ch == '\\' || ch == '/' + || ch == '_' || ch == '-') + ) rclex_readch (); ch = IGNORE_CPP (rclex_translatekeyword (rclex_tok)); if (ch == STRING)