# loki.expression.literals

Literal symbols representing numbers, strings and logicals.

Classes

`FloatLiteral`(value, **kwargs) | A floating point constant in an expression.
`IntLiteral`(value, **kwargs) | An integer constant in an expression.
`IntrinsicLiteral`(value, **kwargs) | Any literal not represented by a dedicated class.
`Literal`(value, **kwargs) | Factory class to instantiate the best-matching literal node.
`LiteralList`(values[, dtype]) | A list of constant literals, e.g., as used in Array Initialization Lists.
`LogicLiteral`(value, **kwargs) | A boolean constant in an expression.
`StringLiteral`(value, **kwargs) | A string constant in an expression.

class FloatLiteral(value, **kwargs)

  Bases: `StrCompareMixin`, `_Literal`

  A floating point constant in an expression.

  Note that its `value` is 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`, `_Literal`

  An 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`, `_Literal`

  A 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`, `_Literal`

  A 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`, `_Literal`

  Any 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: `object`

  Factory class to instantiate the best-matching literal node.

  This always returns a `IntLiteral`, `FloatLiteral`, `StringLiteral`, `LogicLiteral` or, as a fallback, `IntrinsicLiteral`, selected by using any provided `type` information 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`, `AlgebraicLeaf`

  A list of constant literals, e.g., as used in Array Initialization Lists.

  init_arg_names = ('values', 'dtype')
  mapper_method = 'map_literal_list'