summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2012-06-12 22:11:22 (GMT)
committerEvan Martin <martine@danga.com>2012-06-12 22:11:22 (GMT)
commit18ea1ffd900dd81116728c8638d687ec5ca02cc0 (patch)
treed5e78f45189114e2ab4b5422c652262ddd7d5211 /src
parenta25309c029a5a8faae2d77420072d5ed9342a065 (diff)
downloadNinja-18ea1ffd900dd81116728c8638d687ec5ca02cc0.zip
Ninja-18ea1ffd900dd81116728c8638d687ec5ca02cc0.tar.gz
Ninja-18ea1ffd900dd81116728c8638d687ec5ca02cc0.tar.bz2
allow '(' and ')' in depfile paths
Fixes issue #327.
Diffstat (limited to 'src')
-rw-r--r--src/depfile_parser.cc16
-rw-r--r--src/depfile_parser.in.cc2
-rw-r--r--src/depfile_parser_test.cc11
3 files changed, 22 insertions, 7 deletions
diff --git a/src/depfile_parser.cc b/src/depfile_parser.cc
index 261893f..54b934c 100644
--- a/src/depfile_parser.cc
+++ b/src/depfile_parser.cc
@@ -54,7 +54,7 @@ bool DepfileParser::Parse(string* content, string* err) {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 128, 128, 128, 128, 128,
+ 128, 128, 0, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 0, 0, 0, 0, 0,
0, 128, 128, 128, 128, 128, 128, 128,
@@ -84,18 +84,21 @@ bool DepfileParser::Parse(string* content, string* err) {
};
yych = *in;
- if (yych <= '\\') {
- if (yych <= ':') {
+ if (yych <= '[') {
+ if (yych <= '*') {
if (yych <= 0x00) goto yy6;
- if (yych <= '*') goto yy8;
- goto yy4;
+ if (yych <= '\'') goto yy8;
+ if (yych <= ')') goto yy4;
+ goto yy8;
} else {
+ if (yych <= ':') goto yy4;
if (yych <= '@') goto yy8;
if (yych <= 'Z') goto yy4;
- if (yych <= '[') goto yy8;
+ goto yy8;
}
} else {
if (yych <= '`') {
+ if (yych <= '\\') goto yy2;
if (yych == '_') goto yy4;
goto yy8;
} else {
@@ -104,6 +107,7 @@ bool DepfileParser::Parse(string* content, string* err) {
goto yy8;
}
}
+yy2:
++in;
if ((yych = *in) <= '$') {
if (yych <= '\n') {
diff --git a/src/depfile_parser.in.cc b/src/depfile_parser.in.cc
index 5e073df..8c415b9 100644
--- a/src/depfile_parser.in.cc
+++ b/src/depfile_parser.in.cc
@@ -68,7 +68,7 @@ bool DepfileParser::Parse(string* content, string* err) {
*out++ = yych;
continue;
}
- [a-zA-Z0-9+,/_:.~-]+ {
+ [a-zA-Z0-9+,/_:.~()-]+ {
// Got a span of plain text.
int len = in - start;
// Need to shift it over if we're overwriting backslashes.
diff --git a/src/depfile_parser_test.cc b/src/depfile_parser_test.cc
index 736e591..fd76ae7 100644
--- a/src/depfile_parser_test.cc
+++ b/src/depfile_parser_test.cc
@@ -103,6 +103,17 @@ TEST_F(DepfileParserTest, Escapes) {
ASSERT_EQ(0u, parser_.ins_.size());
}
+TEST_F(DepfileParserTest, SpecialChars) {
+ string err;
+ EXPECT_TRUE(Parse(
+"C:/Program\\ Files\\ (x86)/Microsoft\\ crtdefs.h:",
+ &err));
+ ASSERT_EQ("", err);
+ EXPECT_EQ("C:/Program Files (x86)/Microsoft crtdefs.h",
+ parser_.out_.AsString());
+ ASSERT_EQ(0u, parser_.ins_.size());
+}
+
TEST_F(DepfileParserTest, UnifyMultipleOutputs) {
// check that multiple duplicate targets are properly unified
string err;