diff options
author | Nico Weber <nicolasweber@gmx.de> | 2014-05-08 00:11:37 (GMT) |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2014-05-08 00:11:37 (GMT) |
commit | 7ea137fc9a0e810f4d80ef28ea61de30ede0f730 (patch) | |
tree | 218e4837f92ecf9ef178aee726b6644d0458763e /src | |
parent | 1a465ea6c895e4984f9ea7dfea355b66cb489cca (diff) | |
parent | 2136ca304ad492189b59c0a9e747541c6ea29002 (diff) | |
download | Ninja-7ea137fc9a0e810f4d80ef28ea61de30ede0f730.zip Ninja-7ea137fc9a0e810f4d80ef28ea61de30ede0f730.tar.gz Ninja-7ea137fc9a0e810f4d80ef28ea61de30ede0f730.tar.bz2 |
Merge pull request #761 from maximuska/proposed/depfile_parser_fixes
Allow paths with '{' '}' in depfiles
Diffstat (limited to 'src')
-rw-r--r-- | src/depfile_parser.cc | 7 | ||||
-rw-r--r-- | src/depfile_parser.in.cc | 2 | ||||
-rw-r--r-- | src/depfile_parser_test.cc | 7 |
3 files changed, 10 insertions, 6 deletions
diff --git a/src/depfile_parser.cc b/src/depfile_parser.cc index d052a4b..4ca3943 100644 --- a/src/depfile_parser.cc +++ b/src/depfile_parser.cc @@ -64,7 +64,7 @@ bool DepfileParser::Parse(string* content, string* err) { 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 0, 0, 0, 128, 0, + 128, 128, 128, 128, 0, 128, 128, 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, @@ -114,11 +114,12 @@ bool DepfileParser::Parse(string* content, string* err) { if (yych != '\\') goto yy9; } } else { - if (yych <= 'z') { + if (yych <= '{') { if (yych == '`') goto yy9; goto yy5; } else { - if (yych == '~') goto yy5; + if (yych <= '|') goto yy9; + if (yych <= '~') goto yy5; goto yy9; } } diff --git a/src/depfile_parser.in.cc b/src/depfile_parser.in.cc index ba77079..b59baf0 100644 --- a/src/depfile_parser.in.cc +++ b/src/depfile_parser.in.cc @@ -73,7 +73,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 = (int)(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 581f3a2..a5f3321 100644 --- a/src/depfile_parser_test.cc +++ b/src/depfile_parser_test.cc @@ -120,16 +120,19 @@ TEST_F(DepfileParserTest, SpecialChars) { string err; EXPECT_TRUE(Parse( "C:/Program\\ Files\\ (x86)/Microsoft\\ crtdefs.h: \n" -" en@quot.header~ t+t-x!=1", +" en@quot.header~ t+t-x!=1 \n" +" openldap/slapd.d/cn=config/cn=schema/cn={0}core.ldif", &err)); ASSERT_EQ("", err); EXPECT_EQ("C:/Program Files (x86)/Microsoft crtdefs.h", parser_.out_.AsString()); - ASSERT_EQ(2u, parser_.ins_.size()); + ASSERT_EQ(3u, parser_.ins_.size()); EXPECT_EQ("en@quot.header~", parser_.ins_[0].AsString()); EXPECT_EQ("t+t-x!=1", parser_.ins_[1].AsString()); + EXPECT_EQ("openldap/slapd.d/cn=config/cn=schema/cn={0}core.ldif", + parser_.ins_[2].AsString()); } TEST_F(DepfileParserTest, UnifyMultipleOutputs) { |