-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds the ability to add multiple IF conditions in an IF block by using `if else`: ``` if x { ... } else if y { ... } else if z { ... } else { ... } ``` I decided to change the data structure that represents IFs because it was very limited, only allowing for a condition, a consequence and an alternative consequence. Now IFs are a list of `Scenario`, made of conditions and consequences. If we encounter a bare `else` we set the condition of that scenario to true, so that it always evaluates to true. One funny thing that this structure does is that it allows for code like this: ``` if x { ... } else { ... } else if y { ... } ``` (`else` before `else if`) I honestly don't mind having this (it's a fun easter egg), but we might want to raise a parser error later on if users find it annoying.
- Loading branch information
Showing
6 changed files
with
270 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.