Skip to content

Try reduce the duplication in rule callbacks #37

Description

@kunaltyagi

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 #35 (comment)

This could be done for just some of the callbacks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions