diff options
Diffstat (limited to 'src/depfile_parser.in.cc')
-rw-r--r-- | src/depfile_parser.in.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/depfile_parser.in.cc b/src/depfile_parser.in.cc index 3d9a77e..8c04bdd 100644 --- a/src/depfile_parser.in.cc +++ b/src/depfile_parser.in.cc @@ -48,12 +48,19 @@ bool DepfileParser::Parse(const string& content, string* err) { '\\\n' { continue; } [ \n]* { continue; } - [a-zA-Z0-9+,/_:.-]+ { + [a-zA-Z0-9+,/\\_:.-]+ { // Got a filename. - if (p[-1] == ':') { - out_ = StringPiece(start, p - start - 1); + int len = p - start;; + if (start[len] == ':') + len--; // Strip off trailing colon, if any. + + if (len == 0) + continue; // Drop isolated colons. + + if (!out_.str_) { + out_ = StringPiece(start, len); } else { - ins_.push_back(StringPiece(start, p - start)); + ins_.push_back(StringPiece(start, len)); } continue; } |