- All Superinterfaces:
ASTNode,BlockItemNode,LoopNode,StatementNode
A for loop, in addition to the expression and body that all loops possess,
has an initializer and incrementer.
The initializer can be either an expression or a declaration.
See C11 Sec. 6.8.5.
-
Nested Class Summary
Nested 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.statement.BlockItemNode
BlockItemNode.BlockItemKindNested classes/interfaces inherited from interface dev.civl.abc.ast.node.IF.statement.LoopNode
LoopNode.LoopKindNested classes/interfaces inherited from interface dev.civl.abc.ast.node.IF.statement.StatementNode
StatementNode.StatementKind -
Method Summary
Modifier and TypeMethodDescriptioncopy()Returns a deep copy of this AST node.Gets the incrementer part of this for loop node.Gets the initializer part of this for loop node.booleanReturns whether the loop has been marked as being "standard." SeesetStandard(boolean)for what conditions are supposed to hold in order for this to return true.voidsetIncrementer(ExpressionNode node) Sets the incrementer part of this for loop node.voidsetInitializer(ForLoopInitializerNode initNode) Sets the initializer part of this for loop node.voidsetStandard(boolean isStandard) Mark whether the for loop is "standard" or not.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.statement.BlockItemNode
blockItemKindMethods inherited from interface dev.civl.abc.ast.node.IF.statement.LoopNode
getBody, getCondition, getKind, loopContracts, setBody, setConditionMethods inherited from interface dev.civl.abc.ast.node.IF.statement.StatementNode
statementKind
-
Method Details
-
getInitializer
ForLoopInitializerNode getInitializer()Gets the initializer part of this for loop node. Note that this is an instance of eitherExpressionNodeorDeclarationListNode. -
setInitializer
Sets the initializer part of this for loop node.- Parameters:
initNode- the initializer
-
getIncrementer
ExpressionNode getIncrementer()Gets the incrementer part of this for loop node.- Returns:
- incrementer
-
setIncrementer
Sets the incrementer part of this for loop node.- Parameters:
node- the incrementer
-
isStandard
boolean isStandard()Returns whether the loop has been marked as being "standard." SeesetStandard(boolean)for what conditions are supposed to hold in order for this to return true.- Returns:
- whether the loop was marked as "standard"
-
setStandard
void setStandard(boolean isStandard) Mark whether the for loop is "standard" or not. A for loop is standard iff the following conditions are guaranteed to hold for all valid error-free executions (so in particular, an execution is allowed to violate one of these conditions as long as that execution is guaranteed to reach an error state such as an assertion violation): 1. The loop has an initializer expression of the formint i = aori = afor some variablei, called the "loop variable," and some integer expressiona. 2. The loop has a conditional of the formi invalid input: '<' bori invalid input: '<'= bin whichiis the loop variable andbis some integer expression. 3. If evaluating the expressionbat the start of an iteration results in the valuexthen evaluating it at the end of the iteration should also result in the valuex. 4. If the loop variableievaluates toyat the start of an iteration, then at the end of that iteration,ishould evaluate toy+1. -
copy
ForLoopNode 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 interfaceBlockItemNode- Specified by:
copyin interfaceLoopNode- Specified by:
copyin interfaceStatementNode- Returns:
- deep copy of this node
-