@@ -868,6 +868,7 @@ def _decl_or_def_statement1(self) -> bool: ###
868
868
def _decl_or_def_statement2 (self ) -> bool : ###
869
869
#=======================================================================
870
870
# <decl or def statement''> ::= <TYPE'> <decl or def statement'''>
871
+ # | <enum definition>
871
872
# | <identifier> <decl constructor or decl end>
872
873
#=======================================================================
873
874
if self ._TYPE1 ():
@@ -878,6 +879,8 @@ def _decl_or_def_statement2(self) -> bool: ###
878
879
if not self ._decl_constructor_or_decl_end ():
879
880
self ._append_error ( FESyntaxErrors .DECL_DEF_TYPE )
880
881
return True
882
+ elif self ._enum_definition ():
883
+ return True
881
884
else :
882
885
self ._append_error ( FESyntaxErrors .VAR_TYPE )
883
886
return False
@@ -1206,7 +1209,7 @@ def _enum_definition(self) -> bool:
1206
1209
if self ._current .is_ENUM ():
1207
1210
self ._append_syntaxic_node ()
1208
1211
self ._next_token_node ()
1209
- if self ._current .is_IDENT :
1212
+ if self ._current .is_IDENT () :
1210
1213
self ._append_syntaxic_node ()
1211
1214
self ._next_token_node ()
1212
1215
else :
@@ -1216,12 +1219,9 @@ def _enum_definition(self) -> bool:
1216
1219
self ._next_token_node ()
1217
1220
else :
1218
1221
self ._append_error ( FESyntaxErrors .ENUM_BRACKET_OP )
1219
- if self ._enum_list ():
1220
- self ._append_syntaxic_node ()
1221
- self ._next_token_node ()
1222
- else :
1222
+ if not self ._enum_list ():
1223
1223
self ._append_error ( FESyntaxErrors .ENUM_LIST )
1224
- if self ._current .is_BRACKETCL :
1224
+ if self ._current .is_BRACKETCL () :
1225
1225
self ._append_syntaxic_node ()
1226
1226
self ._next_token_node ()
1227
1227
else :
@@ -1413,7 +1413,7 @@ def _file_endianness1(self) -> bool:
1413
1413
return True
1414
1414
1415
1415
#-------------------------------------------------------------------------
1416
- def file_flushing (self ) -> bool :
1416
+ def _file_flushing (self ) -> bool :
1417
1417
#=======================================================================
1418
1418
# <file flushing> ::= '!' <dotted name> <file flushing'>
1419
1419
#=======================================================================
@@ -1428,7 +1428,7 @@ def file_flushing(self) -> bool:
1428
1428
return False
1429
1429
1430
1430
#-------------------------------------------------------------------------
1431
- def file_flushing1 (self ) -> bool :
1431
+ def _file_flushing1 (self ) -> bool :
1432
1432
#=======================================================================
1433
1433
# <file flushing'> ::= '(' <expression> <file flushing''> ')'
1434
1434
# | '[' <expression> ']' '=' <expression>
@@ -2935,6 +2935,8 @@ def _simple_statement(self) -> bool: ###
2935
2935
# <simple statement> ::= <assert statement> <simple statement end>
2936
2936
# | <del statement> <simple statement end>
2937
2937
# | <ensure statement> <simple statement end>
2938
+ # | <file endianness>
2939
+ # | <file flushing>
2938
2940
# | <flow statement> <simple statement end>
2939
2941
# | <import statement> <simple statement end>
2940
2942
# | <nop statement> <simple statement end>
@@ -2945,6 +2947,8 @@ def _simple_statement(self) -> bool: ###
2945
2947
if self ._assert_statement () or \
2946
2948
self ._del_statement () or \
2947
2949
self ._ensure_statement () or \
2950
+ self ._file_endianness () or \
2951
+ self ._file_flushing () or \
2948
2952
self ._flow_statement () or \
2949
2953
self ._import_statement () or \
2950
2954
self ._nop_statement () or \
@@ -4139,5 +4143,3 @@ def _next_token_node(self) -> FEICodeTokenNode:
4139
4143
return self ._current
4140
4144
4141
4145
#===== end of FrontEnd.Parser.parser =====#
4142
-
4143
-
0 commit comments