All Implemented Interfaces:
MoveCheckable, TreeMember, ParseTree, SyntaxTree, TerminalNode, 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.
  • 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