nsiqcppstyle
nsiqcppstyle copied to clipboard
Try reduce the duplication in rule callbacks
In a future PR, let's see if we can reduce the duplication by:
def RunPreprocessRule(self, lexer: Lexer, contextStack: ??) -> None:
""" Run rules which runs in the preprecessor blocks """
_RunLexerRules(self.preprocessRules, lexer, contextStack)
def _RunLexerRules(self, rules: List[Callable], lexer, *args, **kwargs) -> None
for rule in rules:
data = lexer.Backup()
rule(lexer, *args, **kwargs)
lexer.Restore(data)
Originally posted by @kunaltyagi in https://github.com/kunaltyagi/nsiqcppstyle/pull/35#discussion_r908757475
This could be done for just some of the callbacks
https://github.com/kunaltyagi/nsiqcppstyle/pull/35#discussion_r908763042