Пример #1
0
    def setUp(self):
        super(TestStage1, self).setUp()
        r = Reader()
        self.parser = Parse1(r)

        r = CPP()
        self.cpp_parser = Parse1(r)
Пример #2
0
    def setUp(self):
        super(TestStage3, self).setUp()
        r = Reader()
        s1 = Parse1(r)
        s2 = Parse2(s1)
        self.parser = Parse3(s2, debug=True)

        r = CPP()
        s1 = Parse1(r)
        s2 = Parse2(s1)
        self.cpp_parser = Parse3(s2, debug=True)
Пример #3
0
    def setUp(self):
        super(TestStage4, self).setUp()
        r = Reader()
        s1 = Parse1(r)
        s2 = Parse2(s1)
        s3 = Parse3(s2)
        self.parser = Parse4(s3)
        self.forward_parser = Parse4(s3, True)

        r = CPP()
        s1 = Parse1(r)
        s2 = Parse2(s1)
        s3 = Parse3(s2)
        self.cpp_parser = Parse4(s3)
Пример #4
0
def cross_references(path, options):
    index = []

    # Setup a stage 0 parser, to optionally CPP the input.
    if options.cpp:
        s0 = CPP(options.toolprefix, options.cpp_flag)
    else:
        s0 = Reader()

    # Setup a stage 1 parser to translate the source(s) into a plyplus AST.
    s1 = Parse1(s0)

    # Setup a stage 2 parser, though we will not actually utilise its
    # functionality. We'll strip the import statements before going beyond
    # stage 1 to mask any subordinate parse errors.
    s2 = Parse2(s1)

    # Setup a stage 3 parser. This is as far as we will go, and we only go to
    # this point in order to take advantage of the `LiftedAST` representation.
    s3 = Parse3(s2)

    for base, name in get_files(path):
        abspath = os.path.join(base, name)

        # File index entry.
        yield '\n%s%s\n\n' % (pycscope.Mark(pycscope.Mark.FILE),
            abspath), abspath

        _, ast, _ = s1.parse_file(os.path.join(base, name))
Пример #5
0
 def setUp(self):
     super(TestStage5, self).setUp()
     r = Reader()
     s1 = Parse1(r)
     s2 = Parse2(s1)
     s3 = Parse3(s2, debug=True)
     s4 = Parse4(s3)
     self.parser = Parse5(s4)
Пример #6
0
 def setUp(self):
     super(TestStage8, self).setUp()
     r = Reader()
     s1 = Parse1(r)
     s2 = Parse2(s1)
     s3 = Parse3(s2, debug=True)
     s4 = Parse4(s3)
     s5 = Parse5(s4)
     s6 = Parse6(s5)
     s7 = Parse7(s6)
     self.parser = Parse8(s7)
Пример #7
0
 def setUp(self):
     super(TestExamples, self).setUp()
     self.reader = Reader()
     self.cpp = CPP()
     self.s1 = Parse1(self.cpp)
     self.s2 = Parse2(self.s1)
     self.s3 = Parse3(self.s2)
     self.s4 = Parse4(self.s3)
     self.s5 = Parse5(self.s4)
     self.s6 = Parse6(self.s5)
     self.s7 = Parse7(self.s6)
     self.s8 = Parse8(self.s7)
     self.s9 = Parse9(self.s8)
     self.s10 = Parse10(self.s9)
     assert all([hasattr(self, p) for p in PARSERS])
    def setUp(self):
        super(TestExamples, self).setUp()
        self.reader = Reader()
        self.cpp = CPP()
        self.s1 = Parse1(self.cpp)
        self.s2 = Parse2(self.s1)
        self.s3 = Parse3(self.s2)
        self.s4 = Parse4(self.s3)
        self.s5 = Parse5(self.s4)
        self.s6 = Parse6(self.s5)
        self.s7 = Parse7(self.s6)

        # initialise a dtb query parser
        dtbQuery = DtbMatchQuery()
        dtbQuery.parse_args(
            ['--dtb', os.path.join(os.path.dirname(ME), "test.dtb")])
        dtbQuery.check_options()

        self.s71 = QueryParseStage(self.s7,
                                   {dtbQuery.get_query_name(): dtbQuery})
        self.s8 = Parse8(self.s71)
        self.s9 = Parse9(self.s8)
        self.s10 = Parse10(self.s9)
        assert all([hasattr(self, p) for p in PARSERS])