|
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. | |
| 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". | |
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. | |
|
inline |
Definition at line 27 of file parser.h.
References file_reader_, and state_.
Referenced by DyndepParser::DyndepParser(), and ManifestParser::ManifestParser().
|
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_, 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(), file_reader_, METRIC_RECORD_IF, FileReader::Okay, and Parse().
Referenced by DyndepLoader::LoadDyndepFile(), LoadManifests(), and TEST_F().
|
privatepure virtual |
Parse a file, given its contents as a string.
Implemented in DyndepParser, and ManifestParser.
Referenced by Load().
|
protected |
Definition at line 40 of file parser.h.
Referenced by Load(), ManifestParser::ParseFileInclude(), and Parser().
|
protected |
Definition at line 41 of file parser.h.
Referenced by ExpectToken(), 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(), ManifestParser::ParsePool(), and Parser().