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

Add support for try/catch #554

Open
sjbarag opened this issue Sep 29, 2020 · 0 comments
Open

Add support for try/catch #554

sjbarag opened this issue Sep 29, 2020 · 0 comments
Labels
enhancement Any addition to this project's existing capabilities interpreter Affects this project's tree-walking interpreter lexer Affects this project's lexer (aka scanner) parser Affects this project's token parser

Comments

@sjbarag
Copy link
Owner

sjbarag commented Sep 29, 2020

The Reference BrightScript Implementation (RBI) added support for try/catch/throw in version 9.4! https://developer.roku.com/docs/references/brightscript/language/error-handling.md

We should do the same. This work will involve the lexer, parser, and interpreter, and may require some extra changes in the standard library to accommodate.

@sjbarag sjbarag added enhancement Any addition to this project's existing capabilities lexer Affects this project's lexer (aka scanner) parser Affects this project's token parser interpreter Affects this project's tree-walking interpreter labels Sep 29, 2020
sjbarag added a commit that referenced this issue Jan 15, 2021
RBI 9.4 adds support for error handling via the `try`/`catch` model [1].
Interestingly, `try`, `catch`, and `endtry` are all valid identifiers!
That makes parsing a little bit tougher, but it's not unprecedented in
this language.  Detect `try`/`catch`/throw`/`end try` during lexing and
emit the proper lexemes.

[1] https://developer.roku.com/docs/references/brightscript/language/error-handling.html
see #554
sjbarag added a commit that referenced this issue Jan 19, 2021
RBI 9.4 adds support for error handling via the `try`/`catch` model [1].
Interestingly, `try`, `catch`, and `endtry` are all valid identifiers!
That makes parsing a little bit tougher, but it's not unprecedented in
this language.  Detect `try`/`catch`/throw`/`end try` during lexing and
emit the proper lexemes.

[1] https://developer.roku.com/docs/references/brightscript/language/error-handling.html
see #554
sjbarag added a commit that referenced this issue Jan 19, 2021
Throwing exceptions and catching them aren't yet supported in `brs`, so
executing only the `try` block seems to be a reasonable "bare minimum"
approach to try/catch support.  Handle `try`, `catch`, and `end try`
lexemes in the parser, emitting TryCatch statements for the interpreter
to execute naïvely.

see #554
sjbarag added a commit that referenced this issue Jan 19, 2021
Throwing exceptions and catching them aren't yet supported in `brs`, so
executing only the `try` block seems to be a reasonable "bare minimum"
approach to try/catch support.  Handle `try`, `catch`, and `end try`
lexemes in the parser, emitting TryCatch statements for the interpreter
to execute naïvely.

see #554
lvcabral pushed a commit to lvcabral/brs-engine that referenced this issue Nov 29, 2023
Throwing exceptions and catching them aren't yet supported in `brs`, so
executing only the `try` block seems to be a reasonable "bare minimum"
approach to try/catch support.  Handle `try`, `catch`, and `end try`
lexemes in the parser, emitting TryCatch statements for the interpreter
to execute naively.

see sjbarag/brs#554#554
lvcabral pushed a commit to lvcabral/brs-engine that referenced this issue Nov 29, 2023
RBI 9.4 adds support for error handling via the `try`/`catch` model [1].
Interestingly, `try`, `catch`, and `endtry` are all valid identifiers!
That makes parsing a little bit tougher, but it's not unprecedented in
this language.  Detect `try`/`catch`/throw`/`end try` during lexing and
emit the proper lexemes.

[1] https://developer.roku.com/docs/references/brightscript/language/error-handling.html
see sjbarag/brs#554
lvcabral pushed a commit to rokucommunity/brs that referenced this issue Nov 29, 2023
RBI 9.4 adds support for error handling via the `try`/`catch` model [1].
Interestingly, `try`, `catch`, and `endtry` are all valid identifiers!
That makes parsing a little bit tougher, but it's not unprecedented in
this language.  Detect `try`/`catch`/throw`/`end try` during lexing and
emit the proper lexemes.

