def syntax_element_descriptions(self) -> list: return [ SyntaxElementDescription(_DIR_ARG.name, abs_or_rel_path_of_existing('directory', _DIR_ARG.name, _RELATIVITY_ROOT)), ]
def _constant_sed(name: str) -> SyntaxElementDescription: return SyntaxElementDescription(name, _TP.fnap(_LITERAL__HEADER), [ invokation_variant_from_args([ a.Single(a.Multiplicity.MANDATORY, a.Constant( syntax.LITERAL_BEGIN)), a.Single(a.Multiplicity.ONE_OR_MORE, a.Named(_FILE_CONDITION)), a.Single(a.Multiplicity.MANDATORY, a.Constant(syntax.LITERAL_END)), ], _TP.fnap(_LITERAL__DESCRIPTION_REST)), ])
def _name_sed(self) -> SyntaxElementDescription: return SyntaxElementDescription( defs.VAR_NAME_ELEMENT, (), [ invokation_variant_from_args( [syntax_elements.STRING_SYNTAX_ELEMENT.single_mandatory]) ], )
def syntax_element_descriptions(self) -> List[SyntaxElementDescription]: primitive_sed = SyntaxElementDescription( self._primitive_name, (), self._primitive.invokation_variants(), (), ) return [primitive_sed] + self._primitive.syntax_element_descriptions()
def _file_name_sed() -> SyntaxElementDescription: return SyntaxElementDescription( syntax.FILE_NAME.name, (), [ invokation_variant_from_args( [syntax_elements.STRING_SYNTAX_ELEMENT.single_mandatory]) ], _TP.fnap(_FILE_NAME_DESCRIPTION_REST), )
def syntax_element_descriptions(self) -> List[SyntaxElementDescription]: return ([ SyntaxElementDescription( ', '.join( [syntax.TYPE_SYNTAX_ELEMENT, syntax.VALUE_SYNTAX_ELEMENT]), [self._types_table()]), rel_path_doc.path_element_with_all_relativities( _PATH_ARGUMENT.name, type_parser. REL_OPTION_ARGUMENT_CONFIGURATION.options.default_option, def_instruction_rel_cd_description(_PATH_ARGUMENT.name)), ])
def _file_list_sed(name: str) -> SyntaxElementDescription: return SyntaxElementDescription(name, (), [ invokation_variant_from_args([ a.Single(a.Multiplicity.MANDATORY, a.Constant(syntax.FILE_LIST_BEGIN)), a.Single(a.Multiplicity.ONE_OR_MORE, a.Named(syntax.FILE_SPEC__SE_STR)), a.Single(a.Multiplicity.MANDATORY, a.Constant( syntax.FILE_LIST_END)), ], _TP.fnap(_FILE_LIST__DESCRIPTION_REST)), ])
def _path_element_description( path_arg_name: str, default_relativity: RelOptionType, options_list: lists.HeaderContentList, custom_paragraphs_before: Sequence[ParagraphItem], custom_paragraphs_after: Sequence[ParagraphItem] ) -> SyntaxElementDescription: return SyntaxElementDescription( path_arg_name, _path_element_relativity_paragraphs(default_relativity, options_list, custom_paragraphs_before, custom_paragraphs_after))
def _transformation_sed() -> SyntaxElementDescription: return SyntaxElementDescription( _OUTPUT_TRANSFORMATION, (), [ invokation_variant_from_args([ a.Single(a.Multiplicity.MANDATORY, string_transformer.TRANSFORMATION_OPTION) ]), ], _transformation_description_rest(), )
def test_with_syntax_elements_without_invokation_variants(self): description = InstructionDocumentationWithConstantValues( 'instruction name', 'single line description', 'main description rest', [InvokationVariant('invokation variant syntax', paras('invokation variant description rest'))], [SyntaxElementDescription('syntax element', paras('description rest'), [])]) actual = sut.instruction_doc_section_contents_constructor(description).apply(CONSTRUCTION_ENVIRONMENT) struct_check.is_section_contents.apply(self, actual)
def syntax_element_descriptions(self) -> List[SyntaxElementDescription]: negation_elements = [ negation_of_predicate.assertion_syntax_element_description() ] path_element = rel_path_doc.path_element_2(_REL_OPTION_CONFIG) properties_elements = [ SyntaxElementDescription(self.PROPERTIES.name, self._tp.fnap(_PROPERTIES_DESCRIPTION), [self._properties_invokation_variant()]), ] return negation_elements + [path_element] + properties_elements
def _file_condition_sed() -> SyntaxElementDescription: return SyntaxElementDescription( _FILE_CONDITION, _TP.fnap(_FILE_CONDITION_DESCRIPTION_REST), [ invokation_variant_from_args([ syntax.FILE_NAME__ARG, ]), invokation_variant_from_args([ syntax.FILE_NAME__ARG, a.Single(a.Multiplicity.MANDATORY, a.Constant(syntax.FILE_MATCHER_SEPARATOR)), syntax_elements.FILE_MATCHER_SYNTAX_ELEMENT.single_mandatory, ], _TP.fnap(_FILE_NAME_WITH_MATCHER_DESCRIPTION_REST)), ])
def _lines_selection_syntax_elements(self) -> SyntaxElementDescription: description = _TEXT_PARSER.fnap(_DESCRIPTION__LINES_SELECTION) description += texts.type_expression_has_syntax_of_primitive([ names.LINES_SELECTION_OPTION.argument, ]) return SyntaxElementDescription( self.LINES_SELECTOR.name, (), [ invokation_variant_from_args( [a.Single(a.Multiplicity.MANDATORY, names.LINES_SELECTION_OPTION)], ) ], description, )
def _value_sed(self) -> SyntaxElementDescription: after_invokation_variants = [] if self._is_in_setup_phase: after_invokation_variants += self._tp.fnap( _DESCRIPTION__VALUE__ACT) return SyntaxElementDescription( defs.VAR_VALUE_ELEMENT, (), [ invokation_variant_from_args([ syntax_elements.STRING_SOURCE_SYNTAX_ELEMENT. single_mandatory ]) ], after_invokation_variants, )
def _range_expr_sed(self) -> SyntaxElementDescription: int_val = syntax_elements.INTEGER_SYNTAX_ELEMENT.singular_name return SyntaxElementDescription( names.RANGE_EXPR_SED_NAME, self._tp.fnap(_RANGE_EXPR__DESCRIPTION), [ invokation_variant_from_string( int_val, self._tp.fnap(_RANGE_EXPR__DESCRIPTION__INT)), invokation_variant_from_string( _RANGE_LIMIT_SEPARATOR + int_val, self._tp.fnap(_RANGE_EXPR__DESCRIPTION__UPPER)), invokation_variant_from_string( int_val + _RANGE_LIMIT_SEPARATOR, self._tp.fnap(_RANGE_EXPR__DESCRIPTION__LOWER)), invokation_variant_from_string( _RANGE_LIMIT_SEPARATOR.join((int_val, int_val)), self._tp.fnap(_RANGE_EXPR__DESCRIPTION__LOWER_UPPER)), ], after_invokation_variants=self._tp.fnap(_RANGE_EXPR__PROLOGUE))
def _phase_spec_sed(self) -> SyntaxElementDescription: phase_spec__act = a.Option(defs.PHASE_SPEC__OPTION_NAME, defs.PHASE_SPEC__ACT) phase_spec__non_act = a.Option(defs.PHASE_SPEC__OPTION_NAME, defs.PHASE_SPEC__NON_ACT) return SyntaxElementDescription( defs.PHASE_SPEC_ELEMENT, invokation_variants=[ invokation_variant_from_args( [a.Single(a.Multiplicity.MANDATORY, phase_spec__act)], self._tp.fnap(_DESCRIPTION__PHASE_SPEC__ACT), ), invokation_variant_from_args( [a.Single(a.Multiplicity.MANDATORY, phase_spec__non_act)], self._tp.fnap(_DESCRIPTION__PHASE_SPEC__NON_ACT), ), ], before_invokation_variants=(), )
def get_traversal_options_sed() -> SyntaxElementDescription: return SyntaxElementDescription( file_or_dir_contents.DIR_FILE_SET_OPTIONS.name, (), [ invokation_variant_from_args( [ a.Single(a.Multiplicity.MANDATORY, file_or_dir_contents.RECURSIVE_OPTION), a.Single( a.Multiplicity.OPTIONAL, file_or_dir_contents.MIN_DEPTH_OPTION, ), a.Single( a.Multiplicity.OPTIONAL, file_or_dir_contents.MAX_DEPTH_OPTION, ), ], _TP.fnap(DIR_CONTENTS_RECURSION_DESCRIPTION), ) ], _TP.fnap(_DIR_FILE_SET_OPTIONS_MAIN))
def syntax_elements(self) -> Sequence[SyntaxElementDescription]: from exactly_lib.definitions.primitives import file_matcher return [ SyntaxElementDescription( self._ARG_POS.name, self._tp().fnap(_PATH_ARG_POS__DESCRIPTION), [ invokation_variant_from_args( [ a.Single(a.Multiplicity.MANDATORY, file_matcher.PROGRAM_ARG_OPTION__LAST) ], self._tp().fnap(_PATH_ARG_POS__LAST__DESCRIPTION)), invokation_variant_from_args( [ a.Single(a.Multiplicity.MANDATORY, file_matcher.PROGRAM_ARG_OPTION__MARKER) ], self._tp().fnap(_PATH_ARG_POS__MARKER__DESCRIPTION)), ]) ]
from exactly_lib.definitions.cross_ref.name_and_cross_ref import cross_reference_id_list from exactly_lib.definitions.entity import syntax_elements from exactly_lib.help.entities.syntax_elements.contents_structure import syntax_element_documentation from exactly_lib.util.textformat.textformat_parser import TextParser _EXPRESSION_DESCRIPTION = """\ An expression using Python syntax. The expression must evaluate to an integer (a Python "int"). """ _TEXT_PARSER = TextParser({ 'STRING': syntax_elements.STRING_SYNTAX_ELEMENT.singular_name, }) DOCUMENTATION = syntax_element_documentation( None, syntax_elements.INTEGER_SYNTAX_ELEMENT, (), (), [ invokation_variant_from_args([ syntax_elements.STRING_SYNTAX_ELEMENT.single_mandatory, ]) ], [ SyntaxElementDescription( syntax_elements.STRING_SYNTAX_ELEMENT.singular_name, _TEXT_PARSER.fnap(_EXPRESSION_DESCRIPTION), ), ], cross_reference_id_list([ syntax_elements.STRING_SYNTAX_ELEMENT, ]))
def _symbol_name_sed(self) -> SyntaxElementDescription: return SyntaxElementDescription(syntax_elements.SYMBOL_NAME_SYNTAX_ELEMENT.singular_name, self._parser.fnap(_SYMBOL_NAME_DESCRIPTION))
def _file_spec_sed() -> SyntaxElementDescription: return SyntaxElementDescription( syntax.FILE_SPEC__SE_STR, _TP.fnap(_FILE_SPEC_DESCRIPTION_REST), [ file_spec.invokation_variant(_FILE_SPEC_RENDERING_ENV) for file_spec in _file_spec_forms() ])
def _symbol_reference_sed(self) -> SyntaxElementDescription: return SyntaxElementDescription(syntax_elements.SYMBOL_REFERENCE_SYNTAX_ELEMENT.argument.name, self._tp.fnap(_SYMBOL_REFERENCE_DESCRIPTION))
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 _file_name_string_sed(self) -> SyntaxElementDescription: return SyntaxElementDescription( self._file_name.name, (), [invokation_variant_from_args([syntax_elements.STRING_SYNTAX_ELEMENT.single_mandatory])], self._parser.fnap(_STRING_DESCRIPTION_REST))
def as_sed(self) -> SyntaxElementDescription: return SyntaxElementDescription(self.element.name, self.before_invokation_variants, self.invokation_variants)
def prefix_op( name: str, mk_expr: Callable[[Expr], Expr]) -> NameAndValue[grammar.PrefixOperator[Expr]]: return NameAndValue( name, grammar.PrefixOperator(mk_expr, ConstantOperatorDescription([]))) PRIMITIVE_EXPRESSIONS__EXCEPT_RECURSIVE = ( NameAndValue( PRIMITIVE_WITH_ARG, grammar.Primitive( parse_primitive_with_arg, ConstantPrimitiveDescription( [], [], [SyntaxElementDescription(PRIMITIVE_WITH_ARG + '-SED', ())], [CROSS_REF_ID]))), NameAndValue( PRIMITIVE_SANS_ARG, grammar.Primitive(parse_primitive_sans_arg, ConstantPrimitiveDescription([], []))), ) PRIMITIVE_EXPRESSIONS__INCLUDING_RECURSIVE = ( list(PRIMITIVE_EXPRESSIONS__EXCEPT_RECURSIVE) + [ NameAndValue( PRIMITIVE_RECURSIVE, grammar.Primitive( parse_recursive_primitive_of_grammar_w_all_components, ConstantPrimitiveDescription([], []))) ])
from exactly_lib.common.help.syntax_contents_structure import InvokationVariant, SyntaxElementDescription from exactly_lib.util.textformat.structure import structures as docs SYNTAX_ELEMENT_DESCRIPTIONS = [ SyntaxElementDescription('syntax element name', docs.paras('syntax element description rest'))] INVOKATION_VARIANTS = [InvokationVariant('invokation variant syntax')]
def assertion_syntax_element_description( additional_text: str = '') -> SyntaxElementDescription: return SyntaxElementDescription( logic.NOT_OPERATOR_NAME, normalize_and_parse(_ASSERTION_NEGATION_ELEMENT_DESCRIPTION + additional_text))
def _relativity_sed(self) -> SyntaxElementDescription: description_rest = self._parser.fnap(_RELATIVITY_DESCRIPTION_REST) description_rest.append(self._relativity_options_paragraph()) return SyntaxElementDescription(self._relativity_name.name, description_rest)