Beispiel #1
0
 def __init__(self, instructions: Sequence[ActPhaseInstruction]):
     self.instructions = instructions
     single_line_parser = ParserForSingleLineUsingStandardSyntax()
     single_line = single_line_parser.apply(instructions)
     single_line = single_line.strip()
     self._source = ParseSource(single_line)
     self._path_parser = parse_path.PathParser(RELATIVITY_CONFIGURATION)
Beispiel #2
0
 def __init__(self, accepted_file_relativities: RelOptionsConfiguration):
     self._path_parser = parse_path.PathParser(
         RelOptionArgumentConfiguration(
             accepted_file_relativities,
             defs.SOURCE_FILE_ARGUMENT_NAME.name,
             True,
         ))
Beispiel #3
0
 def __init__(
     self,
     relativity: RelOptionArgumentConfiguration = _pgm_syntax_elements.
     EXE_FILE_REL_OPTION_ARG_CONF):
     super().__init__(False, False)
     self._path_parser = parse_path.PathParser(relativity)
     self._choices = [
         _parsing.TokenSyntaxSetup(
             token_matchers.is_option(
                 _pgm_syntax_elements.PYTHON_EXECUTABLE_OPTION_NAME),
             self._parse_python_interpreter,
         ),
     ]
Beispiel #4
0
 def check__abs_stx__source_variants(
     self,
     put: unittest.TestCase,
     source: AbstractSyntax,
     arrangement: Arrangement2,
     expected_parsed_path: Assertion[PathSdv],
 ):
     # ARRANGE #
     parser = sut.PathParser(arrangement.rel_option_argument_configuration)
     for source_variant_case in equivalent_source_variants.expr_parse__s__nsc(
             source.as_str__default()):
         with put.subTest(source=source_variant_case.name):
             source = source_variant_case.source
             # ACT #
             actual = parser.parse(source, arrangement.source_file_path)
             # ASSERT #
             source_variant_case.expectation.apply_with_message(
                 put, source, 'source')
             expected_parsed_path.apply_with_message(
                 put, actual, 'path sdv')
Beispiel #5
0
 def __init__(self):
     super().__init__()
     self._path_parser = parse_path.PathParser(
         ACTUAL_RELATIVITY_CONFIGURATION)
Beispiel #6
0
 def __init__(self, source_dir_argument: RelOptionArgumentConfiguration):
     self._src_path_parser = parse_path.PathParser(source_dir_argument)
Beispiel #7
0
            return Either.of_right(
                ArgumentsSdv.new_without_validation(
                    list_sdvs.from_string(sym_ref_or_string.right())))


class _MkElement(either.Reducer[SymbolName, ArgumentsSdv, ArgumentsSdv]):
    def reduce_left(self, x: SymbolName) -> ArgumentsSdv:
        sym_ref_element = parse_list.symbol_reference_element(x)
        return ArgumentsSdv.new_without_validation(
            list_sdvs.from_elements([sym_ref_element]))

    def reduce_right(self, x: ArgumentsSdv) -> ArgumentsSdv:
        return x


_PATH_PARSER = parse_path.PathParser(REL_OPT_ARG_CONF)


def _parse_existing_file(
        token_parser: TokenParser) -> Either[SymbolName, ArgumentsSdv]:
    path = _PATH_PARSER.parse_from_token_parser(token_parser)
    return Either.of_right(
        arguments_sdvs.ref_to_file_that_must_exist(path, FileType.REGULAR))


def _parse_existing_dir(
        token_parser: TokenParser) -> Either[SymbolName, ArgumentsSdv]:
    path = _PATH_PARSER.parse_from_token_parser(token_parser)
    return Either.of_right(
        arguments_sdvs.ref_to_file_that_must_exist(path, FileType.DIRECTORY))
Beispiel #8
0
 def __init__(self):
     self.format_map = {
         'PATH': config.PATH_ARGUMENT.name,
     }
     self._path_parser = parse_path.PathParser(
         config.ACTUAL_RELATIVITY_CONFIGURATION)
Beispiel #9
0
 def __init__(self, phase_is_after_act: bool):
     self._path_parser = parse_path.PathParser(REL_OPT_ARG_CONF)
     self._file_maker_parser = parse_file_list.ParserOfFileMaker.of_regular_file_maker(
         phase_is_after_act)
Beispiel #10
0
 def __init__(self):
     self.format_map = {
         'PATH': _PATH_ARGUMENT.name,
     }
     self._path_parser = parse_path.PathParser(_REL_OPTION_CONFIG)
Beispiel #11
0
 def __init__(self, is_after_act_phase: bool):
     self.is_after_act_phase = is_after_act_phase
     self._path_parser = parse_path.PathParser(relativity_options(is_after_act_phase))
Beispiel #12
0
 def __init__(self):
     self._path_parser = parse_path.PathParser(
         REL_OPTION_ARGUMENT_CONFIGURATION)
Beispiel #13
0
 def __init__(self):
     self._path_parser = parse_path.PathParser(RELATIVITY_VARIANTS)
     self._file_maker_parser = parse_file_list.ParserOfFileMaker.of_directory_maker(
         _parse_fs.FullFilesSourceParser())
Beispiel #14
0
 def __init__(self, phase_is_after_act: bool):
     self._src_path_parser = parse_path.PathParser(src_rel_opt_arg_conf_for_phase(phase_is_after_act))
     self._dst_path_parser = parse_path.PathParser(REL_OPTION_ARG_CONF_FOR_DESTINATION)