29 :
Parser(state, file_reader)
30 , dyndep_file_(dyndep_file) {
39 bool haveDyndepVersion =
false;
45 if (!haveDyndepVersion)
46 return lexer_.
Error(
"expected 'ninja_dyndep_version = ...'", err);
53 if (haveDyndepVersion)
58 haveDyndepVersion =
true;
64 if (!haveDyndepVersion)
65 return lexer_.
Error(
"expected 'ninja_dyndep_version = ...'", err);
80 if (!
ParseLet(&name, &let_value, err))
82 if (name !=
"ninja_dyndep_version") {
83 return lexer_.
Error(
"expected 'ninja_dyndep_version = ...'", err);
88 if (major != 1 || minor != 0) {
90 string(
"unsupported 'ninja_dyndep_version = ") + version +
"'", err);
124 return lexer_.
Error(
"no build statement exists for '" + path +
"'", err);
126 std::pair<DyndepFile::iterator, bool> res =
129 return lexer_.
Error(
"multiple statements for '" + path +
"'", err);
130 dyndeps = &res.first->second;
139 return lexer_.
Error(
"explicit outputs not supported", err);
143 vector<EvalString> outs;
160 return lexer_.
Error(
"expected build command name 'dyndep'", err);
168 return lexer_.
Error(
"explicit inputs not supported", err);
172 vector<EvalString> ins;
186 return lexer_.
Error(
"order-only inputs not supported", err);
197 return lexer_.
Error(
"binding is not 'restat'", err);
199 dyndeps->
restat_ = !value.empty();
203 for (vector<EvalString>::iterator i = ins.begin(); i != ins.end(); ++i) {
204 string path = i->Evaluate(&
env_);
214 for (vector<EvalString>::iterator i = outs.begin(); i != outs.end(); ++i) {
215 string path = i->Evaluate(&
env_);
std::string Evaluate(Env *env) const
std::vector< Node * > implicit_inputs_
Store data loaded from one dyndep file.
bool Parse(const std::string &filename, const std::string &input, std::string *err)
Parse a file, given its contents as a string.
bool CanonicalizePath(string *path, uint64_t *slash_bits, string *err)
Node * GetNode(StringPiece path, uint64_t slash_bits)
void UnreadToken()
Rewind to the last read Token.
Information about a node in the dependency graph: the file, whether it's dirty, mtime, etc.
bool PeekToken(Token token)
If the next token is token, read it and return true.
An edge in the dependency graph; links between Nodes using Rules.
Node * LookupNode(StringPiece path) const
bool ParseEdge(std::string *err)
bool ReadVarValue(EvalString *value, std::string *err)
Read the value side of a var = value line (complete with $escapes).
Store dynamically-discovered dependency information for one edge.
Token ReadToken()
Read a Token from the Token enum.
DyndepParser(State *state, FileReader *file_reader, DyndepFile *dyndep_file)
bool ReadPath(EvalString *path, std::string *err)
Read a path (complete with $escapes).
void ParseVersion(const string &version, int *major, int *minor)
bool Error(const std::string &message, std::string *err)
Construct an error message with context.
std::string DescribeLastError()
If the last token read was an ERROR token, provide more info or the empty string. ...
bool ParseDyndepVersion(std::string *err)
DyndepFile * dyndep_file_
bool ParseLet(std::string *key, EvalString *val, std::string *err)
static const char * TokenName(Token t)
Return a human-readable form of a token, used in error messages.
Global state (file status) for a single run.
bool ReadIdent(std::string *out)
Read a simple identifier (a rule or variable name).
unsigned long long uint64_t
A tokenized string that contains variable references.
void Start(StringPiece filename, StringPiece input)
Start parsing some input.
std::vector< Node * > implicit_outputs_
bool ExpectToken(Lexer::Token expected, std::string *err)
If the next token is not expected, produce an error string saying "expected foo, got bar"...
Interface for reading files from disk.