Exemplo n.º 1
0
    def __init__(self, name: str):
        super().__init__(name)
        self._tp = TextParser({
            'program_name': program_info.PROGRAM_NAME,
            'phase': phase_names.PHASE_NAME_DICTIONARY,
            'setup': phase_infos.SETUP.name,
            'act': phase_infos.ACT.name,
            'action_to_check': concepts.ACTION_TO_CHECK_CONCEPT_INFO.name,
            'home_directory': formatting.conf_param_(conf_params.HDS_CASE_DIRECTORY_CONF_PARAM_INFO),
            'sandbox': formatting.concept_(concepts.SDS_CONCEPT_INFO),
            'result_dir': tc_fs.SDS_RESULT_INFO.identifier,
            'actor_option': OPTION_FOR_ACTOR,
            'actor': concepts.ACTOR_CONCEPT_INFO.name,
            'actor_instruction': formatting.InstructionName(ACTOR_INSTRUCTION_NAME),
            'default_actor': actors.DEFAULT_ACTOR_SINGLE_LINE_VALUE,
            'null_actor': formatting.entity_(actors.NULL_ACTOR),
            'os_process': misc_texts.OS_PROCESS_NAME,
            'instruction': concepts.INSTRUCTION_CONCEPT_INFO.name,
            'stdin_instruction': InstructionName(instruction_names.CONTENTS_OF_STDIN_INSTRUCTION_NAME),
            'env_instruction': InstructionName(instruction_names.ENV_VAR_INSTRUCTION_NAME),
            'timeout': concepts.TIMEOUT_CONCEPT_INFO.name,
            'timeout_default': concepts.TIMEOUT_CONCEPT_INFO.default,
            'timeout_instruction': InstructionName(instruction_names.TIMEOUT_INSTRUCTION_NAME),
            'conf_param': concepts.CONFIGURATION_PARAMETER_CONCEPT_INFO.name,
            'env_var': concepts.ENVIRONMENT_VARIABLE_CONCEPT_INFO.name,
            'PROGRAM': syntax_elements.PROGRAM_SYNTAX_ELEMENT.singular_name,
            'stdin': misc_texts.STDIN,

            'directive': concepts.DIRECTIVE_CONCEPT_INFO.name,
            'including': formatting.keyword(directives.INCLUDING_DIRECTIVE_INFO.singular_name),

        })
Exemplo n.º 2
0
    def __init__(self):
        super().__init__(syntax_elements.PATH_SYNTAX_ELEMENT)

        self._file_name = instruction_arguments.FILE_NAME_STRING
        self._relativity_name = instruction_arguments.RELATIVITY_ARGUMENT

        path_type_symbol = 'MY_PATH_SYMBOL'

        self._parser = TextParser({
            'Note': headers.NOTE_LINE_HEADER,
            'RELATIVITY_OPTION': self._relativity_name.name,
            'PATH_STRING': self._file_name.name,
            'posix_syntax': documentation_text.POSIX_SYNTAX,
            'string_type': formatting.keyword(types.STRING_TYPE_INFO.name.singular),
            'string_type_plain': types.STRING_TYPE_INFO.name,
            'reserved_word': misc_texts.RESERVED_WORD_NAME,
            'reserved_word_list_str': ', '.join([formatting.keyword(x) for x in reserved_words.RESERVED_TOKENS]),
            'path_type': formatting.keyword(types.PATH_TYPE_INFO.name.singular),
            'string_syntax_element': syntax_elements.STRING_SYNTAX_ELEMENT.singular_name,
            'cd': formatting.concept_(concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO),
            'symbol': formatting.concept_(concepts.SYMBOL_CONCEPT_INFO),
            'SYMBOL_NAME': syntax_elements.SYMBOL_NAME_SYNTAX_ELEMENT.argument.name,
            'define_symbol': formatting.InstructionName(instruction_names.SYMBOL_DEFINITION_INSTRUCTION_NAME),
            'current_directory': formatting.concept_(concepts.CURRENT_WORKING_DIRECTORY_CONCEPT_INFO),
            'REFERENCED_SYMBOL': path_type_symbol,
            'SYMBOL_REFERENCE': symbol_reference_syntax_for_name(path_type_symbol),
            'def_of_path_symbol': define_symbol.def_syntax_string(ValueType.PATH, path_type_symbol, '...'),
            'ref_of_path_symbol': '... ' + str(PurePosixPath(symbol_reference_syntax_for_name(path_type_symbol)) /
                                               'a' / 'path' / 'relative' / 'to' / path_type_symbol),
        })
 def __init__(self):
     super().__init__(SOURCE_INTERPRETER_ACTOR)
     format_map = {
         'phase': phase_names.PHASE_NAME_DICTIONARY,
         'actor_option': formatting.cli_option(common_cli_options.OPTION_FOR_ACTOR),
         'actor_instruction': formatting.InstructionName(ACTOR_INSTRUCTION_NAME),
         'shell_command': formatting.misc_name_with_formatting(misc_texts.SHELL_COMMAND),
     }
     self._parser = TextParser(format_map)
