fparser Reference Guide  0.0.14
fparser.one.statements.Call Class Reference
Inheritance diagram for fparser.one.statements.Call:
Collaboration diagram for fparser.one.statements.Call:

Public Member Functions

def process_item (self)
 
def tofortran (self, isfix=None)
 
def analyze (self)
 
- Public Member Functions inherited from fparser.common.base_classes.Statement
def __init__ (self, parent, item)
 
def __repr__ (self)
 
def torepr (self, depth=-1, incrtab="")
 
def get_indent_tab (self, deindent=False, isfix=None)
 
def __str__ (self)
 
def asfix (self)
 
def format_message (self, kind, message)
 
def error (self, message)
 
def warning (self, message)
 
def info (self, message)
 
def analyze (self)
 
def get_variable (self, name)
 
def get_type (self, name)
 
def get_type_decl (self, kind)
 
def get_provides (self)
 
- Public Member Functions inherited from fparser.common.utils.classes
def __new__ (metacls, name, bases, dict)
 
- Public Member Functions inherited from fparser.common.utils.meta_classes
def __getattr__ (self, name)
 

Public Attributes

 isvalid
 
 designator
 
 items
 
- Public Attributes inherited from fparser.common.base_classes.Statement
 parent
 
 reader
 
 top
 
 item
 
 programblock
 
 isvalid
 
 ignore
 
 a
 

Static Public Attributes

 match
 
- Static Public Attributes inherited from fparser.common.base_classes.Statement
list modes = ["free", "fix", "f77", "pyf"]
 

Detailed Description

Call statement class
CALL <procedure-designator> [ ( [ <actual-arg-spec-list> ] ) ]

<procedure-designator> = <procedure-name>
                       | <proc-component-ref>
                       | <data-ref> % <binding-name>

<actual-arg-spec> = [ <keyword> = ] <actual-arg>
<actual-arg> = <expr>
             | <variable>
             | <procedure-name>
             | <proc-component-ref>
             | <alt-return-spec>
<alt-return-spec> = * <label>

<proc-component-ref> = <variable> % <procedure-component-name>

<variable> = <designator>

Call instance has attributes:
  designator
  arg_list

Definition at line 300 of file statements.py.

Member Function Documentation

◆ process_item()

def fparser.one.statements.Call.process_item (   self)
Parse the string containing the Call and store the
designator and list of arguments (if any)

Definition at line 332 of file statements.py.

References fparser.one.statements.Call.designator, fparser.common.base_classes.Statement.isvalid, fparser.common.base_classes.Statement.item, fparser.one.statements.StatementWithNamelist.items, fparser.one.statements.Assign.items, and fparser.one.statements.Call.items.

332  def process_item(self):
333  """Parse the string containing the Call and store the
334  designator and list of arguments (if any)"""
335  item = self.item
336  apply_map = item.apply_map
337  line = item.get_line()[4:].strip()
338  # Work backwards from the end of the line in order to allow
339  # for code like:
340  # call my_type(1)%my_function(arg(2))
341  # The following code will also support something like:
342  # call my_type(1)%my_function("(")
343  # because fparser will previously have identified the "(" as a
344  # string expression and replaced it with something like
345  # "F2PY_EXPR_TUPLE_2"
346  if line.endswith(")"):
347  # Work back down the line until we find the matching '('
348  i = len(line) - 2
349  nopen = 1
350  while i > 0:
351  if line[i] == ")":
352  nopen += 1
353  elif line[i] == "(":
354  nopen -= 1
355  if nopen == 0:
356  # Have found the matching '(' at position i
357  break
358  i -= 1
359  if i <= 0:
360  # Have reached the beginning of the string without
361  # finding the matching '('
362  self.isvalid = False
363  return
364  self.designator = apply_map(line[:i]).strip()
365  items = split_comma(line[i + 1 : -1], item)
366  else:
367  # Call has no argument list
368  items = []
369  self.designator = apply_map(line).strip()
370  self.items = items
371  return
372 

◆ tofortran()

def fparser.one.statements.Call.tofortran (   self,
  isfix = None 
)
Returns the Fortran representation of this object as a string

Definition at line 373 of file statements.py.

References fparser.one.statements.Call.designator, fparser.common.base_classes.Statement.get_indent_tab(), fparser.one.statements.StatementWithNamelist.items, fparser.one.statements.Assign.items, fparser.one.statements.Call.items, and fparser.common.base_classes.Statement.programblock.

373  def tofortran(self, isfix=None):
374  """Returns the Fortran representation of this object as a string"""
375  txt = self.get_indent_tab(isfix=isfix) + "CALL " + str(self.designator)
376  if self.items:
377  txt += "(" + ", ".join(map(str, self.items)) + ")"
378  return txt
379 
Here is the call graph for this function:
Here is the caller graph for this function:

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