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

CAST handling of MATLAB conditional logic #613

Merged
merged 4 commits into from
Nov 1, 2023

Conversation

jastier
Copy link
Contributor

@jastier jastier commented Nov 1, 2023

MATLAB conditional logic added to CAST parser

This PR fixes the if statement handler in matlab_to_cast.py. We now fully support if elseif else conditional logic of arbitrary depth in MATLAB.

  • One if statement is always included
  • Zero or more elseif clauses can be included
  • Zero or one else clause can be included

Relevant issues

Completes issue #593
Partially completes issue #561

@jastier jastier added the lang/MATLAB Used for work related to MATLAB frontend label Nov 1, 2023
@jastier jastier self-assigned this Nov 1, 2023
@jastier jastier marked this pull request as draft November 1, 2023 01:05
@jastier jastier changed the title Jastier/cast conditional logic Jastier/matlab_conditional_logic Nov 1, 2023
@jastier jastier changed the title Jastier/matlab_conditional_logic MATLAB conditional logic Nov 1, 2023
Copy link
Contributor

@vincentraymond-ua vincentraymond-ua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jastier - Looks good!

@jastier jastier marked this pull request as ready for review November 1, 2023 14:28
@jastier jastier merged commit a66fba6 into main Nov 1, 2023
8 checks passed
@jastier jastier deleted the jastier/cast_conditional_logic branch November 1, 2023 15:00
github-actions bot added a commit that referenced this pull request Nov 1, 2023
## MATLAB conditional logic added to CAST parser

This PR fixes the if statement handler in `matlab_to_cast.py`. We now
fully support `if elseif else` conditional logic of arbitrary depth in
MATLAB.

- One `if` statement is always included
- Zero or more `elseif` clauses can be included
- Zero or one `else` clause can be included

## Relevant issues
Completes issue #593
Partially completes  issue #561

---------

Co-authored-by: Joseph Astier <[email protected]>
Co-authored-by: Vincent Raymond <[email protected]> a66fba6
@jastier jastier mentioned this pull request Nov 1, 2023
jastier added a commit that referenced this pull request Nov 1, 2023
## CAST test upgrades
This PR includes some test utilities for use when testing CAST output,
so common tests such as an assignment or an expression can be done as
single function calls. Some debug scripts are now executables. Minor
edits and code cleanup

## What's New
- Added `skema/program_analysis/CAST/matlab/tests/utils.py` with
functions for common testing tasks
- Added 3 conditional logic tests:
          `if`
          `if else`
          `if elseif else`

## Relevant issues
Related to PR #613 and #583

---------

Co-authored-by: Joseph Astier <[email protected]>
github-actions bot added a commit that referenced this pull request Nov 1, 2023
## CAST test upgrades
This PR includes some test utilities for use when testing CAST output,
so common tests such as an assignment or an expression can be done as
single function calls. Some debug scripts are now executables. Minor
edits and code cleanup

## What's New
- Added `skema/program_analysis/CAST/matlab/tests/utils.py` with
functions for common testing tasks
- Added 3 conditional logic tests:
          `if`
          `if else`
          `if elseif else`

## Relevant issues
Related to PR #613 and #583

---------

Co-authored-by: Joseph Astier <[email protected]> 77c96cb
@jastier jastier changed the title MATLAB conditional logic CAST handling of MATLAB conditional logic Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang/MATLAB Used for work related to MATLAB frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants