Esempio n. 1
0
def _get_preprocessor(config_flags):
  """A function that is a factory for preprocessor object."""
  object_like_macros = _get_object_like_macros(config_flags)

  function_like_macros = {}

  preprocessor_and_64bit_functions = (
      functions.get_preprocessor_and_64bit_functions()
  )

  lazy_and_state_dependent_functions = (
      lazy_functions.get_lazy_and_state_dependent_functions(
          object_like_macros,
          function_like_macros,
      )
  )

  macro_expression_evaluator = (
      macro_expression_evaluator_visitor.MacroExpressionEvaluatorVisitor(
          object_likes=object_like_macros,
          function_likes=function_like_macros,
          functions=preprocessor_and_64bit_functions,
          lazy_functions=lazy_and_state_dependent_functions,
      )
  )

  state_dependent_functions = lazy_functions.get_state_dependent_functions(
      object_like_macros,
      function_like_macros,
  )

  expression_parser_ = expression_parser.expression_parser()
  term_expression_evaluator = (
      macro_expression_evaluator_visitor.MacroExpressionEvaluatorVisitor(
          object_likes=object_like_macros,
          function_likes=function_like_macros,
          functions=functions.get_preprocessor_functions(),
          lazy_functions=state_dependent_functions,
          keep_parentheses=True,
      )
  )

  macro_expander_ = macro_expander.MacroExpander(
      expression_parser=expression_parser_,
      expression_evaluator=term_expression_evaluator,
  )

  return preprocessing_visitor.PreprocessingVisitor(
      object_likes=object_like_macros,
      function_likes=function_like_macros,
      functions=preprocessor_and_64bit_functions,
      expression_evaluator=macro_expression_evaluator,
      macro_expander=macro_expander_,
  )
Esempio n. 2
0
def _get_preprocessor(config_flags):
    """A function that is a factory for preprocessor object."""
    object_like_macros = _get_object_like_macros(config_flags)

    function_like_macros = {}

    preprocessor_and_64bit_functions = (
        functions.get_preprocessor_and_64bit_functions())

    lazy_and_state_dependent_functions = (
        lazy_functions.get_lazy_and_state_dependent_functions(
            object_like_macros,
            function_like_macros,
        ))

    macro_expression_evaluator = (
        macro_expression_evaluator_visitor.MacroExpressionEvaluatorVisitor(
            object_likes=object_like_macros,
            function_likes=function_like_macros,
            functions=preprocessor_and_64bit_functions,
            lazy_functions=lazy_and_state_dependent_functions,
        ))

    state_dependent_functions = lazy_functions.get_state_dependent_functions(
        object_like_macros,
        function_like_macros,
    )

    expression_parser_ = expression_parser.expression_parser()
    term_expression_evaluator = (
        macro_expression_evaluator_visitor.MacroExpressionEvaluatorVisitor(
            object_likes=object_like_macros,
            function_likes=function_like_macros,
            functions=functions.get_preprocessor_functions(),
            lazy_functions=state_dependent_functions,
            keep_parentheses=True,
        ))

    macro_expander_ = macro_expander.MacroExpander(
        expression_parser=expression_parser_,
        expression_evaluator=term_expression_evaluator,
    )

    return preprocessing_visitor.PreprocessingVisitor(
        object_likes=object_like_macros,
        function_likes=function_like_macros,
        functions=preprocessor_and_64bit_functions,
        expression_evaluator=macro_expression_evaluator,
        macro_expander=macro_expander_,
    )
Esempio n. 3
0
 def setUp(self):
   self.preprocessor_functions = functions.get_preprocessor_functions()