fparser Reference Guide  0.0.14
fparser.two.Fortran2003.Generic_Binding Class Reference
Inheritance diagram for fparser.two.Fortran2003.Generic_Binding:
Collaboration diagram for fparser.two.Fortran2003.Generic_Binding:

Public Member Functions

def tostr (self)
 

Static Public Member Functions

def match (string)
 

Static Public Attributes

 subclass_names
 
 use_names
 

Detailed Description

:F03R:`452`::

Fortran 2003 rule R452
that specifies syntax of generic binding for a type-bound
procedure within a derived type.

<generic-binding> = GENERIC [ , <access-spec> ] ::
    <generic-spec> => <binding-name-list>

Definition at line 2390 of file Fortran2003.py.

Member Function Documentation

◆ match()

def fparser.two.Fortran2003.Generic_Binding.match (   string)
static
:param str string: Fortran code to check for a match
:return: 3-tuple containing strings and instances of the
 classes describing a generic type-bound procedure
 (optional access specifier, mandatory generic
 identifier and mandatory binding name list)
:rtype: 3-tuple of objects (2 mandatory and 1 optional)

Definition at line 2406 of file Fortran2003.py.

2406  def match(string):
2407  """
2408  :param str string: Fortran code to check for a match
2409  :return: 3-tuple containing strings and instances of the
2410  classes describing a generic type-bound procedure
2411  (optional access specifier, mandatory generic
2412  identifier and mandatory binding name list)
2413  :rtype: 3-tuple of objects (2 mandatory and 1 optional)
2414  """
2415  # Incorrect 'GENERIC' statement
2416  if string[:7].upper() != "GENERIC":
2417  return
2418  line = string[7:].lstrip()
2419  i = line.find("::")
2420  # No mandatory double colon
2421  if i == -1:
2422  return
2423  aspec = None
2424  # Return optional access specifier (PRIVATE or PUBLIC)
2425  if line.startswith(","):
2426  aspec = Access_Spec(line[1:i].strip())
2427  line = line[i + 2 :].lstrip()
2428  i = line.find("=>")
2429  if i == -1:
2430  return
2431  # Return mandatory Generic_Spec and Binding_Name_List
2432  return (
2433  aspec,
2434  Generic_Spec(line[:i].rstrip()),
2435  Binding_Name_List(line[i + 3 :].lstrip()),
2436  )
2437 
Here is the caller graph for this function:

◆ tostr()

def fparser.two.Fortran2003.Generic_Binding.tostr (   self)
:return: parsed representation of a "GENERIC" type-bound procedure
:rtype: str

Definition at line 2438 of file Fortran2003.py.

References fparser.two.Fortran2003.Comment.items, fparser.one.statements.StatementWithNamelist.items, fparser.one.statements.Assign.items, fparser.one.statements.Call.items, fparser.one.statements.ComputedGoto.items, fparser.one.statements.AssignedGoto.items, fparser.two.utils.Base.items, fparser.one.statements.Print.items, fparser.one.statements.Read0.items, fparser.one.statements.Read1.items, fparser.one.typedecl_statements.Implicit.items, fparser.one.statements.Write.items, fparser.one.statements.Allocate.items, fparser.one.statements.Deallocate.items, fparser.one.statements.ModuleProcedure.items, fparser.one.statements.Access.items, fparser.two.utils.SequenceBase.items, fparser.one.statements.Save.items, fparser.one.statements.Nullify.items, fparser.one.statements.Use.items, fparser.one.statements.Parameter.items, fparser.one.statements.Equivalence.items, fparser.one.statements.Dimension.items, fparser.one.statements.Target.items, fparser.one.statements.Pointer.items, fparser.two.utils.EndStmtBase.items, fparser.one.statements.Inquire.items, fparser.one.statements.Namelist.items, fparser.one.statements.Common.items, fparser.one.statements.Intent.items, fparser.one.statements.Entry.items, fparser.one.statements.GenericBinding.items, fparser.one.statements.Allocatable.items, fparser.one.statements.Bind.items, fparser.one.statements.Case.items, fparser.one.statements.TypeIs.items, fparser.one.statements.ClassIs.items, fparser.one.statements.Enumerator.items, and fparser.one.statements.Depend.items.

2438  def tostr(self):
2439  """
2440  :return: parsed representation of a "GENERIC" type-bound procedure
2441  :rtype: str
2442  """
2443  if self.items[0] is None:
2444  return "GENERIC :: %s => %s" % (self.items[1:])
2445  return "GENERIC, %s :: %s => %s" % (self.items)
2446 
2447 
Here is the caller graph for this function:

The documentation for this class was generated from the following file: