m2isar.frontends.coredsl2.importer
Classes to recursively import files of a CoreDSL model.
Classes
ANTLR listener based importer. Bad on performance, as it traverses |
|
Importer class based on an ANTLR Visitor. Only traverses the model tree |
|
ANTLR visitor to resolve relative import paths. Replaces all import URIs |
Functions
|
Helper method to recursively process all import statements of a given |
Module Contents
- class Importer(search_path)[source]
Bases:
m2isar.frontends.coredsl2.parser_gen.CoreDSL2Listener
ANTLR listener based importer. Bad on performance, as it traverses the entire parse tree when it only has to look for import statements.
- enterImport_file(ctx: m2isar.frontends.coredsl2.parser_gen.CoreDSL2Parser.Import_fileContext)[source]
The actual import functionality. Extracts the filename to import, constructs a new parser and parses the next file.
- recursive_import(tree, search_path)[source]
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.
- class VisitImporter(search_path)[source]
Bases:
m2isar.frontends.coredsl2.parser_gen.CoreDSL2Visitor
Importer class based on an ANTLR Visitor. Only traverses the model tree to the import statements and stops traversion after that.
- visitDescription_content(ctx: m2isar.frontends.coredsl2.parser_gen.CoreDSL2Parser.Description_contentContext)[source]
- visitImport_file(ctx: m2isar.frontends.coredsl2.parser_gen.CoreDSL2Parser.Import_fileContext)[source]
The actual import functionality. Extracts the filename to import, constructs a new parser and parses the next file.
- class ImportPathExtender(search_path: pathlib.Path)[source]
Bases:
m2isar.frontends.coredsl2.parser_gen.CoreDSL2Visitor
ANTLR visitor to resolve relative import paths. Replaces all import URIs with their equivalent absolute path, relative to search_path.
- visitDescription_content(ctx: m2isar.frontends.coredsl2.parser_gen.CoreDSL2Parser.Description_contentContext)[source]
- visitImport_file(ctx: m2isar.frontends.coredsl2.parser_gen.CoreDSL2Parser.Import_fileContext)[source]