summaryrefslogtreecommitdiffstats
path: root/src/lib/dns/master_lexer.cc
diff options
context:
space:
mode:
authorJINMEI Tatuya <jinmei@isc.org>2012-11-29 19:28:26 +0100
committerJINMEI Tatuya <jinmei@isc.org>2012-11-29 19:28:26 +0100
commitae3a1e5d17d5c8ab8c9dcf20cf60a68744f5cca0 (patch)
tree33777b26a0817e99dd5ec05d76c6f415ed677d4c /src/lib/dns/master_lexer.cc
parent[2506] supported NUMBER in getNextToken() with expected type (diff)
downloadkea-ae3a1e5d17d5c8ab8c9dcf20cf60a68744f5cca0.tar.xz
kea-ae3a1e5d17d5c8ab8c9dcf20cf60a68744f5cca0.zip
[2506] handled the case a number is expected but not found
Diffstat (limited to 'src/lib/dns/master_lexer.cc')
-rw-r--r--src/lib/dns/master_lexer.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/dns/master_lexer.cc b/src/lib/dns/master_lexer.cc
index 3127247141..0b60d3b76c 100644
--- a/src/lib/dns/master_lexer.cc
+++ b/src/lib/dns/master_lexer.cc
@@ -225,8 +225,13 @@ MasterLexer::getNextToken(MasterToken::Type expect, bool eol_ok) {
}
if (impl_->token_.getType() != expect) {
ungetToken();
+ if (is_eol_like) {
+ throw LexerError(__FILE__, __LINE__,
+ MasterToken(MasterToken::UNEXPECTED_END));
+ }
+ assert(expect == MasterToken::NUMBER);
throw LexerError(__FILE__, __LINE__,
- MasterToken(MasterToken::UNEXPECTED_END));
+ MasterToken(MasterToken::BAD_NUMBER));
}
return (impl_->token_);
@@ -251,7 +256,8 @@ const char* const error_text[] = {
"unexpected end of input", // UNEXPECTED_END
"unbalanced quotes", // UNBALANCED_QUOTES
"no token produced", // NO_TOKEN_PRODUCED
- "number out of range" // NUMBER_OUT_OF_RANGE
+ "number out of range", // NUMBER_OUT_OF_RANGE
+ "not a valid number" // BAD_NUMBER
};
const size_t error_text_max_count = sizeof(error_text) / sizeof(error_text[0]);
} // end unnamed namespace