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

Static Public Member Functions

def match (reader)
 

Static Public Attributes

 subclass_names
 
 use_names
 

Detailed Description

Rule 1101 specifies that the opening 'program-stmt' is optional. This
class handles the special case when it is not supplied and thus
matches on:

    <main-program> =
                     [ <specification-part> ]
                     [ <execution-part> ]
                     [ <internal-subprogram-part> ]
                     <end-program-stmt>

C1102 The program-name may be included in the end-program-stmt
only if the optional program-stmt is used and, if included, shall
be identical to the program-name specified in the
program-stmt.

In this class an end program name is not allowed due to C1102.

Definition at line 10074 of file Fortran2003.py.

Member Function Documentation

◆ match()

def fparser.two.Fortran2003.Main_Program0.match (   reader)
static
Attempts to match the content in the reader with a program that is
missing the optional opening program-stmt (R1101). If the match
is successful, a symbol table named "fparser2:main_program" is
also created.

:param reader: Content to check for match
:type reader: str or instance of :py:class:`FortranReaderBase`

:return: 2-tuple of (list of matched classes,  None) or None \
 if no match is found.
:rtype: (list of matched classes, None) or NoneType

Definition at line 10105 of file Fortran2003.py.

10105  def match(reader):
10106  """
10107  Attempts to match the content in the reader with a program that is
10108  missing the optional opening program-stmt (R1101). If the match
10109  is successful, a symbol table named "fparser2:main_program" is
10110  also created.
10111 
10112  :param reader: Content to check for match
10113  :type reader: str or instance of :py:class:`FortranReaderBase`
10114 
10115  :return: 2-tuple of (list of matched classes, None) or None \
10116  if no match is found.
10117  :rtype: (list of matched classes, None) or NoneType
10118 
10119  """
10120  # For this special case we have to supply a name for the top-level
10121  # symbol table. We include a ':' so that it is not a valid Fortran
10122  # name and therefore cannot clash with any routine names.
10123  table_name = "fparser2:main_program"
10124  SYMBOL_TABLES.enter_scope(table_name)
10125 
10126  result = BlockBase.match(
10127  None,
10128  [Specification_Part, Execution_Part, Internal_Subprogram_Part],
10129  End_Program_Stmt,
10130  reader,
10131  )
10132 
10133  SYMBOL_TABLES.exit_scope()
10134  if not result:
10135  # The match failed so remove the associated symbol table
10136  SYMBOL_TABLES.remove(table_name)
10137 
10138  return result
10139 
10140 
Here is the caller graph for this function:

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