safer next_char()

master
Daniel Kolesa 2016-09-22 01:19:29 +02:00
parent 1c9f9c8f9f
commit 0f10c3e303
1 changed files with 5 additions and 2 deletions

View File

@ -214,8 +214,11 @@ struct GenState {
void gen_main(ostd::ConstCharRange s, int ret_type = CsValAny);
char next_char() {
return *source++;
void next_char() {
if (source.empty()) {
return;
}
source.pop_front();
}
char current(ostd::Size ahead = 0) {