diff options
author | Evan Martin <martine@danga.com> | 2011-05-23 16:30:33 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-05-23 16:30:33 (GMT) |
commit | 53493b70104f8497d4a062999570c036b17e561b (patch) | |
tree | 562f415725cbd8e7894cfffa79a76e5ae2f6b59f /src | |
parent | b2f8cb24f3a38fa15fb510072d2da46e05adbc00 (diff) | |
download | Ninja-53493b70104f8497d4a062999570c036b17e561b.zip Ninja-53493b70104f8497d4a062999570c036b17e561b.tar.gz Ninja-53493b70104f8497d4a062999570c036b17e561b.tar.bz2 |
refactor
Diffstat (limited to 'src')
-rw-r--r-- | src/parsers.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/parsers.cc b/src/parsers.cc index 3c392db..d2368f4 100644 --- a/src/parsers.cc +++ b/src/parsers.cc @@ -327,21 +327,22 @@ bool ManifestParser::ParseRule(string* err) { if (!ParseLet(&key, &val, false, err)) return false; - string parse_err; + EvalString* eval_target = NULL; if (key == "command") { - if (!rule->ParseCommand(val, &parse_err)) - return tokenizer_.Error(parse_err, err); + eval_target = &rule->command_; } else if (key == "depfile") { - if (!rule->depfile_.Parse(val, &parse_err)) - return tokenizer_.Error(parse_err, err); + eval_target = &rule->depfile_; } else if (key == "description") { - if (!rule->description_.Parse(val, &parse_err)) - return tokenizer_.Error(parse_err, err); + eval_target = &rule->description_; } else { // Die on other keyvals for now; revisit if we want to add a // scope here. return let_loc.Error("unexpected variable '" + key + "'", err); } + + string parse_err; + if (!eval_target->Parse(val, &parse_err)) + return tokenizer_.Error(parse_err, err); } tokenizer_.ConsumeToken(); } |