Skip to content

Commit 43285d1

Browse files
committed
字句解析器の例外時にstrの内容を出力
1 parent 528617f commit 43285d1

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/lexer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ namespace JsonParser {
7373
}
7474
str = str.substr(0, str.find_last_not_of(" \f\t\v\r\n") + 1);
7575
if (!std::regex_match(str, std::regex("-?(0|[1-9]\\d*)(\\.\\d+)?(e[-+](0|[1-9]\\d*)(\\.\\d+)?)?"))) {
76+
std::cout << str << std::endl;
7677
throw std::runtime_error("At LexicalAnalyzer(): \"str\" is not a number.");
7778
}
7879
chs.push_back(str);
@@ -90,6 +91,7 @@ namespace JsonParser {
9091
}
9192
str = str.substr(0, str.find_last_not_of(" \f\t\v\r\n") + 1);
9293
if (str != "true" && str != "false" && str != "null") {
94+
std::cout << str << std::endl;
9395
throw std::runtime_error("At LexicalAnalyzer(): \"str\" is neither true, false nor null.");
9496
}
9597
chs.push_back(str);

0 commit comments

Comments
 (0)