Package icyllis.arc3d.compiler.tree

# Class Literal

java.lang.Object
icyllis.arc3d.compiler.tree.Node
icyllis.arc3d.compiler.tree.Expression
icyllis.arc3d.compiler.tree.Literal

public final class Literal extends Expression
A constant value. These can contain ints, floats, or booleans.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class icyllis.arc3d.compiler.tree.Node

  `Node.ElementKind, Node.ExpressionKind, Node.StatementKind, Node.SymbolKind`

- ## Field Summary

  ### Fields inherited from class icyllis.arc3d.compiler.tree.Node

  `mPosition`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `accept(TreeVisitor visitor)`
  Visit this AST with a given visitor.
  `Expression`
  `clone(int position)`
  `boolean`
  `getBooleanValue()`
  `OptionalDouble`
  `getConstantValue(int i)`
  Returns the i'th compile-time constant value within a literal or constructor.
  `float`
  `getFloatValue()`
  `long`
  `getIntegerValue()`
  `Node.ExpressionKind`
  `getKind()`
  `double`
  `getValue()`
  `boolean`
  `isLiteral()`
  `static Literal`
  `make(int position, double value, Type type)`
  `static Literal`
  `makeBoolean(int position, boolean value, Type type)`
  `static Literal`
  `makeBoolean(Context context, int position, boolean value)`
  `static Literal`
  `makeFloat(int position, float value, Type type)`
  `static Literal`
  `makeFloat(Context context, int position, float value)`
  `static Literal`
  `makeInteger(int position, long value, Type type)`
  `static Literal`
  `makeInteger(Context context, int position, long value)`
  `String`
  `toString(int parentPrecedence)`

  ### Methods inherited from class icyllis.arc3d.compiler.tree.Expression

  `clone, getCoercionCost, getType, isBooleanLiteral, isConstructorCall, isFloatLiteral, isIncomplete, isIntLiteral, toString`

  ### Methods inherited from class icyllis.arc3d.compiler.tree.Node

  `getEndOffset, getStartOffset`

  ### Methods inherited from class java.lang.Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### makeFloat

    @Nonnull public static Literal makeFloat(@Nonnull Context context, int position, float value)

  - ### makeFloat

    @Nonnull public static Literal makeFloat(int position, float value, Type type)

  - ### makeInteger

    @Nonnull public static Literal makeInteger(@Nonnull Context context, int position, long value)

  - ### makeInteger

    @Nonnull public static Literal makeInteger(int position, long value, Type type)

  - ### makeBoolean

    @Nonnull public static Literal makeBoolean(@Nonnull Context context, int position, boolean value)

  - ### makeBoolean

    @Nonnull public static Literal makeBoolean(int position, boolean value, Type type)

  - ### make

    @Nonnull public static Literal make(int position, double value, Type type)

  - ### getKind

    public Node.ExpressionKind getKind()
    Specified by:
      `getKind` in class `Expression`
    See Also:
      - `Node.ExpressionKind`

  - ### accept

    public boolean accept(@Nonnull TreeVisitor visitor)
    Description copied from class: `Node`
    Visit this AST with a given visitor.
    Specified by:
      `accept` in class `Node`
    Returns:
      true to stop recursion and propagate true up the stack, false to continue

  - ### isLiteral

    public boolean isLiteral()
    Overrides:
      `isLiteral` in class `Expression`

  - ### getFloatValue

    public float getFloatValue()

  - ### getIntegerValue

    public long getIntegerValue()

  - ### getBooleanValue

    public boolean getBooleanValue()

  - ### getValue

    public double getValue()

  - ### getConstantValue

    public OptionalDouble getConstantValue(int i)
    Description copied from class: `Expression`
    Returns the i'th compile-time constant value within a literal or constructor. Indices which do not contain compile-time constant values will return empty. `vec4(1, vec2(2), 3)` contains four compile-time constants: (1, 2, 2, 3) `mat2(f)` contains four slots, and two are constant: (empty, 0, 0, empty)
    Overrides:
      `getConstantValue` in class `Expression`

  - ### clone

    @Nonnull public Expression clone(int position)
    Specified by:
      `clone` in class `Expression`

  - ### toString

    @Nonnull public String toString(int parentPrecedence)
    Specified by:
      `toString` in class `Expression`