loki.expression.literals
Literal symbols representing numbers, strings and logicals.
Classes
|
A floating point constant in an expression. |
|
An integer constant in an expression. |
|
Any literal not represented by a dedicated class. |
|
Factory class to instantiate the best-matching literal node. |
|
A list of constant literals, e.g., as used in Array Initialization Lists. |
|
A boolean constant in an expression. |
|
A string constant in an expression. |
- class FloatLiteral(value, **kwargs)
Bases:
StrCompareMixin,_LiteralA floating point constant in an expression.
Note that its
valueis stored as a string to avoid any representation issues that could stem from converting it to a Python floating point number.It can have a specific type associated, which backends can use to cast or annotate the constant to make sure the specified type is used.
- Parameters:
value (str) – The value of that literal.
kind (optional) – The kind information for that literal.
- init_arg_names = ('value', 'kind')
- mapper_method = 'map_float_literal'
- class IntLiteral(value, **kwargs)
Bases:
StrCompareMixin,_LiteralAn integer constant in an expression.
It can have a specific type associated, which backends can use to cast or annotate the constant to make sure the specified type is used.
- Parameters:
value (int) – The value of that literal.
kind (optional) – The kind information for that literal.
- init_arg_names = ('value', 'kind')
- mapper_method = 'map_int_literal'
- class LogicLiteral(value, **kwargs)
Bases:
StrCompareMixin,_LiteralA boolean constant in an expression.
- Parameters:
value (bool) – The value of that literal.
- init_arg_names = ('value',)
- mapper_method = 'map_logic_literal'
- class StringLiteral(value, **kwargs)
Bases:
StrCompareMixin,_LiteralA string constant in an expression.
- Parameters:
value (str) – The value of that literal. Enclosing quotes are removed.
- init_arg_names = ('value',)
- mapper_method = 'map_string_literal'
- class IntrinsicLiteral(value, **kwargs)
Bases:
StrCompareMixin,_LiteralAny literal not represented by a dedicated class.
Its value is stored as string and returned unaltered. This is currently used for complex and BOZ constants and to retain array constructor expressions with type spec or implied-do.
- Parameters:
value (str) – The value of that literal.
- init_arg_names = ('value',)
- mapper_method = 'map_intrinsic_literal'
- class Literal(value, **kwargs)
Bases:
objectFactory class to instantiate the best-matching literal node.
This always returns a
IntLiteral,FloatLiteral,StringLiteral,LogicLiteralor, as a fallback,IntrinsicLiteral, selected by using any providedtypeinformation or inspecting the Python data type of :data: value.- Parameters:
value – The value of that literal.
kind (optional) – The kind information for that literal.
- class LiteralList(values, dtype=None, **kwargs)
Bases:
StrCompareMixin,AlgebraicLeafA list of constant literals, e.g., as used in Array Initialization Lists.
- init_arg_names = ('values', 'dtype')
- mapper_method = 'map_literal_list'