51 char* in = &(*content)[0];
52 char* end = in + content->size();
53 bool have_target =
false;
54 bool parsing_targets =
true;
55 bool poisoned_input =
false;
57 bool have_newline =
false;
65 const char* start = in;
66 char* yymarker = NULL;
165 int len = (int)(out - filename);
166 const bool is_dependency = !parsing_targets;
167 if (len > 0 && filename[len - 1] ==
':') {
169 parsing_targets =
false;
176 std::vector<StringPiece>::iterator pos = std::find(
ins_.begin(),
ins_.end(), piece);
177 if (pos ==
ins_.end()) {
179 if (poisoned_input) {
180 *err =
"inputs may not also have inputs";
184 ins_.push_back(piece);
188 outs_.push_back(piece);
190 }
else if (!is_dependency) {
192 poisoned_input =
true;
198 parsing_targets =
true;
199 poisoned_input =
false;
203 *err =
"expected ':' in depfile";
StringPiece represents a slice of a string whose memory is managed externally.
bool Parse(std::string *content, std::string *err)
Parse an input file.
std::vector< StringPiece > outs_
std::vector< StringPiece > ins_
DepfileParser(DepfileParserOptions options=DepfileParserOptions())