Eclipse CDT
7.0

org.eclipse.cdt.core.dom.ast
Interface INodeFactory

All Known Subinterfaces:
ICNodeFactory, ICPPNodeFactory

public interface INodeFactory

Factory for creating AST nodes. This interface contains factory methods for nodes that are available for both C and C++. Extending interfaces should use covariant return types where appropriate to allow the construction of language-specific versions of certain nodes. Most methods accept child nodes as parameters when constructing a new node. For convenience it is always allowed to pass null for any of these parameters. In this case the newly constructed node may be initialized using its set() and add() methods instead. Nodes created by this factory are not frozen, i.e. for any node created by this factory the following holds node.isFrozen() == false . None of the factory methods should return null.

Since:
5.1

Method Summary
 IASTArrayDeclarator newArrayDeclarator(IASTName name)
           
 IASTArrayModifier newArrayModifier(IASTExpression expr)
           
 IASTArraySubscriptExpression newArraySubscriptExpression(IASTExpression arrayExpr, IASTExpression subscript)
           
 IASTASMDeclaration newASMDeclaration(java.lang.String assembly)
           
 IASTAttribute newAttribute(char[] name, IASTToken argumentClause)
           
 IASTBinaryExpression newBinaryExpression(int op, IASTExpression expr1, IASTExpression expr2)
           
 IASTBreakStatement newBreakStatement()
           
 IASTCaseStatement newCaseStatement(IASTExpression expr)
           
 IASTCastExpression newCastExpression(int operator, IASTTypeId typeId, IASTExpression operand)
           
 IASTCompositeTypeSpecifier newCompositeTypeSpecifier(int key, IASTName name)
           
 IASTCompoundStatement newCompoundStatement()
           
 IASTConditionalExpression newConditionalExpession(IASTExpression condition, IASTExpression positive, IASTExpression negative)
           
 IASTContinueStatement newContinueStatement()
           
 IASTDeclarationStatement newDeclarationStatement(IASTDeclaration declaration)
           
 IASTDeclarator newDeclarator(IASTName name)
           
 IASTDefaultStatement newDefaultStatement()
           
 IASTDoStatement newDoStatement(IASTStatement body, IASTExpression condition)
           
 IASTElaboratedTypeSpecifier newElaboratedTypeSpecifier(int kind, IASTName name)
           
 IASTEnumerationSpecifier newEnumerationSpecifier(IASTName name)
           
 IASTEnumerationSpecifier.IASTEnumerator newEnumerator(IASTName name, IASTExpression value)
           
 IASTEqualsInitializer newEqualsInitializer(IASTInitializerClause initClause)
           
 IASTExpressionList newExpressionList()
           
 IASTExpressionStatement newExpressionStatement(IASTExpression expression)
           
 IASTFieldDeclarator newFieldDeclarator(IASTName name, IASTExpression bitFieldSize)
           
 IASTFieldReference newFieldReference(IASTName name, IASTExpression owner)
           
 IASTForStatement newForStatement(IASTStatement init, IASTExpression condition, IASTExpression iterationExpression, IASTStatement body)
           
 IASTFunctionCallExpression newFunctionCallExpression(IASTExpression idExpr, IASTExpression argList)
          Deprecated. Replaced by newFunctionCallExpression(IASTExpression, IASTInitializerClause[])
 IASTFunctionCallExpression newFunctionCallExpression(IASTExpression idExpr, IASTInitializerClause[] arguments)
           
 IASTStandardFunctionDeclarator newFunctionDeclarator(IASTName name)
           
 IASTFunctionDefinition newFunctionDefinition(IASTDeclSpecifier declSpecifier, IASTFunctionDeclarator declarator, IASTStatement bodyStatement)
           
 IGNUASTCompoundStatementExpression newGNUCompoundStatementExpression(IASTCompoundStatement compoundStatement)
           
 IASTGotoStatement newGotoStatement(IASTName name)
           
 IASTIdExpression newIdExpression(IASTName name)
           
 IASTIfStatement newIfStatement(IASTExpression condition, IASTStatement then, IASTStatement elseClause)
           
 IASTInitializerExpression newInitializerExpression(IASTExpression expression)
          Deprecated. Replaced by newEqualsInitializer(IASTInitializerClause).
 IASTInitializerList newInitializerList()
           
 IASTLabelStatement newLabelStatement(IASTName name, IASTStatement nestedStatement)
           
 IASTLiteralExpression newLiteralExpression(int kind, java.lang.String rep)
           
 IASTName newName()
          Creates a "dummy" name using an empty char array.
 IASTName newName(char[] name)
           
 IASTNullStatement newNullStatement()
           
 IASTParameterDeclaration newParameterDeclaration(IASTDeclSpecifier declSpec, IASTDeclarator declarator)
           
 IASTPointer newPointer()
           
 IASTProblem newProblem(int id, char[] arg, boolean error)
           
 IASTProblemDeclaration newProblemDeclaration(IASTProblem problem)
           
 IASTProblemExpression newProblemExpression(IASTProblem problem)
           
 IASTProblemStatement newProblemStatement(IASTProblem problem)
           
 IASTReturnStatement newReturnStatement(IASTExpression retValue)
           
 IASTSimpleDeclaration newSimpleDeclaration(IASTDeclSpecifier declSpecifier)
           
 IASTSimpleDeclSpecifier newSimpleDeclSpecifier()
           
 IASTSwitchStatement newSwitchStatement(IASTExpression controller, IASTStatement body)
           
 IASTToken newToken(int tokenType, char[] tokenImage)
           
 IASTTokenList newTokenList()
           
 IASTTranslationUnit newTranslationUnit()
          Deprecated. Replaced by newTranslationUnit(IScanner).
 IASTTranslationUnit newTranslationUnit(org.eclipse.cdt.core.parser.IScanner scanner)
          Creates a new translation unit that cooperates with the given scanner in order to track macro-expansions and location information.
 IASTNamedTypeSpecifier newTypedefNameSpecifier(IASTName name)
           
 IASTTypeId newTypeId(IASTDeclSpecifier declSpecifier, IASTDeclarator declarator)
           
 IASTTypeIdExpression newTypeIdExpression(int operator, IASTTypeId typeId)
           
 IASTTypeIdInitializerExpression newTypeIdInitializerExpression(IASTTypeId typeId, IASTInitializer initializer)
           
 IASTUnaryExpression newUnaryExpression(int operator, IASTExpression operand)
           
 IASTWhileStatement newWhileStatement(IASTExpression condition, IASTStatement body)
           
 void setEndOffset(IASTNode node, IASTNode endNode)
          Adjusts the end-offset of a node to be the same as the end-offset of a given node.
 void setEndOffset(IASTNode node, int endOffset)
          Provides the end offset for a node.
 void setOffsets(IASTNode node, int offset, int endOffset)
          Provides the offsets for a node.
 

