Cause tokenize error for unclosed strings

This commit is contained in:
greg 2015-07-30 02:09:32 -07:00
parent d2108f0f97
commit 4ef93fafb5
1 changed files with 5 additions and 4 deletions

View File

@ -46,11 +46,12 @@ pub fn tokenize(input: &str) -> Vec<Token> {
} else if c == '"' {
let mut buffer = String::with_capacity(20);
while let Some(x) = iterator.next() {
if x == '"' {
break;
loop {
match iterator.next() {
Some(x) if x == '"' => break,
Some(x) => buffer.push(x),
None => return tokens,
}
buffer.push(x);
}
tokens.push(Token::StrLiteral(buffer));