Skip to content
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
16 changes: 8 additions & 8 deletions erfa_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@


class FunctionDoc:

def __init__(self, doc):
self.doc = doc.replace("**", " ").replace("/*\n", "").replace("*/", "")
self.doc = self.doc.replace("/*+\n", "") # accommodate eraLdn
self.doc = self.doc.replace("* ", " " * 2) # accommodate eraAticqn
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is the main culprit. It replaces the substring "* " with " " anywhere within the doc comment of any function, but should only replace the beginnings of two lines in the eraAticqn() doc comment.

self.doc = self.doc.replace("*\n", "\n") # accommodate eraAticqn
def __init__(self, doc: str, pyname: str) -> None:
if pyname == "ldn":
doc = doc.removeprefix("+")
elif pyname == "aticqn":
doc = doc.replace("\n* ", "\n** ", 2).replace("\n*\n", "\n**\n", 1)
self.doc: Final = doc.replace("\n**", "\n ").removeprefix("\n")

def _get_arg_doc_list(self, doc_lines):
"""Parse input/output doc section lines, getting arguments from them.
Expand Down Expand Up @@ -322,11 +322,11 @@ def __init__(self, name, source_path):
self.name = name
self.pyname = name.split('era')[-1].lower()

pattern = fr"\n([^\n]+{name} ?\([^)]+\)).+?(/\*.+?\*/)"
pattern = fr"\n([^\n]+{name} ?\([^)]+\)).+?/\*(.+?)\*/"
p = re.compile(pattern, flags=re.DOTALL | re.MULTILINE)
search = p.search((source_path / (self.pyname + ".c")).read_text())
self.cfunc = " ".join(search.group(1).split())
self.doc = FunctionDoc(search.group(2))
self.doc: Final = FunctionDoc(search.group(2), self.pyname)

self.args = []
for arg in re.search(r"\(([^)]+)\)", self.cfunc).group(1).split(', '):
Expand Down