41 char* in = &(*content)[0];
42 char* end = in + content->size();
43 bool have_target =
false;
44 bool have_secondary_target_on_this_rule =
false;
45 bool have_newline_since_primary_target =
false;
46 bool warned_distinct_target_lines =
false;
47 bool parsing_targets =
true;
49 bool have_newline =
false;
57 const char* start = in;
58 char* yymarker = NULL;
119 int len = (int)(out - filename);
120 const bool is_dependency = !parsing_targets;
121 if (len > 0 && filename[len - 1] ==
':') {
123 parsing_targets =
false;
129 if (have_secondary_target_on_this_rule) {
130 if (!have_newline_since_primary_target) {
131 *err =
"depfile has multiple output paths";
136 "depfile has multiple output paths (on separate lines)" 137 " [-w depfilemulti=err]";
140 if (!warned_distinct_target_lines) {
141 warned_distinct_target_lines =
true;
142 Warning(
"depfile has multiple output paths (on separate lines); " 143 "continuing anyway [-w depfilemulti=warn]");
152 have_secondary_target_on_this_rule =
true;
158 parsing_targets =
true;
159 have_secondary_target_on_this_rule =
false;
161 have_newline_since_primary_target =
true;
166 *err =
"expected ':' in depfile";
StringPiece represents a slice of a string whose memory is managed externally.
bool Parse(string *content, string *err)
Parse an input file.
DepfileParserOptions options_
DepfileDistinctTargetLinesAction depfile_distinct_target_lines_action_
vector< StringPiece > ins_
DepfileParser(DepfileParserOptions options=DepfileParserOptions())
void Warning(const char *msg,...)
Log a warning message.