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

Static Public Member Functions

def match (string)
 

Static Public Attributes

 subclass_names
 
 use_names
 

Detailed Description

Fortran 2003 Rule R612

data-ref is part-ref [ % part-ref ] ...

If there is only one part-ref then return a 'Part_Ref' object (or
another object from a matching sub-rule). If there is more than
one part-ref then return a 'Data_Ref' object containing the
part-ref's.

Definition at line 4631 of file Fortran2003.py.

Member Function Documentation

◆ match()

def fparser.two.Fortran2003.Data_Ref.match (   string)
static
Implements the matching for a data-reference. This defines a series
of dereferences e.g. a%b%c.

If there is more than one part-ref then return a 'Data_Ref'
object containing the part-ref's, otherwise return 'None'. A
single 'part-ref' is purposely not matched here.

:param str string: Fortran code to check for a match

:return: `None` if there is no match, or a tuple containing \
 the matched operator as a string and another tuple \
 containing the matched subclasses.

:rtype: NoneType or (str, (obj, obj, ...))

Definition at line 4648 of file Fortran2003.py.

4648  def match(string):
4649  """Implements the matching for a data-reference. This defines a series
4650  of dereferences e.g. a%b%c.
4651 
4652  If there is more than one part-ref then return a 'Data_Ref'
4653  object containing the part-ref's, otherwise return 'None'. A
4654  single 'part-ref' is purposely not matched here.
4655 
4656  :param str string: Fortran code to check for a match
4657 
4658  :return: `None` if there is no match, or a tuple containing \
4659  the matched operator as a string and another tuple \
4660  containing the matched subclasses.
4661 
4662  :rtype: NoneType or (str, (obj, obj, ...))
4663 
4664  """
4665  # Use SequenceBase as normal, then force no match when there is
4666  # only one entry in the sequence.
4667  result = SequenceBase.match(r"%", Part_Ref, string)
4668  entries = result[1]
4669  if len(entries) > 1:
4670  # There is more than one part-ref so return a Data_Ref
4671  # object containing the part-refs.
4672  return result
4673  # There is only one part-ref so return None to indicate there
4674  # is no match and allow the subclass_names Part_Ref class to
4675  # match instead.
4676  return None
4677 
4678 
Here is the caller graph for this function:

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