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;
58 bool have_newline =
false;
66 const char* start = in;
67 char* yymarker = NULL;
166 int len = (int)(out - filename);
167 const bool is_dependency = !parsing_targets;
168 if (len > 0 && filename[len - 1] ==
':') {
170 parsing_targets =
false;
178 std::vector<StringPiece>::iterator pos = std::find(
ins_.begin(),
ins_.end(), piece);
179 if (pos ==
ins_.end()) {
181 if (poisoned_input) {
182 *err =
"inputs may not also have inputs";
186 ins_.push_back(piece);
190 outs_.push_back(piece);
192 }
else if (!is_dependency) {
194 poisoned_input =
true;
200 parsing_targets =
true;
201 poisoned_input =
false;
204 if (!have_target && !is_empty) {
205 *err =
"expected ':' in depfile";
bool Parse(std::string *content, std::string *err)
Parse an input file.
DepfileParser(DepfileParserOptions options=DepfileParserOptions())
std::vector< StringPiece > outs_
std::vector< StringPiece > ins_
StringPiece represents a slice of a string whose memory is managed externally.