summaryrefslogtreecommitdiffstats
path: root/src/manifest_parser.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-09-07 17:55:14 (GMT)
committerBrad King <brad.king@kitware.com>2017-09-07 18:52:56 (GMT)
commite679202a14d9ca08ccd0f471f2bcbf6388ddb3de (patch)
treec952091bbf21cd362e806e974feab50789966c79 /src/manifest_parser.h
parent7738c19dc42f63bedb5cb728d6ebde71b8fdaaf4 (diff)
downloadNinja-e679202a14d9ca08ccd0f471f2bcbf6388ddb3de.zip
Ninja-e679202a14d9ca08ccd0f471f2bcbf6388ddb3de.tar.gz
Ninja-e679202a14d9ca08ccd0f471f2bcbf6388ddb3de.tar.bz2
Factor ManifestParser options into a structure
This will allow more options to be added without updating everywhere that constructs a ManifestParser. Also extend the AssertParse function to take the options so tests can control them.
Diffstat (limited to 'src/manifest_parser.h')
-rw-r--r--src/manifest_parser.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/manifest_parser.h b/src/manifest_parser.h
index 043e4b2..4ae21c4 100644
--- a/src/manifest_parser.h
+++ b/src/manifest_parser.h
@@ -31,10 +31,15 @@ enum DupeEdgeAction {
kDupeEdgeActionError,
};
+struct ManifestParserOptions {
+ ManifestParserOptions(): dupe_edge_action_(kDupeEdgeActionWarn) {}
+ DupeEdgeAction dupe_edge_action_;
+};
+
/// Parses .ninja files.
struct ManifestParser {
ManifestParser(State* state, FileReader* file_reader,
- DupeEdgeAction dupe_edge_action);
+ ManifestParserOptions options = ManifestParserOptions());
/// Load and parse a file.
bool Load(const string& filename, string* err, Lexer* parent = NULL);
@@ -67,7 +72,7 @@ private:
BindingEnv* env_;
FileReader* file_reader_;
Lexer lexer_;
- DupeEdgeAction dupe_edge_action_;
+ ManifestParserOptions options_;
bool quiet_;
};