riscemu.types.program_loader module
- class riscemu.types.program_loader.ProgramLoader(source_path: str, options: Dict[str, Any])
Bases:
ABC
A program loader is always specific to a given source file. It is a place to store all state concerning the parsing and loading of that specific source file, including options.
- __init__(source_path: str, options: Dict[str, Any])
- abstract classmethod can_parse(source_path: str) float
Return confidence that the file located at source_path should be parsed and loaded by this loader :param source_path: the path of the source file :return: the confidence that this file belongs to this parser
- abstract classmethod get_options(argv: List[str]) [List[str], Dict[str, Any]]
parse command line args into an options dictionary
- Parameters:
argv – the command line args list
- Returns:
all remaining command line args and the parser options object
- classmethod instantiate(source_path: str, options: Dict[str, Any]) ProgramLoader
Instantiate a loader for the given source file with the required arguments
- Parameters:
source_path – the path to the source file
options – the parsed options (guaranteed to come from this classes get_options method.
- Returns:
An instance of a ProgramLoader for the spcified source