Skip to content

Empty statements not fully implemented #892

Closed
@Razican

Description

Currently, a code like this one will work fine:

let a = 10;;;

But, this one is broken:

;;;let a = 10;;

This is because if a statement list starts with an empty statement, we only check if it's a closing brace or not, bug it it's not, we just try to parse a StatementListItem, which will fail.

All this is implemented in this loop, and an equivalent one here.

As you can see, before looping again, we do consume any repeated semicolons, so the first example works, but not the second one.

Ideally, we should add an extra branch to the first check in both loops, to see if the next item is a semicolon. If it is, just call continue; after consuming the token. With this, we can remove the while loop at the end of the loop.

Metadata

Assignees

No one assigned

    Labels

    E-EasyEasyHacktoberfestHacktoberfest 2021 - https://hacktoberfest.digitalocean.combugSomething isn't workinggood first issueGood for newcomersparserIssues surrounding the parser

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions