Skip to content

Commit

Permalink
#150-Modify-Correct Parser code
Browse files Browse the repository at this point in the history
Corrected module `FrontEnd/Parser/fe_parser.py` according to corrections on rule `<statements_block>`.
  • Loading branch information
schmouk committed Feb 8, 2019
1 parent 85ffca3 commit c50d120
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Language-specifications/typee_specs_LL1-v9-1.grm
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ SOFTWARE.
<simple statement end> ::= ';'

<statements block> ::= '{' <statements list> '}'
| <empty statement> <statements block> ###
| <compound statement> ###
| <empty statement> <statements block> ###
| <simple statement> ###
## | <nop statement> <simple statement end> ###
## | <simple statement end> ###
Expand Down
13 changes: 6 additions & 7 deletions src/FrontEnd/Parser/fe_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3050,8 +3050,9 @@ def _spaced_template_def(self) -> bool: ###
def _statements_block(self) -> bool: ###
#=======================================================================
# <statements block> ::= '{' <statements list> '}'
# | <nop statement> <simple statement end>
# | <simple statement end>
# | <compound statement>
# | <empty statement> <statements block>
# | <simple statement>
#=======================================================================
if self._current.is_BRACEOP():
self._append_syntaxic_node()
Expand All @@ -3064,12 +3065,10 @@ def _statements_block(self) -> bool: ###
else:
self._append_error( FESyntaxErrors.BODY_END )
return True
elif self._nop_statement():
if not self._simple_statement_end():
self._append_error( FESyntaxErrors.STATEMENT_END )
return True
elif self._simple_statement_end():
elif self._compound_statement() or self._simple_statement():
return True
elif self._empty_statement():
return self._statements_block()
else:
return False

Expand Down

0 comments on commit c50d120

Please sign in to comment.