[1] https://developer.roku.com/docs/references/brightscript/language/error-handling.html
see sjbarag#554
lvcabral pushed a commit to rokucommunity/brs that referenced this issue Nov 29, 2023
Throwing exceptions and catching them aren't yet supported in `brs`, so
executing only the `try` block seems to be a reasonable "bare minimum"
approach to try/catch support.  Handle `try`, `catch`, and `end try`
lexemes in the parser, emitting TryCatch statements for the interpreter
to execute naïvely.

see sjbarag#554
lvcabral added a commit to lvcabral/brs-engine that referenced this issue Nov 29, 2023
* feat(parse): Consume try, catch, and end try lexemes

Throwing exceptions and catching them aren't yet supported in `brs`, so
executing only the `try` block seems to be a reasonable "bare minimum"
approach to try/catch support.  Handle `try`, `catch`, and `end try`
lexemes in the parser, emitting TryCatch statements for the interpreter
to execute naively.

see sjbarag/brs#554#554

* feat(lex): Emit try/catch/throw lexemes for parsing

RBI 9.4 adds support for error handling via the `try`/`catch` model [1].
Interestingly, `try`, `catch`, and `endtry` are all valid identifiers!
That makes parsing a little bit tougher, but it's not unprecedented in
this language.  Detect `try`/`catch`/throw`/`end try` during lexing and
emit the proper lexemes.

[1] https://developer.roku.com/docs/references/brightscript/language/error-handling.html
see sjbarag/brs#554

* Removing `super()` from TryCatch statement implementation

---------

Co-authored-by: Sean Barag <[email protected]>
TwitchBronBron added a commit to rokucommunity/brs that referenced this issue Dec 1, 2023
* feat(lex): Emit try/catch/throw lexemes for parsing

RBI 9.4 adds support for error handling via the `try`/`catch` model [1].
Interestingly, `try`, `catch`, and `endtry` are all valid identifiers!
That makes parsing a little bit tougher, but it's not unprecedented in
this language.  Detect `try`/`catch`/throw`/`end try` during lexing and
emit the proper lexemes.

[1] https://developer.roku.com/docs/references/brightscript/language/error-handling.html
see sjbarag#554

* feat(parse): Consume try, catch, and end try lexemes

Throwing exceptions and catching them aren't yet supported in `brs`, so
executing only the `try` block seems to be a reasonable "bare minimum"
approach to try/catch support.  Handle `try`, `catch`, and `end try`
lexemes in the parser, emitting TryCatch statements for the interpreter
to execute naïvely.

see sjbarag#554

* Fixed Test Case

---------

Co-authored-by: Sean Barag <[email protected]>
Co-authored-by: Bronley Plumb <[email protected]>
lvcabral pushed a commit to rokucommunity/brs that referenced this issue Apr 4, 2024
Throwing exceptions and catching them aren't yet supported in `brs`, so
executing only the `try` block seems to be a reasonable "bare minimum"
approach to try/catch support.  Handle `try`, `catch`, and `end try`
lexemes in the parser, emitting TryCatch statements for the interpreter
to execute naïvely.

see sjbarag#554
lvcabral pushed a commit to rokucommunity/brs that referenced this issue Apr 4, 2024
Throwing exceptions and catching them aren't yet supported in `brs`, so
executing only the `try` block seems to be a reasonable "bare minimum"
approach to try/catch support.  Handle `try`, `catch`, and `end try`
lexemes in the parser, emitting TryCatch statements for the interpreter
to execute naïvely.

see sjbarag#554
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any addition to this project's existing capabilities interpreter Affects this project's tree-walking interpreter lexer Affects this project's lexer (aka scanner) parser Affects this project's token parser
Projects
None yet
Development

No branches or pull requests

1 participant