Skip to content

Commit

Permalink
#150-Modify/Correct Parser code
Browse files Browse the repository at this point in the history
Implemented code related to the newly added `otherwise`  alternative to clause `else` in statement `if` - for language consistency with statements `while`, `for`, `try`, and `switch`.
  • Loading branch information
schmouk committed Apr 14, 2019
1 parent d3962f4 commit c0b834c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/FrontEnd/Parser/fe_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,10 +748,10 @@ def _condition1(self) -> bool:
self._next_token_node()
if not self._or_test():
self._append_error( FESyntaxErrors.IF_COND )
if self._current.is_ELSE():
if self._current.is_ELSE() or self._current.is_OTHERWISE():
self._append_syntaxic_node()
self._next_token_node()
if not self._self._expression():
if not self._expression():
self._append_error( FESyntaxErrors.IF_ELSE_EXPR )
return True
else:
Expand Down Expand Up @@ -1998,6 +1998,7 @@ def _if_statement1(self) -> bool:
# | 'elif' '(' <expression> ')' <statements block> <if statement'>
# | 'elsif' '(' <expression> ')' <statements block> <if statement'>
# | 'else' <statements block>
# | 'otherwise' <statements block>
# | EPS
#=======================================================================
while self._current.is_ELIF():
Expand Down

0 comments on commit c0b834c

Please sign in to comment.