Method Detail

newArrayDeclarator

IASTArrayDeclarator newArrayDeclarator(IASTName name)

newArrayModifier

IASTArrayModifier newArrayModifier(IASTExpression expr)

newArraySubscriptExpression

IASTArraySubscriptExpression newArraySubscriptExpression(IASTExpression arrayExpr,
                                                         IASTExpression subscript)

newASMDeclaration

IASTASMDeclaration newASMDeclaration(java.lang.String assembly)

newAttribute

IASTAttribute newAttribute(char[] name,
                           IASTToken argumentClause)
Since:
5.4

newBinaryExpression

IASTBinaryExpression newBinaryExpression(int op,
                                         IASTExpression expr1,
                                         IASTExpression expr2)

newBreakStatement

IASTBreakStatement newBreakStatement()

newCaseStatement

IASTCaseStatement newCaseStatement(IASTExpression expr)

newCastExpression

IASTCastExpression newCastExpression(int operator,
                                     IASTTypeId typeId,
                                     IASTExpression operand)

newCompositeTypeSpecifier

IASTCompositeTypeSpecifier newCompositeTypeSpecifier(int key,
                                                     IASTName name)

newCompoundStatement

IASTCompoundStatement newCompoundStatement()

newConditionalExpession

IASTConditionalExpression newConditionalExpession(IASTExpression condition,
                                                  IASTExpression positive,
                                                  IASTExpression negative)

