|
Ninja
|
Parses dyndep files. More...
#include <dyndep_parser.h>

Public Member Functions | |
| DyndepParser (State *state, FileReader *file_reader, DyndepFile *dyndep_file) | |
| bool | Load (const std::string &filename, std::string *err, Lexer *parent=NULL) |
| Load and parse a file. More... | |
| bool | ParseTest (const std::string &input, std::string *err) |
| Parse a text string of input. Used by tests. More... | |
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 | |
| bool | Parse (const std::string &filename, const std::string &input, std::string *err) |
| Parse a file, given its contents as a string. More... | |
| bool | ParseDyndepVersion (std::string *err) |
| bool | ParseEdge (std::string *err) |
| bool | ParseLet (std::string *key, EvalString *val, std::string *err) |
Private Attributes | |
| DyndepFile * | dyndep_file_ |
| BindingEnv | env_ |
Parses dyndep files.
Definition at line 25 of file dyndep_parser.h.
| DyndepParser::DyndepParser | ( | State * | state, |
| FileReader * | file_reader, | ||
| DyndepFile * | dyndep_file | ||
| ) |
Definition at line 27 of file dyndep_parser.cc.
|
protectedinherited |
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(), ParseEdge(), ManifestParser::ParseEdge(), ManifestParser::ParseFileInclude(), ParseLet(), ManifestParser::ParseLet(), ManifestParser::ParsePool(), and ManifestParser::ParseRule().
|
inherited |
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().
|
privatevirtual |
Parse a file, given its contents as a string.
Implements Parser.
Definition at line 33 of file dyndep_parser.cc.
References Lexer::BUILD, Lexer::DescribeLastError(), Lexer::ERROR, Lexer::Error(), Lexer::IDENT, Parser::lexer_, Lexer::NEWLINE, ParseDyndepVersion(), ParseEdge(), Lexer::ReadToken(), Lexer::Start(), Lexer::TEOF, Lexer::TokenName(), and Lexer::UnreadToken().
Referenced by ParseTest().
|
private |
Definition at line 77 of file dyndep_parser.cc.
References env_, Lexer::Error(), EvalString::Evaluate(), Parser::lexer_, ParseLet(), and ParseVersion().
Referenced by Parse().
|
private |
Definition at line 101 of file dyndep_parser.cc.
References CanonicalizePath(), Lexer::COLON, dyndep_file_, EvalString::empty(), env_, Lexer::Error(), EvalString::Evaluate(), Parser::ExpectToken(), State::GetNode(), Dyndeps::implicit_inputs_, Dyndeps::implicit_outputs_, Node::in_edge(), Lexer::INDENT, Parser::lexer_, State::LookupNode(), Lexer::NEWLINE, ParseLet(), Lexer::PeekToken(), Lexer::PIPE, Lexer::PIPE2, Lexer::ReadIdent(), Lexer::ReadPath(), Dyndeps::restat_, and Parser::state_.
Referenced by Parse().
|
private |
Definition at line 95 of file dyndep_parser.cc.
References Lexer::EQUALS, Lexer::Error(), Parser::ExpectToken(), Parser::lexer_, Lexer::ReadIdent(), and Lexer::ReadVarValue().
Referenced by ParseDyndepVersion(), and ParseEdge().
|
inline |
Parse a text string of input. Used by tests.
Definition at line 30 of file dyndep_parser.h.
References Parse().
Referenced by DyndepParserTest::AssertParse(), and TEST_F().
|
private |
Definition at line 43 of file dyndep_parser.h.
Referenced by ParseEdge().
|
private |
Definition at line 44 of file dyndep_parser.h.
Referenced by ParseDyndepVersion(), and ParseEdge().
|
protectedinherited |
Definition at line 40 of file parser.h.
Referenced by ManifestParser::ParseFileInclude().
|
protectedinherited |
Definition at line 41 of file parser.h.
Referenced by Parse(), ManifestParser::Parse(), ManifestParser::ParseDefault(), ParseDyndepVersion(), ParseEdge(), ManifestParser::ParseEdge(), ManifestParser::ParseFileInclude(), ParseLet(), ManifestParser::ParseLet(), ManifestParser::ParsePool(), and ManifestParser::ParseRule().
|
protectedinherited |
Definition at line 39 of file parser.h.
Referenced by ManifestParser::ParseDefault(), ParseEdge(), ManifestParser::ParseEdge(), ManifestParser::ParseFileInclude(), and ManifestParser::ParsePool().