Ninja
|
Parser for the dependency information emitted by gcc's -M flags. More...
#include <depfile_parser.h>
Public Member Functions | |
bool | Parse (string *content, string *err) |
Parse an input file. More... | |
Public Attributes | |
vector< StringPiece > | ins_ |
StringPiece | out_ |
Parser for the dependency information emitted by gcc's -M flags.
Definition at line 25 of file depfile_parser.h.
bool DepfileParser::Parse | ( | string * | content, |
string * | err | ||
) |
Parse an input file.
Input must be NUL-terminated. Warning: may mutate the content in-place and parsed StringPieces are pointers within it.
re2c re2c:define:YYCTYPE = "char"; re2c:define:YYCURSOR = in; re2c:define:YYLIMIT = end;
re2c:yyfill:enable = 0;
re2c:indent:top = 2; re2c:indent:string = " ";
nul = "\000"; escape = [ \#*[|];
'\' escape { De-escape backslashed character. out++ = yych; continue; } '$$' { De-escape dollar character. out++ = '$'; continue; } '\' [^\000
] { Let backslash before other characters through verbatim. out++ = '\'; out++ = yych; continue; } [a-zA-Z0-9+,/_:.~()@=-!]+ { Got a span of plain text. int len = (int)(in - start); Need to shift it over if we're overwriting backslashes. if (out < start) memmove(out, start, len); out += len; continue; } nul { break; } [^] { For any other character (e.g. whitespace), swallow it here, allowing the outer logic to loop around again. break; }
Definition at line 32 of file depfile_parser.cc.
References ins_, out_, and StringPiece::str_.
Referenced by Builder::ExtractDeps(), ImplicitDepLoader::LoadDepFile(), main(), and DepfileParserTest::Parse().
vector<StringPiece> DepfileParser::ins_ |
Definition at line 32 of file depfile_parser.h.
Referenced by Builder::ExtractDeps(), ImplicitDepLoader::LoadDepFile(), and Parse().
StringPiece DepfileParser::out_ |
Definition at line 31 of file depfile_parser.h.
Referenced by ImplicitDepLoader::LoadDepFile(), and Parse().