Skip to content

Commit

Permalink
Removed too much newline
Browse files Browse the repository at this point in the history
  • Loading branch information
intoinside committed Jun 20, 2023
1 parent 9651dac commit 7f60020
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions KickAssemblerToDoxygen.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ def add_semicolor_to_label_declaration(content):

return content

def remove_some_newline(content):
"""Function printing python version."""
# content = content.replace("\n\n\n", "\n\n")
content = re.sub(r"[\n]{2,}\/\*\*", r"\n\n/**", content)

return content

def read_file(filename):
"""Function printing python version."""
print("Processing " + filename)
Expand Down Expand Up @@ -131,6 +138,8 @@ def convert_file(content):
content = remove_inital_dot_from_keywords(content)

content = add_semicolor_to_label_declaration(content)

content = remove_some_newline(content)
return content

def write_file(filename, content):
Expand Down
15 changes: 15 additions & 0 deletions test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,21 @@ def testAddSemicolonToLabel(self):
expected = "label xyz = $beef;"
self.assertEqual(add_semicolor_to_label_declaration(sourceCode), expected, "Should have semicolon at end")

def testRemoveSomeNewLine(self):
sourceCode = "\n\n\n/**"
expected = "\n\n/**"
self.assertEqual(remove_some_newline(sourceCode), expected, "Should have reduced newline")

def testRemoveSomeNewLine2(self):
sourceCode = "\n\n\n\n/**"
expected = "\n\n/**"
self.assertEqual(remove_some_newline(sourceCode), expected, "Should have reduced newline")

def testRemoveSomeNewLine2(self):
sourceCode = "\n/**"
expected = "\n/**"
self.assertEqual(remove_some_newline(sourceCode), expected, "Should have not reduced newline")

def testReplaceBodyInCurlyBrackets(self):
sourceCode = """.macro SetVICBank(bank) {
lda Cia.CIA2_DATA_PORT_A
Expand Down

0 comments on commit 7f60020

Please sign in to comment.