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);
119 return lexer_.
Error(
"no build statement exists for '" + path +
"'", err);
121 std::pair<DyndepFile::iterator, bool> res =
124 return lexer_.
Error(
"multiple statements for '" + path +
"'", err);
125 dyndeps = &res.first->second;
134 return lexer_.
Error(
"explicit outputs not supported", err);
138 vector<EvalString> outs;
155 return lexer_.
Error(
"expected build command name 'dyndep'", err);
163 return lexer_.
Error(
"explicit inputs not supported", err);
167 vector<EvalString> ins;
181 return lexer_.
Error(
"order-only inputs not supported", err);
192 return lexer_.
Error(
"binding is not 'restat'", err);
194 dyndeps->
restat_ = !value.empty();
199 string path = in.Evaluate(&
env_);
210 string path = out.Evaluate(&
env_);
Store data loaded from one dyndep file.
bool ParseEdge(std::string *err)
bool ParseLet(std::string *key, EvalString *val, std::string *err)
DyndepFile * dyndep_file_
bool ParseDyndepVersion(std::string *err)
bool Parse(const std::string &filename, const std::string &input, std::string *err)
Parse a file, given its contents as a string.
DyndepParser(State *state, FileReader *file_reader, DyndepFile *dyndep_file)
Store dynamically-discovered dependency information for one edge.
std::vector< Node * > implicit_inputs_
std::vector< Node * > implicit_outputs_
An edge in the dependency graph; links between Nodes using Rules.
A tokenized string that contains variable references.
std::string Evaluate(Env *env) const
Interface for reading files from disk.
static const char * TokenName(Token t)
Return a human-readable form of a token, used in error messages.
bool PeekToken(Token token)
If the next token is token, read it and return true.
std::string DescribeLastError()
If the last token read was an ERROR token, provide more info or the empty string.
void UnreadToken()
Rewind to the last read Token.
void Start(StringPiece filename, StringPiece input)
Start parsing some input.
Token ReadToken()
Read a Token from the Token enum.
bool ReadVarValue(EvalString *value, std::string *err)
Read the value side of a var = value line (complete with $escapes).
bool ReadIdent(std::string *out)
Read a simple identifier (a rule or variable name).
bool ReadPath(EvalString *path, std::string *err)
Read a path (complete with $escapes).
bool Error(const std::string &message, std::string *err)
Construct an error message with context.
Information about a node in the dependency graph: the file, whether it's dirty, mtime,...
bool ExpectToken(Lexer::Token expected, std::string *err)
If the next token is not expected, produce an error string saying "expected foo, got bar".
Global state (file status) for a single run.
Node * GetNode(StringPiece path, uint64_t slash_bits)
Node * LookupNode(StringPiece path) const
void CanonicalizePath(string *path, uint64_t *slash_bits)
void ParseVersion(const string &version, int *major, int *minor)
unsigned long long uint64_t