diff options
author | Nicolas Despres <nicolas.despres@gmail.com> | 2012-03-14 19:33:32 (GMT) |
---|---|---|
committer | Nicolas Despres <nicolas.despres@gmail.com> | 2012-03-14 19:33:32 (GMT) |
commit | 6a09b9653e5c6698dd687c6e9deb0b51eac39dca (patch) | |
tree | 3e4debe297d6cb584ae75d2289475d554d51390d | |
parent | fdec96f54e92d2990ebf1ba5434b317d3d8ad49d (diff) | |
download | Ninja-6a09b9653e5c6698dd687c6e9deb0b51eac39dca.zip Ninja-6a09b9653e5c6698dd687c6e9deb0b51eac39dca.tar.gz Ninja-6a09b9653e5c6698dd687c6e9deb0b51eac39dca.tar.bz2 |
Depfile parser accept tilde.
-rw-r--r-- | src/depfile_parser.cc | 16 | ||||
-rw-r--r-- | src/depfile_parser.in.cc | 2 | ||||
-rw-r--r-- | src/depfile_parser_test.cc | 13 |
3 files changed, 21 insertions, 10 deletions
diff --git a/src/depfile_parser.cc b/src/depfile_parser.cc index 7219eb0..261893f 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, 0, 0, + 128, 128, 128, 0, 0, 0, 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, @@ -84,7 +84,7 @@ bool DepfileParser::Parse(string* content, string* err) { }; yych = *in; - if (yych <= '[') { + if (yych <= '\\') { if (yych <= ':') { if (yych <= 0x00) goto yy6; if (yych <= '*') goto yy8; @@ -92,20 +92,18 @@ bool DepfileParser::Parse(string* content, string* err) { } else { if (yych <= '@') goto yy8; if (yych <= 'Z') goto yy4; - goto yy8; + if (yych <= '[') goto yy8; } } else { - if (yych <= '_') { - if (yych <= '\\') goto yy2; - if (yych <= '^') goto yy8; - goto yy4; + if (yych <= '`') { + if (yych == '_') goto yy4; + goto yy8; } else { - if (yych <= '`') goto yy8; if (yych <= 'z') goto yy4; + if (yych == '~') goto yy4; 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 419ed8d..5e073df 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 883926a..ce122cf 100644 --- a/src/depfile_parser_test.cc +++ b/src/depfile_parser_test.cc @@ -119,3 +119,16 @@ TEST_F(DepfileParserTest, RejectMultipleDifferentOutputs) { string err; EXPECT_FALSE(Parse("foo bar: x y z", &err)); } + +TEST_F(DepfileParserTest, Tilde) { + string err; + EXPECT_TRUE(Parse( +"foo~.o: foo~.c", + &err)); + ASSERT_EQ("", err); + EXPECT_EQ("foo~.o", + parser_.out_.AsString()); + ASSERT_EQ(1u, parser_.ins_.size()); + EXPECT_EQ("foo~.c", + parser_.ins_[0].AsString()); +} |