newContinueStatement

IASTContinueStatement newContinueStatement()

newDeclarationStatement

IASTDeclarationStatement newDeclarationStatement(IASTDeclaration declaration)

newDeclarator

IASTDeclarator newDeclarator(IASTName name)

newDefaultStatement

IASTDefaultStatement newDefaultStatement()

newDoStatement

IASTDoStatement newDoStatement(IASTStatement body,
                               IASTExpression condition)

newElaboratedTypeSpecifier

IASTElaboratedTypeSpecifier newElaboratedTypeSpecifier(int kind,
                                                       IASTName name)

newEnumerationSpecifier

IASTEnumerationSpecifier newEnumerationSpecifier(IASTName name)

newEnumerator

IASTEnumerationSpecifier.IASTEnumerator newEnumerator(IASTName name,
                                                      IASTExpression value)

newEqualsInitializer

IASTEqualsInitializer newEqualsInitializer(IASTInitializerClause initClause)
Since:
5.2

newExpressionList

IASTExpressionList newExpressionList()

newExpressionStatement

IASTExpressionStatement newExpressionStatement(IASTExpression expression)

newFieldDeclarator

IASTFieldDeclarator newFieldDeclarator(IASTName name,
                                       IASTExpression bitFieldSize)

newFieldReference

IASTFieldReference newFieldReference(IASTName name,
                                     IASTExpression owner)

newForStatement

IASTForStatement newForStatement(IASTStatement init,
                                 IASTExpression condition,
                                 IASTExpression iterationExpression,
                                 IASTStatement body)

newFunctionCallExpression

@Deprecated
IASTFunctionCallExpression newFunctionCallExpression(IASTExpression idExpr,
                                                                IASTExpression argList)
Deprecated. Replaced by newFunctionCallExpression(IASTExpression, IASTInitializerClause[])


newFunctionCallExpression

IASTFunctionCallExpression newFunctionCallExpression(IASTExpression idExpr,
                                                     IASTInitializerClause[] arguments)
Since:
5.2

newFunctionDeclarator

IASTStandardFunctionDeclarator newFunctionDeclarator(IASTName name)

newFunctionDefinition

IASTFunctionDefinition newFunctionDefinition(IASTDeclSpecifier declSpecifier,
                                             IASTFunctionDeclarator declarator,
                                             IASTStatement bodyStatement)

newGNUCompoundStatementExpression

IGNUASTCompoundStatementExpression newGNUCompoundStatementExpression(IASTCompoundStatement compoundStatement)

newGotoStatement

IASTGotoStatement newGotoStatement(IASTName name)

newIdExpression

IASTIdExpression newIdExpression(IASTName name)

newIfStatement

IASTIfStatement newIfStatement(IASTExpression condition,
                               IASTStatement then,
                               IASTStatement elseClause)

newInitializerExpression

@Deprecated
IASTInitializerExpression newInitializerExpression(IASTExpression expression)
Deprecated. Replaced by newEqualsInitializer(IASTInitializerClause).


newInitializerList

IASTInitializerList newInitializerList()

newLabelStatement

IASTLabelStatement newLabelStatement(IASTName name,
                                     IASTStatement nestedStatement)

newLiteralExpression

IASTLiteralExpression newLiteralExpression(int kind,
                                           java.lang.String rep)

newName

IASTName newName()
Creates a "dummy" name using an empty char array.


newName

IASTName newName(char[] name)

newNullStatement

IASTNullStatement newNullStatement()

newParameterDeclaration

