Skip to content

Commit 2f10785

Browse files
committed
Fix semicolons in field lists appearing in the AST
1 parent 4ad3d82 commit 2f10785

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

rezparser/parser.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,8 +1103,11 @@ def p_field(self, p):
11031103
symbolic_constants=symconsts,
11041104
is_key=is_key,
11051105
)
1106+
elif p[1] == ";":
1107+
# Remove semicolons
1108+
p[0] = None
11061109
else:
1107-
# Anything else (semicolon, fill, align, array, switch) can be passed through as-is.
1110+
# Anything else (fill, align, array, switch) can be passed through as-is.
11081111
p[0] = p[1]
11091112

11101113
return p
@@ -1114,7 +1117,11 @@ def p_fields(self, p):
11141117
| fields field
11151118
"""
11161119

1117-
p[0] = p[1] + p[2:]
1120+
if len(p) > 2 and p[2]:
1121+
p[0] = p[1] + [p[2]]
1122+
else:
1123+
p[0] = p[1]
1124+
11181125
return p
11191126

11201127
def p_type_statement(self, p):

0 commit comments

Comments
 (0)