36 '''Module containing the ScalarArgMetadata class which captures the metadata
37 associated with a scalar argument. Supports the creation, modification
38 and Fortran output of a Scalar argument.
47 '''Class to capture LFRic kernel metadata information for a scalar
58 datatype_arg_index = 1
66 def _get_metadata(cls, fparser2_tree):
67 '''Extract the required metadata from the fparser2 tree and return it
70 :param fparser2_tree: fparser2 tree containing the metadata \
72 :type fparser2_tree: :py:class:`fparser.two.Fortran2003.Part_Ref` | \
73 :py:class:`fparser.two.Fortran2003.Structure_Constructor`
75 :returns: a tuple containing the datatype and access metadata.
76 :rtype: Tuple[str, str]
82 def _get_datatype_access_metadata(cls, fparser2_tree):
83 '''Extract the datatype and access metadata from the fparser2 tree and
84 return them as strings. Also check that the metadata is in the
85 expected form (but do not check the metadata values as that is
88 :param fparser2_tree: fparser2 tree containing the metadata \
90 :type fparser2_tree: :py:class:`fparser.two.Fortran2003.Part_Ref` | \
91 :py:class:`fparser.two.Fortran2003.Structure_Constructor`
93 :returns: a tuple containing the datatype and access metadata.
94 :rtype: Tuple[str, str]
102 return (datatype, access)
106 :returns: the metadata represented by this class as Fortran.
109 return f
"arg_type({self.form}, {self.datatype}, {self.access})"
114 :param str value: the datatype to check for validity.
117 ScalarArgMetadata.validate_scalar_value(
118 value, const.VALID_SCALAR_DATA_TYPES,
"datatype descriptor")
123 :param str value: the access descriptor to validate.
126 ScalarArgMetadata.validate_scalar_value(
127 value, const.VALID_SCALAR_ACCESS_TYPES,
"access descriptor")
130 __all__ = [
"ScalarArgMetadata"]
def check_nargs(fparser2_tree, nargs)
def check_fparser2_arg(cls, fparser2_tree, type_name)
def get_arg(fparser2_tree, index)
def check_first_arg(cls, fparser2_tree)
def check_nargs(cls, fparser2_tree)
def _get_datatype_access_metadata(cls, fparser2_tree)
def check_datatype(value)