15 #ifndef NINJA_LEXER_H_
16 #define NINJA_LEXER_H_
30 explicit Lexer(
const char* input);
91 bool Error(
const std::string& message, std::string* err);
A tokenized string that contains variable references.
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.
bool ReadEvalString(EvalString *eval, bool path, std::string *err)
Read a $-escaped string.
void Start(StringPiece filename, StringPiece input)
Start parsing some input.
Token ReadToken()
Read a Token from the Token enum.
static const char * TokenErrorHint(Token expected)
Return a human-readable token hint, used in error messages.
bool ReadVarValue(EvalString *value, std::string *err)
Read the value side of a var = value line (complete with $escapes).
void EatWhitespace()
Skip past whitespace (called after each read token/ident/etc.).
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.
StringPiece represents a slice of a string whose memory is managed externally.