fix: look for end token when parsing switch instead of always looking for right brace

This commit is contained in:
Ryan Chandler 2022-12-09 23:14:16 +00:00
parent fa19d0eb8d
commit c8608eab92
No known key found for this signature in database
GPG Key ID: F113BCADDB3B0CCA

View File

@ -121,6 +121,7 @@ pub fn switch_statement(state: &mut State) -> ParseResult<Statement> {
while state.current.kind != TokenKind::Case
&& state.current.kind != TokenKind::Default
&& state.current.kind != TokenKind::RightBrace
&& state.current.kind != end_token
{
body.push(parser::statement(state)?);
state.skip_comments();
@ -140,7 +141,7 @@ pub fn switch_statement(state: &mut State) -> ParseResult<Statement> {
while state.current.kind != TokenKind::Case
&& state.current.kind != TokenKind::Default
&& state.current.kind != TokenKind::RightBrace
&& state.current.kind != end_token
{
body.push(parser::statement(state)?);
}