From af6b4f93bae917b0f57020e46d187ce30e494625 Mon Sep 17 00:00:00 2001 From: "Magomed Kostoev (mkostoevr)" Date: Tue, 29 Jun 2021 17:41:04 +0000 Subject: [PATCH] [asmxygen] Translate dict in AsmReaderReadingComments into just a set of fields git-svn-id: svn://kolibrios.org@8974 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/asmxygen.py | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/kernel/trunk/asmxygen.py b/kernel/trunk/asmxygen.py index 27fd5b3646..f5786ed6ba 100644 --- a/kernel/trunk/asmxygen.py +++ b/kernel/trunk/asmxygen.py @@ -5,8 +5,6 @@ import sys """ TODO: - Optimize name and var_type checking - - Translate dict in AsmReaderReadingComments into just a set of fields - - Check if we should return handled_files from handle_file """ # Parameters @@ -1263,36 +1261,30 @@ class AsmReaderReadingComments(AsmReaderRecognizingStrings): def status_reset(self): # If the line has non-comment code - self.status['has_code'] = False + self.status_has_code = False # If the line has a comment at the end - self.status['has_comment'] = False + self.status_has_comment = False # Let it recognize strings further, we are definitely out of a comment self.should_recognize_strings = True def status_set_has_comment(self): - self.status['has_comment'] = True + self.status_has_comment = True # Don't let it recognize strings cause we are in a comment now self.should_recognize_strings = False def status_set_has_code(self): - self.status['has_code'] = True - - def status_has_comment(self): - return self.status['has_comment'] - - def status_has_code(self): - return self.status['has_code'] + self.status_has_code = True def update_status(self): # If we aren't in a comment and we aren't in a string - say we are now in a comment if ';' met - if not self.status_has_comment() and not self.in_string and self.curr() == ';': + if not self.status_has_comment and not self.in_string and self.curr() == ';': self.status_set_has_comment() # Else if we are in a comment - collect the comment - elif self.status_has_comment(): + elif self.status_has_comment: self.comment += self.curr() # Else if there's some non-whitespace character out of a comment # then the line has code - elif not self.status_has_comment() and not self.curr().isspace(): + elif not self.status_has_comment and not self.curr().isspace(): self.status_set_has_code() def step(self): @@ -1307,7 +1299,7 @@ class AsmReaderReadingComments(AsmReaderRecognizingStrings): # If the line we leave was not a comment-only line # then forget the collected comment # 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 = '' # Reset the line status (now it's the status of the new line) self.status_reset()