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

Commit

Permalink
Restore changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shaldengeki committed Feb 14, 2024
1 parent d0b02f7 commit 2009b32
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/proto_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ def construct(
@staticmethod
def parse_syntax_and_preceding_comments(
proto_content: str,
) -> tuple[ProtoSyntax, Sequence[ProtoComment], str]:
) -> tuple[ProtoSyntax, Sequence[ProtoNode], str]:
# First, parse any preceding comments.
parsed_tree = []
parsed_tree: list[ProtoNode] = []
while True:
for node_type in [ProtoSingleLineComment, ProtoMultiLineComment]:
try:
Expand All @@ -161,6 +161,7 @@ def parse_syntax_and_preceding_comments(
raise ValueError(f"Proto doesn't have parseable syntax:\n{proto_content}")
syntax = syntax_match.node
proto_content = syntax_match.remaining_source.strip()
parsed_tree.append(syntax)

return syntax, parsed_tree, proto_content

Expand All @@ -172,7 +173,7 @@ def normalize(self) -> Optional["ProtoNode"]:
)

def serialize(self) -> str:
serialized_parts = [self.syntax.serialize()]
serialized_parts = []
previous_type: type[ProtoNode] = self.syntax.__class__
for node in self.nodes:
# Attempt to group up lines of the same type.
Expand Down

0 comments on commit 2009b32

Please sign in to comment.