Class StringNode
java.lang.Object
org.antlr.v4.runtime.tree.TerminalNodeImpl
io.github.douira.glsl_transformer.tree.ExtendedTerminalNode
io.github.douira.glsl_transformer.cst.node.TerminalCSTNode
io.github.douira.glsl_transformer.cst.node.UnparsableCSTNode
io.github.douira.glsl_transformer.cst.node.StringNode
- All Implemented Interfaces:
MoveCheckable,TreeMember,ParseTree,SyntaxTree,TerminalNode,Tree
- Direct Known Subclasses:
Directive
String node provides a terminal node with arbitrary contents. This is useful
for inserting strings into the printed code such as comments.
Only use this terminal node for non-parsed tokens like comments, whitespace
or preprocessor directives. For all other syntax features, use the local
roots system. Parse tree search doesn't work inside string nodes as they are
not parsed.
- See Also:
-
Field Summary
Fields inherited from class org.antlr.v4.runtime.tree.TerminalNodeImpl
parent, symbol -
Constructor Summary
ConstructorsConstructorDescriptionStringNode(String content) Creates a new string node with the given string content.StringNode(String content, boolean doNewlineInsertion) Creates a new string node with the given string content and a newline insertion flag. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIf true, the printer will insert a newline before each group of consecutive unparsable CST nodes.protected StringReturns the string node's content.protected StringGenerates the string representation of this CST object as it would be in the generated code.Methods inherited from class io.github.douira.glsl_transformer.cst.node.UnparsableCSTNode
getTextMethods inherited from class io.github.douira.glsl_transformer.tree.ExtendedTerminalNode
getParent, getPreviousNode, processRemoval, setPreviousNodeMethods inherited from class org.antlr.v4.runtime.tree.TerminalNodeImpl
accept, getChild, getChildCount, getPayload, getSourceInterval, getSymbol, 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, 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
-
StringNode
Creates a new string node with the given string content.- Parameters:
content- The string to create a token for
-
StringNode
Creates a new string node with the given string content and a newline insertion flag.- Parameters:
content- The string to create a token fordoNewlineInsertion- Whether to insert a newline before each group of unparsable CST nodes in the printer
-
-
Method Details
-
getPrinted
Description copied from class:TerminalCSTNodeGenerates the string representation of this CST object as it would be in the generated code.- Specified by:
getPrintedin classTerminalCSTNode- Returns:
- The printed string for this CST object
-
doNewlineInsertion
public boolean doNewlineInsertion()Description copied from class:UnparsableCSTNodeIf true, the printer will insert a newline before each group of consecutive unparsable CST nodes.- Overrides:
doNewlineInsertionin classUnparsableCSTNode- Returns:
- If newline insertion should happen with this node
-
getContent
Returns the string node's content.- Returns:
- The content
-