fparser Reference Guide  0.0.14
fparser.two.C99Preprocessor.Cpp_Pp_Tokens Class Reference
Inheritance diagram for fparser.two.C99Preprocessor.Cpp_Pp_Tokens:
Collaboration diagram for fparser.two.C99Preprocessor.Cpp_Pp_Tokens:

Public Member Functions

def tostr (self)
 
- Public Member Functions inherited from fparser.two.utils.Base
def __init__ (self, string, parent_cls=None)
 
def __new__ (cls, string, parent_cls=None)
 
def get_root (self)
 
def children (self)
 
def init (self, items)
 
def torepr (self)
 
def __str__ (self)
 
def __repr__ (self)
 
def tofortran (self, tab="", isfix=None)
 
def restore_reader (self, reader)
 
- Public Member Functions inherited from fparser.two.utils.ComparableMixin
def __lt__ (self, other)
 
def __le__ (self, other)
 
def __eq__ (self, other)
 
def __ge__ (self, other)
 
def __gt__ (self, other)
 
def __ne__ (self, other)
 

Static Public Member Functions

def match (string)
 

Static Public Attributes

 subclass_names
 
- Static Public Attributes inherited from fparser.two.utils.Base
 subclasses
 

Additional Inherited Members

- Public Attributes inherited from fparser.two.utils.Base
 parent
 
 items
 

Detailed Description

Generic class for preprocessor tokens that form the right hand
side of a preprocessor directive (such as #error, #line, #if, etc.).

Definition at line 109 of file C99Preprocessor.py.

Member Function Documentation

◆ match()

def fparser.two.C99Preprocessor.Cpp_Pp_Tokens.match (   string)
static
Implements the matching for arbitrary preprocessor tokens
that form the right hand side of a preprocessor directive. It
does not impose any restrictions other than the string not
being empty.

:param str string: the string to be matched as pp-tokens.

:return: a 1-tuple containing the matched string or None.
:rtype: (str,) or NoneType

Definition at line 117 of file C99Preprocessor.py.

117  def match(string):
118  """Implements the matching for arbitrary preprocessor tokens
119  that form the right hand side of a preprocessor directive. It
120  does not impose any restrictions other than the string not
121  being empty.
122 
123  :param str string: the string to be matched as pp-tokens.
124 
125  :return: a 1-tuple containing the matched string or None.
126  :rtype: (str,) or NoneType
127 
128  """
129  if not string:
130  return None
131  line = string.strip()
132  if not line:
133  return None
134  return (line,)
135 
Here is the caller graph for this function:

◆ tostr()

def fparser.two.C99Preprocessor.Cpp_Pp_Tokens.tostr (   self)
:return: this pp-tokens as a string.
:rtype: str

Definition at line 136 of file C99Preprocessor.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.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.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.

136  def tostr(self):
137  """
138  :return: this pp-tokens as a string.
139  :rtype: str
140  """
141  return self.items[0]
142 
143 
144 # 6.10.1 Conditional inclusion
145 # Deviating from the standard's definition, not entire if-else-endif
146 # blocks are treated as constructs but instead the relevant preprocessor
147 # directives are kept as single line nodes.
148 
149 
Here is the caller graph for this function:

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