How to use the pcpp.preprocessor function in pcpp

To help you get started, we’ve selected a few pcpp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ned14 / pcpp / tests / doctests.py View on Github external
def runTest(self):
        import doctest, pcpp.preprocessor
        failurecount, testcount = doctest.testmod(pcpp.preprocessor)
        #self.assertGreater(testcount, 0)
        self.assertEqual(failurecount, 0)
github Sei-Lisa / LSL-PyOptimizer / cpreproc.py View on Github external
"""
        if evaluating:
            return self.conditional_expression(evaluating)
        while True:
            result = self.conditional_expression(evaluating)
            if not self.eat(','):
                return result

    def evaluate(self):
        result = self.expression(True)

        # Did we eat all tokens?
        self.expect('END')
        return result

class Preproc(preprocessor.Preprocessor):
    def __init__(self, input, defines=(), sysincpaths=(), incpaths=()):
        super(Preproc, self).__init__()
        self.auto_pragma_once_enabled = False
        for define in defines:
            self.define('%s %s' % define)

        for v in sysincpaths:
            self.add_path(v)
        for v in incpaths:
            self.add_path(v)

        self.ignore = set()
        self.parser = self.parsegen(input, '', '')

    def get(self):
        try: