|
Ninja
|
Base class for parsers. More...
#include <parser.h>

Public Member Functions | |
| bool | Load (const std::string &filename, std::string *err, Lexer *parent=NULL) |
| Load and parse a file. More... | |
| Parser (State *state, FileReader *file_reader) | |
| virtual | ~Parser () |
Protected Member Functions | |
| bool | ExpectToken (Lexer::Token expected, std::string *err) |
| If the next token is not expected, produce an error string saying "expected foo, got bar". More... | |
Protected Attributes | |
| FileReader * | file_reader_ |
| Lexer | lexer_ |
| State * | state_ |
Private Member Functions | |
| virtual bool | Parse (const std::string &filename, const std::string &input, std::string *err)=0 |
| Parse a file, given its contents as a string. More... | |
|
inline |
|
protected |
If the next token is not expected, produce an error string saying "expected foo, got bar".
Definition at line 40 of file parser.cc.
References Lexer::TokenErrorHint(), and Lexer::TokenName().
Referenced by ManifestParser::ParseDefault(), DyndepParser::ParseEdge(), ManifestParser::ParseEdge(), ManifestParser::ParseFileInclude(), DyndepParser::ParseLet(), ManifestParser::ParseLet(), ManifestParser::ParsePool(), and ManifestParser::ParseRule().
| bool Parser::Load | ( | const std::string & | filename, |
| std::string * | err, | ||
| Lexer * | parent = NULL |
||
| ) |
Load and parse a file.
Definition at line 22 of file parser.cc.
References Lexer::Error(), METRIC_RECORD_IF, and FileReader::Okay.
Referenced by DyndepLoader::LoadDyndepFile(), LoadManifests(), and TEST_F().
|
privatepure virtual |
Parse a file, given its contents as a string.
Implemented in ManifestParser, and DyndepParser.
|
protected |
Definition at line 40 of file parser.h.
Referenced by ManifestParser::ParseFileInclude().
|
protected |
Definition at line 41 of file parser.h.
Referenced by DyndepParser::Parse(), ManifestParser::Parse(), ManifestParser::ParseDefault(), DyndepParser::ParseDyndepVersion(), DyndepParser::ParseEdge(), ManifestParser::ParseEdge(), ManifestParser::ParseFileInclude(), DyndepParser::ParseLet(), ManifestParser::ParseLet(), ManifestParser::ParsePool(), and ManifestParser::ParseRule().
|
protected |
Definition at line 39 of file parser.h.
Referenced by ManifestParser::ParseDefault(), DyndepParser::ParseEdge(), ManifestParser::ParseEdge(), ManifestParser::ParseFileInclude(), and ManifestParser::ParsePool().