15 #ifndef NINJA_EVAL_ENV_H_
16 #define NINJA_EVAL_ENV_H_
55 typedef std::vector<std::pair<std::string, TokenType> >
TokenList;
69 static std::unique_ptr<Rule>
Phony();
86 typedef std::map<std::string, EvalString>
Bindings;
100 void AddRule(std::unique_ptr<const Rule> rule);
103 const std::map<std::string, std::unique_ptr<const Rule>>&
GetRules()
const;
105 void AddBinding(
const std::string& key,
const std::string& val);
117 std::map<std::string, std::unique_ptr<const Rule>>
rules_;
An Env which contains a mapping of variables to values as well as a pointer to a parent scope.
std::string LookupWithFallback(const std::string &var, const EvalString *eval, Env *env)
This is tricky.
void AddBinding(const std::string &key, const std::string &val)
BindingEnv(BindingEnv *parent)
const Rule * LookupRule(const std::string &rule_name)
const std::map< std::string, std::unique_ptr< const Rule > > & GetRules() const
std::map< std::string, std::string > bindings_
std::map< std::string, std::unique_ptr< const Rule > > rules_
const Rule * LookupRuleCurrentScope(const std::string &rule_name)
virtual std::string LookupVariable(const std::string &var)
void AddRule(std::unique_ptr< const Rule > rule)
An interface for a scope for variable (e.g. "$foo") lookups.
virtual std::string LookupVariable(const std::string &var)=0
A tokenized string that contains variable references.
std::string Evaluate(Env *env) const
std::string Unparse() const
void AddSpecial(StringPiece text)
std::string single_token_
std::string Serialize() const
Construct a human-readable representation of the parsed state, for use in tests.
std::vector< std::pair< std::string, TokenType > > TokenList
void AddText(StringPiece text)
An invocable build command and associated metadata (description, etc.).
std::map< std::string, EvalString > Bindings
const EvalString * GetBinding(const std::string &key) const
void AddBinding(const std::string &key, const EvalString &val)
static std::unique_ptr< Rule > Phony()
const std::string & name() const
Rule(const std::string &name)
static bool IsReservedBinding(const std::string &var)
StringPiece represents a slice of a string whose memory is managed externally.