fixed bug where the last item in a list would break the parser if it wasn't followed by a whitespace, ), or }. (added ] to the list of statement-breaking chars)

This commit is contained in:
Dummi26 2023-03-14 20:21:36 +01:00
parent 862418ce98
commit 1b43dfebda

View File

@ -174,13 +174,13 @@ fn parse_statement_adv(
} else { } else {
loop { loop {
match match file.peek() { match match file.peek() {
Some(ch) if matches!(ch, '}' | ')' | '.') => Some(ch), Some(ch) if matches!(ch, '}' | ']' | ')' | '.') => Some(ch),
_ => file.next(), _ => file.next(),
} { } {
Some('=') => { Some('=') => {
break parse_statement(file)?.output_to(start.trim().to_string()); break parse_statement(file)?.output_to(start.trim().to_string());
} }
Some(ch) if (ch.is_whitespace() || ch == '}' || ch == ')' || ch == '.') => { Some(ch) if ch.is_whitespace() || matches!(ch, '}' | ']' | ')' | '.') => {
file.skip_whitespaces(); file.skip_whitespaces();
if let Some('=') = file.peek() { if let Some('=') = file.peek() {
continue; continue;