- All Superinterfaces:
ASTNode,ExpressionNode,ForLoopInitializerNode,InitializerNode,SizeableNode
- All Known Subinterfaces:
CharacterConstantNode,EnumerationConstantNode,FloatingConstantNode,HereOrRootNode,IntegerConstantNode,ProcnullNode,SelfNode,StatenullNode
A "constant" in the sense of the C11 Standard. See C11 Sec. 6.4.4. Note that
C uses the word "constant" in a limited way. Character, integer, and floating
point literals and enumeration constants are all considered "constants".
String literals and compound literals (array, structure, and union literals)
are not considered constants.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface dev.civl.abc.ast.node.IF.ASTNode
ASTNode.NodeKindNested classes/interfaces inherited from interface dev.civl.abc.ast.node.IF.expression.ExpressionNode
ExpressionNode.ExpressionKind -
Method Summary
Modifier and TypeMethodDescriptioncopy()Returns a deep copy of this AST node.Returns the actual constant value, obtained by evaluating this constant expression.Returns the representation of the constant exactly as it occurred in the source code.voidsetStringRepresentation(String representation) Sets the value returned bygetStringRepresentation().Methods inherited from interface dev.civl.abc.ast.node.IF.ASTNode
addAllTransformAnnotations, addTransformAnnotation, child, childIndex, children, diff, equiv, getAttribute, getOwner, getScope, getSource, id, keepOnly, nextDFS, nodeKind, numChildren, parent, prettyPrint, prettyRepresentation, prettyRepresentation, print, remove, removeChild, removeTransformAnnotation, setAttribute, setChild, setId, setOwner, setScope, toString, transformAnnotationsMethods inherited from interface dev.civl.abc.ast.node.IF.expression.ExpressionNode
addConversion, expressionKind, getConversion, getConvertedType, getInitialType, getNumConversions, isConstantExpression, isLvalue, removeConversions, setInitialTypeMethods inherited from interface dev.civl.abc.ast.node.IF.declaration.InitializerNode
isSideEffectFreeMethods inherited from interface dev.civl.abc.ast.node.IF.expression.SizeableNode
getType
-
Method Details
-
constantKind
ConstantNode.ConstantKind constantKind() -
getStringRepresentation
String getStringRepresentation()Returns the representation of the constant exactly as it occurred in the source code.- Returns:
- the original representation of this constant in the source code
-
setStringRepresentation
Sets the value returned bygetStringRepresentation().- Parameters:
representation- the original representation of this constant in the source code
-
getConstantValue
Value getConstantValue()Returns the actual constant value, obtained by evaluating this constant expression.- Returns:
- the value of this constant expression
-
copy
ConstantNode copy()Description copied from interface:ASTNodeReturns a deep copy of this AST node. The node and all of its descendants will be cloned. The cloning does not copy analysis or attribute information.- Specified by:
copyin interfaceASTNode- Specified by:
copyin interfaceExpressionNode- Specified by:
copyin interfaceForLoopInitializerNode- Specified by:
copyin interfaceInitializerNode- Specified by:
copyin interfaceSizeableNode- Returns:
- deep copy of this node
-