public class LiteralNode extends ExpressionNodeBase implements ILiteralNode
ILiteralNode.LiteralType
Modifier and Type | Field and Description |
---|---|
protected ILiteralNode.LiteralType |
type
Type of the literal (e.g.
|
protected String |
value |
flags
emptyNodeArray, parent
UNKNOWN
Modifier | Constructor and Description |
---|---|
|
LiteralNode(ASToken t,
ILiteralNode.LiteralType type)
Constructor.
|
|
LiteralNode(ILiteralNode.LiteralType type,
String value)
Constructor.
|
|
LiteralNode(ILiteralNode.LiteralType type,
String value,
SourceLocation sourceLocation)
Constructor.
|
|
LiteralNode(ILiteralNode.LiteralType type,
antlr.Token t)
Constructor.
|
protected |
LiteralNode(LiteralNode other)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
buildInnerString(StringBuilder sb)
For debugging only.
|
protected LiteralNode |
copy()
Copy the ExpressionNodeBase and its subtree.
|
ILiteralNode.LiteralType |
getLiteralType()
Returns the
ILiteralNode.LiteralType that this node represents |
ASTNodeID |
getNodeID()
Get the opcode of this node
|
String |
getValue()
Returns the value of this literal as a String
|
String |
getValue(boolean rawValue)
Returns the value of this literal as a String
|
boolean |
isDynamicExpression(ICompilerProject project)
Does this expression evaluate to a dynamic value
|
boolean |
isSynthetic()
Returns whether this node is synthetic.
|
boolean |
isTerminal()
Determines if this node is a terminal node, meaning it cannot have
children
|
void |
normalize(boolean fillInOffsets)
Normalize the tree.
|
ITypeDefinition |
resolveType(ICompilerProject project)
The type of the result of this expression.
|
void |
setSynthetic(boolean synthetic)
Sets whether this node is synthetic.
|
computeNamespaceReference, copyForInitializer, getASScope, getBaseExpression, getDecorationNode, getDependencyType, getMName, getParentExpression, hasParenthesis, inFilter, inWith, isPackageReference, resolve, setHasParenthesis
analyze, buildStringRecursive, canContinueContainmentSearch, collectImportNodes, combineAttributes, connectedToProjectScope, contains, endAfter, endAfter, endBefore, endBefore, fillInOffsets, getAbsoluteEnd, getAbsoluteStart, getAncestorOfType, getChild, getChildCount, getContainingFilePath, getContainingNode, getContainingScope, getEnd, getFileScope, getFileSpecification, getInnerString, getNodeKind, getPackageName, getParent, getScopeNode, getSpanningStart, getStart, getSucceedingNode, getWorkspace, isTransparent, looselyContains, replaceChild, runPostProcess, setChildren, setParent, span, span, span, startAfter, startAfter, startBefore, startBefore, swapChildren, toString, tryGetOffsetLookup, verify
getColumn, getEndColumn, getEndLine, getLine, getLineColumnString, getOffsetsString, getSourcePath, getSourcePathString, setColumn, setEnd, setEndColumn, setEndLine, setLine, setSourceLocation, setSourcePath, setStart, span, span
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
copyForInitializer, hasParenthesis, resolve
contains, getAncestorOfType, getChild, getChildCount, getContainingNode, getContainingScope, getFileSpecification, getPackageName, getParent, getSpanningStart, getSucceedingNode
getAbsoluteEnd, getAbsoluteStart, getColumn, getEnd, getEndColumn, getEndLine, getLine, getSourcePath, getStart
protected ILiteralNode.LiteralType type
protected String value
public LiteralNode(ILiteralNode.LiteralType type, String value)
type
- The type of the literal.value
- The value of the literal.public LiteralNode(ILiteralNode.LiteralType type, antlr.Token t)
type
- type of the literalt
- tokenpublic LiteralNode(ILiteralNode.LiteralType type, String value, SourceLocation sourceLocation)
type
- type of the literalvalue
- value of the literalsourceLocation
- object that stores location information of the
literalpublic LiteralNode(ASToken t, ILiteralNode.LiteralType type)
t
- Token with text and source location.type
- Literal typeprotected LiteralNode(LiteralNode other)
other
- The node to copy.public ASTNodeID getNodeID()
IASNode
public void normalize(boolean fillInOffsets)
ExpressionNodeBase
normalize
in class ExpressionNodeBase
protected boolean buildInnerString(StringBuilder sb)
NodeBase
buildOuterString()
.
It is overridden by subclasses to display optional node-specific
information in the middle of the string, between the node type and the
location information.buildInnerString
in class NodeBase
public boolean isTerminal()
IASNode
isTerminal
in interface IASNode
isTerminal
in class FixedChildrenNode
public ITypeDefinition resolveType(ICompilerProject project)
IExpressionNode
resolveType
in interface IExpressionNode
resolveType
in class ExpressionNodeBase
project
- The ICompilerProject
to use to do lookups.ITypeDefinition
of the type this expression results in.protected LiteralNode copy()
ExpressionNodeBase
copy
in class ExpressionNodeBase
public boolean isDynamicExpression(ICompilerProject project)
IExpressionNode
isDynamicExpression
in interface IExpressionNode
isDynamicExpression
in class ExpressionNodeBase
project
- The ICompilerProject
to use to do lookups.true
if we evaluate to something dynamicpublic ILiteralNode.LiteralType getLiteralType()
ILiteralNode
ILiteralNode.LiteralType
that this node representsgetLiteralType
in interface ILiteralNode
public String getValue()
ILiteralNode
getValue
in interface ILiteralNode
public String getValue(boolean rawValue)
ILiteralNode
getValue
in interface ILiteralNode
rawValue
- True if you want the raw value, otherwise some massaging
of the value will be done before returning the value if it's a String
(enclosing quotes will be removed).public boolean isSynthetic()
public void setSynthetic(boolean synthetic)
synthetic
- true if this node is syntheticCopyright © 2016 The Apache Software Foundation. All rights reserved.