diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/depfile_parser.cc | 36 | ||||
-rw-r--r-- | src/depfile_parser.in.cc | 2 | ||||
-rw-r--r-- | src/depfile_parser_test.cc | 9 |
3 files changed, 30 insertions, 17 deletions
diff --git a/src/depfile_parser.cc b/src/depfile_parser.cc index 54b934c..03dad92 100644 --- a/src/depfile_parser.cc +++ b/src/depfile_parser.cc @@ -56,8 +56,8 @@ bool DepfileParser::Parse(string* content, string* err) { 0, 0, 0, 0, 0, 0, 0, 0, 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, + 128, 128, 128, 0, 0, 128, 0, 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, 128, 0, 0, 0, 0, 128, @@ -84,27 +84,35 @@ bool DepfileParser::Parse(string* content, string* err) { }; yych = *in; - if (yych <= '[') { + if (yych <= 'Z') { if (yych <= '*') { if (yych <= 0x00) goto yy6; if (yych <= '\'') goto yy8; if (yych <= ')') goto yy4; goto yy8; } else { - if (yych <= ':') goto yy4; - if (yych <= '@') goto yy8; - if (yych <= 'Z') goto yy4; - goto yy8; + if (yych <= '<') { + if (yych <= ':') goto yy4; + goto yy8; + } else { + if (yych <= '=') goto yy4; + if (yych <= '?') goto yy8; + goto yy4; + } } } else { - if (yych <= '`') { - if (yych <= '\\') goto yy2; - if (yych == '_') goto yy4; - goto yy8; + if (yych <= '_') { + if (yych == '\\') goto yy2; + if (yych <= '^') goto yy8; + goto yy4; } else { - if (yych <= 'z') goto yy4; - if (yych == '~') goto yy4; - goto yy8; + if (yych <= 'z') { + if (yych <= '`') goto yy8; + goto yy4; + } else { + if (yych == '~') goto yy4; + goto yy8; + } } } yy2: diff --git a/src/depfile_parser.in.cc b/src/depfile_parser.in.cc index 8c415b9..68b6a95 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 fd76ae7..2bb9105 100644 --- a/src/depfile_parser_test.cc +++ b/src/depfile_parser_test.cc @@ -106,12 +106,17 @@ TEST_F(DepfileParserTest, Escapes) { TEST_F(DepfileParserTest, SpecialChars) { string err; EXPECT_TRUE(Parse( -"C:/Program\\ Files\\ (x86)/Microsoft\\ crtdefs.h:", +"C:/Program\\ Files\\ (x86)/Microsoft\\ crtdefs.h: \n" +" en@quot.header~ t+t-x=1", &err)); ASSERT_EQ("", err); EXPECT_EQ("C:/Program Files (x86)/Microsoft crtdefs.h", parser_.out_.AsString()); - ASSERT_EQ(0u, parser_.ins_.size()); + ASSERT_EQ(2u, parser_.ins_.size()); + EXPECT_EQ("en@quot.header~", + parser_.ins_[0].AsString()); + EXPECT_EQ("t+t-x=1", + parser_.ins_[1].AsString()); } TEST_F(DepfileParserTest, UnifyMultipleOutputs) { |