safe lexing with unterminated strings

master
Daniel Kolesa 2016-09-22 01:15:51 +02:00
parent b3110c30b9
commit 1c9f9c8f9f
1 changed files with 4 additions and 1 deletions

View File

@ -218,7 +218,10 @@ struct GenState {
return *source++;
}
char current(int ahead = 0) {
char current(ostd::Size ahead = 0) {
if (source.size() <= ahead) {
return '\0';
}
return source[ahead];
}