How to use the autoconfig.cxx_parsers_cfg function in autoconfig

To help you get started, we’ve selected a few autoconfig 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 gccxml / pygccxml / unittests / type_traits_tester.py View on Github external
def test(self):
        config = autoconfig.cxx_parsers_cfg.gccxml
        code = "struct const_item{ const int values[10]; };"
        global_ns = parser.parse_string(code, config)[0]
        ci = global_ns.class_('const_item')
        if ("CastXML" not in utils.xml_generator or
                utils.xml_output_version >= 1.138):
            # Prior to version 1.138, CastXML would incorrect create a default
            # constructor definition.
            # See https://github.com/CastXML/CastXML/issues/55
            # Copy constructor, destructor, variable
            self.assertEqual(len(ci.declarations), 3)
github gccxml / pygccxml / unittests / cache_enums_tester.py View on Github external
enum_matcher = declarations.declaration_matcher_t(
            name="EColor",
            decl_type=declarations.enumeration_t)

        color1 = declarations.matcher.get_single(enum_matcher, decls1)
        color2 = declarations.matcher.get_single(enum_matcher, decls2)
        self.assertTrue(color1.values == color2.values)

# there is no progress with this parser
# class synopsis_tester_t( tester_impl_t ):
#    CXX_PARSER_CFG = autoconfig.cxx_parsers_cfg.synopsis


class gccxml_tester_t(tester_impl_t):
    CXX_PARSER_CFG = autoconfig.cxx_parsers_cfg.gccxml


def create_suite():
    suite = unittest.TestSuite()
    # suite.addTest( unittest.makeSuite(synopsis_tester_t))
    suite.addTest(unittest.makeSuite(gccxml_tester_t))
    return suite


def run_suite():
    unittest.TextTestRunner(verbosity=2).run(create_suite())

if __name__ == "__main__":
    run_suite()
github gccxml / pygccxml / unittests / copy_constructor_tester.py View on Github external
# Extract the xml file from the bz2 archive
            bz2_path = os.path.join(
                autoconfig.data_directory,
                'ogre.1.7.xml.bz2')
            self.xml_path = os.path.join(
                autoconfig.data_directory,
                'ogre.1.7.xml')
            with open(self.xml_path, 'wb') as new_file:
                # bz2.BZ2File can not be used in a with statement in python 2.6
                bz2_file = bz2.BZ2File(bz2_path, 'rb')
                for data in iter(lambda: bz2_file.read(100 * 1024), b''):
                    new_file.write(data)
                bz2_file.close()

            reader = parser.source_reader_t(autoconfig.cxx_parsers_cfg.gccxml)
            self.global_ns = declarations.get_global_namespace(
                reader.read_xml_file(
                    self.xml_path))
            self.global_ns.init_optimizer()