All Implemented Interfaces:
TreeMember, org.antlr.v4.runtime.tree.ParseTree, org.antlr.v4.runtime.tree.SyntaxTree, org.antlr.v4.runtime.tree.TerminalNode, org.antlr.v4.runtime.tree.Tree

public class Tensor extends ParsableASTNode
A tensor abstractly represents the many multidimensional number types that GLSL has. It does this within a single datastructure by modelling scalars, vectors and matrices as n-dimensional and also taking the bit depth into account.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The different ways bits in a tensor can be interpreted.
    static final record 
    The shape is an array of up to three integers describing how big this tensor is in each dimension.
  • Field Summary

    Fields inherited from class org.antlr.v4.runtime.tree.TerminalNodeImpl

    parent, symbol
  • Constructor Summary

    Constructors
    Constructor
    Description
    Tensor(int tokenType)
    Creates a new tensor with the type given as a lexer token index.
    Creates a new tensor with the given type.
    Tensor(io.github.douira.glsl_transformer.GLSLParser.BuiltinTypeSpecifierParseableContext ctx)
    Creates a new tensor from the given type specifier parse tree node.
    Creates a new tensor by parsing the type specified in the given string.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the compact name of the contained type.
    Returns the explicit name of the contained type.
    protected Function<io.github.douira.glsl_transformer.GLSLParser,ExtendedContext>
    This method is overwritten by the implementing class to specify with which parser method the generated string should be parsed.
    protected String
    Generates the string representation of this AST object as it would be in the generated code.

    Methods inherited from class io.github.douira.glsl_transformer.ast.ParsableASTNode

    getParsed, getParsed

    Methods inherited from class io.github.douira.glsl_transformer.generic.ExtendedTerminalNode

    getParent, omitTokens

    Methods inherited from class org.antlr.v4.runtime.tree.TerminalNodeImpl

    accept, getChild, getChildCount, getPayload, getSourceInterval, getSymbol, getText, setParent, toString, toStringTree, toStringTree

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.antlr.v4.runtime.tree.ParseTree

    accept, getChild, getText, setParent, toStringTree

    Methods inherited from interface org.antlr.v4.runtime.tree.SyntaxTree

    getSourceInterval

    Methods inherited from interface org.antlr.v4.runtime.tree.Tree

    getChildCount, getPayload, toStringTree
  • Constructor Details

    • Tensor

      public Tensor(Tensor.Type type)
      Creates a new tensor with the given type.
      Parameters:
      type - The type of the new tensor
    • Tensor

      public Tensor(int tokenType)
      Creates a new tensor with the type given as a lexer token index.
      Parameters:
      tokenType - The token type index
      See Also:
      • GLSLLexer
    • Tensor

      public Tensor(io.github.douira.glsl_transformer.GLSLParser.BuiltinTypeSpecifierParseableContext ctx)
      Creates a new tensor from the given type specifier parse tree node.
      Parameters:
      ctx - The parse tree node to read the type from
    • Tensor

      public Tensor(String str)
      Creates a new tensor by parsing the type specified in the given string. The string should contain a builtin type specifier. See the parser grammar for details.
      Parameters:
      str - The string to parse as a GLSL type specifier
  • Method Details

    • getCompactName

      public String getCompactName()
      Returns the compact name of the contained type. This is the shortest available name that specifies this type.
      Returns:
      The type's most compact name
    • getExplicitName

      public String getExplicitName()
      Returns the explicit name of the contained type. This name uses an explicit arithmetic type name that may not be compatible if the extension for these type names is not available.
      Returns:
      The type's most explicit name
    • getPrinted

      protected String getPrinted()
      Description copied from class: ASTNode
      Generates the string representation of this AST object as it would be in the generated code.
      Specified by:
      getPrinted in class ASTNode
      Returns:
      The printed string for this AST object
    • getOutputParseMethod

      protected Function<io.github.douira.glsl_transformer.GLSLParser,ExtendedContext> getOutputParseMethod()
      Description copied from class: ParsableASTNode
      This method is overwritten by the implementing class to specify with which parser method the generated string should be parsed.
      Specified by:
      getOutputParseMethod in class ParsableASTNode
      Returns:
      A method reference from GLSLParser