handle unterminated char literals

This commit is contained in:
2025-12-19 17:34:40 +01:00
parent fdcf7eca37
commit ada570c84e

View File

@@ -212,6 +212,9 @@ impl Tokenizer {
} }
// TODO: escape sequences // TODO: escape sequences
'\'' => { '\'' => {
if self.eof() {
return error!(self.loc, "unterminated char literal");
}
self.advance(); self.advance();
if !self.match_char('\'') { if !self.match_char('\'') {
return error!(self.loc, "expected ' after char literal"); return error!(self.loc, "expected ' after char literal");