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 data structure by modeling scalars, vectors and matrices as n-dimensional and also taking the bit depth into account.
  • Constructor Details

    • Tensor

      public Tensor(io.github.douira.glsl_transformer.ast.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

    • 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
    • getType

      public io.github.douira.glsl_transformer.ast.Type getType()
      Returns the type contained in this tensor node.
      Returns:
      The type of this tensor
    • setType

      public void setType(io.github.douira.glsl_transformer.ast.Type type)
      Sets the type of this tensor.
      Parameters:
      type - The new type of this tensor