Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax and transpile support for continue statement #697

Merged
merged 6 commits into from
Sep 27, 2022

Conversation

TwitchBronBron
Copy link
Member

@TwitchBronBron TwitchBronBron commented Sep 27, 2022

Roku OS 11.5 introduced the continue statement. This PR adds the necessary parsing and transpiling to support using that feature as defined by Roku.

This does not address backwards-compatibile transpiling (i.e. transpile to labels and goto expressions). That effort is still ongoing in #489 and will be addressed at a future time.

@arturocuya
Copy link
Contributor

Does the new Continue statement support plugin annotations?

@TwitchBronBron
Copy link
Member Author

@arturocuya do you mean like this? If so, then no. I believe annotations are currently only applicable to the higher-level things like namespaces and functions.

while true 
    @YourCustomAnnotation
    continue while
end while

@arturocuya
Copy link
Contributor

@TwitchBronBron Ah ok. I was asking because in another project I use brs for testing and it doesn't recognize newer statements like throw, so I exclude them from the compilation using an annotation:

    private sub validateArgs(args as object)
        if ((args.direction <> Direction.row) and (args.direction <> Direction.column))
            if (m.logger <> invalid)
                m.logger.error(ErrorCode.invalidDirection, args.direction)
            end if
            @deviceOnly
            throw ErrorCode.invalidDirection
        end if

@TwitchBronBron
Copy link
Member Author

Oh, well if annotations work with throw, then they should also work for continue, as both are "statements".

@TwitchBronBron TwitchBronBron merged commit fba1c3a into master Sep 27, 2022
@TwitchBronBron TwitchBronBron deleted the continue-parser-support branch September 27, 2022 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants