Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try reduce the duplication in rule callbacks #37

Open
kunaltyagi opened this issue Jul 4, 2022 · 1 comment
Open

Try reduce the duplication in rule callbacks #37

kunaltyagi opened this issue Jul 4, 2022 · 1 comment

Comments

@kunaltyagi
Copy link
Owner

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

@kunaltyagi
Copy link
Owner Author

#35 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant