Skip to content

Commit

Permalink
chore: correct wrong rebase (#20)
Browse files Browse the repository at this point in the history
Corrects some changes that were lost on a previous rebase.
  • Loading branch information
Nirei authored Jan 2, 2025
1 parent 10b8c9d commit 3a297b0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ def __init__(
self,
grammar=grammar.imperivm,
visitor=visitor.ImperivmVisitor(),
preprocessor=preprocessor.PipelinePreprocessor(
[preprocessor.CommentsPreprocessor()]
),
preprocessor=preprocessor.PipelinePreprocessor([preprocessor.CommentsPreprocessor()]),
):
self.grammar = grammar
self.visitor = visitor
Expand Down
6 changes: 2 additions & 4 deletions src/preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@

class Preprocessor(ABC):
@abstractmethod
def process(self, program: str):
def process(self, program: str) -> str:
pass


class CommentsPreprocessor(Preprocessor):
@override
def process(self, program: str):
cleaned_program = map(
lambda line: re.sub(r"#.*$", "", line), program.splitlines()
)
cleaned_program = map(lambda line: re.sub(r"#.*$", "", line), program.splitlines())
return "\n".join(cleaned_program)


Expand Down

0 comments on commit 3a297b0

Please sign in to comment.