Ninja
Public Member Functions | Private Types | Private Attributes | List of all members
EvalString Struct Reference

A tokenized string that contains variable references. More...

#include <eval_env.h>

Public Member Functions

void AddSpecial (StringPiece text)
 
void AddText (StringPiece text)
 
void Clear ()
 
bool empty () const
 
std::string Evaluate (Env *env) const
 
std::string Serialize () const
 Construct a human-readable representation of the parsed state, for use in tests. More...
 
std::string Unparse () const
 

Private Types

typedef std::vector< std::pair< std::string, TokenType > > TokenList
 
enum  TokenType { RAW , SPECIAL }
 

Private Attributes

TokenList parsed_
 
std::string single_token_
 

Detailed Description

A tokenized string that contains variable references.

Can be evaluated relative to an Env.

Definition at line 35 of file eval_env.h.

Member Typedef Documentation

◆ TokenList

typedef std::vector<std::pair<std::string, TokenType> > EvalString::TokenList
private

Definition at line 55 of file eval_env.h.

Member Enumeration Documentation

◆ TokenType

enum EvalString::TokenType
private
Enumerator
RAW 
SPECIAL 

Definition at line 54 of file eval_env.h.

Member Function Documentation

◆ AddSpecial()

void EvalString::AddSpecial ( StringPiece  text)

Definition at line 136 of file eval_env.cc.

References StringPiece::AsString().

Referenced by Lexer::ReadEvalString().

◆ AddText()

void EvalString::AddText ( StringPiece  text)

◆ Clear()

void EvalString::Clear ( )
inline

Definition at line 43 of file eval_env.h.

References parsed_, and single_token_.

Referenced by ManifestParser::ParseDefault(), and ManifestParser::ParseEdge().

◆ empty()

bool EvalString::empty ( ) const
inline

◆ Evaluate()

string EvalString::Evaluate ( Env env) const

◆ Serialize()

string EvalString::Serialize ( ) const

Construct a human-readable representation of the parsed state, for use in tests.

Definition at line 146 of file eval_env.cc.

Referenced by TEST().

◆ Unparse()

string EvalString::Unparse ( ) const
Returns
The string with variables not expanded.

Definition at line 164 of file eval_env.cc.

Member Data Documentation

◆ parsed_

TokenList EvalString::parsed_
private

Definition at line 56 of file eval_env.h.

Referenced by Clear(), and empty().

◆ single_token_

std::string EvalString::single_token_
private

Definition at line 62 of file eval_env.h.

Referenced by Clear(), and empty().


The documentation for this struct was generated from the following files: