m2isar.frontends.coredsl2.importer ================================== .. py:module:: m2isar.frontends.coredsl2.importer .. autoapi-nested-parse:: Classes to recursively import files of a CoreDSL model. Classes ------- .. autoapisummary:: m2isar.frontends.coredsl2.importer.Importer m2isar.frontends.coredsl2.importer.VisitImporter m2isar.frontends.coredsl2.importer.ImportPathExtender Functions --------- .. autoapisummary:: m2isar.frontends.coredsl2.importer.recursive_import Module Contents --------------- .. py:class:: Importer(search_path) Bases: :py:obj:`m2isar.frontends.coredsl2.parser_gen.CoreDSL2Listener` .. autoapi-inheritance-diagram:: m2isar.frontends.coredsl2.importer.Importer :parts: 1 :private-bases: ANTLR listener based importer. Bad on performance, as it traverses the entire parse tree when it only has to look for import statements. .. py:attribute:: imported .. py:attribute:: new_children :value: [] .. py:attribute:: new_defs :value: [] .. py:attribute:: got_new :value: True .. py:attribute:: search_path .. py:method:: enterImport_file(ctx: m2isar.frontends.coredsl2.parser_gen.CoreDSL2Parser.Import_fileContext) The actual import functionality. Extracts the filename to import, constructs a new parser and parses the next file. .. py:function:: recursive_import(tree, search_paths) Helper method to recursively process all import statements of a given parse tree. The search path should be set to the directory of the root document. .. py:class:: VisitImporter(search_paths: List[pathlib.Path]) Bases: :py:obj:`m2isar.frontends.coredsl2.parser_gen.CoreDSL2Visitor` .. autoapi-inheritance-diagram:: m2isar.frontends.coredsl2.importer.VisitImporter :parts: 1 :private-bases: Importer class based on an ANTLR Visitor. Only traverses the model tree to the import statements and stops traversion after that. .. py:attribute:: imported .. py:attribute:: new_children :value: [] .. py:attribute:: new_imports :value: [] .. py:attribute:: new_defs :value: [] .. py:attribute:: got_new :value: True .. py:attribute:: logger .. py:attribute:: search_paths .. py:method:: visitDescription_content(ctx: m2isar.frontends.coredsl2.parser_gen.CoreDSL2Parser.Description_contentContext) .. py:method:: visitImport_file(ctx: m2isar.frontends.coredsl2.parser_gen.CoreDSL2Parser.Import_fileContext) The actual import functionality. Extracts the filename to import, constructs a new parser and parses the next file. .. py:class:: ImportPathExtender(search_paths: List[pathlib.Path]) Bases: :py:obj:`m2isar.frontends.coredsl2.parser_gen.CoreDSL2Visitor` .. autoapi-inheritance-diagram:: m2isar.frontends.coredsl2.importer.ImportPathExtender :parts: 1 :private-bases: ANTLR visitor to resolve relative import paths. Replaces all import URIs with their equivalent absolute path, relative to search_path. .. py:attribute:: search_paths .. py:method:: visitDescription_content(ctx: m2isar.frontends.coredsl2.parser_gen.CoreDSL2Parser.Description_contentContext) .. py:method:: visitImport_file(ctx: m2isar.frontends.coredsl2.parser_gen.CoreDSL2Parser.Import_fileContext)