- All Superinterfaces:
ASTNode,BlockItemNode,StatementNode
A pragma may be included in the AST wherever a statement or an external
definition may occur. The pragma is represented as an identifier (the first
token to follow the
# pragma tokens), followed by some sequence
of tokens of length (say) n, followed by a newline character. We will refer
to that sequence as the "pragma body". Note that the pragma body does not
include the pragma identifier and does not include the final newline
character.-
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.StatementNode
StatementNode.StatementKind -
Method Summary
Modifier and TypeMethodDescriptioncopy()Returns a deep copy of this AST node.Returns the newline token which terminates this pragma.intReturns n, the number of tokens in the pragma body, i.e., the number of tokens following# pragma IDENTIFIERReturns the pragma identifier, i.e., the identifier immediately following# pragma.getToken(int index) Returns the index-th token in the pragma body.Returns an iterable over the tokens in the pragma body.Returns the tokens of the pragma body as aCivlcTokenSource, which can then be fed into an ANTLR parser for syntactic analysis.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.StatementNode
statementKind
-
Method Details
-
getPragmaIdentifier
IdentifierNode getPragmaIdentifier()Returns the pragma identifier, i.e., the identifier immediately following# pragma. For example, in# pragma omp ..., the identifierompwould be returned.- Returns:
- the pragma identifier
-
getNumTokens
int getNumTokens()Returns n, the number of tokens in the pragma body, i.e., the number of tokens following# pragma IDENTIFIER- Returns:
- number of tokens in the pragma body
-
getToken
Returns the index-th token in the pragma body. The tokens of body are indexed beginning with 0.- Parameters:
index- an integer in the range [0,n-1], where n is the value returned bygetNumTokens()- Returns:
- the index-th token in the pragma body
-
getTokens
Iterable<CivlcToken> getTokens()Returns an iterable over the tokens in the pragma body.- Returns:
- iterator over the tokens of pragma body
-
newTokenSource
CivlcTokenSource newTokenSource()Returns the tokens of the pragma body as a
CivlcTokenSource, which can then be fed into an ANTLR parser for syntactic analysis. Note that each call returns a new token source, since each can only be used once.The token source will effectively append an infinite sequence of EOF tokens after the pragma body. This is what is expected from most parsers.
- Returns:
- a token source for the tokens comprising the body of this pragma
-
getNewlineToken
CivlcToken getNewlineToken()Returns the newline token which terminates this pragma.- Returns:
- the newline token
-
copy
PragmaNode 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 interfaceStatementNode- Returns:
- deep copy of this node
-