def __init__(self): super().__init__(FILE_INTERPRETER_ACTOR) self._tp = TextParser({ 'shell_syntax_concept': formatting.concept_(concepts.SHELL_SYNTAX_CONCEPT_INFO), 'LINE_COMMENT_MARKER': formatting.string_constant(LINE_COMMENT_MARKER), 'ACT_INTERPRETER': formatting.syntax_element( syntax_elements.ACT_INTERPRETER_SYNTAX_ELEMENT.singular_name), })
def _tp(self) -> TextParser: if self.__tp is None: from exactly_lib.definitions.entity import types from exactly_lib.definitions import matcher_model from exactly_lib.definitions import formatting from exactly_lib.definitions import misc_texts from exactly_lib.definitions.primitives import file_matcher self.__tp = TextParser({ 'MODEL': matcher_model.FILE_MATCHER_MODEL, 'PATH_ARGUMENT_POSITION': formatting.syntax_element(self._ARG_POS.name), 'PATH_ARG_MARKER': formatting.syntax_element( file_matcher.PROGRAM_ARG_OPTION__MARKER.argument), 'program': types.PROGRAM_TYPE_INFO.name, 'PROGRAM': syntax_elements.PROGRAM_SYNTAX_ELEMENT.singular_name, 'exit_code': misc_texts.EXIT_CODE, }) return self.__tp
'string_se': formatting.syntax_element_(syntax_elements.STRING_SYNTAX_ELEMENT), 'list_type': formatting.keyword(types.LIST_TYPE_INFO.name.singular), 'list_se': formatting.syntax_element_(syntax_elements.LIST_SYNTAX_ELEMENT), 'path_type': formatting.keyword(types.PATH_TYPE_INFO.name.singular), 'path_se': formatting.syntax_element_(syntax_elements.PATH_SYNTAX_ELEMENT), 'program_type': formatting.keyword(types.PROGRAM_TYPE_INFO.name.singular), 'symbol': formatting.concept_(concepts.SYMBOL_CONCEPT_INFO), 'hds': formatting.concept_(concepts.HOME_DIRECTORY_STRUCTURE_CONCEPT_INFO), 'SYMBOL_REFERENCE_SYNTAX_ELEMENT': formatting.syntax_element_(syntax_elements.SYMBOL_REFERENCE_SYNTAX_ELEMENT), 'TRANSFORMATION': instruction_arguments.STRING_TRANSFORMATION_ARGUMENT.name, 'define_symbol': instruction_names.SYMBOL_DEFINITION_INSTRUCTION_NAME, 'TEXT_UNTIL_END_OF_LINE': instruction_arguments.TEXT_UNTIL_END_OF_LINE_ARGUMENT.name, 'SYMBOL_NAME': formatting.syntax_element_(syntax_elements.SYMBOL_NAME_SYNTAX_ELEMENT), 'THE_PYTHON_INTERPRETER': program_info.PYTHON_INTERPRETER_WHICH_CAN_RUN_THIS_PROGRAM, 'PATH_OF_EXISTING_FILE': PATH_OF_EXISTING_FILE_OPT_CONFIG.argument_syntax_name, 'ARGUMENT': formatting.syntax_element(pgm_syntax_elements.ARGUMENT_SYNTAX_ELEMENT_NAME.name), 'SHELL_COMMAND_LINE': formatting.syntax_element_(syntax_elements.SHELL_COMMAND_LINE_SYNTAX_ELEMENT), }) DOCUMENTATION = _Documentation() _PGM_AND_ARGS = """\ A program followed by arguments until end of line. """ _PGM_WITH_ARG_LIST_INVOKATION_VARIANT_DESCRIPTION = """\ A program with a list of arguments. """ _SHELL_COMMAND_INVOKATION_VARIANT_DESCRIPTION = """\
def invokation_variants(self) -> List[InvokationVariant]: return single_eq_invokation_variants(a.Named(_ARG_NAME)) def syntax_element_descriptions(self) -> List[SyntaxElementDescription]: from exactly_lib.help.entities.configuration_parameters.objects.test_case_status import \ execution_modes_list return [ SyntaxElementDescription(_ARG_NAME, [execution_modes_list()]) ] def see_also_targets(self) -> list: return [conf_params.TEST_CASE_STATUS_CONF_PARAM_INFO.cross_reference_target] _ARG_NAME = formatting.syntax_element(conf_params.TEST_CASE_STATUS_CONF_PARAM_INFO.configuration_parameter_name) class Parser(InstructionParserThatConsumesCurrentLine): def _parse(self, rest_of_line: str) -> ConfigurationPhaseInstruction: status_element_arg = extract_single_eq_argument_string(rest_of_line) argument = status_element_arg.upper() try: target = NAME_2_STATUS[argument] except KeyError: raise SingleInstructionInvalidArgumentException('Invalid {status}: `{actual}`'.format( status=conf_params.TEST_CASE_STATUS_CONF_PARAM_INFO.configuration_parameter_name, actual=status_element_arg)) return _Instruction(target)
def syntax_element_name(self) -> str: return formatting.syntax_element(self.singular_name)
def syntax_element_descriptions(self) -> List[SyntaxElementDescription]: from exactly_lib.help.entities.configuration_parameters.objects.test_case_status import \ execution_modes_list return [SyntaxElementDescription(_ARG_NAME, [execution_modes_list()])] def notes(self) -> SectionContents: return self._tp.section_contents(_NOTES) def see_also_targets(self) -> List[SeeAlsoTarget]: return [ conf_params.TEST_CASE_STATUS_CONF_PARAM_INFO.cross_reference_target ] _ARG_NAME = formatting.syntax_element( conf_params.TEST_CASE_STATUS_CONF_PARAM_INFO.configuration_parameter_name) class Parser(InstructionParserThatConsumesCurrentLine): def _parse(self, rest_of_line: str) -> ConfigurationPhaseInstruction: status_element_arg = extract_single_eq_argument_string( _ARG_NAME, rest_of_line) argument = status_element_arg.upper() try: target = NAME_2_STATUS[argument] except KeyError: raise SingleInstructionInvalidArgumentException( 'Invalid {status}: `{actual}`'.format( status=conf_params.TEST_CASE_STATUS_CONF_PARAM_INFO. configuration_parameter_name, actual=status_element_arg))
syntax_elements.PROGRAM_SYNTAX_ELEMENT.singular_name, 'symbol': concepts.SYMBOL_CONCEPT_INFO.name, 'hds': concepts.HDS_CONCEPT_INFO.name, 'TRANSFORMATION': string_transformer.STRING_TRANSFORMATION_ARGUMENT.name, 'define_symbol': formatting.InstructionName( instruction_names.SYMBOL_DEFINITION_INSTRUCTION_NAME), 'instruction': concepts.INSTRUCTION_CONCEPT_INFO.name, 'SYMBOL_NAME': formatting.syntax_element_(syntax_elements.SYMBOL_NAME_SYNTAX_ELEMENT), 'ARGUMENT': formatting.syntax_element( syntax_elements.PROGRAM_ARGUMENT_SYNTAX_ELEMENT.singular_name), 'SHELL_COMMAND_LINE': formatting.syntax_element_( syntax_elements.SHELL_COMMAND_LINE_SYNTAX_ELEMENT), 'EOL': defs.END_OF_LINE, 'executable_file': formatting.misc_name_with_formatting(misc_texts.EXECUTABLE_FILE), 'FAIL': exit_values.EXECUTION__FAIL.exit_identifier, 'shell_command': formatting.misc_name_with_formatting(misc_texts.SHELL_COMMAND), 'relativity': formatting.misc_name_with_formatting(misc_texts.RELATIVITY), 'Note': headers.NOTE_LINE_HEADER,