diff options
author | Nico Weber <nicolasweber@gmx.de> | 2014-09-04 02:31:29 (GMT) |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2014-09-04 02:31:29 (GMT) |
commit | e32783165866c1a7e5c3a949d6a340de0327308a (patch) | |
tree | 3225308eb9ae984b90b7a8366be02cd65d410a28 | |
parent | 1d9184c3adbfabacb844b0a715a64b08998c204f (diff) | |
download | Ninja-e32783165866c1a7e5c3a949d6a340de0327308a.zip Ninja-e32783165866c1a7e5c3a949d6a340de0327308a.tar.gz Ninja-e32783165866c1a7e5c3a949d6a340de0327308a.tar.bz2 |
Provide an error message on malformed lets. Fixes #807.
-rw-r--r-- | src/manifest_parser.cc | 2 | ||||
-rw-r--r-- | src/manifest_parser_test.cc | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/manifest_parser.cc b/src/manifest_parser.cc index 6fa4f7c..55d191f 100644 --- a/src/manifest_parser.cc +++ b/src/manifest_parser.cc @@ -191,7 +191,7 @@ bool ManifestParser::ParseRule(string* err) { bool ManifestParser::ParseLet(string* key, EvalString* value, string* err) { if (!lexer_.ReadIdent(key)) - return false; + return lexer_.Error("expected variable name", err); if (!ExpectToken(Lexer::EQUALS, err)) return false; if (!lexer_.ReadVarValue(value, err)) diff --git a/src/manifest_parser_test.cc b/src/manifest_parser_test.cc index 152b965..5f4b30a 100644 --- a/src/manifest_parser_test.cc +++ b/src/manifest_parser_test.cc @@ -553,6 +553,15 @@ TEST_F(ParserTest, Errors) { State state; ManifestParser parser(&state, NULL); string err; + EXPECT_FALSE(parser.ParseTest("rule cc\n command = foo\n && bar", + &err)); + EXPECT_EQ("input:3: expected variable name\n", err); + } + + { + State state; + ManifestParser parser(&state, NULL); + string err; EXPECT_FALSE(parser.ParseTest("rule cc\n command = foo\n" "build $: cc bar.cc\n", &err)); |