예제 #1
0
        syntax_elements: Sequence[SyntaxElementDescription] = (),
        see_also_targets: Sequence[SeeAlsoTarget] = (),
        operand_evaluation__lazy__left_to_right: bool = False,
    ):
        self._description_rest = description_rest
        self._see_also_targets = list(see_also_targets)
        self._syntax_elements = syntax_elements
        self._operand_evaluation__lazy__left_to_right = operand_evaluation__lazy__left_to_right

    @property
    def description_rest(self) -> Sequence[ParagraphItem]:
        return self._description_rest

    @property
    def syntax_elements(self) -> Sequence[SyntaxElementDescription]:
        return self._syntax_elements

    @property
    def see_also_targets(self) -> Sequence[SeeAlsoTarget]:
        return self._see_also_targets

    @property
    def operand_evaluation__lazy__left_to_right(self) -> bool:
        return self._operand_evaluation__lazy__left_to_right


CONCEPT = grammar.Concept(
    NameWithGenderWithFormatting(
        NameWithGender('a', 'concept singular', 'concept plural')),
    'type-system-name', a.Named('SYNTAX-ELEMENT-NAME'))
예제 #2
0
            _TP.fnap(_LINE_NUMBER_MATCHER_SED_DESCRIPTION) +
            texts.type_expression_has_syntax_of_primitive([
                syntax_elements.INTEGER_MATCHER_SYNTAX_ELEMENT.singular_name,
            ]))

    @property
    def see_also_targets(self) -> Sequence[SeeAlsoTarget]:
        return [
            syntax_elements.INTEGER_MATCHER_SYNTAX_ELEMENT.
            cross_reference_target
        ]


_CONCEPT = grammar.Concept(
    types.LINE_MATCHER_TYPE_INFO.name,
    types.LINE_MATCHER_TYPE_INFO.identifier,
    syntax_elements.LINE_MATCHER_SYNTAX_ELEMENT.argument,
)

GRAMMAR = standard_expression_grammar.new_grammar(
    _CONCEPT,
    model=matcher_model.LINE_MATCHER_MODEL,
    value_type=ValueType.LINE_MATCHER,
    simple_expressions=(
        NameAndValue(
            line_matcher.CONTENTS_MATCHER_NAME,
            grammar.Primitive(contents_parse.PARSER.parse,
                              contents_doc.SyntaxDescription())),
        NameAndValue(
            line_matcher.LINE_NUMBER_MATCHER_NAME,
            grammar.Primitive(line_number.parse_line_number,
예제 #3
0
파일: parse.py 프로젝트: emilkarlen/exactly
class FullFilesSourceParser(ParserFromTokens[FilesSourceSdv]):
    def __init__(self):
        self._parser: Optional[Callable[[TokenParser], FilesSourceSdv]] = None

    def parse(self, token_parser: TokenParser) -> FilesSourceSdv:
        self._construct_parser()
        return self._parser(token_parser)

    def _construct_parser(self):
        if self._parser is None:
            self._parser = parsers(False).full.parse_from_token_parser


_GRAMMAR_CONCEPT = _expr_grammar.Concept(
    name=types.FILES_SOURCE_TYPE_INFO.name,
    type_system_type_name=types.FILES_SOURCE_TYPE_INFO.identifier,
    syntax_element_name=syntax_elements.FILES_SOURCE_SYNTAX_ELEMENT.argument,
)

_COPY__SRC_PATH_ARG = syntax_elements.PATH_SYNTAX_ELEMENT

_DESCRIPTION_OF_FILE_LIST = documentation.FileListSyntaxDescription()
_DESCRIPTION_OF_COPY = documentation.CopySyntaxDescription(_COPY__SRC_PATH_ARG)


def _grammar(
    parser_of_nested: ParserFromTokens[FilesSourceSdv]
) -> _expr_grammar.Grammar[FilesSourceSdv]:
    copy_src_dir_arg_conf = defs.src_dir_path_argument(
        _COPY__SRC_PATH_ARG.singular_name)
예제 #4
0
    @property
    def description_rest(self) -> Sequence[ParagraphItem]:
        return _type_matcher_sed_description()


def _description() -> SectionContents:
    return SectionContents(
        [],
        [names_doc.name_parts_description()],
    )


GRAMMAR = standard_expression_grammar.new_grammar(
    concept=grammar.Concept(
        name=types.FILE_MATCHER_TYPE_INFO.name,
        type_system_type_name=types.FILE_MATCHER_TYPE_INFO.identifier,
        syntax_element_name=syntax_elements.FILE_MATCHER_SYNTAX_ELEMENT.argument,
    ),
    description=_description,
    model=matcher_model.FILE_MATCHER_MODEL,
    value_type=ValueType.FILE_MATCHER,
    simple_expressions=(

        NameAndValue(
            file_matcher.TYPE_MATCHER_NAME,
            grammar.Primitive(
                _parse_type_matcher,
                _TypeSyntaxDescription()
            )
        ),
from exactly_lib.util.cli_syntax.elements import argument as a
from exactly_lib.util.name_and_value import NameAndValue

STRING_TRANSFORMER_ARGUMENT = a.Named(
    types.STRING_TRANSFORMER_TYPE_INFO.syntax_element_name)


def parsers(
    must_be_on_current_line: bool = False
) -> GrammarParsers[StringTransformerSdv]:
    return _PARSERS_FOR_MUST_BE_ON_CURRENT_LINE[must_be_on_current_line]


_CONCEPT = grammar.Concept(
    types.STRING_TRANSFORMER_TYPE_INFO.name,
    types.STRING_TRANSFORMER_TYPE_INFO.identifier,
    syntax_elements.STRING_TRANSFORMER_SYNTAX_ELEMENT.argument,
)


def _mk_reference(name: str) -> StringTransformerSdv:
    return sdvs.StringTransformerSdvReference(name)


GRAMMAR = grammar.Grammar(
    _CONCEPT,
    mk_reference=_mk_reference,
    primitives=(
        NameAndValue(
            names.FILTER_TRANSFORMER_NAME,
            grammar.Primitive(