def setUp(self):
     self.macros = preprocessing_parser.Macros(config_flags={})
     self.macro_expander = macro_expander.MacroParser(self.macros)
     self.expression_parser = expression_parser.ExpressionParser()
     self.expression_evaluator = (
         macro_expression_evaluator_visitor.MacroExpressionEvaluatorVisitor(
             self.macros))
Пример #2
0
    def _preprocess_pre_ast(self):
        # First step - link includes in the Pre_AST forest.
        self._link_includes()

        # Second step - Use the config #defines to pre-process the Pre-AST.
        config_flags = self._extract_config_flags()

        # Pre-processor macro database.
        macros = preprocessing_parser.Macros(config_flags)

        # Get the preprocessing visitor.
        visitor = preprocessing_visitor.PreprocessingVisitor(
            macros, progress_cb=self.progress_cb)

        logging.info('PREPROCESSING')
        # Preprocess starting from the root node.
        root_node = self.pre_ast_forest["ROOT"]
        result = visitor.preprocess(root_node)
        logging.info('PREPROCESSED')

        return result
Пример #3
0
 def setUp(self):
     self.macros = preprocessing_parser.Macros()
     self.parser = preprocessing_parser.PreprocessingParser()
     self.visitor = preprocessing_visitor.PreprocessingVisitor(self.macros)
     self.macro_expander = macro_expander.MacroParser(self.macros,
                                                      eval_mode=True)