nopasaran.parsers.interpreter_parser.Parser¶
- class nopasaran.parsers.interpreter_parser.Parser¶
Bases:
objectA class for parsing commands and validating arguments.
- __init__()¶
Methods
__init__()parse(command, input_args, output_args[, ...])Parse the command and validate the arguments.
- static parse(command, input_args, output_args, optional_inputs=False, optional_outputs=False)¶
Parse the command and validate the arguments.
This method parses the command and validates the number of input and output arguments based on the specified constraints.
- Args:
command (str): The command to parse. input_args (int): The expected number of input arguments. output_args (int): The expected number of output arguments. optional_inputs (bool, optional): Whether optional inputs are allowed. Defaults to False. optional_outputs (bool, optional): Whether optional outputs are allowed. Defaults to False.
- Returns:
tuple: A tuple containing two lists: the input arguments and the output arguments.
- Raises:
- RuntimeError: If the command has too many or too few argument sets,
incorrect number of inputs or outputs, or if the arguments do not match the expected constraints.