Exemplo n.º 4
0
def notes_on_when_to_use_run_instruction() -> SectionContents:
    tp = TextParser({
        'stdin':
        misc_texts.STDIN,
        'exit_code':
        misc_texts.EXIT_CODE,
        'run_program':
        formatting.InstructionName(instruction_names.RUN_INSTRUCTION_NAME),
        'instruction':
        concepts.INSTRUCTION_CONCEPT_INFO.singular_name,
    })
    return tp.section_contents(_WHEN_TO_USE_RUN)
Exemplo n.º 5
0
 def __init__(self):
     super().__init__(SYMBOL_CONCEPT_INFO)
     list_symbol_name = 'LIST_SYMBOL'
     file_trans_symbol_name = 'REPLACE_ID'
     symbol_names = [
         list_symbol_name,
         file_trans_symbol_name,
     ]
     self._parser = TextParser({
         'program_name':
         formatting.program_name(program_info.PROGRAM_NAME),
         'symbol':
         SYMBOL_CONCEPT_INFO.name,
         'instruction':
         concepts.INSTRUCTION_CONCEPT_INFO.name,
         'symbol_name_syntax_element':
         syntax_elements.SYMBOL_NAME_SYNTAX_ELEMENT.argument.name,
         'define_symbol':
         formatting.InstructionName(
             instruction_names.SYMBOL_DEFINITION_INSTRUCTION_NAME),
         'symbol_name_syntax':
         syntax_descriptions.SYMBOL_NAME_SYNTAX_DESCRIPTION,
         'def':
         instruction_names.SYMBOL_DEFINITION_INSTRUCTION_NAME,
         'string_type_in_text':
         types.STRING_TYPE_INFO.name,
         'string_type':
         types.VALUE_TYPE_2_TYPES_INFO_DICT[ValueType.STRING].identifier,
         'list_type':
         types.VALUE_TYPE_2_TYPES_INFO_DICT[ValueType.LIST].identifier,
         'file_trans_type':
         types.VALUE_TYPE_2_TYPES_INFO_DICT[
             ValueType.STRING_TRANSFORMER].identifier,
         'max_type_width':
         max(
             map(lambda type_info: len(type_info.identifier),
                 types.VALUE_TYPE_2_TYPES_INFO_DICT.values())),
         'LIST_SYMBOL':
         list_symbol_name,
         'FILE_TRANS_SYMBOL':
         file_trans_symbol_name,
         'max_symbol_name_width':
         max(map(len, symbol_names)),
         'ref_syntax_of_symbol_name':
         symbol_reference_syntax_for_name('symbol_name'),
         'exists_file':
         instruction_names.TEST_CASE_STATUS_INSTRUCTION_NAME,
         'stdout':
         instruction_names.CONTENTS_OF_STDOUT_INSTRUCTION_NAME,
         'transformed':
         string_transformer.STRING_TRANSFORMATION_ARGUMENT,
     })
Exemplo n.º 6
0
    def _contents(self) -> Sequence[ParagraphItem]:
        tp = TextParser({
            'action_to_check': formatting.concept_(concepts.ACTION_TO_CHECK_CONCEPT_INFO),
            'actor': self.name(),
            'actor_option': formatting.cli_option(common_cli_options.OPTION_FOR_ACTOR),
            'actor_instruction': formatting.InstructionName(instruction_names.ACTOR_INSTRUCTION_NAME),
            'act': phase_infos.ACT.name,
            'default_actor': actors.DEFAULT_ACTOR_SINGLE_LINE_VALUE,
            'null_actor': formatting.entity(actors.NULL_ACTOR.singular_name),
            'actor_conf_param': formatting.conf_param_(conf_params.ACTOR_CONF_PARAM_INFO),
            'conf_param': concepts.CONFIGURATION_PARAMETER_CONCEPT_INFO.name,
            'space': misc_texts.WHITESPACE,
        })
        ret_val = list(tp.fnap(_AFTER_SLD__BEFORE_EXAMPLES))
        ret_val += atc.atc_examples()
        ret_val += tp.fnap(_AFTER_SLD__AFTER_EXAMPLES)

        return ret_val
Exemplo n.º 7
0
    def _description() -> Sequence[ParagraphItem]:
        parser = TextParser({
            'action_to_check':
            concepts.ACTION_TO_CHECK_CONCEPT_INFO.name,
            'actor':
            concepts.ACTOR_CONCEPT_INFO.name,
            'ATC':
            concepts.ACTION_TO_CHECK_CONCEPT_INFO.acronym,
            'actor_option':
            formatting.cli_option(common_cli_options.OPTION_FOR_ACTOR),
            'actor_instruction':
            formatting.InstructionName(ACTOR_INSTRUCTION_NAME),
            'act':
            phase_infos.ACT.name,
            'phase':
            PHASE_NAME_DICTIONARY,
            'os_process':
            misc_texts.OS_PROCESS_NAME,
        })
        ret_val = list(parser.fnap(_DESCRIPTION))
        ret_val += atc.atc_examples()

        return ret_val
Exemplo n.º 8
0
_TEXT_PARSER = TextParser({
    'program_type':
    types.PROGRAM_TYPE_INFO.name,
    'string_type':
    types.STRING_TYPE_INFO.name,
    'PROGRAM':
    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':