Skip to content

Commit

Permalink
Merge branch '#150-Modify-Correct-Parser-Code'
Browse files Browse the repository at this point in the history
  • Loading branch information
schmouk committed Feb 4, 2019
2 parents 0f0d97e + c678171 commit c0e21ca
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
7 changes: 3 additions & 4 deletions Language-specifications/typee_specs_LL1-v9-1.grm
Original file line number Diff line number Diff line change
Expand Up @@ -584,26 +584,25 @@ SOFTWARE.
| EPS

<enum list> ::= <enum item> <enum list'>
## | EPS ####
<enum list'> ::= ',' <enum item> <enum list'>
| EPS

<exclude statement> ::= 'exclude' <languages> '{{' <statements list> '}}'

<file endianness> ::= '<' <expression> <file endianness'> ####
<file endianness> ::= '<' <expression> <file endianness'>
| '>' <expression> <file endianness'>
<file endianness'> ::= '<<' <expression> <file endianness'>
| '>>' <expression> <file endianness'>
| '>>>' <expression> <file endianness'>
| EPS

<file flushing> ::= '!' <dotted.name> <file flushing'> ####
<file flushing> ::= '!' <dotted name> <file flushing'>
<file flushing'> ::= '(' <expression> <file flushing''> ')'
| '[' <expression> ']' '=' <expression>
| '>>' <expression>
| '>>>' <expression>
| EPS
<file flushing''> ::= ',' <expression> <file flushing'> ####
<file flushing''> ::= ',' <expression> <file flushing'>
| EPS

<flow statement> ::= 'break'
Expand Down
22 changes: 11 additions & 11 deletions src/FrontEnd/Errors/fe_syntax_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,17 @@ class FESyntaxErrors:
EXCLUDE_LANGS = 'missing or badly formed targeted languages list in exclude clause',
EXPR_FOR_COMPREHENSION = 'missing keyword for after expression in comprehension clause',

FILE_ENDIAN_EXPR = 'missing or badly formed file identifier or expression after endianness specification',
FILE_FLUSH_APPEND_EXPR = 'missing or badly formed expression to be appended at end while flushing file',
FILE_FLUSH_FUNC_CALL = 'missing or badly form expression in function or method arguments while flushing file',
FILE_FLUSH_FUNC_END = 'missing ) at end of function call while flushing file',
FILE_FLUSH_IDENT = 'missing or badly formed file identifier after flushing operator "!"',
FILE_FLUSH_INDEX = 'missing or badly formed expression in container index while flushing file',
FILE_FLUSH_INDEX_ASSIGN = 'missing = for storage while flushing indexed file,'
FILE_FLUSH_INDEX_END = 'missing ] at end of container index while flushing file',
FILE_FLUSH_INDEX_EXPR = 'missing or badly formed expression to be stored while flushing indexed file',
FILE_FLUSH_STORE_EXPR = 'missing or badly formed expression to be stored while flushing file',
FILE_STREAM_EXPR = 'missing or badly formed identifier or expression in file streaming statement',
FILE_ENDIAN_EXPR = 'missing or badly formed expression after file identifier while specifying endianness',
FILE_FLUSH_APPEND_EXPR = 'missing or badly formed expression in file appending while flushing file',
FILE_FLUSH_FUNC_CALL = 'missing or badly formed arguments of function/method while flushing file',
FILE_FLUSH_FUNC_END = 'missing ) at end of arguments of function/method call while flushing file',
FILE_FLUSH_IDENT = 'missing or badly formed identifier of file while applying flush operator "!"',
FILE_FLUSH_INDEX = 'missing or badly formed expression in index while flushing indexed file',
FILE_FLUSH_INDEX_ASSIGN = 'missing = after container indexing while flushing file',
FILE_FLUSH_INDEX_END = 'missing ] at end of index while flushing indexed file',
FILE_FLUSH_INDEX_EXPR = 'missing or badly formed expression to store while flushing indexed file'
FILE_FLUSH_STREAM_EXPR = 'missing or badly formed expression in file streaming while flushing file',
FILE_STREAM_EXPR = 'missing or badly formed expression in file streaming while specifying endianness',
FINAL_DEF = 'missing type identifier after keyword "final"',
FOR_BODY = 'missing instruction or block of instructions after for clause in for instruction',
FOR_COMPR_CONDITION = 'missing or badly formed condition after keyword "if" in for-comprehension clause',
Expand Down
8 changes: 4 additions & 4 deletions src/FrontEnd/Parser/fe_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,7 @@ def _file_endianness1(self) -> bool:
#=======================================================================
while self._current.is_SHIFTL() or \
self._current.is_SHIFTR() or \
self._current.is_SHIFT0L():
self._current.is_SHIFT0R():
self._append_syntaxic_node()
self._next_token_node()
if not self._expression():
Expand All @@ -1415,12 +1415,12 @@ def _file_endianness1(self) -> bool:
#-------------------------------------------------------------------------
def file_flushing(self) -> bool:
#=======================================================================
# <file flushing> ::= '!' <expression> <file flushing'>
# <file flushing> ::= '!' <dotted name> <file flushing'>
#=======================================================================
if self._current.is_EXCL():
self._append_syntaxic_node()
self._next_token_node()
if not self._expression()():
if not self._dotted_name():
self._append_error( FESyntaxErrors.FILE_FLUSH_IDENT )
self._file_flushing1();
return True
Expand Down Expand Up @@ -1468,7 +1468,7 @@ def file_flushing1(self) -> bool:
self._append_syntaxic_node()
self._next_token_node()
if not self._expression():
self._append_error( FESyntaxErrors.FILE_FLUSH_STORE_EXPR )
self._append_error( FESyntaxErrors.FILE_FLUSH_STREAM_EXPR )
elif self._current.is_SHIFT0R():
self._append_syntaxic_node()
self._next_token_node()
Expand Down

0 comments on commit c0e21ca

Please sign in to comment.