IASTParameterDeclaration newParameterDeclaration(IASTDeclSpecifier declSpec,
                                                 IASTDeclarator declarator)

newPointer

IASTPointer newPointer()

newProblem

IASTProblem newProblem(int id,
                       char[] arg,
                       boolean error)

newProblemDeclaration

IASTProblemDeclaration newProblemDeclaration(IASTProblem problem)

newProblemExpression

IASTProblemExpression newProblemExpression(IASTProblem problem)

newProblemStatement

IASTProblemStatement newProblemStatement(IASTProblem problem)

newReturnStatement

IASTReturnStatement newReturnStatement(IASTExpression retValue)

newSimpleDeclaration

IASTSimpleDeclaration newSimpleDeclaration(IASTDeclSpecifier declSpecifier)

newSimpleDeclSpecifier

IASTSimpleDeclSpecifier newSimpleDeclSpecifier()

newSwitchStatement

IASTSwitchStatement newSwitchStatement(IASTExpression controller,
                                       IASTStatement body)

newToken

IASTToken newToken(int tokenType,
                   char[] tokenImage)
Since:
5.4

newTokenList

IASTTokenList newTokenList()
Since:
5.4

newTranslationUnit

@Deprecated
IASTTranslationUnit newTranslationUnit()
Deprecated. Replaced by newTranslationUnit(IScanner).


newTranslationUnit

IASTTranslationUnit newTranslationUnit(org.eclipse.cdt.core.parser.IScanner scanner)
Creates a new translation unit that cooperates with the given scanner in order to track macro-expansions and location information.

Parameters:
scanner - the preprocessor the translation unit interacts with.
Since:
5.2

newTypedefNameSpecifier

IASTNamedTypeSpecifier newTypedefNameSpecifier(IASTName name)

newTypeId

IASTTypeId newTypeId(IASTDeclSpecifier declSpecifier,
                     IASTDeclarator declarator)

newTypeIdExpression

IASTTypeIdExpression newTypeIdExpression(int operator,
                                         IASTTypeId typeId)

newTypeIdInitializerExpression

IASTTypeIdInitializerExpression newTypeIdInitializerExpression(IASTTypeId typeId,
                                                               IASTInitializer initializer)

newUnaryExpression

IASTUnaryExpression newUnaryExpression(int operator,
                                       IASTExpression operand)

newWhileStatement

IASTWhileStatement newWhileStatement(IASTExpression condition,
                                     IASTStatement body)

setEndOffset

void setEndOffset(IASTNode node,
                  IASTNode endNode)
Adjusts the end-offset of a node to be the same as the end-offset of a given node. May throw an exception when either one of the nodes provided was not created by this factory.

Parameters:
node - a node created by this factory
endNode - a node created by this factory defining the end for the other node.
Since:
5.2

setEndOffset

void setEndOffset(IASTNode node,
                  int endOffset)
Provides the end offset for a node. The offset is an artificial numbers that identifies the position of a node in the translation unit. It is not a file-offset. You can obtain a valid offset via IToken.getEndOffset() from a token provided by the scanner for this translation unit. May throw an exception when the node provided was not created by this factory.

Parameters:
node - a node created by this factory
endOffset - the end offset (exclusive) for the node
Since:
5.2
See Also:
newTranslationUnit(IScanner)

setOffsets

void setOffsets(IASTNode node,
                int offset,
                int endOffset)
Provides the offsets for a node. The offsets are artificial numbers that identify the position of a node in the translation unit. They are not file-offsets. You can obtain valid offsets via IToken.getOffset() or IToken.getEndOffset() from tokens provided by the scanner for this translation unit. May throw an exception when the node provided was not created by this factory.

Parameters:
node - a node created by this factory
offset - the offset (inclusive) for the node
endOffset - the end offset (exclusive) for the node
Since:
5.2
See Also:
newTranslationUnit(IScanner)

Eclipse CDT
7.0

Copyright (c) IBM Corp. and others 2004, 2012. All Rights Reserved.