mirror of
https://github.com/danog/parser.git
synced 2024-11-26 20:04:57 +01:00
fix: look for end token when parsing switch instead of always looking for right brace
This commit is contained in:
parent
fa19d0eb8d
commit
c8608eab92
@ -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)?);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user