66 """The file implements the Fortran2008 rules as defined in 67 https://j3-fortran.org/doc/year/10/10-007r1.pdf 84 Type_Declaration_StmtBase,
97 Module_Subprogram_Part,
100 Declaration_Construct,
103 Declaration_Type_Spec,
111 Program_Unit
as Program_Unit_2003,
112 Attr_Spec
as Attr_Spec_2003,
113 Alloc_Opt
as Alloc_Opt_2003,
114 Allocate_Stmt
as Allocate_Stmt_2003,
115 Type_Declaration_Stmt
as Type_Declaration_Stmt_2003,
116 Component_Attr_Spec
as Component_Attr_Spec_2003,
117 Data_Component_Def_Stmt
as Data_Component_Def_Stmt_2003,
118 Action_Stmt
as Action_Stmt_2003,
119 Action_Stmt_C201
as Action_Stmt_C201_2003,
120 Action_Stmt_C802
as Action_Stmt_C802_2003,
121 Action_Stmt_C824
as Action_Stmt_C824_2003,
122 If_Stmt
as If_Stmt_2003,
123 Do_Term_Action_Stmt
as Do_Term_Action_Stmt_2003,
124 Executable_Construct
as Executable_Construct_2003,
125 Executable_Construct_C201
as Executable_Construct_C201_2003,
131 Fortran 2008 rule R202 132 program-unit is main-program 133 or external-subprogram 142 subclass_names = Program_Unit_2003.subclass_names[:]
143 subclass_names.append(
"Submodule")
149 Fortran 2003 rule R213 150 executable-construct is action-stmt 151 or associate-construct 154 or critical-construct 158 or select-type-construct 161 Associated constraints are: 163 "C201 (R208) An execution-part shall not contain an end-function-stmt, 164 end-mp-subprogram-stmt, end-program-stmt, or end-subroutine-stmt." 166 NB: The new block-construct and critical-construct are not yet implemented. 167 TODO: Implement missing F2008 executable-construct (#320) 172 "Associate_Construct",
177 "Select_Type_Construct",
184 executable-construct-c201 is executable construct. 188 subclass_names = Executable_Construct.subclass_names[:]
189 subclass_names[subclass_names.index(
"Action_Stmt")] =
"Action_Stmt_C201" 194 Fortran 2008 rule R214 195 action-stmt is allocate-stmt 204 or end-mp-subprogram-stmt 206 or end-subroutine-stmt 218 or pointer-assignment-stmt 231 or arithmetic-if-stmt 232 or computed-goto-stmt 234 The implementation of this rule adds the relevant subclass names 235 for new statements added in Fortran 2008. 237 Associated constraints are: 239 "C201 (R208) An execution-part shall not contain an end-function-stmt, 240 end-mp-subprogram-stmt, end-program-stmt, or end-subroutine-stmt." 242 NB: The following statements are not yet implemented: 243 end-mp-subprogram-stmt, endfile-stmt, lock-stmt, sync-all-stmt, 244 sync-images-stmt, sync-memory-stmt, unlock-stmt. 250 subclass_names = Action_Stmt_2003.subclass_names[:]
251 subclass_names.append(
"Error_Stop_Stmt")
256 action-stmt-c201 is action-stmt 260 subclass_names = Action_Stmt.subclass_names[:]
261 subclass_names.remove(
"End_Function_Stmt")
262 subclass_names.remove(
"End_Subroutine_Stmt")
267 action-stmt-c816 is action-stmt 271 subclass_names = Action_Stmt.subclass_names[:]
272 subclass_names.remove(
"Arithmetic_If_Stmt")
273 subclass_names.remove(
"Continue_Stmt")
274 subclass_names.remove(
"Cycle_Stmt")
275 subclass_names.remove(
"End_Function_Stmt")
276 subclass_names.remove(
"End_Subroutine_Stmt")
277 subclass_names.remove(
"Error_Stop_Stmt")
278 subclass_names.remove(
"Exit_Stmt")
279 subclass_names.remove(
"Goto_Stmt")
280 subclass_names.remove(
"Return_Stmt")
281 subclass_names.remove(
"Stop_Stmt")
286 action-stmt-c828 is action-stmt 290 subclass_names = Action_Stmt.subclass_names[:]
291 subclass_names.remove(
"End_Function_Stmt")
292 subclass_names.remove(
"End_Subroutine_Stmt")
293 subclass_names.remove(
"If_Stmt")
298 Fortran 2008 rule 436 299 data-component-def-stmt is declaration-type-spec [ 300 [ , component-attr-spec-list ] :: ] component-decl-list 302 The implementation of this rule does not add anything to the Fortran 2003 303 variant but reimplements the match method identical to Fortran 2003 as 304 otherwise the generated Fortran 2008 variant of `Component_Attr_Spec_List` 305 would not be used. Unfortunately, the required `attr_spec_list_cls` can not 306 simply be provided as a class property since the relevant class is only 307 generated at the end of this file using the `use_names` class property of 310 Associated constraints are: 312 "C439 (R436) No component-attr-spec shall appear more than once in a given 314 "C440 (R436) If neither the POINTER nor the ALLOCATABLE attribute is 315 specified, the declaration-type-spec in the component-def-stmt shall 316 specify an intrinsic type or a previously defined derived type." 317 "C441 (R436) If the POINTER or ALLOCATABLE attribute is specified, each 318 component-array-spec shall be a deferred-shape-spec-list." 319 "C442 (R436) If a coarray-spec appears, it shall be a 320 deferred-coshape-spec-list and the component shall have the 321 ALLOCATABLE attribute." 322 "C443 (R436) If a coarray-spec appears, the component shall not be of type 324 "C445 (R436) If neither the POINTER nor the ALLOCATABLE attribute is 325 specified, each component-array-spec shall be an 326 explicit-shape-spec-list." 327 "C447 (R436) A component shall not have both the ALLOCATABLE and POINTER 329 "C448 (R436) If the CONTIGUOUS attribute is specified, the component shall 330 be an array with the POINTER attribute." 331 "C457 (R436) If component-initialization appears, a double-colon separator 332 shall appear before the component-decl-list." 333 "C458 (R436) If component-initialization appears, every type parameter and 334 array bound of the component shall be a colon or constant expression. 335 "C459 (R436) If => appears in component-initialization, POINTER shall 336 appear in the component-attr-spec-list. If = appears in 337 component-initialization, neither POINTER nor ALLOCATABLE shall 338 appear in the component-attr-spec-list." 340 C439-C443, C445, C447-C448, C457-C459 are currently not checked 347 """Implements the matching of a data component definition statement. 349 :param str string: the reader or string to match as a data \ 350 component definition statement. 352 :return: a 3-tuple containing declaration type specification, \ 353 component attribute specification and component declaration \ 354 list if there is a match or None if there is no match. 355 :rtype: `NoneType` or \ 356 (:py:class:`fparser.two.Fortran2003.Declaration_Type_Spec`, \ 357 :py:class:`fparser.two.Fortran2008.Component_Attr_Spec_List`, \ 358 :py:class:`fparser.two.Fortran2003.Component_Decl_List`) 361 return Type_Declaration_StmtBase.match(
362 Declaration_Type_Spec, Component_Attr_Spec_List, Component_Decl_List, string
368 Fortran 2008 rule R437 369 component-attr-spec is access-spec 371 or CODIMENSION lbracket coarray-spec rbracket 373 or DIMENSION ( component-array-spec ) 376 In the spec above, lbracket and rbracket are left and right square 377 brackets `[]` but not printed explicitly to avoid misinterpretation 380 This rule adds CODIMENSION and CONTIGUOUS attributes to Fortran2003's R441. 384 subclass_names = Component_Attr_Spec_2003.subclass_names[:]
385 subclass_names.append(
"Codimension_Attr_Spec")
386 attributes = Component_Attr_Spec_2003.attributes[:]
387 attributes.append(
"CONTIGUOUS")
392 Fortran 2008 rule 501 393 type-declaration-stmt is declaration-type-spec [ [ , attr-spec ] ... :: ] 396 The implementation of this rule does not add anything to the Fortran 2003 397 variant but overwrites :py:meth:`get_attr_spec_list_cls` to use 398 the Fortran 2008 variant of :py:class:`Attr_Spec_List`. 400 Associated constraints are: 402 "C501 (R501) The same attr-spec shall not appear more than once in a given 403 type-declaration-stmt." 404 "C502 (R501) If a language-binding-spec with a NAME= specifier appears, 405 the entity-decl-list shall consist of a single entity-decl." 406 "C503 (R501) If a language-binding-spec is specified, the entity-decl-list 407 shall not contain any procedure names." 408 "C505 (R501) If initialization appears, a double-colon separator shall 409 appear before the entity-decl-list." 411 C501-C503, C505 are currently not checked - issue #259. 416 def get_attr_spec_list_cls():
417 """Return the type used to match the attr-spec-list 419 This overwrites the Fortran 2003 type with the Fortran 2008 variant. 422 return Attr_Spec_List
427 codimension-attr-spec is CODIMENSION lbracket coarray-spec rbracket 429 In the spec above, lbracket and rbracket are left and right square 430 brackets `[]` but not printed explicitly to avoid misinterpretation 436 use_names = [
"Coarray_Bracket_Spec"]
441 Implements the matching for the CODIMENSION attribute. 443 :param str string: the string to match as the attribute. 445 :return: `None` if there is no match, otherwise a 2-tuple \ 446 containing `CODIMENSION` as a string and the matched \ 448 :rtype: `NoneType` or \ 449 (`str`, :py:class:`fparser.two.Fortran2008.Coarray_Bracket_Spec`,) 452 return WORDClsBase.match(
453 "CODIMENSION", Coarray_Bracket_Spec, string, colons=
False, require_cls=
True 459 coarray-bracket-spec is lbracket coarray-spec rbracket 461 In the spec above, lbracket and rbracket are left and right square 462 brackets `[]` but not printed explicitly to avoid misinterpretation 468 use_names = [
"Coarray_Spec"]
473 Implements the matching for the coarray specification 474 including the square brackets. 476 :param str string: the string to match as the specification. 478 :return: `None` if there is no match, otherwise a 3-tuple \ 479 containing the left bracket, the matched coarray-spec, \ 480 and the right bracket. 481 :rtype: `NoneType` or \ 482 (`str`, :py:class:`fparser.two.Fortran2008.Coarray_Spec`, `str`) 485 return BracketBase.match(
"[]", Coarray_Spec, string)
490 Fortran 2008 rule R502 491 attr-spec is access-spec 494 or CODIMENSION lbracket coarray-spec rbracket 496 or DIMENSION ( array-spec ) 498 or INTENT ( intent-spec ) 500 or language-binding-spec 510 In the spec above, lbracket and rbracket are left and right square 511 brackets `[]` but not printed explicitly to avoid misinterpretation 514 This rule adds CODIMENSION and CONTIGUOUS attributes to Fortran2003's R503. 518 subclass_names = Attr_Spec_2003.subclass_names[:]
519 subclass_names.append(
"Codimension_Attr_Spec")
525 Implements the matching for attributes of types. 527 :param str string: the string to match as attribute. 529 :return: `None` if there is no match, otherwise a 1-tuple \ 530 containing the matched string. 531 :rtype: `NoneType` or (`str`,) 534 return STRINGBase.match(pattern.abs_attr_spec_f08, string)
539 Fortran 2008 rule R509 540 coarray-spec is deferred-coshape-spec-list 541 or explicit-coshape-spec-list 545 subclass_names = [
"Explicit_Coshape_Spec",
"Deferred_Coshape_Spec_List"]
550 Fortran 2008 rule R510 551 deferred-coshape-spec is : 560 Implements the matching for deferred coarray shape specification. 562 :param str string: the string to match as deferred shape. 564 :return: `None` if there is no match, otherwise a 2-tuple \ 566 :rtype: `NoneType` or (`None`, `None`) 576 Fortran 2008 rule R511 577 explicit-coshape-spec is [ coshape-spec-list , ] [ lower-cobound : ] * 579 Associated constraint is: 581 "C529 (R511) A lower-cobound or upper-cobound that is not a constant 582 expression shall appear only in a subprogram, BLOCK construct, or 585 C529 is currently not checked - issue #259. 590 use_names = [
"Coshape_Spec_List",
"Lower_Cobound"]
595 Implements the matching for explicit coarray shape specification. 597 :param str string: the string to match as deferred shape. 599 :return: `None` if there is no match, otherwise a 2-tuple \ 600 containing matched coshape-spec-list or `None` and \ 601 matched lower-cobound or `None`. 602 :rtype: `NoneType` or \ 603 (:py:class:`fparser.two.Fortran2008.Coshape_Spec_List` or `None`, \ 604 :py:class:`fparser.two:Fortran2008.Lower_Cobound` or `None`) 607 if not string.endswith(
"*"):
609 line = string[:-1].rstrip()
612 if line.endswith(
":"):
613 line, repmap = string_replace_map(line[:-1].rstrip())
614 sep_pos = line.rfind(
",")
618 Coshape_Spec_List(repmap(line[:sep_pos].rstrip())),
621 if not line.endswith(
","):
623 line = line[:-1].rstrip()
624 return (Coshape_Spec_List(line),
None)
628 Converts the explicit coarray shape specification to string. 630 :return: the shape specification as string. 636 s += str(self.items[0]) +
", " 638 s += str(self.items[1]) +
" : " 645 coshape-spec is [ lower-cobound : ] upper-cobound 650 use_names = [
"Lower_Cobound",
"Upper_Cobound"]
655 Implements the matching for a coarray shape. 657 :param str string: the string to match as shape. 659 :return: `None` if there is no match, otherwise a 2-tuple with \ 660 lower bound if given or `None`, and upper bound. 661 :rtype: `NoneType` or \ 662 (`None`, :py:class:`fparser.two.Fortran2008.Upper_Cobound`) or \ 663 (:py:class:`fparser.two.Fortran2008.Lower_Cobound`, \ 664 :py:class:`fparser.two.Fortran2008.Upper_Cobound`) 667 line, repmap = string_replace_map(string)
670 lower, upper = line.split(
":", 1)
671 lower = lower.rstrip()
672 upper = upper.lstrip()
681 Converts the Shape specification to string. 683 :return: the shape specification as string. 687 if self.items[0]
is None:
688 return str(self.items[1])
689 return SeparatorBase.tostr(self)
694 Fortran 2008 rule R512 695 lower-cobound is specification-expr 699 subclass_names = [
"Specification_Expr"]
704 Fortran 2008 rule R513 705 upper-cobound is specification-expr 709 subclass_names = [
"Specification_Expr"]
714 Fortran 2008 rule R826 715 do-term-action-stmt is action-stmt 717 Associated constraints are: 719 "C816 (R826) A do-term-action-stmt shall not be an arithmetic-if-stmt, 720 continue-stmt, cycle-stmt, end-function-stmt, end-mp-subprogram-stmt, 721 end-program-stmt, end-subroutine-stmt, error-stop-stmt, exit-stmt, 722 goto-stmt, return-stmt, or stop-stmt." 725 subclass_names = [
"Action_Stmt_C816"]
730 Fortran2008 rule R627 731 alloc-opt is ERRMSG = errmsg-variable 732 or MOLD = source-expr 733 or SOURCE = source-expr 734 or STAT = stat-variable 736 Extends the Fortran2003 version of this class by updating the keyword 737 pairs (used in match) with support for MOLD. 742 (
"STAT", Stat_Variable),
743 (
"ERRMSG", Errmsg_Variable),
744 (
"SOURCE", Source_Expr),
745 (
"MOLD", Source_Expr),
751 Fortran 2008 rule R626 752 allocate-stmt is ALLOCATE ( [ type-spec :: ] allocation-list 753 [, alloc-opt-list ] ) 755 The implementation of this rule simply ensures that the Fortran2008 version 756 of Alloc_Opt is used. 761 use_names = [
"Type_Spec",
"Allocation_List",
"Alloc_Opt_List"]
764 def alloc_opt_list(cls):
766 :returns: the Fortran2008 flavour of Alloc_Opt_List. 769 return Alloc_Opt_List
774 Fortran 2008 rule R837 775 if-stmt is IF ( scalar-logical-expr ) action-stmt 777 The implementation of this rule only replaces the :py:attr:`use_names` and 778 :py:attr:`action_stmt_class` attributes to use the Fortran 2008 variant 779 :py:class:`Action_Stmt_C828` instead of 780 :py:class:`fparser.two.Fortran2003.Action_Stmt_C802`. 782 Associated constraints are: 784 C828 (R837) The action-stmt in the if-stmt shall not be an end-function-stmt, 785 end-mp-subprogram-stmt, end-program-stmt, end-subroutine-stmt, or if-stmt. 789 use_names = [
"Scalar_Logical_Expr",
"Action_Stmt_C828"]
790 action_stmt_cls = Action_Stmt_C828
795 Fortran 2008 rule R856 796 error-stop-stmt is ERROR STOP [ stop-code ] 801 use_names = [
"Stop_Code"]
805 """Check whether the input matches the rule 807 :param str string: Text that we are trying to match. 809 :returns: None if there is no match or, if there is a match, a \ 810 2-tuple containing a string matching 'ERROR STOP' and an \ 811 instance of :py:class:`fparser.two.Fortran2003.Stop_Code` \ 812 (or None if an instance of 'Stop_Code' is not required and \ 814 :rtype: (str, :py:class:`fparser.two.Fortran2003.Stop_Code` or None) \ 818 return WORDClsBase.match(
"ERROR STOP", Stop_Code, string)
822 """Fortran 2008 constraint C1112 823 C1112 A submodule specification-part shall not contain a 824 format-stmt, entry-stmt, or stmt-function-stmt. 826 These statements are found in the following rule hierarchy 828 format-stmt Specification_Part/implicit_part/implicit_part_stmt/format_stmt 829 Specification_Part/declaration_construct/format_stmt 830 entry-stmt Specification_Part/implicit_part/implicit_part_stmt/entry_stmt 831 Specification_Part/declaration_construct/entry_stmt 832 stmt-function-stmt Specification_Part/declaration_construct/ 835 Therefore we need to specialise implicit_part, implicit_part_stmt 836 and declaration_construct 843 "Implicit_Part_C1112",
844 "Declaration_Construct_C1112",
849 """Check whether the input matches the rule 851 param reader: the fortran file reader containing the line(s) 852 of code that we are trying to match 853 :type reader: :py:class:`fparser.common.readfortran.FortranFileReader` 855 :py:class:`fparser.common.readfortran.FortranStringReader` 856 :return: `tuple` containing a single `list` which contains 857 instance of the classes that have matched if there is 858 a match or `None` if there is no match 861 return BlockBase.match(
863 [Use_Stmt, Import_Stmt, Implicit_Part_C1112, Declaration_Construct_C1112],
870 """Fortran 2008 constraint C1112 871 C1112 A submodule specification-part shall not contain a 872 format-stmt, entry-stmt, or stmt-function-stmt. 874 This class specialises 'Implicit_Part' so that the specialised 875 'Implicit_Part_Stmt_C1112' is called rather than the original 880 use_names = [
"Implicit_Part_Stmt_C1112",
"Implicit_Stmt"]
884 """Check whether the input matches the rule 886 param reader: the fortran file reader containing the line(s) 887 of code that we are trying to match 888 :type reader: :py:class:`fparser.common.readfortran.FortranFileReader` 890 :py:class:`fparser.common.readfortran.FortranStringReader` 891 :return: `tuple` containing a single `list` which contains 892 instance of the classes that have matched if there is 893 a match or `None` if there is no match 896 return BlockBase.match(
None, [Implicit_Part_Stmt_C1112],
None, reader)
900 """Fortran 2008 constraint C1112 901 C1112 A submodule specification-part shall not contain a 902 format-stmt, entry-stmt, or stmt-function-stmt. 904 This class specialises 'Implicit_Part_Stmt' to remove 905 'Format_Stmt' and 'Entry_Stmt' 909 subclass_names = Implicit_Part_Stmt.subclass_names[:]
910 subclass_names.remove(
"Format_Stmt")
911 subclass_names.remove(
"Entry_Stmt")
915 """Fortran 2008 constraint C1112 916 C1112 A submodule specification-part shall not contain a 917 format-stmt, entry-stmt, or stmt-function-stmt. 919 This class specialises 'Declaration_Construct' to remove 920 'Format_Stmt', 'Entry_Stmt' and 'Stmt_Function_Stmt' 924 subclass_names = Declaration_Construct.subclass_names[:]
925 subclass_names.remove(
"Format_Stmt")
926 subclass_names.remove(
"Entry_Stmt")
934 """Fortran 2008 rule R1116 935 submodule is submodule-stmt 936 [ specification-part ] 937 [ module-subprogram-part ] 940 C1112 A submodule specification-part shall not contain a 941 format-stmt, entry-stmt, or stmt-function-stmt. 942 This constraint is handled by specialising the Specification_Part 945 C1114 If a submodule-name appears in the end-submodule-stmt, it 946 shall be identical to the one in the submodule-stmt. 947 This constraint is handled by the Base class with the names being 948 provided by the 'Submodule_Stmt and 'End_Submodule_Stmt' classes 949 via a `get_name` method 956 "Specification_Part_C1112",
957 "Module_Subprogram_Part",
958 "End_Submodule_Stmt",
963 """Check whether the input matches the rule 965 param reader: the fortran file reader containing the line(s) 966 of code that we are trying to match 967 :type reader: :py:class:`fparser.common.readfortran.FortranFileReader` 969 :py:class:`fparser.common.readfortran.FortranStringReader` 970 :return: `tuple` containing a single `list` which contains 971 instance of the classes that have matched if there is 972 a match or `None` if there is no match 976 result = BlockBase.match(
978 [Specification_Part_C1112, Module_Subprogram_Part],
987 Fortran 2008 rule R1117 988 submodule-stmt is SUBMODULE ( parent-identifier ) submodule-name 993 use_names = [
"Submodule_Name",
"Parent_Identifier"]
997 """Check whether the input matches the rule 999 param string fstring : contains the Fortran that we are trying 1002 :return: instances of the Classes that have matched if there 1003 is a match or `None` if there is no match 1008 if fstring[: len(name)].upper() != name:
1016 splitline = splitparen(fstring[len(name) :].lstrip())
1021 if len(splitline) != 3:
1024 spurious = splitline[0]
1025 parent_id_brackets = splitline[1]
1026 submodule_name = splitline[2]
1032 if parent_id_brackets[0] !=
"(":
1034 if parent_id_brackets[-1] !=
")":
1036 parent_id = parent_id_brackets[1:-1].lstrip().rstrip()
1042 """return the fortran representation of this object""" 1044 return "SUBMODULE ({0}) {1}".format(self.items[0], self.items[1])
1047 """Fortran 2008 constraint C1114 1048 return the submodule name. This is used by the base class to check 1049 whether the submodule name matches the name used for the end 1050 submodule statement if one is provided. 1052 :return: the name of the submodule stored in a Name class 1053 :return type: :py:class:`fparser.two.Fortran2003.Name` 1055 return self.items[1]
1060 Fortran 2008 rule R1119 1061 end-submodule-stmt is END [ SUBMODULE [ submodule-name ] ] 1066 use_names = [
"Submodule_Name"]
1070 """Check whether the input matches the rule 1072 param string fstring : contains the Fortran that we are trying 1075 :return: instances of the Classes that have matched if there 1076 is a match or `None` if there is no match 1079 return EndStmtBase.match(
"SUBMODULE", Submodule_Name, fstring)
1082 """Fortran 2008 constraint C1114 return the submodule name as 1083 specified by the end submodule statement or `None` if one is 1084 not specified. This is used by the base class to check whether 1085 this name matches the submodule name. 1087 :return: the name of the submodule stored in a Name class 1088 :return type: :py:class:`fparser.two.Fortran2003.Name` or `None` 1091 return self.items[1]
1095 """Fortran 2008 rule R1118 1096 parent-identifier is ancestor-module-name [ : parent-submodule-name ] 1098 C1113 The ancestor-module-name shall be the name of a nonintrinsic 1099 module; the parent-submodule name shall be the name of a 1100 descendant of that module. 1101 This constraint can not be tested by fparser in general as the 1102 module or submodule may be in a different file. We therefore do 1103 not check this constraint in fparser. 1107 use_names = [
"Ancestor_Module_Name",
"Parent_SubModule_Name"]
1111 """Check whether the input matches the rule 1113 param string fstring : contains the Fortran that we are trying 1116 :return: instances of the Classes that have matched if there 1117 is a match or `None` if there is no match 1120 split_string = fstring.split(
":")
1121 len_split_string = len(split_string)
1122 lhs_name = split_string[0].lstrip().rstrip()
1123 if len_split_string == 1:
1124 return Ancestor_Module_Name(lhs_name),
None 1125 elif len_split_string == 2:
1126 rhs_name = split_string[1].lstrip().rstrip()
1127 return Ancestor_Module_Name(lhs_name), Parent_SubModule_Name(rhs_name)
1132 """return the fortran representation of this object""" 1135 return "{0}:{1}".format(self.items[0], self.items[1])
1136 return str(self.items[0])
1144 ClassType = type(Base)
1146 for clsname
in _names:
1149 isinstance(cls, ClassType)
1150 and issubclass(cls, Base)
1151 and not cls.__name__.endswith(
"Base")
1155 names = getattr(cls,
"subclass_names", []) + getattr(cls,
"use_names", [])
1159 if n.endswith(
"_List"):
1165 class %s_List(SequenceBase): 1166 subclass_names = [\'%s\'] 1169 def match(string): return SequenceBase.match(r\',\', %s, string) 1173 elif n.endswith(
"_Name"):
1178 class %s_Name(Base): 1179 subclass_names = [\'Name\'] 1183 elif n.startswith(
"Scalar_"):
1188 class Scalar_%s(Base): 1189 subclass_names = [\'%s\']