Class Tensor
- All Implemented Interfaces:
MoveCheckable,TreeMember,ParseTree,SyntaxTree,TerminalNode,Tree
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 ClassesModifier and TypeClassDescriptionstatic enumThe different ways bits in a tensor can be interpreted.static final recordThe 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
ConstructorsConstructorDescriptionTensor(int tokenType) Creates a new tensor with the type given as a lexer token index.Tensor(Tensor.Type type) 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 TypeMethodDescriptionReturns 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 StringGenerates 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, getParsedMethods inherited from class io.github.douira.glsl_transformer.tree.ExtendedTerminalNode
getParent, getPreviousNode, omitTokens, setPreviousNodeMethods inherited from class org.antlr.v4.runtime.tree.TerminalNodeImpl
accept, getChild, getChildCount, getPayload, getSourceInterval, getSymbol, getText, setParent, toString, toStringTree, toStringTreeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.antlr.v4.runtime.tree.ParseTree
accept, getChild, getText, setParent, toStringTreeMethods inherited from interface org.antlr.v4.runtime.tree.SyntaxTree
getSourceIntervalMethods inherited from interface org.antlr.v4.runtime.tree.Tree
getChildCount, getPayload, toStringTree
-
Constructor Details
-
Tensor
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
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
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
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
Description copied from class:ASTNodeGenerates the string representation of this AST object as it would be in the generated code.- Specified by:
getPrintedin classASTNode- Returns:
- The printed string for this AST object
-
getOutputParseMethod
protected Function<io.github.douira.glsl_transformer.GLSLParser,ExtendedContext> getOutputParseMethod()Description copied from class:ParsableASTNodeThis method is overwritten by the implementing class to specify with which parser method the generated string should be parsed.- Specified by:
getOutputParseMethodin classParsableASTNode- Returns:
- A method reference from
GLSLParser
-