diff options
author | Brad King <brad.king@kitware.com> | 2015-07-02 17:12:44 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-04-18 12:21:44 (GMT) |
commit | d71880839246046cf0b1b662abf91687ea91f9b9 (patch) | |
tree | 5b88a492a01b92dd6aae8062918e56a2355ab4c5 /src/manifest_parser.h | |
parent | 215a190a57efddcd114658f8b24d57f58c217d88 (diff) | |
download | Ninja-d71880839246046cf0b1b662abf91687ea91f9b9.zip Ninja-d71880839246046cf0b1b662abf91687ea91f9b9.tar.gz Ninja-d71880839246046cf0b1b662abf91687ea91f9b9.tar.bz2 |
Factor out a base class of ManifestParser
Create a Parser base class that holds parser functionality not specific
to the build manifest file format. This will allow it to be re-used for
other parsers later.
Diffstat (limited to 'src/manifest_parser.h')
-rw-r--r-- | src/manifest_parser.h | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/src/manifest_parser.h b/src/manifest_parser.h index 76c17b0..e14d069 100644 --- a/src/manifest_parser.h +++ b/src/manifest_parser.h @@ -15,16 +15,10 @@ #ifndef NINJA_MANIFEST_PARSER_H_ #define NINJA_MANIFEST_PARSER_H_ -#include <string> - -using namespace std; - -#include "lexer.h" +#include "parser.h" struct BindingEnv; struct EvalString; -struct FileReader; -struct State; enum DupeEdgeAction { kDupeEdgeActionWarn, @@ -45,13 +39,10 @@ struct ManifestParserOptions { }; /// Parses .ninja files. -struct ManifestParser { +struct ManifestParser : public Parser { ManifestParser(State* state, FileReader* file_reader, ManifestParserOptions options = ManifestParserOptions()); - /// Load and parse a file. - bool Load(const string& filename, string* err, Lexer* parent = NULL); - /// Parse a text string of input. Used by tests. bool ParseTest(const string& input, string* err) { quiet_ = true; @@ -72,14 +63,7 @@ private: /// Parse either a 'subninja' or 'include' line. bool ParseFileInclude(bool new_scope, string* err); - /// If the next token is not \a expected, produce an error string - /// saying "expected foo, got bar". - bool ExpectToken(Lexer::Token expected, string* err); - - State* state_; BindingEnv* env_; - FileReader* file_reader_; - Lexer lexer_; ManifestParserOptions options_; bool quiet_; }; |