Skip to content

Commit

Permalink
#253 - Front-End Parser - Test & Validation
Browse files Browse the repository at this point in the history
Fixed a few bugs.
  • Loading branch information
schmouk committed Sep 16, 2019
1 parent ac9225e commit 8101932
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/FrontEnd/Errors/fe_syntax_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class FESyntaxErrors:
CASTING_PAROP = 'missing ( in scalar type casting clause',
CLASS_BODY = 'missing class definition after class clause',
CLASS_NAME = 'missing or badly formed class name after keyword class',
COMMENT_NL = 'missing new line character at end of comment or multi-comment statement',
COMP_EXPR = 'missing or badly formed expression after comparison operator',
CONST_TYPE = 'missing or badly formed type identifier after keyword "const"',
CONTAINED_TYPE = 'missing type specification after < in contained type definition',
Expand Down
10 changes: 8 additions & 2 deletions src/FrontEnd/Parser/fe_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1172,9 +1172,15 @@ def _empty_statement(self) -> bool:
# <empty statement> ::= <comment>
# | <NEWLINE>
#=======================================================================
if self._current.is_COMMENT() or self._current.is_COMMENT_ML() or self._current.is_NL(): ## (notice: previously scanned by Scanner)
if self._current.is_COMMENT() or self._current.is_COMMENT_ML(): ## (notice: previously scanned by Scanner)
self._append_syntaxic_node()
self._new_line()
self._next_token_node()
if not self._new_line():
self._append_error( FESyntaxErrors.COMMENT_NL )
return True
elif self._current.is_NL():
self._append_syntaxic_node()
self._next_token_node()
return True
else:
return False
Expand Down

0 comments on commit 8101932

Please sign in to comment.