Skip to content

Commit

Permalink
Merge pull request #210 from Typee-Language/#150-Modify-Correct-Parse…
Browse files Browse the repository at this point in the history
…r-Code

#150 modify correct parser code
  • Loading branch information
schmouk committed Apr 11, 2019
2 parents d886807 + 5b7bb89 commit 55df5b7
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions src/FrontEnd/Parser/fe_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ def _atom(self) -> bool:
#=======================================================================
# <atom> ::= <decr> <dotted name> <incr or decr>
# | <incr> <dotted name> <incr or decr>
# | <dotted name> <atom'>
# | <enclosure>
# | <reference>
# | <scalar>
Expand All @@ -295,8 +294,6 @@ def _atom(self) -> bool:
if not self._dotted_name():
self._append_error( FESyntaxErrors.INCR_IDENT )
return self._incr_or_decr()
elif self._dotted_name():
return self._atom1()
else:
return self._enclosure() or \
self._reference() or \
Expand Down Expand Up @@ -336,30 +333,30 @@ def _atom_element(self) -> bool:

#-------------------------------------------------------------------------
def _atom_element1(self) -> bool:
#===============================================================================
# <atom element'> ::= <atom element''>
# | <dotted name'> <atom element'>
# | <function call> <atom element'>
# | <subscription or slicing> <atom element'>
# | EPS
#===============================================================================
if self._atom_element2():
return True
else:
while self._dotted_name1() or self._function_call() or self._subscription_or_slicing():
continue
return True
#=======================================================================
# <atom element'> ::= <atom'>
# | <atom element''>
#=======================================================================
return self._atom1() or self._atom_element2()

#-------------------------------------------------------------------------
def _atom_element2(self) -> bool:
#=======================================================================
# <atom element"> ::= <is instance of>
# | <scalar type casting>
# <atom element'' > ::= <dotted name'> <atom element''>
# | <function call> <atom element''>
# | <is instance of>
# | <scalar type casting>
# | <subscription or slicing> <atom element''>
# | EPS
#=======================================================================
while self._dotted_name1() or \
self._function_call() or \
self._subscription_or_slicing():
continue
if self._is_instance_of() or self._scalar_type_casting():
return True
else:
return False
return True

#-------------------------------------------------------------------------
def _atom_element3(self) -> bool:
Expand Down

0 comments on commit 55df5b7

Please sign in to comment.