From b12139c13e8924ce4d0e634f5798274a5d87f5d7 Mon Sep 17 00:00:00 2001 From: Evan Jones Date: Wed, 4 Jan 2012 11:40:30 -0500 Subject: Add a space to unexpected token errors. --- src/parsers.cc | 2 +- src/parsers_test.cc | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/parsers.cc b/src/parsers.cc index 506b209..afb097a 100644 --- a/src/parsers.cc +++ b/src/parsers.cc @@ -78,7 +78,7 @@ bool ManifestParser::Parse(const string& filename, const string& input, case Lexer::NEWLINE: break; default: - return lexer_.Error(string("unexpected") + Lexer::TokenName(token), + return lexer_.Error(string("unexpected ") + Lexer::TokenName(token), err); } } diff --git a/src/parsers_test.cc b/src/parsers_test.cc index 9d46beb..e7047da 100644 --- a/src/parsers_test.cc +++ b/src/parsers_test.cc @@ -448,6 +448,13 @@ TEST_F(ParserTest, Errors) { // as we see them, not after we've read them all! EXPECT_EQ("input:4: empty path\n", err); } + + { + ManifestParser parser(NULL, NULL); + string err; + EXPECT_FALSE(parser.ParseTest(" # bad indented comment\n", &err)); + EXPECT_EQ("input:1: unexpected indent\n", err); + } } TEST_F(ParserTest, MultipleOutputs) -- cgit v0.12