Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Jac Formatter Update #93

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions jaclang/jac/passes/tool/jac_formatter_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def exit_sub_node_list(self, node: ast.SubNodeList) -> None:
"""
count = 0
for stmt in node.kid:
if isinstance(node.parent, ast.EnumDef) and stmt.gen.jac == ",":
if isinstance(node.parent, (ast.EnumDef, ast.Enum)) and stmt.gen.jac == ",":
self.indent_level -= 1
self.emit_ln(node, f"{stmt.gen.jac}")
self.indent_level += 1
Expand Down Expand Up @@ -376,6 +376,8 @@ def exit_ability(self, node: ast.Ability) -> None:
self.emit_ln(node, node.doc.gen.jac)
start = True
for i in node.kid:
if isinstance(i, ast.String):
continue
if isinstance(i, ast.CommentToken):
if i.is_inline:
self.emit(node, f" {i.gen.jac}")
Expand Down Expand Up @@ -463,7 +465,9 @@ def exit_enum(self, node: ast.Enum) -> None:
self.emit_ln(node, node.doc.value)
start = True
for i in node.kid:
if isinstance(i, ast.CommentToken):
if isinstance(i, ast.String):
continue
elif isinstance(i, ast.CommentToken):
if i.is_inline:
self.emit(node, f" {i.gen.jac}")
else:
Expand Down
Loading