[ASMXYGEN] Make it read comments before align specifier

git-svn-id: svn://kolibrios.org@9403 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Magomed Kostoev (mkostoevr) 2021-12-05 15:46:26 +00:00
parent e259e30fbf
commit 162c652619

View File

@ -192,6 +192,9 @@ class LegacyAsmReader:
self.line_idx = 0 self.line_idx = 0
self.i = 0 self.i = 0
def currline(self):
return self.lines[self.line_idx]
def curr(self): def curr(self):
try: return self.lines[self.line_idx][self.i] try: return self.lines[self.line_idx][self.i]
except: return '' except: return ''
@ -298,12 +301,17 @@ class AsmReaderReadingComments(AsmReaderRecognizingStrings):
return c return c
def nextline(self): def nextline(self):
prev_line = self.currline()
super().nextline() super().nextline()
# If the line we leave was not a comment-only line # If the line we leave was not a comment-only line
# then forget the collected comment # then forget the collected comment
# Otherwise the collected comment should be complemented by comment from next line in step() # Otherwise the collected comment should be complemented by comment from next line in step()
if self.status_has_code: if self.status_has_code:
self.comment = '' # But we should preserve comment for the next line
# If previous line set align (cause many functions re documented
# right before align set, not before their labels)
if not prev_line.startswith("align "):
self.comment = ''
# Reset the line status (now it's the status of the new line) # Reset the line status (now it's the status of the new line)
self.status_reset() self.status_reset()
# Set new status for this line according to the first character in the line # Set new status for this line according to the first character in the line