Reference Guide  2.5.0
psyclone.expression.NamedArg Class Reference
Inheritance diagram for psyclone.expression.NamedArg:
Collaboration diagram for psyclone.expression.NamedArg:

Public Member Functions

def __init__ (self, toks)
 
def __repr__ (self)
 
def __str__ (self)
 
def name (self)
 
def value (self)
 
def is_string (self)
 

Additional Inherited Members

- Public Attributes inherited from psyclone.expression.ExpressionNode
 names
 
 toks
 

Detailed Description

 Expression node for a Fortran named argument. 

Definition at line 193 of file expression.py.

Constructor & Destructor Documentation

◆ __init__()

def psyclone.expression.NamedArg.__init__ (   self,
  toks 
)
 The recursive collection of names enables the dependencies of
expressions to be analysed. 

Reimplemented from psyclone.expression.ExpressionNode.

Definition at line 195 of file expression.py.

195  def __init__(self, toks):
196  ExpressionNode.__init__(self, toks)
197 
198  # First token is the name of the argument
199  self._name = toks[0]
200  self.names.update([self._name])
201 
202  # The second token is the '=' so we ignore that and skip to
203  # the third token which contains the value assigned to the
204  # argument...
205  # The named variable can be assigned a character string. We've
206  # told the parser not to remove the delimiters so that we can
207  # see whether they are single or double quotes.
208  first_char = toks[2][0]
209  if first_char in ["'", '"']:
210  # Store the quotation character and the content of the string
211  # excluding the quotation marks
212  self._quote = toks[2][0]
213  self._value = toks[2][1:-1]
214  else:
215  # The quantity being assigned is not a string
216  self._quote = None
217  self._value = toks[2]
218 

References psyclone.domain.common.algorithm.psyir.AlgorithmInvokeCall._name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata._name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.GridArg._name, psyclone.domain.lfric.kernel.lfric_kernel_metadata.LFRicKernelMetadata._name, psyclone.dynamo0p3.DynFuncDescriptor03._name, psyclone.expression.NamedArg._name, psyclone.gocean1p0.GOKernelGridArgument._name, psyclone.gocean1p0.GOStencil._name, psyclone.nemo.NemoInvoke._name, psyclone.nemo.NemoPSy._name, psyclone.parse.algorithm.FileInfo._name, psyclone.parse.algorithm.InvokeCall._name, psyclone.parse.kernel.KernelProcedure._name, psyclone.parse.kernel.KernelType._name, psyclone.parse.module_info.ModuleInfo._name, psyclone.psyGen.PSy._name, psyclone.psyGen.Invoke._name, psyclone.psyGen.Kern._name, psyclone.psyGen.Argument._name, psyclone.psyir.nodes.container.Container._name, psyclone.psyir.nodes.routine.Routine._name, psyclone.psyir.symbols.symbol.Symbol._name, psyclone.expression.NamedArg._quote, psyclone.expression.NamedArg._value, psyclone.psyir.nodes.literal.Literal._value, psyclone.expression.ExpressionNode.names, psyclone.f2pygen.BaseDeclGen.names(), psyclone.psyGen.Invokes.names(), and psyclone.psyGen.Arguments.names().

Here is the call graph for this function:

Member Function Documentation

◆ is_string()

def psyclone.expression.NamedArg.is_string (   self)
 Returns True if the RHS of the named argument is a string 

Definition at line 249 of file expression.py.

249  def is_string(self):
250  ''' Returns True if the RHS of the named argument is a string '''
251  return self._quote is not None
252 
253 
254 # Construct a grammar using PyParsing
255 
256 # A Fortran variable name starts with a letter and continues with
257 # letters, numbers and _. Can you start a name with _?

References psyclone.expression.NamedArg._quote.

◆ name()

◆ value()

def psyclone.expression.NamedArg.value (   self)
 Returns the value (RHS) of the named argument 

Definition at line 244 of file expression.py.

244  def value(self):
245  ''' Returns the value (RHS) of the named argument '''
246  return self._value
247 

References psyclone.expression.NamedArg._value, and psyclone.psyir.nodes.literal.Literal._value.

Here is the caller graph for this function:

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