Cause tokenize error for unclosed strings
This commit is contained in:
parent
d2108f0f97
commit
4ef93fafb5
@ -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));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user