fparser.two.Fortran2003 ======================= .. py:module:: fparser.two.Fortran2003 .. autoapi-nested-parse:: Fortran 2003 Syntax Rules. Attributes ---------- .. autoapisummary:: fparser.two.Fortran2003.ClassType fparser.two.Fortran2003._names fparser.two.Fortran2003.my_cls fparser.two.Fortran2003.classes fparser.two.Fortran2003.__all__ Classes ------- .. autoapisummary:: fparser.two.Fortran2003.Directive fparser.two.Fortran2003.Comment fparser.two.Fortran2003.Program fparser.two.Fortran2003.Include_Filename fparser.two.Fortran2003.Include_Stmt fparser.two.Fortran2003.Program_Unit fparser.two.Fortran2003.External_Subprogram fparser.two.Fortran2003.Specification_Part fparser.two.Fortran2003.Implicit_Part fparser.two.Fortran2003.Implicit_Part_Stmt fparser.two.Fortran2003.Declaration_Construct fparser.two.Fortran2003.Execution_Part fparser.two.Fortran2003.Execution_Part_Construct fparser.two.Fortran2003.Execution_Part_Construct_C201 fparser.two.Fortran2003.Internal_Subprogram_Part fparser.two.Fortran2003.Internal_Subprogram fparser.two.Fortran2003.Specification_Stmt fparser.two.Fortran2003.Executable_Construct fparser.two.Fortran2003.Executable_Construct_C201 fparser.two.Fortran2003.Action_Stmt fparser.two.Fortran2003.Action_Stmt_C201 fparser.two.Fortran2003.Action_Stmt_C802 fparser.two.Fortran2003.Action_Stmt_C824 fparser.two.Fortran2003.Keyword fparser.two.Fortran2003.Name fparser.two.Fortran2003.Constant fparser.two.Fortran2003.Literal_Constant fparser.two.Fortran2003.Named_Constant fparser.two.Fortran2003.Int_Constant fparser.two.Fortran2003.Char_Constant fparser.two.Fortran2003.Defined_Operator fparser.two.Fortran2003.Extended_Intrinsic_Op fparser.two.Fortran2003.Label fparser.two.Fortran2003.Type_Spec fparser.two.Fortran2003.Type_Param_Value fparser.two.Fortran2003.Intrinsic_Type_Spec fparser.two.Fortran2003.Kind_Selector fparser.two.Fortran2003.Signed_Int_Literal_Constant fparser.two.Fortran2003.Int_Literal_Constant fparser.two.Fortran2003.Digit_String fparser.two.Fortran2003.Boz_Literal_Constant fparser.two.Fortran2003.Binary_Constant fparser.two.Fortran2003.Octal_Constant fparser.two.Fortran2003.Hex_Constant fparser.two.Fortran2003.Signed_Real_Literal_Constant fparser.two.Fortran2003.Real_Literal_Constant fparser.two.Fortran2003.Complex_Literal_Constant fparser.two.Fortran2003.Real_Part fparser.two.Fortran2003.Imag_Part fparser.two.Fortran2003.Char_Selector fparser.two.Fortran2003.Length_Selector fparser.two.Fortran2003.Char_Length fparser.two.Fortran2003.Char_Literal_Constant fparser.two.Fortran2003.Logical_Literal_Constant fparser.two.Fortran2003.Derived_Type_Def fparser.two.Fortran2003.Derived_Type_Stmt fparser.two.Fortran2003.Type_Name fparser.two.Fortran2003.Type_Attr_Spec fparser.two.Fortran2003.Private_Or_Sequence fparser.two.Fortran2003.End_Type_Stmt fparser.two.Fortran2003.Sequence_Stmt fparser.two.Fortran2003.Type_Param_Def_Stmt fparser.two.Fortran2003.Type_Param_Decl fparser.two.Fortran2003.Type_Param_Attr_Spec fparser.two.Fortran2003.Component_Part fparser.two.Fortran2003.Component_Def_Stmt fparser.two.Fortran2003.Data_Component_Def_Stmt fparser.two.Fortran2003.Dimension_Component_Attr_Spec fparser.two.Fortran2003.Component_Attr_Spec fparser.two.Fortran2003.Component_Decl fparser.two.Fortran2003.Component_Array_Spec fparser.two.Fortran2003.Component_Initialization fparser.two.Fortran2003.Proc_Component_Def_Stmt fparser.two.Fortran2003.Proc_Component_PASS_Arg_Name fparser.two.Fortran2003.Proc_Component_Attr_Spec fparser.two.Fortran2003.Private_Components_Stmt fparser.two.Fortran2003.Type_Bound_Procedure_Part fparser.two.Fortran2003.Binding_Private_Stmt fparser.two.Fortran2003.Proc_Binding_Stmt fparser.two.Fortran2003.Specific_Binding fparser.two.Fortran2003.Binding_PASS_Arg_Name fparser.two.Fortran2003.Generic_Binding fparser.two.Fortran2003.Binding_Attr fparser.two.Fortran2003.Final_Binding fparser.two.Fortran2003.Derived_Type_Spec fparser.two.Fortran2003.Type_Param_Spec fparser.two.Fortran2003.Structure_Constructor fparser.two.Fortran2003.Component_Spec fparser.two.Fortran2003.Component_Data_Source fparser.two.Fortran2003.Enum_Def fparser.two.Fortran2003.Enum_Def_Stmt fparser.two.Fortran2003.Enumerator_Def_Stmt fparser.two.Fortran2003.Enumerator fparser.two.Fortran2003.End_Enum_Stmt fparser.two.Fortran2003.Array_Constructor fparser.two.Fortran2003.Ac_Spec fparser.two.Fortran2003.Ac_Value fparser.two.Fortran2003.Ac_Implied_Do fparser.two.Fortran2003.Ac_Implied_Do_Control fparser.two.Fortran2003.Ac_Do_Variable fparser.two.Fortran2003.Type_Declaration_Stmt fparser.two.Fortran2003.Declaration_Type_Spec fparser.two.Fortran2003.Dimension_Attr_Spec fparser.two.Fortran2003.Intent_Attr_Spec fparser.two.Fortran2003.Attr_Spec fparser.two.Fortran2003.Entity_Decl fparser.two.Fortran2003.Object_Name fparser.two.Fortran2003.Initialization fparser.two.Fortran2003.Null_Init fparser.two.Fortran2003.Access_Spec fparser.two.Fortran2003.Language_Binding_Spec fparser.two.Fortran2003.Array_Spec fparser.two.Fortran2003.Explicit_Shape_Spec fparser.two.Fortran2003.Lower_Bound fparser.two.Fortran2003.Upper_Bound fparser.two.Fortran2003.Assumed_Shape_Spec fparser.two.Fortran2003.Deferred_Shape_Spec fparser.two.Fortran2003.Assumed_Size_Spec fparser.two.Fortran2003.Intent_Spec fparser.two.Fortran2003.Access_Stmt fparser.two.Fortran2003.Access_Id fparser.two.Fortran2003.Object_Name_Deferred_Shape_Spec_List_Item fparser.two.Fortran2003.Allocatable_Stmt fparser.two.Fortran2003.Asynchronous_Stmt fparser.two.Fortran2003.Bind_Stmt fparser.two.Fortran2003.Bind_Entity fparser.two.Fortran2003.Data_Stmt fparser.two.Fortran2003.Data_Stmt_Set fparser.two.Fortran2003.Data_Stmt_Object fparser.two.Fortran2003.Data_Implied_Do fparser.two.Fortran2003.Data_I_Do_Object fparser.two.Fortran2003.Data_I_Do_Variable fparser.two.Fortran2003.Data_Stmt_Value fparser.two.Fortran2003.Data_Stmt_Repeat fparser.two.Fortran2003.Data_Stmt_Constant fparser.two.Fortran2003.Int_Constant_Subobject fparser.two.Fortran2003.Constant_Subobject fparser.two.Fortran2003.Dimension_Stmt fparser.two.Fortran2003.Intent_Stmt fparser.two.Fortran2003.Optional_Stmt fparser.two.Fortran2003.Parameter_Stmt fparser.two.Fortran2003.Named_Constant_Def fparser.two.Fortran2003.Cray_Pointer_Stmt fparser.two.Fortran2003.Cray_Pointer_Decl fparser.two.Fortran2003.Cray_Pointee_Decl fparser.two.Fortran2003.Cray_Pointee_Array_Spec fparser.two.Fortran2003.Pointer_Stmt fparser.two.Fortran2003.Pointer_Decl fparser.two.Fortran2003.Protected_Stmt fparser.two.Fortran2003.Save_Stmt fparser.two.Fortran2003.Saved_Entity fparser.two.Fortran2003.Proc_Pointer_Name fparser.two.Fortran2003.Target_Entity_Decl fparser.two.Fortran2003.Target_Stmt fparser.two.Fortran2003.Value_Stmt fparser.two.Fortran2003.Volatile_Stmt fparser.two.Fortran2003.Implicit_Stmt fparser.two.Fortran2003.Implicit_Spec fparser.two.Fortran2003.Letter_Spec fparser.two.Fortran2003.Namelist_Stmt fparser.two.Fortran2003.Namelist_Group_Object fparser.two.Fortran2003.Equivalence_Stmt fparser.two.Fortran2003.Equivalence_Set fparser.two.Fortran2003.Equivalence_Object fparser.two.Fortran2003.Common_Stmt fparser.two.Fortran2003.Common_Block_Object fparser.two.Fortran2003.Variable fparser.two.Fortran2003.Variable_Name fparser.two.Fortran2003.Designator fparser.two.Fortran2003.Logical_Variable fparser.two.Fortran2003.Default_Logical_Variable fparser.two.Fortran2003.Char_Variable fparser.two.Fortran2003.Default_Char_Variable fparser.two.Fortran2003.Int_Variable fparser.two.Fortran2003.Substring fparser.two.Fortran2003.Parent_String fparser.two.Fortran2003.Substring_Range fparser.two.Fortran2003.Data_Ref fparser.two.Fortran2003.Part_Ref fparser.two.Fortran2003.Structure_Component fparser.two.Fortran2003.Type_Param_Inquiry fparser.two.Fortran2003.Array_Element fparser.two.Fortran2003.Array_Section fparser.two.Fortran2003.Subscript fparser.two.Fortran2003.Section_Subscript fparser.two.Fortran2003.Subscript_Triplet fparser.two.Fortran2003.Stride fparser.two.Fortran2003.Vector_Subscript fparser.two.Fortran2003.Allocate_Stmt fparser.two.Fortran2003.Stat_Variable fparser.two.Fortran2003.Errmsg_Variable fparser.two.Fortran2003.Source_Expr fparser.two.Fortran2003.Alloc_Opt fparser.two.Fortran2003.Allocation fparser.two.Fortran2003.Allocate_Object fparser.two.Fortran2003.Allocate_Shape_Spec fparser.two.Fortran2003.Lower_Bound_Expr fparser.two.Fortran2003.Upper_Bound_Expr fparser.two.Fortran2003.Nullify_Stmt fparser.two.Fortran2003.Pointer_Object fparser.two.Fortran2003.Deallocate_Stmt fparser.two.Fortran2003.Dealloc_Opt fparser.two.Fortran2003.Scalar_Char_Initialization_Expr fparser.two.Fortran2003.Primary fparser.two.Fortran2003.Parenthesis fparser.two.Fortran2003.Level_1_Expr fparser.two.Fortran2003.Defined_Unary_Op fparser.two.Fortran2003.Defined_Op fparser.two.Fortran2003.Mult_Operand fparser.two.Fortran2003.Add_Operand fparser.two.Fortran2003.Level_2_Expr fparser.two.Fortran2003.Level_2_Unary_Expr fparser.two.Fortran2003.Level_3_Expr fparser.two.Fortran2003.Level_4_Expr fparser.two.Fortran2003.And_Operand fparser.two.Fortran2003.Or_Operand fparser.two.Fortran2003.Equiv_Operand fparser.two.Fortran2003.Level_5_Expr fparser.two.Fortran2003.Expr fparser.two.Fortran2003.Defined_Binary_Op fparser.two.Fortran2003.Logical_Expr fparser.two.Fortran2003.Char_Expr fparser.two.Fortran2003.Default_Char_Expr fparser.two.Fortran2003.Int_Expr fparser.two.Fortran2003.Numeric_Expr fparser.two.Fortran2003.Specification_Expr fparser.two.Fortran2003.Initialization_Expr fparser.two.Fortran2003.Char_Initialization_Expr fparser.two.Fortran2003.Int_Initialization_Expr fparser.two.Fortran2003.Logical_Initialization_Expr fparser.two.Fortran2003.Assignment_Stmt fparser.two.Fortran2003.Pointer_Assignment_Stmt fparser.two.Fortran2003.Data_Pointer_Object fparser.two.Fortran2003.Bounds_Spec fparser.two.Fortran2003.Bounds_Remapping fparser.two.Fortran2003.Data_Target fparser.two.Fortran2003.Proc_Pointer_Object fparser.two.Fortran2003.Proc_Component_Ref fparser.two.Fortran2003.Proc_Target fparser.two.Fortran2003.Where_Stmt fparser.two.Fortran2003.Where_Construct fparser.two.Fortran2003.Where_Construct_Stmt fparser.two.Fortran2003.Where_Body_Construct fparser.two.Fortran2003.Where_Assignment_Stmt fparser.two.Fortran2003.Mask_Expr fparser.two.Fortran2003.Masked_Elsewhere_Stmt fparser.two.Fortran2003.Elsewhere_Stmt fparser.two.Fortran2003.End_Where_Stmt fparser.two.Fortran2003.Forall_Construct fparser.two.Fortran2003.Forall_Construct_Stmt fparser.two.Fortran2003.Forall_Header fparser.two.Fortran2003.Forall_Triplet_Spec fparser.two.Fortran2003.Forall_Body_Construct fparser.two.Fortran2003.Forall_Assignment_Stmt fparser.two.Fortran2003.End_Forall_Stmt fparser.two.Fortran2003.Forall_Stmt fparser.two.Fortran2003.Block fparser.two.Fortran2003.If_Construct fparser.two.Fortran2003.If_Then_Stmt fparser.two.Fortran2003.Else_If_Stmt fparser.two.Fortran2003.Else_Stmt fparser.two.Fortran2003.End_If_Stmt fparser.two.Fortran2003.If_Stmt fparser.two.Fortran2003.Case_Construct fparser.two.Fortran2003.Select_Case_Stmt fparser.two.Fortran2003.Case_Stmt fparser.two.Fortran2003.End_Select_Stmt fparser.two.Fortran2003.Case_Expr fparser.two.Fortran2003.Case_Selector fparser.two.Fortran2003.Case_Value_Range fparser.two.Fortran2003.Case_Value fparser.two.Fortran2003.Associate_Construct fparser.two.Fortran2003.Associate_Stmt fparser.two.Fortran2003.Association fparser.two.Fortran2003.Selector fparser.two.Fortran2003.End_Associate_Stmt fparser.two.Fortran2003.Select_Type_Construct fparser.two.Fortran2003.Select_Type_Stmt fparser.two.Fortran2003.Type_Guard_Stmt fparser.two.Fortran2003.End_Select_Type_Stmt fparser.two.Fortran2003.Do_Construct fparser.two.Fortran2003.Block_Do_Construct fparser.two.Fortran2003.Block_Label_Do_Construct fparser.two.Fortran2003.Block_Nonlabel_Do_Construct fparser.two.Fortran2003.Do_Stmt fparser.two.Fortran2003.Label_Do_Stmt fparser.two.Fortran2003.Nonlabel_Do_Stmt fparser.two.Fortran2003.Loop_Control fparser.two.Fortran2003.Do_Variable fparser.two.Fortran2003.Do_Block fparser.two.Fortran2003.End_Do fparser.two.Fortran2003.End_Do_Stmt fparser.two.Fortran2003.Nonblock_Do_Construct fparser.two.Fortran2003.Action_Term_Do_Construct fparser.two.Fortran2003.Do_Body fparser.two.Fortran2003.Do_Term_Action_Stmt fparser.two.Fortran2003.Outer_Shared_Do_Construct fparser.two.Fortran2003.Shared_Term_Do_Construct fparser.two.Fortran2003.Inner_Shared_Do_Construct fparser.two.Fortran2003.Do_Term_Shared_Stmt fparser.two.Fortran2003.Cycle_Stmt fparser.two.Fortran2003.Exit_Stmt fparser.two.Fortran2003.Goto_Stmt fparser.two.Fortran2003.Computed_Goto_Stmt fparser.two.Fortran2003.Arithmetic_If_Stmt fparser.two.Fortran2003.Continue_Stmt fparser.two.Fortran2003.Stop_Stmt fparser.two.Fortran2003.Stop_Code fparser.two.Fortran2003.Io_Unit fparser.two.Fortran2003.File_Unit_Number fparser.two.Fortran2003.Internal_File_Variable fparser.two.Fortran2003.Open_Stmt fparser.two.Fortran2003.Connect_Spec fparser.two.Fortran2003.File_Name_Expr fparser.two.Fortran2003.Iomsg_Variable fparser.two.Fortran2003.Close_Stmt fparser.two.Fortran2003.Close_Spec fparser.two.Fortran2003.Read_Stmt fparser.two.Fortran2003.Write_Stmt fparser.two.Fortran2003.Print_Stmt fparser.two.Fortran2003.Io_Control_Spec_List fparser.two.Fortran2003.Io_Control_Spec fparser.two.Fortran2003.Format fparser.two.Fortran2003.Input_Item fparser.two.Fortran2003.Output_Item fparser.two.Fortran2003.Io_Implied_Do fparser.two.Fortran2003.Io_Implied_Do_Object fparser.two.Fortran2003.Io_Implied_Do_Control fparser.two.Fortran2003.Dtv_Type_Spec fparser.two.Fortran2003.Wait_Stmt fparser.two.Fortran2003.Wait_Spec fparser.two.Fortran2003.Backspace_Stmt fparser.two.Fortran2003.Endfile_Stmt fparser.two.Fortran2003.Rewind_Stmt fparser.two.Fortran2003.Position_Spec fparser.two.Fortran2003.Flush_Stmt fparser.two.Fortran2003.Flush_Spec fparser.two.Fortran2003.Inquire_Stmt fparser.two.Fortran2003.Inquire_Spec fparser.two.Fortran2003.Format_Stmt fparser.two.Fortran2003.Format_Item_List fparser.two.Fortran2003.Format_Specification fparser.two.Fortran2003.Format_Item_C1002 fparser.two.Fortran2003.Hollerith_Item fparser.two.Fortran2003.Format_Item fparser.two.Fortran2003.R fparser.two.Fortran2003.Data_Edit_Desc_C1002 fparser.two.Fortran2003.Data_Edit_Desc fparser.two.Fortran2003.W fparser.two.Fortran2003.M fparser.two.Fortran2003.D fparser.two.Fortran2003.E fparser.two.Fortran2003.V fparser.two.Fortran2003.Control_Edit_Desc fparser.two.Fortran2003.K fparser.two.Fortran2003.Position_Edit_Desc fparser.two.Fortran2003.N fparser.two.Fortran2003.Sign_Edit_Desc fparser.two.Fortran2003.Blank_Interp_Edit_Desc fparser.two.Fortran2003.Round_Edit_Desc fparser.two.Fortran2003.Decimal_Edit_Desc fparser.two.Fortran2003.Char_String_Edit_Desc fparser.two.Fortran2003.Main_Program fparser.two.Fortran2003.Main_Program0 fparser.two.Fortran2003.Program_Stmt fparser.two.Fortran2003.End_Program_Stmt fparser.two.Fortran2003.Module fparser.two.Fortran2003.Module_Stmt fparser.two.Fortran2003.End_Module_Stmt fparser.two.Fortran2003.Module_Subprogram_Part fparser.two.Fortran2003.Module_Subprogram fparser.two.Fortran2003.Use_Stmt fparser.two.Fortran2003.Module_Nature fparser.two.Fortran2003.Rename fparser.two.Fortran2003.Only fparser.two.Fortran2003.Only_Use_Name fparser.two.Fortran2003.Local_Defined_Operator fparser.two.Fortran2003.Use_Defined_Operator fparser.two.Fortran2003.Block_Data fparser.two.Fortran2003.Block_Data_Stmt fparser.two.Fortran2003.End_Block_Data_Stmt fparser.two.Fortran2003.Interface_Block fparser.two.Fortran2003.Interface_Specification fparser.two.Fortran2003.Interface_Stmt fparser.two.Fortran2003.End_Interface_Stmt fparser.two.Fortran2003.Function_Body fparser.two.Fortran2003.Subroutine_Body fparser.two.Fortran2003.Interface_Body fparser.two.Fortran2003.Procedure_Stmt fparser.two.Fortran2003.Generic_Spec fparser.two.Fortran2003.Dtio_Generic_Spec fparser.two.Fortran2003.Import_Stmt fparser.two.Fortran2003.External_Stmt fparser.two.Fortran2003.Procedure_Declaration_Stmt fparser.two.Fortran2003.Proc_Interface fparser.two.Fortran2003.Proc_Attr_Spec fparser.two.Fortran2003.Proc_Decl fparser.two.Fortran2003.Interface_Name fparser.two.Fortran2003.Intrinsic_Stmt fparser.two.Fortran2003.Function_Reference fparser.two.Fortran2003.Intrinsic_Name fparser.two.Fortran2003.Intrinsic_Function_Reference fparser.two.Fortran2003.Call_Stmt fparser.two.Fortran2003.Procedure_Designator fparser.two.Fortran2003.Actual_Arg_Spec fparser.two.Fortran2003.Actual_Arg fparser.two.Fortran2003.Alt_Return_Spec fparser.two.Fortran2003.Function_Subprogram fparser.two.Fortran2003.Function_Stmt fparser.two.Fortran2003.Proc_Language_Binding_Spec fparser.two.Fortran2003.Dummy_Arg_Name fparser.two.Fortran2003.Prefix fparser.two.Fortran2003.Prefix_Spec fparser.two.Fortran2003.Suffix fparser.two.Fortran2003.End_Function_Stmt fparser.two.Fortran2003.Subroutine_Subprogram fparser.two.Fortran2003.Subroutine_Stmt fparser.two.Fortran2003.Dummy_Arg fparser.two.Fortran2003.End_Subroutine_Stmt fparser.two.Fortran2003.Entry_Stmt fparser.two.Fortran2003.Return_Stmt fparser.two.Fortran2003.Contains_Stmt fparser.two.Fortran2003.Stmt_Function_Stmt Functions --------- .. autoapisummary:: fparser.two.Fortran2003.match_comment_or_include fparser.two.Fortran2003.add_comments_includes_directives fparser.two.Fortran2003.skip_digits fparser.two.Fortran2003.c1242_valid Module Contents --------------- .. py:class:: Directive(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` Represents a Directive. Directives are leaves in the tree, containing a single item consisting of the directive string. Fparser supports the following directive formats: 1. '!$', 'c$' or '*$' followed by any alphabetical character for generic directives. 2. '!dir$' or 'cdir$' for the flang, ifx or ifort compilers. 3. '!gcc$' for the gfortran compiler. .. py:attribute:: subclass_names :value: [] .. py:attribute:: _directive_formats :value: ['\\!\\$[a-z]', 'c\\$[a-z]', '\\*\\$[a-z]', '\\!dir\\$', 'cdir\\$', '\\!gcc\\$'] .. py:method:: init(comment) -> None Initialise this Directive from a comment object. :param comment: The comment object produced by the reader :type comment: :py:class:`readfortran.Comment` .. py:method:: tostr() -> str :returns: this directive as a string. .. py:class:: Comment(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` Represents a Fortran Comment. .. py:attribute:: subclass_names :value: [] .. py:method:: init(comment) Initialise this Comment :param comment: The comment object produced by the reader :type comment: :py:class:`readfortran.Comment` .. py:method:: tostr() :returns: this comment as a string. :rtype: :py:class:`str` .. py:function:: match_comment_or_include(reader) Creates a comment, directive, or include object from the current line. :param reader: the fortran file reader containing the line of code that we are trying to match :type reader: :py:class:`fparser.common.readfortran.FortranFileReader` or :py:class:`fparser.common.readfortran.FortranStringReader` :return: a comment, directive, or include object if found, otherwise `None`. :rtype: :py:class:`fparser.two.Fortran2003.Comment` or :py:class:`fparser.two.Fortran2003.Include_Stmt` or :py:class:`fparser.two.Fortran2003.Directive` .. py:function:: add_comments_includes_directives(content, reader) Creates comment, include, and/or cpp directive objects and adds them to the content list. Comment, include, and/or directive objects are added until a line that is not a comment, include, or directive is found. :param content: a `list` of matched objects. Any matched comments, includes, or directives in this routine are added to this list. :type content: :obj:`list` :param reader: the fortran file reader containing the line(s) of code that we are trying to match :type reader: :py:class:`fparser.common.readfortran.FortranFileReader` or :py:class:`fparser.common.readfortran.FortranStringReader` .. py:class:: Program(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.BlockBase` Fortran 2003 rule R201:: program is program-unit [ program-unit ] ... .. py:attribute:: subclass_names :value: [] .. py:attribute:: use_names :value: ['Program_Unit'] .. py:method:: __getnewargs__() Method to dictate the values passed to the __new__() method upon unpickling. The method must return a pair (args, kwargs) where args is a tuple of positional arguments and kwargs a dictionary of named arguments for constructing the object. Those will be passed to the __new__() method upon unpickling. :return: set of arguments for __new__ :rtype: tuple[str, bool] .. py:method:: match(reader) :staticmethod: Implements the matching for a Program. Whilst the rule looks like it could make use of BlockBase, the parser must not match if an optional program_unit has a syntax error, which the BlockBase match implementation does not do. :param reader: the fortran file reader containing the line(s) of code that we are trying to match :type reader: :py:class:`fparser.common.readfortran.FortranFileReader` or :py:class:`fparser.common.readfortran.FortranStringReader` :return: `tuple` containing a single `list` which contains instance of the classes that have matched if there is a match or `None` if there is no match .. py:class:: Include_Filename(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.StringBase` Implements the matching of a filename from an include statement. .. py:attribute:: subclass_names :value: [] .. py:method:: match(string) :staticmethod: Match the string with the regular expression file_name in the pattern_tools file. The only content that is not accepted is an empty string or white space at the start or end of the string. :param str string: the string to match with the pattern rule. :return: a tuple of size 1 containing a string with the matched name if there is a match, or None if there is not. :rtype: (str) or NoneType .. py:class:: Include_Stmt(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` Implements the matching of a Fortran include statement. There is no rule for this as the compiler is expected to inline any content from an include statement when one is found. However, for a parser it can make sense to represent an include statement in a parse tree:: include-stmt is INCLUDE ['filename' or "filename"] .. py:attribute:: use_names :value: ['Include_Filename'] .. py:method:: match(string) :staticmethod: Implements the matching for an include statement. :param str string: the string to match with as an include statement. :returns: a tuple of size 1 containing an Include_Filename object with the matched filename if there is a match, or None if there is not. :rtype: (:py:class:`fparser.two.Fortran2003.Include_Filename`) or NoneType .. py:method:: tostr() :return: this include_stmt as a string :rtype: str .. py:class:: Program_Unit(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` Fortran 2003 Rule R202:: = | | | .. py:attribute:: subclass_names :value: ['Comment', 'Main_Program', 'External_Subprogram', 'Module', 'Block_Data'] .. py:class:: External_Subprogram(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` Fortran2003 Rule R203:: = | .. py:attribute:: subclass_names :value: ['Comment', 'Function_Subprogram', 'Subroutine_Subprogram'] .. py:class:: Specification_Part(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.BlockBase` Fortran2003 Rule R204:: = [ ]... [ ]... [ ] [ ]... .. py:attribute:: subclass_names :value: [] .. py:attribute:: use_names :value: ['Use_Stmt', 'Import_Stmt', 'Implicit_Part', 'Declaration_Construct'] .. py:method:: match(reader) :staticmethod: Checks whether the content in reader matches the given type of block statement (e.g. DO..END DO, IF...END IF etc.) :param type startcls: the class marking the beginning of the block :param list subclasses: list of classes that can be children of the block. :param type endcls: the class marking the end of the block. :param reader: content to check for match. :type reader: str or instance of :py:class:`FortranReaderBase` :param bool match_labels: whether or not the statement terminating the block must have a label that matches the opening statement. Default is False. :param bool match_names: TBD :param tuple match_name_classes: TBD :param bool enable_do_label_construct_hook: TBD :param bool enable_if_construct_hook: TBD :param bool enable_where_construct_hook: TBD :param bool strict_order: whether to enforce the order of the given subclasses. :param bool strict_match_names: if start name present, end name must exist and match. :return: instance of startcls or None if no match is found :rtype: startcls .. py:class:: Implicit_Part(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.BlockBase` Fortran2003 Rule R205:: = [ ]... .. py:attribute:: subclass_names :value: [] .. py:attribute:: use_names :value: ['Implicit_Part_Stmt', 'Implicit_Stmt'] .. py:method:: match(reader) :staticmethod: Checks whether the content in reader matches the given type of block statement (e.g. DO..END DO, IF...END IF etc.) :param type startcls: the class marking the beginning of the block :param list subclasses: list of classes that can be children of the block. :param type endcls: the class marking the end of the block. :param reader: content to check for match. :type reader: str or instance of :py:class:`FortranReaderBase` :param bool match_labels: whether or not the statement terminating the block must have a label that matches the opening statement. Default is False. :param bool match_names: TBD :param tuple match_name_classes: TBD :param bool enable_do_label_construct_hook: TBD :param bool enable_if_construct_hook: TBD :param bool enable_where_construct_hook: TBD :param bool strict_order: whether to enforce the order of the given subclasses. :param bool strict_match_names: if start name present, end name must exist and match. :return: instance of startcls or None if no match is found :rtype: startcls .. py:class:: Implicit_Part_Stmt(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` Fortran2003 Rule R206:: = | | | .. py:attribute:: subclass_names :value: ['Comment', 'Implicit_Stmt', 'Parameter_Stmt', 'Format_Stmt', 'Entry_Stmt'] .. py:class:: Declaration_Construct(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` Fortran 2003 rule R207:: declaration-construct is derived-type-def or entry-stmt or enum-def or format-stmt or interface-block or parameter-stmt or procedure-declaration-stmt or specification-stmt or type-declaration-stmt or stmt-function-stmt Note, stmt-function-stmt is not currently matched. .. py:attribute:: subclass_names :value: ['Derived_Type_Def', 'Entry_Stmt', 'Enum_Def', 'Format_Stmt', 'Interface_Block',... .. py:class:: Execution_Part(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.BlockBase` Fortran2003 Rule R208:: = | [ ]... shall not contain , , .. py:attribute:: subclass_names :value: [] .. py:attribute:: use_names :value: ['Executable_Construct_C201', 'Execution_Part_Construct_C201'] .. py:method:: match(string) :staticmethod: Checks whether the content in reader matches the given type of block statement (e.g. DO..END DO, IF...END IF etc.) :param type startcls: the class marking the beginning of the block :param list subclasses: list of classes that can be children of the block. :param type endcls: the class marking the end of the block. :param reader: content to check for match. :type reader: str or instance of :py:class:`FortranReaderBase` :param bool match_labels: whether or not the statement terminating the block must have a label that matches the opening statement. Default is False. :param bool match_names: TBD :param tuple match_name_classes: TBD :param bool enable_do_label_construct_hook: TBD :param bool enable_if_construct_hook: TBD :param bool enable_where_construct_hook: TBD :param bool strict_order: whether to enforce the order of the given subclasses. :param bool strict_match_names: if start name present, end name must exist and match. :return: instance of startcls or None if no match is found :rtype: startcls .. py:class:: Execution_Part_Construct(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` :: = | | | .. py:attribute:: subclass_names :value: ['Comment', 'Executable_Construct', 'Format_Stmt', 'Entry_Stmt', 'Data_Stmt'] .. py:class:: Execution_Part_Construct_C201(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` Base class for Fortran 2003 syntax rules. All Base classes have the following attributes:: self.string - original argument to construct a class instance, its type is either str or FortranReaderBase. self.item - Line instance (holds label) or None. :param type cls: the class of object to create. :param string: (source of) Fortran string to parse. :type string: str | :py:class:`fparser.common.readfortran.FortranReaderBase` :param parent_cls: the parent class of this object. :type parent_cls: `type` .. py:attribute:: subclass_names :value: ['Comment', 'Executable_Construct_C201', 'Format_Stmt', 'Entry_Stmt', 'Data_Stmt'] .. py:class:: Internal_Subprogram_Part(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.BlockBase` :: = [ ]... .. py:attribute:: subclass_names :value: [] .. py:attribute:: use_names :value: ['Contains_Stmt', 'Internal_Subprogram'] .. py:method:: match(reader) :staticmethod: Checks whether the content in reader matches the given type of block statement (e.g. DO..END DO, IF...END IF etc.) :param type startcls: the class marking the beginning of the block :param list subclasses: list of classes that can be children of the block. :param type endcls: the class marking the end of the block. :param reader: content to check for match. :type reader: str or instance of :py:class:`FortranReaderBase` :param bool match_labels: whether or not the statement terminating the block must have a label that matches the opening statement. Default is False. :param bool match_names: TBD :param tuple match_name_classes: TBD :param bool enable_do_label_construct_hook: TBD :param bool enable_if_construct_hook: TBD :param bool enable_where_construct_hook: TBD :param bool strict_order: whether to enforce the order of the given subclasses. :param bool strict_match_names: if start name present, end name must exist and match. :return: instance of startcls or None if no match is found :rtype: startcls .. py:class:: Internal_Subprogram(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` :: = | .. py:attribute:: subclass_names :value: ['Function_Subprogram', 'Subroutine_Subprogram'] .. py:class:: Specification_Stmt(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` :: = | | | | | | | | | | | | | | | | | | .. py:attribute:: subclass_names :value: ['Access_Stmt', 'Allocatable_Stmt', 'Asynchronous_Stmt', 'Bind_Stmt', 'Comment', 'Common_Stmt',... .. py:class:: Executable_Construct(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` Fortran 2003 rule R213:: executable-construct is action-stmt or associate-construct or case-construct or do-construct or forall-construct or if-construct or select-type-construct or where-construct .. py:attribute:: subclass_names :value: ['Action_Stmt', 'Associate_Construct', 'Case_Construct', 'Do_Construct', 'Forall_Construct',... .. py:class:: Executable_Construct_C201(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` Base class for Fortran 2003 syntax rules. All Base classes have the following attributes:: self.string - original argument to construct a class instance, its type is either str or FortranReaderBase. self.item - Line instance (holds label) or None. :param type cls: the class of object to create. :param string: (source of) Fortran string to parse. :type string: str | :py:class:`fparser.common.readfortran.FortranReaderBase` :param parent_cls: the parent class of this object. :type parent_cls: `type` .. py:attribute:: subclass_names :value: ['Action_Stmt', 'Associate_Construct', 'Case_Construct', 'Do_Construct', 'Forall_Construct',... .. py:class:: Action_Stmt(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` :: = | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | .. py:attribute:: subclass_names :value: ['Allocate_Stmt', 'Assignment_Stmt', 'Backspace_Stmt', 'Call_Stmt', 'Close_Stmt', 'Comment',... .. py:class:: Action_Stmt_C201(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` :: = C201 is applied. .. py:attribute:: subclass_names :value: ['Allocate_Stmt', 'Assignment_Stmt', 'Backspace_Stmt', 'Call_Stmt', 'Close_Stmt', 'Comment',... .. py:class:: Action_Stmt_C802(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` :: = C802 is applied. .. py:attribute:: subclass_names :value: ['Allocate_Stmt', 'Assignment_Stmt', 'Backspace_Stmt', 'Call_Stmt', 'Close_Stmt', 'Comment',... .. py:class:: Action_Stmt_C824(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` :: = C824 is applied. .. py:attribute:: subclass_names :value: ['Allocate_Stmt', 'Assignment_Stmt', 'Backspace_Stmt', 'Call_Stmt', 'Close_Stmt', 'Comment',... .. py:class:: Keyword(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` :: = .. py:attribute:: subclass_names :value: ['Name'] .. py:class:: Name(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.StringBase` Fortran 2003 rule R304:: name is letter [ alphanumeric_character ]... .. py:attribute:: subclass_names :value: [] .. py:method:: match(string) :staticmethod: Match the string with the regular expression abs_name in the pattern_tools file. :param str string: the string to match with the pattern rule. :return: a tuple of size 1 containing a string with the matched name if there is a match, or None if there is not. :rtype: (str) or None .. py:class:: Constant(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` :: = | .. py:attribute:: subclass_names :value: ['Literal_Constant', 'Named_Constant'] .. py:class:: Literal_Constant(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` :: = | | | | | .. py:attribute:: subclass_names :value: ['Int_Literal_Constant', 'Real_Literal_Constant', 'Complex_Literal_Constant',... .. py:class:: Named_Constant(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` :: = .. py:attribute:: subclass_names :value: ['Name'] .. py:class:: Int_Constant(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` :: = .. py:attribute:: subclass_names :value: ['Constant'] .. py:class:: Char_Constant(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` :: = .. py:attribute:: subclass_names :value: ['Constant'] .. py:class:: Defined_Operator(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.Base` Fortran 2003 rule R311:: defined-operator is defined-unary-op or defined-binary-op or extended-intrinsic-op Note, defined-operator is defined in pattern_tools.py so could be called directly via a stringbase match. However, the defined unary and binary op rules have constraints which would not be checked if we did this. Note, whilst we subclass for both Defined Unary and Binary ops, the match is the same so we will only ever match with the first (so the second is not really necessary here). This is OK from a parsing point of view as they both return a Defined_Op class, so are identical from the parsers point of view. .. py:attribute:: subclass_names :value: ['Defined_Unary_Op', 'Defined_Binary_Op', 'Extended_Intrinsic_Op'] .. py:class:: Extended_Intrinsic_Op(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.StringBase` Fortran 2003 rule R312:: extended-intrinsic-op is intrinsic-operator Note, extended-intrinsic-op is only ever used by R311 and is defined in pattern_tools.py so could be matched directly in the Defined_Operator class (by changing it to STRINGBase and moving the match in this class into the Defined_Operator class). This would mean that this class would not be required. However, the parse tree would then not have the concept of an Extended_Intrinsic_Op which might be useful for code manipulation tools. .. py:method:: match(string) :staticmethod: Implements the matching for the extended-intrinsic-op rule. Matches the string with the regular expression extended_intrinsic_operator in the pattern_tools file. :param str string: the string to match with the pattern rule. :return: a tuple of size 1 containing a string with the matched name if there is a match, or None if there is not. :rtype: (str) or None .. py:class:: Label(string, parent_cls=None) Bases: :py:obj:`fparser.two.utils.StringBase` ::