mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
bug #206952, add constructor methods to AST node classes, set() methods now call setParent() and setPropertyInParent()
This commit is contained in:
parent
5ec0f9d046
commit
a83d0a7ac9
147 changed files with 2362 additions and 3570 deletions
|
@ -21,8 +21,8 @@ public interface IASTExpressionStatement extends IASTStatement {
|
||||||
* <code>EXPRESSION</code> is the relationship between an
|
* <code>EXPRESSION</code> is the relationship between an
|
||||||
* <code>IASTExpressionStatement</code> and an <code>IASTExpression</code>.
|
* <code>IASTExpressionStatement</code> and an <code>IASTExpression</code>.
|
||||||
*/
|
*/
|
||||||
public static final ASTNodeProperty EXPFRESSION = new ASTNodeProperty(
|
public static final ASTNodeProperty EXPRESSION = new ASTNodeProperty(
|
||||||
"IASTExpressionStatement.IASTStatement - IASTExpression for IASTExpressionStatement"); //$NON-NLS-1$
|
"IASTExpressionStatement.EXPRESSION - IASTExpression for IASTExpressionStatement"); //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the expression in this statement.
|
* Get the expression in this statement.
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Ed Swartz (Nokia)
|
* Ed Swartz (Nokia)
|
||||||
|
* Mike Kucera (IBM) - bug #206952
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser;
|
package org.eclipse.cdt.internal.core.dom.parser;
|
||||||
|
|
||||||
|
@ -37,7 +38,6 @@ import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTGotoStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTGotoStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
|
||||||
|
@ -48,7 +48,6 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNullStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTNullStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTProblem;
|
import org.eclipse.cdt.core.dom.ast.IASTProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTProblemHolder;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTProblemStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTProblemStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
|
||||||
|
@ -138,8 +137,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void throwBacktrack(int offset, int length)
|
protected final void throwBacktrack(int offset, int length) throws BacktrackException {
|
||||||
throws BacktrackException {
|
|
||||||
++backtrackCount;
|
++backtrackCount;
|
||||||
backtrack.initialize(offset, (length < 0) ? 0 : length);
|
backtrack.initialize(offset, (length < 0) ? 0 : length);
|
||||||
throw backtrack;
|
throw backtrack;
|
||||||
|
@ -149,11 +147,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
|
|
||||||
protected ASTCompletionNode completionNode;
|
protected ASTCompletionNode completionNode;
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.ISourceCodeParser#getCompletionNode()
|
|
||||||
*/
|
|
||||||
public IASTCompletionNode getCompletionNode() {
|
public IASTCompletionNode getCompletionNode() {
|
||||||
return completionNode;
|
return completionNode;
|
||||||
}
|
}
|
||||||
|
@ -558,25 +552,19 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
int startingOffset = consume(IToken.tLBRACE).getOffset();
|
int startingOffset = consume(IToken.tLBRACE).getOffset();
|
||||||
|
|
||||||
((ASTNode) result).setOffset(startingOffset);
|
((ASTNode) result).setOffset(startingOffset);
|
||||||
result.setPropertyInParent(IASTFunctionDefinition.FUNCTION_BODY);
|
//result.setPropertyInParent(IASTFunctionDefinition.FUNCTION_BODY);
|
||||||
while (LT(1) != IToken.tRBRACE && LT(1) != IToken.tEOC) {
|
while (LT(1) != IToken.tRBRACE && LT(1) != IToken.tEOC) {
|
||||||
int checkToken = LA(1).hashCode();
|
int checkToken = LA(1).hashCode();
|
||||||
try {
|
try {
|
||||||
IASTStatement s = statement();
|
IASTStatement s = statement();
|
||||||
result.addStatement(s);
|
result.addStatement(s);
|
||||||
s.setParent(result);
|
|
||||||
s.setPropertyInParent(IASTCompoundStatement.NESTED_STATEMENT);
|
|
||||||
} catch (BacktrackException b) {
|
} catch (BacktrackException b) {
|
||||||
IASTProblem p = failParse(b);
|
IASTProblem p = failParse(b);
|
||||||
IASTProblemStatement ps = createProblemStatement();
|
IASTProblemStatement ps = createProblemStatement();
|
||||||
ps.setProblem(p);
|
ps.setProblem(p);
|
||||||
((ASTNode) ps).setOffsetAndLength(((ASTNode) p).getOffset(),
|
((ASTNode) ps).setOffsetAndLength(((ASTNode) p).getOffset(),
|
||||||
((ASTNode) p).getLength());
|
((ASTNode) p).getLength());
|
||||||
p.setParent(ps);
|
|
||||||
p.setPropertyInParent(IASTProblemHolder.PROBLEM);
|
|
||||||
result.addStatement(ps);
|
result.addStatement(ps);
|
||||||
ps.setParent(result);
|
|
||||||
ps.setPropertyInParent(IASTCompoundStatement.NESTED_STATEMENT);
|
|
||||||
if (LA(1).hashCode() == checkToken)
|
if (LA(1).hashCode() == checkToken)
|
||||||
failParseWithErrorHandling();
|
failParseWithErrorHandling();
|
||||||
}
|
}
|
||||||
|
@ -604,15 +592,12 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
* @throws EndOfFileException
|
* @throws EndOfFileException
|
||||||
* @throws BacktrackException
|
* @throws BacktrackException
|
||||||
*/
|
*/
|
||||||
protected IASTExpression compoundStatementExpression()
|
protected IASTExpression compoundStatementExpression() throws EndOfFileException, BacktrackException {
|
||||||
throws EndOfFileException, BacktrackException {
|
|
||||||
int startingOffset = consume().getOffset(); // tLPAREN always
|
int startingOffset = consume().getOffset(); // tLPAREN always
|
||||||
IASTCompoundStatement compoundStatement = null;
|
IASTCompoundStatement compoundStatement = null;
|
||||||
if (mode == ParserMode.QUICK_PARSE
|
if (mode == ParserMode.QUICK_PARSE || mode == ParserMode.STRUCTURAL_PARSE)
|
||||||
|| mode == ParserMode.STRUCTURAL_PARSE)
|
|
||||||
skipOverCompoundStatement();
|
skipOverCompoundStatement();
|
||||||
else if (mode == ParserMode.COMPLETION_PARSE
|
else if (mode == ParserMode.COMPLETION_PARSE || mode == ParserMode.SELECTION_PARSE) {
|
||||||
|| mode == ParserMode.SELECTION_PARSE) {
|
|
||||||
if (scanner.isOnTopContext())
|
if (scanner.isOnTopContext())
|
||||||
compoundStatement();
|
compoundStatement();
|
||||||
else
|
else
|
||||||
|
@ -622,13 +607,9 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
|
|
||||||
int lastOffset = consume(IToken.tRPAREN).getEndOffset();
|
int lastOffset = consume(IToken.tRPAREN).getEndOffset();
|
||||||
IGNUASTCompoundStatementExpression resultExpression = createCompoundStatementExpression();
|
IGNUASTCompoundStatementExpression resultExpression = createCompoundStatementExpression();
|
||||||
((ASTNode) resultExpression).setOffsetAndLength(startingOffset,
|
((ASTNode) resultExpression).setOffsetAndLength(startingOffset, lastOffset - startingOffset);
|
||||||
lastOffset - startingOffset);
|
|
||||||
if (compoundStatement != null) {
|
if (compoundStatement != null) {
|
||||||
resultExpression.setCompoundStatement(compoundStatement);
|
resultExpression.setCompoundStatement(compoundStatement);
|
||||||
compoundStatement.setParent(resultExpression);
|
|
||||||
compoundStatement
|
|
||||||
.setPropertyInParent(IGNUASTCompoundStatementExpression.STATEMENT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultExpression;
|
return resultExpression;
|
||||||
|
@ -639,8 +620,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
*/
|
*/
|
||||||
protected abstract IGNUASTCompoundStatementExpression createCompoundStatementExpression();
|
protected abstract IGNUASTCompoundStatementExpression createCompoundStatementExpression();
|
||||||
|
|
||||||
protected IASTExpression expression() throws BacktrackException,
|
protected IASTExpression expression() throws BacktrackException, EndOfFileException {
|
||||||
EndOfFileException {
|
|
||||||
IToken la = LA(1);
|
IToken la = LA(1);
|
||||||
int startingOffset = la.getOffset();
|
int startingOffset = la.getOffset();
|
||||||
|
|
||||||
|
@ -658,18 +638,12 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
IASTExpressionList expressionList = createExpressionList();
|
IASTExpressionList expressionList = createExpressionList();
|
||||||
((ASTNode) expressionList).setOffset(startingOffset);
|
((ASTNode) expressionList).setOffset(startingOffset);
|
||||||
expressionList.addExpression(assignmentExpression);
|
expressionList.addExpression(assignmentExpression);
|
||||||
assignmentExpression.setParent(expressionList);
|
|
||||||
assignmentExpression
|
|
||||||
.setPropertyInParent(IASTExpressionList.NESTED_EXPRESSION);
|
|
||||||
|
|
||||||
int lastOffset = 0;
|
int lastOffset = 0;
|
||||||
while (LT(1) == IToken.tCOMMA) {
|
while (LT(1) == IToken.tCOMMA) {
|
||||||
consume();
|
consume();
|
||||||
IASTExpression secondExpression = assignmentExpression();
|
IASTExpression secondExpression = assignmentExpression();
|
||||||
expressionList.addExpression(secondExpression);
|
expressionList.addExpression(secondExpression);
|
||||||
secondExpression.setParent(expressionList);
|
|
||||||
secondExpression
|
|
||||||
.setPropertyInParent(IASTExpressionList.NESTED_EXPRESSION);
|
|
||||||
lastOffset = calculateEndOffset(secondExpression);
|
lastOffset = calculateEndOffset(secondExpression);
|
||||||
}
|
}
|
||||||
((ASTNode) expressionList).setLength(lastOffset - startingOffset);
|
((ASTNode) expressionList).setLength(lastOffset - startingOffset);
|
||||||
|
@ -794,9 +768,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
* @param expression
|
* @param expression
|
||||||
* @throws BacktrackException
|
* @throws BacktrackException
|
||||||
*/
|
*/
|
||||||
protected IASTExpression andExpression() throws EndOfFileException,
|
protected IASTExpression andExpression() throws EndOfFileException, BacktrackException {
|
||||||
BacktrackException {
|
|
||||||
|
|
||||||
IASTExpression firstExpression = equalityExpression();
|
IASTExpression firstExpression = equalityExpression();
|
||||||
while (LT(1) == IToken.tAMPER) {
|
while (LT(1) == IToken.tAMPER) {
|
||||||
consume();
|
consume();
|
||||||
|
@ -841,11 +813,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
int o = ((ASTNode) firstExpression).getOffset();
|
int o = ((ASTNode) firstExpression).getOffset();
|
||||||
((ASTNode) result).setOffsetAndLength(o, lastOffset - o);
|
((ASTNode) result).setOffsetAndLength(o, lastOffset - o);
|
||||||
result.setOperand1(firstExpression);
|
result.setOperand1(firstExpression);
|
||||||
firstExpression.setParent(result);
|
|
||||||
firstExpression.setPropertyInParent(IASTBinaryExpression.OPERAND_ONE);
|
|
||||||
result.setOperand2(secondExpression);
|
result.setOperand2(secondExpression);
|
||||||
secondExpression.setParent(result);
|
|
||||||
secondExpression.setPropertyInParent(IASTBinaryExpression.OPERAND_TWO);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -924,18 +892,9 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
|
|
||||||
IASTConditionalExpression result = createConditionalExpression();
|
IASTConditionalExpression result = createConditionalExpression();
|
||||||
result.setLogicalConditionExpression(firstExpression);
|
result.setLogicalConditionExpression(firstExpression);
|
||||||
firstExpression.setParent(result);
|
|
||||||
firstExpression
|
|
||||||
.setPropertyInParent(IASTConditionalExpression.LOGICAL_CONDITION);
|
|
||||||
result.setPositiveResultExpression(secondExpression);
|
result.setPositiveResultExpression(secondExpression);
|
||||||
secondExpression.setParent(result);
|
|
||||||
secondExpression
|
|
||||||
.setPropertyInParent(IASTConditionalExpression.POSITIVE_RESULT);
|
|
||||||
if (thirdExpression != null) {
|
if (thirdExpression != null) {
|
||||||
result.setNegativeResultExpression(thirdExpression);
|
result.setNegativeResultExpression(thirdExpression);
|
||||||
thirdExpression.setParent(result);
|
|
||||||
thirdExpression
|
|
||||||
.setPropertyInParent(IASTConditionalExpression.NEGATIVE_RESULT);
|
|
||||||
((ASTNode) result).setOffsetAndLength(((ASTNode) firstExpression)
|
((ASTNode) result).setOffsetAndLength(((ASTNode) firstExpression)
|
||||||
.getOffset(), calculateEndOffset(thirdExpression)
|
.getOffset(), calculateEndOffset(thirdExpression)
|
||||||
- ((ASTNode) firstExpression).getOffset());
|
- ((ASTNode) firstExpression).getOffset());
|
||||||
|
@ -965,11 +924,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
IASTUnaryExpression result = createUnaryExpression();
|
IASTUnaryExpression result = createUnaryExpression();
|
||||||
((ASTNode) result).setOffsetAndLength(offset, lastOffset - offset);
|
((ASTNode) result).setOffsetAndLength(offset, lastOffset - offset);
|
||||||
result.setOperator(operator);
|
result.setOperator(operator);
|
||||||
if (operand != null) {
|
result.setOperand(operand);
|
||||||
result.setOperand(operand);
|
|
||||||
operand.setParent(result);
|
|
||||||
operand.setPropertyInParent(IASTUnaryExpression.OPERAND);
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1069,25 +1024,19 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
|
|
||||||
protected IASTStatement handleFunctionBody() throws BacktrackException,
|
protected IASTStatement handleFunctionBody() throws BacktrackException,
|
||||||
EndOfFileException {
|
EndOfFileException {
|
||||||
if (mode == ParserMode.QUICK_PARSE
|
if (mode == ParserMode.QUICK_PARSE || mode == ParserMode.STRUCTURAL_PARSE) {
|
||||||
|| mode == ParserMode.STRUCTURAL_PARSE) {
|
|
||||||
IToken curr = LA(1);
|
IToken curr = LA(1);
|
||||||
IToken last = skipOverCompoundStatement();
|
IToken last = skipOverCompoundStatement();
|
||||||
IASTCompoundStatement cs = createCompoundStatement();
|
IASTCompoundStatement cs = createCompoundStatement();
|
||||||
((ASTNode) cs).setOffsetAndLength(curr.getOffset(), last
|
((ASTNode) cs).setOffsetAndLength(curr.getOffset(), last.getEndOffset() - curr.getOffset());
|
||||||
.getEndOffset()
|
|
||||||
- curr.getOffset());
|
|
||||||
return cs;
|
return cs;
|
||||||
} else if (mode == ParserMode.COMPLETION_PARSE
|
} else if (mode == ParserMode.COMPLETION_PARSE || mode == ParserMode.SELECTION_PARSE) {
|
||||||
|| mode == ParserMode.SELECTION_PARSE) {
|
|
||||||
if (scanner.isOnTopContext())
|
if (scanner.isOnTopContext())
|
||||||
return functionBody();
|
return functionBody();
|
||||||
IToken curr = LA(1);
|
IToken curr = LA(1);
|
||||||
IToken last = skipOverCompoundStatement();
|
IToken last = skipOverCompoundStatement();
|
||||||
IASTCompoundStatement cs = createCompoundStatement();
|
IASTCompoundStatement cs = createCompoundStatement();
|
||||||
((ASTNode) cs).setOffsetAndLength(curr.getOffset(), last
|
((ASTNode) cs).setOffsetAndLength(curr.getOffset(), last.getEndOffset() - curr.getOffset());
|
||||||
.getEndOffset()
|
|
||||||
- curr.getOffset());
|
|
||||||
return cs;
|
return cs;
|
||||||
} else if (mode == ParserMode.COMPLETE_PARSE)
|
} else if (mode == ParserMode.COMPLETE_PARSE)
|
||||||
return functionBody();
|
return functionBody();
|
||||||
|
@ -1101,8 +1050,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
* @throws BacktrackException
|
* @throws BacktrackException
|
||||||
* request a backtrack
|
* request a backtrack
|
||||||
*/
|
*/
|
||||||
protected IASTStatement functionBody() throws EndOfFileException,
|
protected IASTStatement functionBody() throws EndOfFileException, BacktrackException {
|
||||||
BacktrackException {
|
|
||||||
return compoundStatement();
|
return compoundStatement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1315,8 +1263,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
IASTEnumerationSpecifier result = createEnumerationSpecifier();
|
IASTEnumerationSpecifier result = createEnumerationSpecifier();
|
||||||
((ASTNode) result).setOffset(startOffset);
|
((ASTNode) result).setOffset(startOffset);
|
||||||
result.setName(name);
|
result.setName(name);
|
||||||
name.setParent(result);
|
|
||||||
name.setPropertyInParent(IASTEnumerationSpecifier.ENUMERATION_NAME);
|
|
||||||
|
|
||||||
consume(); // IToken.tLBRACE
|
consume(); // IToken.tLBRACE
|
||||||
enumLoop: while (true) {
|
enumLoop: while (true) {
|
||||||
|
@ -1350,19 +1296,10 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
((ASTNode) enumerator).setOffsetAndLength(
|
((ASTNode) enumerator).setOffsetAndLength(
|
||||||
((ASTNode) enumeratorName).getOffset(), lastOffset
|
((ASTNode) enumeratorName).getOffset(), lastOffset
|
||||||
- ((ASTNode) enumeratorName).getOffset());
|
- ((ASTNode) enumeratorName).getOffset());
|
||||||
enumeratorName.setParent(enumerator);
|
|
||||||
enumeratorName
|
|
||||||
.setPropertyInParent(IASTEnumerationSpecifier.IASTEnumerator.ENUMERATOR_NAME);
|
|
||||||
if (initialValue != null) {
|
if (initialValue != null) {
|
||||||
enumerator.setValue(initialValue);
|
enumerator.setValue(initialValue);
|
||||||
initialValue.setParent(enumerator);
|
|
||||||
initialValue
|
|
||||||
.setPropertyInParent(IASTEnumerationSpecifier.IASTEnumerator.ENUMERATOR_VALUE);
|
|
||||||
}
|
}
|
||||||
result.addEnumerator(enumerator);
|
result.addEnumerator(enumerator);
|
||||||
enumerator.setParent(result);
|
|
||||||
enumerator
|
|
||||||
.setPropertyInParent(IASTEnumerationSpecifier.ENUMERATOR);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1381,19 +1318,10 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
((ASTNode) enumerator).setOffsetAndLength(
|
((ASTNode) enumerator).setOffsetAndLength(
|
||||||
((ASTNode) enumeratorName).getOffset(), lastOffset
|
((ASTNode) enumeratorName).getOffset(), lastOffset
|
||||||
- ((ASTNode) enumeratorName).getOffset());
|
- ((ASTNode) enumeratorName).getOffset());
|
||||||
enumeratorName.setParent(enumerator);
|
|
||||||
enumeratorName
|
|
||||||
.setPropertyInParent(IASTEnumerationSpecifier.IASTEnumerator.ENUMERATOR_NAME);
|
|
||||||
if (initialValue != null) {
|
if (initialValue != null) {
|
||||||
enumerator.setValue(initialValue);
|
enumerator.setValue(initialValue);
|
||||||
initialValue.setParent(enumerator);
|
|
||||||
initialValue
|
|
||||||
.setPropertyInParent(IASTEnumerationSpecifier.IASTEnumerator.ENUMERATOR_VALUE);
|
|
||||||
}
|
}
|
||||||
result.addEnumerator(enumerator);
|
result.addEnumerator(enumerator);
|
||||||
enumerator.setParent(result);
|
|
||||||
enumerator
|
|
||||||
.setPropertyInParent(IASTEnumerationSpecifier.ENUMERATOR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int lastOffset = consume().getEndOffset();
|
int lastOffset = consume().getEndOffset();
|
||||||
|
@ -1409,25 +1337,16 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
protected abstract IASTStatement statement() throws EndOfFileException,
|
protected abstract IASTStatement statement() throws EndOfFileException,
|
||||||
BacktrackException;
|
BacktrackException;
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTEnumerator createEnumerator();
|
protected abstract IASTEnumerator createEnumerator();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTEnumerationSpecifier createEnumerationSpecifier();
|
protected abstract IASTEnumerationSpecifier createEnumerationSpecifier();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTName createName();
|
protected abstract IASTName createName();
|
||||||
|
|
||||||
/**
|
|
||||||
* @param token
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTName createName(IToken token);
|
protected abstract IASTName createName(IToken token);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1439,11 +1358,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
return cond;
|
return cond;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.internal.core.parser2.ISourceCodeParser#encounteredError()
|
|
||||||
*/
|
|
||||||
public boolean encounteredError() {
|
public boolean encounteredError() {
|
||||||
return !parsePassed;
|
return !parsePassed;
|
||||||
}
|
}
|
||||||
|
@ -1452,69 +1367,43 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
|
|
||||||
protected abstract IASTNamedTypeSpecifier createNamedTypeSpecifier();
|
protected abstract IASTNamedTypeSpecifier createNamedTypeSpecifier();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTDeclarationStatement createDeclarationStatement();
|
protected abstract IASTDeclarationStatement createDeclarationStatement();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTExpressionStatement createExpressionStatement();
|
protected abstract IASTExpressionStatement createExpressionStatement();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTLabelStatement createLabelStatement();
|
protected abstract IASTLabelStatement createLabelStatement();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTNullStatement createNullStatement();
|
protected abstract IASTNullStatement createNullStatement();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTGotoStatement createGoToStatement();
|
protected abstract IASTGotoStatement createGoToStatement();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTReturnStatement createReturnStatement();
|
protected abstract IASTReturnStatement createReturnStatement();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTContinueStatement createContinueStatement();
|
protected abstract IASTContinueStatement createContinueStatement();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTBreakStatement createBreakStatement();
|
protected abstract IASTBreakStatement createBreakStatement();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTDoStatement createDoStatement();
|
protected abstract IASTDoStatement createDoStatement();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTWhileStatement createWhileStatement();
|
protected abstract IASTWhileStatement createWhileStatement();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTIdExpression createIdExpression();
|
protected abstract IASTIdExpression createIdExpression();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTDefaultStatement createDefaultStatement();
|
protected abstract IASTDefaultStatement createDefaultStatement();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTCaseStatement createCaseStatement();
|
protected abstract IASTCaseStatement createCaseStatement();
|
||||||
|
|
||||||
protected abstract IASTDeclaration declaration() throws BacktrackException,
|
protected abstract IASTDeclaration declaration() throws BacktrackException,
|
||||||
|
@ -1553,41 +1442,25 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTASMDeclaration createASMDirective();
|
protected abstract IASTASMDeclaration createASMDirective();
|
||||||
|
|
||||||
/**
|
|
||||||
* @param op
|
|
||||||
* @param typeId
|
|
||||||
* @param subExpression
|
|
||||||
* @param startingOffset
|
|
||||||
* @param lastOffset
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected IASTExpression buildTypeIdUnaryExpression(int op,
|
protected IASTExpression buildTypeIdUnaryExpression(int op,
|
||||||
IASTTypeId typeId, IASTExpression subExpression,
|
IASTTypeId typeId, IASTExpression subExpression,
|
||||||
int startingOffset, int lastOffset) {
|
int startingOffset, int lastOffset) {
|
||||||
IASTCastExpression result = createCastExpression();
|
IASTCastExpression result = createCastExpression();
|
||||||
result.setOperator(op);
|
result.setOperator(op);
|
||||||
((ASTNode) result).setOffsetAndLength(startingOffset, lastOffset
|
((ASTNode) result).setOffsetAndLength(startingOffset, lastOffset - startingOffset);
|
||||||
- startingOffset);
|
|
||||||
result.setTypeId(typeId);
|
result.setTypeId(typeId);
|
||||||
typeId.setParent(result);
|
|
||||||
typeId.setPropertyInParent(IASTCastExpression.TYPE_ID);
|
|
||||||
if (subExpression != null) { // which it can be in a completion
|
if (subExpression != null) { // which it can be in a completion
|
||||||
result.setOperand(subExpression);
|
result.setOperand(subExpression);
|
||||||
subExpression.setParent(result);
|
|
||||||
subExpression.setPropertyInParent(IASTCastExpression.OPERAND);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected abstract IASTCastExpression createCastExpression();
|
protected abstract IASTCastExpression createCastExpression();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1614,10 +1487,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
expressionStatement = createExpressionStatement();
|
expressionStatement = createExpressionStatement();
|
||||||
expressionStatement.setExpression(expression);
|
expressionStatement.setExpression(expression);
|
||||||
((ASTNode) expressionStatement).setOffsetAndLength(
|
((ASTNode) expressionStatement).setOffsetAndLength(
|
||||||
mark.getOffset(), lastTokenOfExpression.getEndOffset()
|
mark.getOffset(), lastTokenOfExpression.getEndOffset() - mark.getOffset());
|
||||||
- mark.getOffset());
|
|
||||||
expression.setParent(expressionStatement);
|
|
||||||
expression.setPropertyInParent(IASTExpressionStatement.EXPFRESSION);
|
|
||||||
} catch (BacktrackException b) {
|
} catch (BacktrackException b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1629,10 +1499,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
IASTDeclaration d = declaration();
|
IASTDeclaration d = declaration();
|
||||||
ds = createDeclarationStatement();
|
ds = createDeclarationStatement();
|
||||||
ds.setDeclaration(d);
|
ds.setDeclaration(d);
|
||||||
((ASTNode) ds).setOffsetAndLength(((ASTNode) d).getOffset(),
|
((ASTNode) ds).setOffsetAndLength(((ASTNode) d).getOffset(), ((ASTNode) d).getLength());
|
||||||
((ASTNode) d).getLength());
|
|
||||||
d.setParent(ds);
|
|
||||||
d.setPropertyInParent(IASTDeclarationStatement.DECLARATION);
|
|
||||||
} catch (BacktrackException b) {
|
} catch (BacktrackException b) {
|
||||||
savedBt = b;
|
savedBt = b;
|
||||||
backup(mark);
|
backup(mark);
|
||||||
|
@ -1654,8 +1521,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
// resolve ambiguities
|
// resolve ambiguities
|
||||||
// A * B = C;
|
// A * B = C;
|
||||||
if (expressionStatement.getExpression() instanceof IASTBinaryExpression) {
|
if (expressionStatement.getExpression() instanceof IASTBinaryExpression) {
|
||||||
IASTBinaryExpression exp = (IASTBinaryExpression) expressionStatement
|
IASTBinaryExpression exp = (IASTBinaryExpression) expressionStatement.getExpression();
|
||||||
.getExpression();
|
|
||||||
if (exp.getOperator() == IASTBinaryExpression.op_assign) {
|
if (exp.getOperator() == IASTBinaryExpression.op_assign) {
|
||||||
IASTExpression lhs = exp.getOperand1();
|
IASTExpression lhs = exp.getOperand1();
|
||||||
if (lhs instanceof IASTBinaryExpression
|
if (lhs instanceof IASTBinaryExpression
|
||||||
|
@ -1736,12 +1602,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
|
|
||||||
IASTAmbiguousStatement statement = createAmbiguousStatement();
|
IASTAmbiguousStatement statement = createAmbiguousStatement();
|
||||||
statement.addStatement(ds);
|
statement.addStatement(ds);
|
||||||
ds.setParent(statement);
|
|
||||||
ds.setPropertyInParent(IASTAmbiguousStatement.STATEMENT);
|
|
||||||
statement.addStatement(expressionStatement);
|
statement.addStatement(expressionStatement);
|
||||||
expressionStatement.setParent(statement);
|
|
||||||
expressionStatement
|
|
||||||
.setPropertyInParent(IASTAmbiguousStatement.STATEMENT);
|
|
||||||
((ASTNode) statement).setOffsetAndLength((ASTNode) ds);
|
((ASTNode) statement).setOffsetAndLength((ASTNode) ds);
|
||||||
return statement;
|
return statement;
|
||||||
}
|
}
|
||||||
|
@ -1765,12 +1626,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
|
|
||||||
IASTName name = createName(labelName);
|
IASTName name = createName(labelName);
|
||||||
label_statement.setName(name);
|
label_statement.setName(name);
|
||||||
name.setParent(label_statement);
|
label_statement.setNestedStatement(nestedStatement);
|
||||||
name.setPropertyInParent(IASTLabelStatement.NAME);
|
|
||||||
|
|
||||||
label_statement.setNestedStatement( nestedStatement );
|
|
||||||
nestedStatement.setParent( label_statement );
|
|
||||||
nestedStatement.setPropertyInParent( IASTLabelStatement.NESTED_STATEMENT );
|
|
||||||
return label_statement;
|
return label_statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1784,9 +1640,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
IToken t = consume(); // tSEMI
|
IToken t = consume(); // tSEMI
|
||||||
|
|
||||||
IASTNullStatement null_statement = createNullStatement();
|
IASTNullStatement null_statement = createNullStatement();
|
||||||
((ASTNode) null_statement).setOffsetAndLength(t.getOffset(), t
|
((ASTNode) null_statement).setOffsetAndLength(t.getOffset(), t.getEndOffset() - t.getOffset());
|
||||||
.getEndOffset()
|
|
||||||
- t.getOffset());
|
|
||||||
return null_statement;
|
return null_statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1803,11 +1657,8 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
|
|
||||||
IASTName goto_label_name = createName(identifier);
|
IASTName goto_label_name = createName(identifier);
|
||||||
IASTGotoStatement goto_statement = createGoToStatement();
|
IASTGotoStatement goto_statement = createGoToStatement();
|
||||||
((ASTNode) goto_statement).setOffsetAndLength(startOffset, lastOffset
|
((ASTNode) goto_statement).setOffsetAndLength(startOffset, lastOffset - startOffset);
|
||||||
- startOffset);
|
|
||||||
goto_statement.setName(goto_label_name);
|
goto_statement.setName(goto_label_name);
|
||||||
goto_label_name.setParent(goto_statement);
|
|
||||||
goto_label_name.setPropertyInParent(IASTGotoStatement.NAME);
|
|
||||||
return goto_statement;
|
return goto_statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1822,8 +1673,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
int lastOffset = consume(IToken.tSEMI).getEndOffset();
|
int lastOffset = consume(IToken.tSEMI).getEndOffset();
|
||||||
|
|
||||||
IASTBreakStatement break_statement = createBreakStatement();
|
IASTBreakStatement break_statement = createBreakStatement();
|
||||||
((ASTNode) break_statement).setOffsetAndLength(startOffset, lastOffset
|
((ASTNode) break_statement).setOffsetAndLength(startOffset, lastOffset - startOffset);
|
||||||
- startOffset);
|
|
||||||
return break_statement;
|
return break_statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1838,8 +1688,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
int lastOffset = consume(IToken.tSEMI).getEndOffset();
|
int lastOffset = consume(IToken.tSEMI).getEndOffset();
|
||||||
|
|
||||||
IASTContinueStatement continue_statement = createContinueStatement();
|
IASTContinueStatement continue_statement = createContinueStatement();
|
||||||
((ASTNode) continue_statement).setOffsetAndLength(startOffset,
|
((ASTNode) continue_statement).setOffsetAndLength(startOffset, lastOffset - startOffset);
|
||||||
lastOffset - startOffset);
|
|
||||||
return continue_statement;
|
return continue_statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1861,8 +1710,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
IASTName name = createName(LA(1));
|
IASTName name = createName(LA(1));
|
||||||
IASTIdExpression idExpr = createIdExpression();
|
IASTIdExpression idExpr = createIdExpression();
|
||||||
idExpr.setName(name);
|
idExpr.setName(name);
|
||||||
name.setParent(idExpr);
|
|
||||||
name.setPropertyInParent(IASTIdExpression.ID_NAME);
|
|
||||||
result = idExpr;
|
result = idExpr;
|
||||||
break;
|
break;
|
||||||
case IToken.tSEMI:
|
case IToken.tSEMI:
|
||||||
|
@ -1889,8 +1736,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
- startOffset);
|
- startOffset);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
return_statement.setReturnValue(result);
|
return_statement.setReturnValue(result);
|
||||||
result.setParent(return_statement);
|
|
||||||
result.setPropertyInParent(IASTReturnStatement.RETURNVALUE);
|
|
||||||
}
|
}
|
||||||
return return_statement;
|
return return_statement;
|
||||||
}
|
}
|
||||||
|
@ -1934,16 +1779,11 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
|
|
||||||
|
|
||||||
IASTDoStatement do_statement = createDoStatement();
|
IASTDoStatement do_statement = createDoStatement();
|
||||||
((ASTNode) do_statement).setOffsetAndLength(startOffset, lastOffset
|
((ASTNode) do_statement).setOffsetAndLength(startOffset, lastOffset - startOffset);
|
||||||
- startOffset);
|
|
||||||
do_statement.setBody(do_body);
|
do_statement.setBody(do_body);
|
||||||
do_body.setParent(do_statement);
|
|
||||||
do_body.setPropertyInParent(IASTDoStatement.BODY);
|
|
||||||
|
|
||||||
if (do_condition != null) {
|
if (do_condition != null) {
|
||||||
do_statement.setCondition(do_condition);
|
do_statement.setCondition(do_condition);
|
||||||
do_condition.setParent(do_statement);
|
|
||||||
do_condition.setPropertyInParent(IASTDoStatement.CONDITION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return do_statement;
|
return do_statement;
|
||||||
|
@ -1954,8 +1794,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
* @throws EndOfFileException
|
* @throws EndOfFileException
|
||||||
* @throws BacktrackException
|
* @throws BacktrackException
|
||||||
*/
|
*/
|
||||||
protected IASTStatement parseWhileStatement() throws EndOfFileException,
|
protected IASTStatement parseWhileStatement() throws EndOfFileException, BacktrackException {
|
||||||
BacktrackException {
|
|
||||||
int startOffset = consume().getOffset();
|
int startOffset = consume().getOffset();
|
||||||
consume(IToken.tLPAREN);
|
consume(IToken.tLPAREN);
|
||||||
IASTExpression while_condition = condition();
|
IASTExpression while_condition = condition();
|
||||||
|
@ -1976,15 +1815,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
((ASTNode) while_statement).setOffsetAndLength(startOffset,
|
((ASTNode) while_statement).setOffsetAndLength(startOffset,
|
||||||
(while_body != null ? calculateEndOffset(while_body) : LA(1).getEndOffset()) - startOffset);
|
(while_body != null ? calculateEndOffset(while_body) : LA(1).getEndOffset()) - startOffset);
|
||||||
while_statement.setCondition(while_condition);
|
while_statement.setCondition(while_condition);
|
||||||
while_condition.setParent(while_statement);
|
while_statement.setBody(while_body);
|
||||||
while_condition
|
|
||||||
.setPropertyInParent(IASTWhileStatement.CONDITIONEXPRESSION);
|
|
||||||
|
|
||||||
if (while_body != null) {
|
|
||||||
while_statement.setBody(while_body);
|
|
||||||
while_body.setParent(while_statement);
|
|
||||||
while_body.setPropertyInParent(IASTWhileStatement.BODY);
|
|
||||||
}
|
|
||||||
|
|
||||||
return while_statement;
|
return while_statement;
|
||||||
}
|
}
|
||||||
|
@ -2003,16 +1834,13 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
ASTNode r = ((ASTNode) current);
|
ASTNode r = ((ASTNode) current);
|
||||||
if (current.getElseClause() != null) {
|
if (current.getElseClause() != null) {
|
||||||
ASTNode else_clause = ((ASTNode) current.getElseClause());
|
ASTNode else_clause = ((ASTNode) current.getElseClause());
|
||||||
r.setLength(else_clause.getOffset() + else_clause.getLength()
|
r.setLength(else_clause.getOffset() + else_clause.getLength() - r.getOffset());
|
||||||
- r.getOffset());
|
|
||||||
} else {
|
} else {
|
||||||
ASTNode then_clause = (ASTNode) current.getThenClause();
|
ASTNode then_clause = (ASTNode) current.getThenClause();
|
||||||
if (then_clause != null)
|
if (then_clause != null)
|
||||||
r.setLength(then_clause.getOffset()
|
r.setLength(then_clause.getOffset() + then_clause.getLength() - r.getOffset());
|
||||||
+ then_clause.getLength() - r.getOffset());
|
|
||||||
}
|
}
|
||||||
if (current.getParent() != null
|
if (current.getParent() != null && current.getParent() instanceof IASTIfStatement)
|
||||||
&& current.getParent() instanceof IASTIfStatement)
|
|
||||||
current = (IASTIfStatement) current.getParent();
|
current = (IASTIfStatement) current.getParent();
|
||||||
else
|
else
|
||||||
current = null;
|
current = null;
|
||||||
|
@ -2029,8 +1857,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
* @throws EndOfFileException
|
* @throws EndOfFileException
|
||||||
* @throws BacktrackException
|
* @throws BacktrackException
|
||||||
*/
|
*/
|
||||||
protected IASTStatement parseCompoundStatement() throws EndOfFileException,
|
protected IASTStatement parseCompoundStatement() throws EndOfFileException, BacktrackException {
|
||||||
BacktrackException {
|
|
||||||
IASTCompoundStatement compound = compoundStatement();
|
IASTCompoundStatement compound = compoundStatement();
|
||||||
return compound;
|
return compound;
|
||||||
}
|
}
|
||||||
|
@ -2040,14 +1867,12 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
* @throws EndOfFileException
|
* @throws EndOfFileException
|
||||||
* @throws BacktrackException
|
* @throws BacktrackException
|
||||||
*/
|
*/
|
||||||
protected IASTStatement parseDefaultStatement() throws EndOfFileException,
|
protected IASTStatement parseDefaultStatement() throws EndOfFileException, BacktrackException {
|
||||||
BacktrackException {
|
|
||||||
int startOffset = consume().getOffset(); // t_default
|
int startOffset = consume().getOffset(); // t_default
|
||||||
int lastOffset = consume(IToken.tCOLON).getEndOffset();
|
int lastOffset = consume(IToken.tCOLON).getEndOffset();
|
||||||
|
|
||||||
IASTDefaultStatement df = createDefaultStatement();
|
IASTDefaultStatement df = createDefaultStatement();
|
||||||
((ASTNode) df)
|
((ASTNode) df).setOffsetAndLength(startOffset, lastOffset - startOffset);
|
||||||
.setOffsetAndLength(startOffset, lastOffset - startOffset);
|
|
||||||
return df;
|
return df;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2056,8 +1881,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
* @throws EndOfFileException
|
* @throws EndOfFileException
|
||||||
* @throws BacktrackException
|
* @throws BacktrackException
|
||||||
*/
|
*/
|
||||||
protected IASTStatement parseCaseStatement() throws EndOfFileException,
|
protected IASTStatement parseCaseStatement() throws EndOfFileException, BacktrackException {
|
||||||
BacktrackException {
|
|
||||||
int startOffset = consume().getOffset(); // t_case
|
int startOffset = consume().getOffset(); // t_case
|
||||||
IASTExpression case_exp = constantExpression();
|
IASTExpression case_exp = constantExpression();
|
||||||
int lastOffset = 0;
|
int lastOffset = 0;
|
||||||
|
@ -2071,31 +1895,19 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
IASTCaseStatement cs = createCaseStatement();
|
IASTCaseStatement cs = createCaseStatement();
|
||||||
((ASTNode) cs)
|
((ASTNode) cs).setOffsetAndLength(startOffset, lastOffset - startOffset);
|
||||||
.setOffsetAndLength(startOffset, lastOffset - startOffset);
|
|
||||||
cs.setExpression(case_exp);
|
cs.setExpression(case_exp);
|
||||||
case_exp.setParent(cs);
|
|
||||||
case_exp.setPropertyInParent(IASTCaseStatement.EXPRESSION);
|
|
||||||
return cs;
|
return cs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param declSpec
|
protected int figureEndOffset(IASTDeclSpecifier declSpec, IASTDeclarator[] declarators) {
|
||||||
* @param declarators
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected int figureEndOffset(IASTDeclSpecifier declSpec,
|
|
||||||
IASTDeclarator[] declarators) {
|
|
||||||
if (declarators.length == 0)
|
if (declarators.length == 0)
|
||||||
return calculateEndOffset(declSpec);
|
return calculateEndOffset(declSpec);
|
||||||
return calculateEndOffset(declarators[declarators.length - 1]);
|
return calculateEndOffset(declarators[declarators.length - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param declSpecifier
|
|
||||||
* @param declarator
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected int figureEndOffset(IASTDeclSpecifier declSpecifier,
|
protected int figureEndOffset(IASTDeclSpecifier declSpecifier,
|
||||||
IASTDeclarator declarator) {
|
IASTDeclarator declarator) {
|
||||||
if (declarator == null || ((ASTNode) declarator).getLength() == 0)
|
if (declarator == null || ((ASTNode) declarator).getLength() == 0)
|
||||||
|
@ -2103,9 +1915,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
return calculateEndOffset(declarator);
|
return calculateEndOffset(declarator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param token
|
|
||||||
*/
|
|
||||||
protected void throwBacktrack(IToken token) throws BacktrackException {
|
protected void throwBacktrack(IToken token) throws BacktrackException {
|
||||||
throwBacktrack(token.getOffset(), token.getLength());
|
throwBacktrack(token.getOffset(), token.getLength());
|
||||||
}
|
}
|
||||||
|
@ -2125,8 +1935,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
if (typeIdWithParentheses)
|
if (typeIdWithParentheses)
|
||||||
consume(IToken.tLPAREN);
|
consume(IToken.tLPAREN);
|
||||||
typeId = typeId(false);
|
typeId = typeId(false);
|
||||||
if (typeId != null)
|
if (typeId != null) {
|
||||||
{
|
|
||||||
if (typeIdWithParentheses) {
|
if (typeIdWithParentheses) {
|
||||||
switch (LT(1)) {
|
switch (LT(1)) {
|
||||||
case IToken.tRPAREN:
|
case IToken.tRPAREN:
|
||||||
|
@ -2181,8 +1990,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
|
|
||||||
protected abstract IASTAmbiguousExpression createAmbiguousExpression();
|
protected abstract IASTAmbiguousExpression createAmbiguousExpression();
|
||||||
|
|
||||||
protected IASTExpression parseSizeofExpression() throws BacktrackException,
|
protected IASTExpression parseSizeofExpression() throws BacktrackException, EndOfFileException {
|
||||||
EndOfFileException {
|
|
||||||
int startingOffset = consume().getOffset(); // t_sizeof
|
int startingOffset = consume().getOffset(); // t_sizeof
|
||||||
int[] endoffset= new int[] {0};
|
int[] endoffset= new int[] {0};
|
||||||
IASTNode[] choice = parseTypeIdOrUnaryExpression(true, endoffset);
|
IASTNode[] choice = parseTypeIdOrUnaryExpression(true, endoffset);
|
||||||
|
@ -2205,11 +2013,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
IASTUnaryExpression.op_sizeof, (IASTExpression) choice[1],
|
IASTUnaryExpression.op_sizeof, (IASTExpression) choice[1],
|
||||||
startingOffset, endoffset[0]);
|
startingOffset, endoffset[0]);
|
||||||
ambExpr.addExpression(e1);
|
ambExpr.addExpression(e1);
|
||||||
e1.setParent(ambExpr);
|
|
||||||
e1.setPropertyInParent(IASTAmbiguousExpression.SUBEXPRESSION);
|
|
||||||
ambExpr.addExpression(e2);
|
ambExpr.addExpression(e2);
|
||||||
e2.setParent(ambExpr);
|
|
||||||
e2.setPropertyInParent(IASTAmbiguousExpression.SUBEXPRESSION);
|
|
||||||
((ASTNode) ambExpr).setOffsetAndLength((ASTNode) e2);
|
((ASTNode) ambExpr).setOffsetAndLength((ASTNode) e2);
|
||||||
return ambExpr;
|
return ambExpr;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -20,17 +20,19 @@ import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
|
||||||
public class CASTASMDeclaration extends CASTNode implements IASTASMDeclaration {
|
public class CASTASMDeclaration extends CASTNode implements IASTASMDeclaration {
|
||||||
|
|
||||||
char [] assembly = null;
|
char [] assembly = null;
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTASMDeclaration#getAssembly()
|
public CASTASMDeclaration() {
|
||||||
*/
|
}
|
||||||
public String getAssembly() {
|
|
||||||
|
public CASTASMDeclaration(String assembly) {
|
||||||
|
setAssembly(assembly);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAssembly() {
|
||||||
if( assembly == null ) return ""; //$NON-NLS-1$
|
if( assembly == null ) return ""; //$NON-NLS-1$
|
||||||
return new String( assembly );
|
return new String( assembly );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTASMDeclaration#setAssembly(java.lang.String)
|
|
||||||
*/
|
|
||||||
public void setAssembly(String assembly) {
|
public void setAssembly(String assembly) {
|
||||||
this.assembly = assembly.toCharArray();
|
this.assembly = assembly.toCharArray();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@ public class CASTAmbiguousExpression extends CASTAmbiguity implements
|
||||||
public void addExpression(IASTExpression e) {
|
public void addExpression(IASTExpression e) {
|
||||||
if (e != null) {
|
if (e != null) {
|
||||||
expressions = (IASTExpression[]) ArrayUtil.append( IASTExpression.class, expressions, ++expressionsPos, e );
|
expressions = (IASTExpression[]) ArrayUtil.append( IASTExpression.class, expressions, ++expressionsPos, e );
|
||||||
|
e.setParent(this);
|
||||||
|
e.setPropertyInParent(SUBEXPRESSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@ public class CASTAmbiguousStatement extends CASTAmbiguity implements
|
||||||
public void addStatement(IASTStatement s) {
|
public void addStatement(IASTStatement s) {
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
stmts = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, stmts, ++stmtsPos, s );
|
stmts = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, stmts, ++stmtsPos, s );
|
||||||
|
s.setParent(this);
|
||||||
|
s.setPropertyInParent(STATEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,18 +15,29 @@ import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTArrayDeclarator extends CASTDeclarator implements
|
public class CASTArrayDeclarator extends CASTDeclarator implements IASTArrayDeclarator {
|
||||||
IASTArrayDeclarator {
|
|
||||||
|
|
||||||
private IASTArrayModifier [] arrayMods = null;
|
private IASTArrayModifier [] arrayMods = null;
|
||||||
private int arrayModsPos=-1;
|
private int arrayModsPos=-1;
|
||||||
|
|
||||||
public IASTArrayModifier[] getArrayModifiers() {
|
public CASTArrayDeclarator() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CASTArrayDeclarator(IASTName name, IASTInitializer initializer) {
|
||||||
|
super(name, initializer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CASTArrayDeclarator(IASTName name) {
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTArrayModifier[] getArrayModifiers() {
|
||||||
if( arrayMods == null ) return IASTArrayModifier.EMPTY_ARRAY;
|
if( arrayMods == null ) return IASTArrayModifier.EMPTY_ARRAY;
|
||||||
arrayMods = (IASTArrayModifier[]) ArrayUtil.removeNullsAfter( IASTArrayModifier.class, arrayMods, arrayModsPos );
|
arrayMods = (IASTArrayModifier[]) ArrayUtil.removeNullsAfter( IASTArrayModifier.class, arrayMods, arrayModsPos );
|
||||||
return arrayMods;
|
return arrayMods;
|
||||||
|
@ -35,6 +46,8 @@ public class CASTArrayDeclarator extends CASTDeclarator implements
|
||||||
|
|
||||||
public void addArrayModifier(IASTArrayModifier arrayModifier) {
|
public void addArrayModifier(IASTArrayModifier arrayModifier) {
|
||||||
if (arrayModifier != null) {
|
if (arrayModifier != null) {
|
||||||
|
arrayModifier.setParent(this);
|
||||||
|
arrayModifier.setPropertyInParent(ARRAY_MODIFIER);
|
||||||
arrayMods = (IASTArrayModifier[]) ArrayUtil.append( IASTArrayModifier.class, arrayMods, ++arrayModsPos, arrayModifier );
|
arrayMods = (IASTArrayModifier[]) ArrayUtil.append( IASTArrayModifier.class, arrayMods, ++arrayModsPos, arrayModifier );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,18 +26,25 @@ public class CASTArrayDesignator extends CASTNode implements
|
||||||
|
|
||||||
private IASTExpression exp;
|
private IASTExpression exp;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayDesignator#getSubscriptExpression()
|
public CASTArrayDesignator() {
|
||||||
*/
|
}
|
||||||
|
|
||||||
|
public CASTArrayDesignator(IASTExpression exp) {
|
||||||
|
setSubscriptExpression(exp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public IASTExpression getSubscriptExpression() {
|
public IASTExpression getSubscriptExpression() {
|
||||||
return exp;
|
return exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayDesignator#setSubscriptExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setSubscriptExpression(IASTExpression value) {
|
public void setSubscriptExpression(IASTExpression value) {
|
||||||
exp = value;
|
exp = value;
|
||||||
|
if(value != null) {
|
||||||
|
value.setParent(this);
|
||||||
|
value.setPropertyInParent(SUBSCRIPT_EXPRESSION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -23,18 +23,25 @@ public class CASTArrayModifier extends CASTNode implements IASTArrayModifier, IA
|
||||||
|
|
||||||
private IASTExpression exp;
|
private IASTExpression exp;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTArrayModifier#getConstantExpression()
|
public CASTArrayModifier() {
|
||||||
*/
|
}
|
||||||
|
|
||||||
|
public CASTArrayModifier(IASTExpression exp) {
|
||||||
|
setConstantExpression(exp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public IASTExpression getConstantExpression() {
|
public IASTExpression getConstantExpression() {
|
||||||
return exp;
|
return exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTArrayModifier#setConstantExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setConstantExpression(IASTExpression expression) {
|
public void setConstantExpression(IASTExpression expression) {
|
||||||
this.exp = expression;
|
this.exp = expression;
|
||||||
|
if(expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(CONSTANT_EXPRESSION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -26,32 +26,36 @@ public class CASTArrayRangeDesignator extends CASTNode implements
|
||||||
|
|
||||||
private IASTExpression floor, ceiling;
|
private IASTExpression floor, ceiling;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public CASTArrayRangeDesignator() {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.gcc.IGCCASTArrayRangeDesignator#getRangeFloor()
|
}
|
||||||
*/
|
|
||||||
public IASTExpression getRangeFloor() {
|
public CASTArrayRangeDesignator(IASTExpression floor, IASTExpression ceiling) {
|
||||||
|
setRangeFloor(floor);
|
||||||
|
setRangeCeiling(ceiling);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getRangeFloor() {
|
||||||
return this.floor;
|
return this.floor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.gcc.IGCCASTArrayRangeDesignator#setRangeFloor(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setRangeFloor(IASTExpression expression) {
|
public void setRangeFloor(IASTExpression expression) {
|
||||||
floor =expression;
|
floor = expression;
|
||||||
|
if(expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(SUBSCRIPT_FLOOR_EXPRESSION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.gcc.IGCCASTArrayRangeDesignator#getRangeCeiling()
|
|
||||||
*/
|
|
||||||
public IASTExpression getRangeCeiling() {
|
public IASTExpression getRangeCeiling() {
|
||||||
return ceiling;
|
return ceiling;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.gcc.IGCCASTArrayRangeDesignator#setRangeCeiling(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setRangeCeiling(IASTExpression expression) {
|
public void setRangeCeiling(IASTExpression expression) {
|
||||||
ceiling = expression;
|
ceiling = expression;
|
||||||
|
if(expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(SUBSCRIPT_CEILING_EXPRESSION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -27,12 +27,24 @@ public class CASTArraySubscriptExpression extends CASTNode implements
|
||||||
private IASTExpression array;
|
private IASTExpression array;
|
||||||
private IASTExpression subscript;
|
private IASTExpression subscript;
|
||||||
|
|
||||||
public IASTExpression getArrayExpression() {
|
public CASTArraySubscriptExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CASTArraySubscriptExpression(IASTExpression array, IASTExpression subscript) {
|
||||||
|
setArrayExpression(array);
|
||||||
|
setSubscriptExpression(subscript);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getArrayExpression() {
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setArrayExpression(IASTExpression expression) {
|
public void setArrayExpression(IASTExpression expression) {
|
||||||
array = expression;
|
array = expression;
|
||||||
|
if(expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(ARRAY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTExpression getSubscriptExpression() {
|
public IASTExpression getSubscriptExpression() {
|
||||||
|
@ -41,6 +53,10 @@ public class CASTArraySubscriptExpression extends CASTNode implements
|
||||||
|
|
||||||
public void setSubscriptExpression(IASTExpression expression) {
|
public void setSubscriptExpression(IASTExpression expression) {
|
||||||
this.subscript = expression;
|
this.subscript = expression;
|
||||||
|
if(expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(SUBSCRIPT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -24,7 +24,7 @@ public abstract class CASTBaseDeclSpecifier extends CASTNode implements ICASTDec
|
||||||
protected boolean isRestrict;
|
protected boolean isRestrict;
|
||||||
protected boolean isInline;
|
protected boolean isInline;
|
||||||
|
|
||||||
public boolean isRestrict() {
|
public boolean isRestrict() {
|
||||||
return isRestrict;
|
return isRestrict;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,37 +44,22 @@ public abstract class CASTBaseDeclSpecifier extends CASTNode implements ICASTDec
|
||||||
return isInline;
|
return isInline;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param storageClass The storageClass to set.
|
|
||||||
*/
|
|
||||||
public void setStorageClass(int storageClass) {
|
public void setStorageClass(int storageClass) {
|
||||||
this.storageClass = storageClass;
|
this.storageClass = storageClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setConst(boolean)
|
|
||||||
*/
|
|
||||||
public void setConst(boolean value) {
|
public void setConst(boolean value) {
|
||||||
this.isConst = value;
|
this.isConst = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setVolatile(boolean)
|
|
||||||
*/
|
|
||||||
public void setVolatile(boolean value) {
|
public void setVolatile(boolean value) {
|
||||||
this.isVolatile = value;
|
this.isVolatile = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier#setRestrict(boolean)
|
|
||||||
*/
|
|
||||||
public void setRestrict(boolean value) {
|
public void setRestrict(boolean value) {
|
||||||
this.isRestrict = value;
|
this.isRestrict = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setInline(boolean)
|
|
||||||
*/
|
|
||||||
public void setInline(boolean value) {
|
public void setInline(boolean value) {
|
||||||
this.isInline = value;
|
this.isInline = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,16 @@ public class CASTBinaryExpression extends CASTNode implements
|
||||||
private IASTExpression operand1;
|
private IASTExpression operand1;
|
||||||
private IASTExpression operand2;
|
private IASTExpression operand2;
|
||||||
|
|
||||||
public int getOperator() {
|
public CASTBinaryExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CASTBinaryExpression(int op, IASTExpression operand1, IASTExpression operand2) {
|
||||||
|
this.op = op;
|
||||||
|
setOperand1(operand1);
|
||||||
|
setOperand2(operand2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOperator() {
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,16 +49,27 @@ public class CASTBinaryExpression extends CASTNode implements
|
||||||
return operand2;
|
return operand2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param op An op_X field from {@link IASTBinaryExpression}
|
||||||
|
*/
|
||||||
public void setOperator(int op) {
|
public void setOperator(int op) {
|
||||||
this.op = op;
|
this.op = op;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOperand1(IASTExpression expression) {
|
public void setOperand1(IASTExpression expression) {
|
||||||
operand1 = expression;
|
operand1 = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(OPERAND_ONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOperand2(IASTExpression expression) {
|
public void setOperand2(IASTExpression expression) {
|
||||||
operand2 = expression;
|
operand2 = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(OPERAND_TWO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -24,18 +24,24 @@ public class CASTCaseStatement extends CASTNode implements IASTCaseStatement, IA
|
||||||
|
|
||||||
private IASTExpression expression;
|
private IASTExpression expression;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCaseStatement#getExpression()
|
public CASTCaseStatement() {
|
||||||
*/
|
}
|
||||||
public IASTExpression getExpression() {
|
|
||||||
|
public CASTCaseStatement(IASTExpression expression) {
|
||||||
|
setExpression(expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getExpression() {
|
||||||
return expression;
|
return expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCaseStatement#setExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setExpression(IASTExpression expression) {
|
public void setExpression(IASTExpression expression) {
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(EXPRESSION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -18,21 +18,27 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTCastExpression extends CASTUnaryExpression implements
|
public class CASTCastExpression extends CASTUnaryExpression implements IASTCastExpression {
|
||||||
IASTCastExpression {
|
|
||||||
|
|
||||||
private IASTTypeId typeId;
|
private IASTTypeId typeId;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTUnaryTypeIdExpression#setTypeId(org.eclipse.cdt.core.dom.ast.IASTTypeId)
|
public CASTCastExpression() {
|
||||||
*/
|
}
|
||||||
public void setTypeId(IASTTypeId typeId) {
|
|
||||||
|
public CASTCastExpression(IASTTypeId typeId, IASTExpression operand) {
|
||||||
|
super(op_cast, operand);
|
||||||
|
setTypeId(typeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypeId(IASTTypeId typeId) {
|
||||||
this.typeId = typeId;
|
this.typeId = typeId;
|
||||||
|
if (typeId != null) {
|
||||||
|
typeId.setParent(this);
|
||||||
|
typeId.setPropertyInParent(TYPE_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTUnaryTypeIdExpression#getTypeId()
|
|
||||||
*/
|
|
||||||
public IASTTypeId getTypeId() {
|
public IASTTypeId getTypeId() {
|
||||||
return typeId;
|
return typeId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,33 +28,33 @@ public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
private int key;
|
private int key;
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getKey()
|
public CASTCompositeTypeSpecifier() {
|
||||||
*/
|
}
|
||||||
|
|
||||||
|
public CASTCompositeTypeSpecifier(int key, IASTName name) {
|
||||||
|
this.key = key;
|
||||||
|
setName(name);
|
||||||
|
}
|
||||||
|
|
||||||
public int getKey() {
|
public int getKey() {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#setKey(int)
|
|
||||||
*/
|
|
||||||
public void setKey(int key) {
|
public void setKey(int key) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getName()
|
|
||||||
*/
|
|
||||||
public IASTName getName() {
|
public IASTName getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(TYPE_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,37 +63,28 @@ public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
private IScope scope = null;
|
private IScope scope = null;
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getMembers()
|
|
||||||
*/
|
|
||||||
public IASTDeclaration [] getMembers() {
|
public IASTDeclaration [] getMembers() {
|
||||||
if( declarations == null ) return IASTDeclaration.EMPTY_DECLARATION_ARRAY;
|
if( declarations == null ) return IASTDeclaration.EMPTY_DECLARATION_ARRAY;
|
||||||
declarations = (IASTDeclaration[]) ArrayUtil.removeNullsAfter( IASTDeclaration.class, declarations, declarationsPos );
|
declarations = (IASTDeclaration[]) ArrayUtil.removeNullsAfter( IASTDeclaration.class, declarations, declarationsPos );
|
||||||
return declarations;
|
return declarations;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#addMemberDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
|
||||||
*/
|
|
||||||
public void addMemberDeclaration(IASTDeclaration declaration) {
|
public void addMemberDeclaration(IASTDeclaration declaration) {
|
||||||
if (declaration != null) {
|
if (declaration != null) {
|
||||||
|
declaration.setParent(this);
|
||||||
|
declaration.setPropertyInParent(MEMBER_DECLARATION);
|
||||||
declarations = (IASTDeclaration[]) ArrayUtil.append( IASTDeclaration.class, declarations, ++declarationsPos, declaration );
|
declarations = (IASTDeclaration[]) ArrayUtil.append( IASTDeclaration.class, declarations, ++declarationsPos, declaration );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getScope()
|
|
||||||
*/
|
|
||||||
public IScope getScope() {
|
public IScope getScope() {
|
||||||
if( scope == null )
|
if( scope == null )
|
||||||
scope = new CCompositeTypeScope( this );
|
scope = new CCompositeTypeScope( this );
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#getRawSignature()
|
|
||||||
*/
|
|
||||||
public String getRawSignature() {
|
public String getRawSignature() {
|
||||||
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
|
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -122,12 +113,12 @@ public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public int getRoleForName(IASTName n) {
|
public int getRoleForName(IASTName n) {
|
||||||
if( n == this.name )
|
if( n == this.name )
|
||||||
return r_definition;
|
return r_definition;
|
||||||
return r_unclear;
|
return r_unclear;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,33 +22,25 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTCompoundStatement extends CASTNode implements
|
public class CASTCompoundStatement extends CASTNode implements IASTCompoundStatement, IASTAmbiguityParent {
|
||||||
IASTCompoundStatement, IASTAmbiguityParent {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private IASTStatement [] statements = null;
|
private IASTStatement [] statements = null;
|
||||||
private IScope scope = null;
|
private IScope scope = null;
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompoundStatement#getStatements()
|
|
||||||
*/
|
|
||||||
public IASTStatement[] getStatements() {
|
public IASTStatement[] getStatements() {
|
||||||
if( statements == null ) return IASTStatement.EMPTY_STATEMENT_ARRAY;
|
if( statements == null ) return IASTStatement.EMPTY_STATEMENT_ARRAY;
|
||||||
return (IASTStatement[]) ArrayUtil.trim( IASTStatement.class, statements );
|
return (IASTStatement[]) ArrayUtil.trim( IASTStatement.class, statements );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompoundStatement#addStatement(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
|
||||||
*/
|
|
||||||
public void addStatement(IASTStatement statement) {
|
public void addStatement(IASTStatement statement) {
|
||||||
statements = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, statements, statement );
|
statements = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, statements, statement );
|
||||||
|
if(statement != null) {
|
||||||
|
statement.setParent(this);
|
||||||
|
statement.setPropertyInParent(NESTED_STATEMENT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompoundStatement#resolveBinding()
|
|
||||||
*/
|
|
||||||
public IScope getScope() {
|
public IScope getScope() {
|
||||||
if( scope == null )
|
if( scope == null )
|
||||||
scope = new CScope( this );
|
scope = new CScope( this );
|
||||||
|
@ -90,5 +82,4 @@ public class CASTCompoundStatement extends CASTNode implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
|
@ -24,12 +24,23 @@ public class CASTCompoundStatementExpression extends CASTNode implements
|
||||||
|
|
||||||
private IASTCompoundStatement statement;
|
private IASTCompoundStatement statement;
|
||||||
|
|
||||||
public IASTCompoundStatement getCompoundStatement() {
|
public CASTCompoundStatementExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CASTCompoundStatementExpression(IASTCompoundStatement statement) {
|
||||||
|
setCompoundStatement(statement);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTCompoundStatement getCompoundStatement() {
|
||||||
return statement;
|
return statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCompoundStatement(IASTCompoundStatement statement) {
|
public void setCompoundStatement(IASTCompoundStatement statement) {
|
||||||
this.statement = statement;
|
this.statement = statement;
|
||||||
|
if (statement != null) {
|
||||||
|
statement.setParent(this);
|
||||||
|
statement.setPropertyInParent(STATEMENT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -28,12 +28,26 @@ public class CASTConditionalExpression extends CASTNode implements
|
||||||
private IASTExpression negative;
|
private IASTExpression negative;
|
||||||
private IASTExpression positive;
|
private IASTExpression positive;
|
||||||
|
|
||||||
public IASTExpression getLogicalConditionExpression() {
|
public CASTConditionalExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CASTConditionalExpression(IASTExpression condition,
|
||||||
|
IASTExpression positive, IASTExpression negative) {
|
||||||
|
setLogicalConditionExpression(condition);
|
||||||
|
setPositiveResultExpression(positive);
|
||||||
|
setNegativeResultExpression(negative);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getLogicalConditionExpression() {
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLogicalConditionExpression(IASTExpression expression) {
|
public void setLogicalConditionExpression(IASTExpression expression) {
|
||||||
condition = expression;
|
condition = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(LOGICAL_CONDITION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTExpression getPositiveResultExpression() {
|
public IASTExpression getPositiveResultExpression() {
|
||||||
|
@ -42,6 +56,10 @@ public class CASTConditionalExpression extends CASTNode implements
|
||||||
|
|
||||||
public void setPositiveResultExpression(IASTExpression expression) {
|
public void setPositiveResultExpression(IASTExpression expression) {
|
||||||
this.positive = expression;
|
this.positive = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(POSITIVE_RESULT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTExpression getNegativeResultExpression() {
|
public IASTExpression getNegativeResultExpression() {
|
||||||
|
@ -50,6 +68,10 @@ public class CASTConditionalExpression extends CASTNode implements
|
||||||
|
|
||||||
public void setNegativeResultExpression(IASTExpression expression) {
|
public void setNegativeResultExpression(IASTExpression expression) {
|
||||||
this.negative = expression;
|
this.negative = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(NEGATIVE_RESULT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -18,23 +18,28 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTDeclarationStatement extends CASTNode implements
|
public class CASTDeclarationStatement extends CASTNode implements IASTDeclarationStatement {
|
||||||
IASTDeclarationStatement {
|
|
||||||
|
|
||||||
private IASTDeclaration declaration;
|
private IASTDeclaration declaration;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement#getDeclaration()
|
public CASTDeclarationStatement() {
|
||||||
*/
|
}
|
||||||
public IASTDeclaration getDeclaration() {
|
|
||||||
|
public CASTDeclarationStatement(IASTDeclaration declaration) {
|
||||||
|
setDeclaration(declaration);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTDeclaration getDeclaration() {
|
||||||
return declaration;
|
return declaration;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement#setDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
|
||||||
*/
|
|
||||||
public void setDeclaration(IASTDeclaration declaration) {
|
public void setDeclaration(IASTDeclaration declaration) {
|
||||||
this.declaration = declaration;
|
this.declaration = declaration;
|
||||||
|
if (declaration != null) {
|
||||||
|
declaration.setParent(this);
|
||||||
|
declaration.setPropertyInParent(DECLARATION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -39,65 +39,67 @@ public class CASTDeclarator extends CASTNode implements IASTDeclarator {
|
||||||
private int pointerOpsPos=-1;
|
private int pointerOpsPos=-1;
|
||||||
|
|
||||||
|
|
||||||
|
public CASTDeclarator() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CASTDeclarator(IASTName name) {
|
||||||
|
setName(name);
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public CASTDeclarator(IASTName name, IASTInitializer initializer) {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getPointerOperators()
|
setInitializer(initializer);
|
||||||
*/
|
setName(name);
|
||||||
public IASTPointerOperator[] getPointerOperators() {
|
}
|
||||||
|
|
||||||
|
public IASTPointerOperator[] getPointerOperators() {
|
||||||
if( pointerOps == null ) return IASTPointerOperator.EMPTY_ARRAY;
|
if( pointerOps == null ) return IASTPointerOperator.EMPTY_ARRAY;
|
||||||
pointerOps = (IASTPointerOperator[]) ArrayUtil.removeNullsAfter( IASTPointerOperator.class, pointerOps, pointerOpsPos );
|
pointerOps = (IASTPointerOperator[]) ArrayUtil.removeNullsAfter( IASTPointerOperator.class, pointerOps, pointerOpsPos );
|
||||||
return pointerOps;
|
return pointerOps;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getNestedDeclarator()
|
|
||||||
*/
|
|
||||||
public IASTDeclarator getNestedDeclarator() {
|
public IASTDeclarator getNestedDeclarator() {
|
||||||
return nestedDeclarator;
|
return nestedDeclarator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getName()
|
|
||||||
*/
|
|
||||||
public IASTName getName() {
|
public IASTName getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getInitializer()
|
|
||||||
*/
|
|
||||||
public IASTInitializer getInitializer() {
|
public IASTInitializer getInitializer() {
|
||||||
return initializer;
|
return initializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param initializer
|
|
||||||
*/
|
|
||||||
public void setInitializer(IASTInitializer initializer) {
|
public void setInitializer(IASTInitializer initializer) {
|
||||||
this.initializer = initializer;
|
this.initializer = initializer;
|
||||||
|
if (initializer != null) {
|
||||||
|
initializer.setParent(this);
|
||||||
|
initializer.setPropertyInParent(INITIALIZER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#addPointerOperator(org.eclipse.cdt.core.dom.ast.IASTPointerOperator)
|
|
||||||
*/
|
|
||||||
public void addPointerOperator(IASTPointerOperator operator) {
|
public void addPointerOperator(IASTPointerOperator operator) {
|
||||||
if (operator != null) {
|
if (operator != null) {
|
||||||
|
operator.setParent(this);
|
||||||
|
operator.setPropertyInParent(POINTER_OPERATOR);
|
||||||
pointerOps = (IASTPointerOperator[]) ArrayUtil.append( IASTPointerOperator.class, pointerOps, ++pointerOpsPos, operator );
|
pointerOps = (IASTPointerOperator[]) ArrayUtil.append( IASTPointerOperator.class, pointerOps, ++pointerOpsPos, operator );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#setNestedDeclarator(org.eclipse.cdt.core.dom.ast.IASTDeclarator)
|
|
||||||
*/
|
|
||||||
public void setNestedDeclarator(IASTDeclarator nested) {
|
public void setNestedDeclarator(IASTDeclarator nested) {
|
||||||
this.nestedDeclarator = nested;
|
this.nestedDeclarator = nested;
|
||||||
|
if (nested != null) {
|
||||||
|
nested.setParent(this);
|
||||||
|
nested.setPropertyInParent(NESTED_DECLARATOR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(DECLARATOR_NAME);;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
@ -147,9 +149,6 @@ public class CASTDeclarator extends CASTNode implements IASTDeclarator {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public int getRoleForName(IASTName n ) {
|
public int getRoleForName(IASTName n ) {
|
||||||
if( n == this.name )
|
if( n == this.name )
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,18 +25,23 @@ public class CASTDesignatedInitializer extends CASTNode implements
|
||||||
|
|
||||||
private IASTInitializer rhs;
|
private IASTInitializer rhs;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer#addDesignator(org.eclipse.cdt.core.dom.ast.c.ICASTDesignator)
|
public CASTDesignatedInitializer() {
|
||||||
*/
|
}
|
||||||
public void addDesignator(ICASTDesignator designator) {
|
|
||||||
|
public CASTDesignatedInitializer(IASTInitializer rhs) {
|
||||||
|
setOperandInitializer(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addDesignator(ICASTDesignator designator) {
|
||||||
if (designator != null) {
|
if (designator != null) {
|
||||||
|
designator.setParent(this);
|
||||||
|
designator.setPropertyInParent(DESIGNATOR);
|
||||||
designators = (ICASTDesignator[]) ArrayUtil.append( ICASTDesignator.class, designators, ++designatorsPos, designator );
|
designators = (ICASTDesignator[]) ArrayUtil.append( ICASTDesignator.class, designators, ++designatorsPos, designator );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer#getDesignators()
|
|
||||||
*/
|
|
||||||
public ICASTDesignator[] getDesignators() {
|
public ICASTDesignator[] getDesignators() {
|
||||||
if( designators == null ) return ICASTDesignatedInitializer.EMPTY_DESIGNATOR_ARRAY;
|
if( designators == null ) return ICASTDesignatedInitializer.EMPTY_DESIGNATOR_ARRAY;
|
||||||
designators = (ICASTDesignator[]) ArrayUtil.removeNullsAfter( ICASTDesignator.class, designators, designatorsPos );
|
designators = (ICASTDesignator[]) ArrayUtil.removeNullsAfter( ICASTDesignator.class, designators, designatorsPos );
|
||||||
|
@ -45,18 +50,19 @@ public class CASTDesignatedInitializer extends CASTNode implements
|
||||||
|
|
||||||
private ICASTDesignator [] designators = null;
|
private ICASTDesignator [] designators = null;
|
||||||
int designatorsPos=-1;
|
int designatorsPos=-1;
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer#getRHSInitializer()
|
|
||||||
*/
|
|
||||||
public IASTInitializer getOperandInitializer() {
|
public IASTInitializer getOperandInitializer() {
|
||||||
return rhs;
|
return rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer#setRHSInitializer(org.eclipse.cdt.core.dom.ast.IASTInitializer)
|
|
||||||
*/
|
|
||||||
public void setOperandInitializer(IASTInitializer rhs) {
|
public void setOperandInitializer(IASTInitializer rhs) {
|
||||||
this.rhs = rhs;
|
this.rhs = rhs;
|
||||||
|
if (rhs != null) {
|
||||||
|
rhs.setParent(this);
|
||||||
|
rhs.setPropertyInParent(OPERAND);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -26,32 +26,39 @@ public class CASTDoStatement extends CASTNode implements IASTDoStatement, IASTAm
|
||||||
private IASTStatement body;
|
private IASTStatement body;
|
||||||
private IASTExpression condition;
|
private IASTExpression condition;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDoStatement#getBody()
|
public CASTDoStatement() {
|
||||||
*/
|
}
|
||||||
public IASTStatement getBody() {
|
|
||||||
|
public CASTDoStatement(IASTStatement body, IASTExpression condition) {
|
||||||
|
setBody(body);
|
||||||
|
setCondition(condition);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTStatement getBody() {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDoStatement#setBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
|
||||||
*/
|
|
||||||
public void setBody(IASTStatement body) {
|
public void setBody(IASTStatement body) {
|
||||||
this.body = body;
|
this.body = body;
|
||||||
|
if (body != null) {
|
||||||
|
body.setParent(this);
|
||||||
|
body.setPropertyInParent(BODY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDoStatement#getCondition()
|
|
||||||
*/
|
|
||||||
public IASTExpression getCondition() {
|
public IASTExpression getCondition() {
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDoStatement#setCondition(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setCondition(IASTExpression condition) {
|
public void setCondition(IASTExpression condition) {
|
||||||
this.condition = condition;
|
this.condition = condition;
|
||||||
|
if (condition != null) {
|
||||||
|
condition.setParent(this);
|
||||||
|
condition.setPropertyInParent(CONDITION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -29,32 +29,33 @@ public class CASTElaboratedTypeSpecifier extends CASTBaseDeclSpecifier implement
|
||||||
private int kind;
|
private int kind;
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#getKind()
|
public CASTElaboratedTypeSpecifier() {
|
||||||
*/
|
}
|
||||||
public int getKind() {
|
|
||||||
|
public CASTElaboratedTypeSpecifier(int kind, IASTName name) {
|
||||||
|
this.kind = kind;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getKind() {
|
||||||
return kind;
|
return kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#setKind(int)
|
|
||||||
*/
|
|
||||||
public void setKind(int value) {
|
public void setKind(int value) {
|
||||||
this.kind = value;
|
this.kind = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#getName()
|
|
||||||
*/
|
|
||||||
public IASTName getName() {
|
public IASTName getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(TYPE_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
@ -76,9 +77,6 @@ public class CASTElaboratedTypeSpecifier extends CASTBaseDeclSpecifier implement
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public int getRoleForName(IASTName n ) {
|
public int getRoleForName(IASTName n ) {
|
||||||
if( n != name ) return r_unclear;
|
if( n != name ) return r_unclear;
|
||||||
|
|
||||||
|
|
|
@ -25,18 +25,23 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#addEnumerator(org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator)
|
public CASTEnumerationSpecifier() {
|
||||||
*/
|
}
|
||||||
public void addEnumerator(IASTEnumerator enumerator) {
|
|
||||||
|
public CASTEnumerationSpecifier(IASTName name) {
|
||||||
|
setName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addEnumerator(IASTEnumerator enumerator) {
|
||||||
if (enumerator != null) {
|
if (enumerator != null) {
|
||||||
|
enumerator.setParent(this);
|
||||||
|
enumerator.setPropertyInParent(ENUMERATOR);
|
||||||
enumerators = (IASTEnumerator[]) ArrayUtil.append( IASTEnumerator.class, enumerators, ++enumeratorsPos, enumerator );
|
enumerators = (IASTEnumerator[]) ArrayUtil.append( IASTEnumerator.class, enumerators, ++enumeratorsPos, enumerator );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#getEnumerators()
|
|
||||||
*/
|
|
||||||
public IASTEnumerator[] getEnumerators() {
|
public IASTEnumerator[] getEnumerators() {
|
||||||
if( enumerators == null ) return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY;
|
if( enumerators == null ) return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY;
|
||||||
enumerators = (IASTEnumerator[]) ArrayUtil.removeNullsAfter( IASTEnumerator.class, enumerators, enumeratorsPos );
|
enumerators = (IASTEnumerator[]) ArrayUtil.removeNullsAfter( IASTEnumerator.class, enumerators, enumeratorsPos );
|
||||||
|
@ -46,23 +51,19 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
private IASTEnumerator [] enumerators = null;
|
private IASTEnumerator [] enumerators = null;
|
||||||
private int enumeratorsPos=-1;
|
private int enumeratorsPos=-1;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(ENUMERATION_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#getName()
|
|
||||||
*/
|
|
||||||
public IASTName getName() {
|
public IASTName getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#getRawSignature()
|
|
||||||
*/
|
|
||||||
public String getRawSignature() {
|
public String getRawSignature() {
|
||||||
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
|
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -90,9 +91,6 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public int getRoleForName(IASTName n ) {
|
public int getRoleForName(IASTName n ) {
|
||||||
if( this.name == n )
|
if( this.name == n )
|
||||||
return r_definition;
|
return r_definition;
|
||||||
|
|
|
@ -26,30 +26,35 @@ public class CASTEnumerator extends CASTNode implements IASTEnumerator, IASTAmbi
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
private IASTExpression value;
|
private IASTExpression value;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
public CASTEnumerator() {
|
||||||
*/
|
}
|
||||||
public void setName(IASTName name) {
|
|
||||||
|
public CASTEnumerator(IASTName name, IASTExpression value) {
|
||||||
|
setName(name);
|
||||||
|
setValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(ENUMERATOR_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator#getName()
|
|
||||||
*/
|
|
||||||
public IASTName getName() {
|
public IASTName getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator#setValue(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setValue(IASTExpression expression) {
|
public void setValue(IASTExpression expression) {
|
||||||
this.value = expression;
|
this.value = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(ENUMERATOR_VALUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator#getValue()
|
|
||||||
*/
|
|
||||||
public IASTExpression getValue() {
|
public IASTExpression getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -74,9 +79,7 @@ public class CASTEnumerator extends CASTNode implements IASTEnumerator, IASTAmbi
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public int getRoleForName(IASTName n) {
|
public int getRoleForName(IASTName n) {
|
||||||
if( n == name )return r_definition;
|
if( n == name )return r_definition;
|
||||||
return r_unclear;
|
return r_unclear;
|
||||||
|
|
|
@ -34,6 +34,10 @@ public class CASTExpressionList extends CASTNode implements IASTExpressionList,
|
||||||
|
|
||||||
public void addExpression(IASTExpression expression) {
|
public void addExpression(IASTExpression expression) {
|
||||||
expressions = (IASTExpression[]) ArrayUtil.append( IASTExpression.class, expressions, expression );
|
expressions = (IASTExpression[]) ArrayUtil.append( IASTExpression.class, expressions, expression );
|
||||||
|
if(expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(NESTED_EXPRESSION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IASTExpression [] expressions = new IASTExpression[2];
|
private IASTExpression [] expressions = new IASTExpression[2];
|
||||||
|
|
|
@ -25,22 +25,24 @@ public class CASTExpressionStatement extends CASTNode implements
|
||||||
|
|
||||||
private IASTExpression expression;
|
private IASTExpression expression;
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
public CASTExpressionStatement() {
|
||||||
*
|
}
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTExpressionStatement#getExpression()
|
|
||||||
*/
|
public CASTExpressionStatement(IASTExpression expression) {
|
||||||
public IASTExpression getExpression() {
|
setExpression(expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getExpression() {
|
||||||
return expression;
|
return expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTExpressionStatement#setExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setExpression(IASTExpression expression) {
|
public void setExpression(IASTExpression expression) {
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(EXPRESSION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept(ASTVisitor action) {
|
public boolean accept(ASTVisitor action) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
|
|
||||||
|
@ -25,18 +26,26 @@ public class CASTFieldDeclarator extends CASTDeclarator implements
|
||||||
|
|
||||||
private IASTExpression bitFieldSize;
|
private IASTExpression bitFieldSize;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator#getBitFieldSize()
|
public CASTFieldDeclarator() {
|
||||||
*/
|
}
|
||||||
public IASTExpression getBitFieldSize() {
|
|
||||||
|
public CASTFieldDeclarator(IASTName name, IASTExpression bitFieldSize) {
|
||||||
|
super(name);
|
||||||
|
setBitFieldSize(bitFieldSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getBitFieldSize() {
|
||||||
return bitFieldSize;
|
return bitFieldSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator#setBitFieldSize(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setBitFieldSize(IASTExpression size) {
|
public void setBitFieldSize(IASTExpression size) {
|
||||||
bitFieldSize = size;
|
bitFieldSize = size;
|
||||||
|
if (size != null) {
|
||||||
|
size.setParent(this);
|
||||||
|
size.setPropertyInParent(FIELD_SIZE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean postAccept( ASTVisitor action ){
|
protected boolean postAccept( ASTVisitor action ){
|
||||||
|
|
|
@ -24,18 +24,24 @@ public class CASTFieldDesignator extends CASTNode implements
|
||||||
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator#getName()
|
public CASTFieldDesignator() {
|
||||||
*/
|
}
|
||||||
public IASTName getName() {
|
|
||||||
|
public CASTFieldDesignator(IASTName name) {
|
||||||
|
setName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTName getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(FIELD_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -31,12 +31,31 @@ public class CASTFieldReference extends CASTNode implements IASTFieldReference,
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
private boolean ptr;
|
private boolean ptr;
|
||||||
|
|
||||||
public IASTExpression getFieldOwner() {
|
public CASTFieldReference() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public CASTFieldReference(IASTName name, IASTExpression owner) {
|
||||||
|
this(name, owner, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public CASTFieldReference(IASTName name, IASTExpression owner, boolean ptr) {
|
||||||
|
setFieldOwner(owner);
|
||||||
|
setFieldName(name);
|
||||||
|
this.ptr = ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getFieldOwner() {
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFieldOwner(IASTExpression expression) {
|
public void setFieldOwner(IASTExpression expression) {
|
||||||
this.owner = expression;
|
this.owner = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(FIELD_OWNER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTName getFieldName() {
|
public IASTName getFieldName() {
|
||||||
|
@ -45,6 +64,10 @@ public class CASTFieldReference extends CASTNode implements IASTFieldReference,
|
||||||
|
|
||||||
public void setFieldName(IASTName name) {
|
public void setFieldName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(FIELD_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPointerDereference() {
|
public boolean isPointerDereference() {
|
||||||
|
|
|
@ -30,52 +30,64 @@ public class CASTForStatement extends CASTNode implements IASTForStatement, IAST
|
||||||
private IASTStatement body, init;
|
private IASTStatement body, init;
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public CASTForStatement() {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#getCondition()
|
}
|
||||||
*/
|
|
||||||
public IASTExpression getConditionExpression() {
|
public CASTForStatement(IASTStatement init, IASTExpression condition,
|
||||||
|
IASTExpression iterationExpression, IASTStatement body) {
|
||||||
|
setInitializerStatement(init);
|
||||||
|
setConditionExpression(condition);
|
||||||
|
setIterationExpression(iterationExpression);
|
||||||
|
setBody(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getConditionExpression() {
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#setCondition(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setConditionExpression(IASTExpression condition) {
|
public void setConditionExpression(IASTExpression condition) {
|
||||||
this.condition = condition;
|
this.condition = condition;
|
||||||
|
if (condition != null) {
|
||||||
|
condition.setParent(this);
|
||||||
|
condition.setPropertyInParent(CONDITION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#getIterationExpression()
|
|
||||||
*/
|
|
||||||
public IASTExpression getIterationExpression() {
|
public IASTExpression getIterationExpression() {
|
||||||
return iterationExpression;
|
return iterationExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#setIterationExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setIterationExpression(IASTExpression iterator) {
|
public void setIterationExpression(IASTExpression iterator) {
|
||||||
this.iterationExpression = iterator;
|
this.iterationExpression = iterator;
|
||||||
|
if (iterator != null) {
|
||||||
|
iterator.setParent(this);
|
||||||
|
iterator.setPropertyInParent(ITERATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTStatement getInitializerStatement() {
|
||||||
|
return init;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public void setInitializerStatement(IASTStatement statement) {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#getBody()
|
init = statement;
|
||||||
*/
|
if (statement != null) {
|
||||||
|
statement.setParent(this);
|
||||||
|
statement.setPropertyInParent(INITIALIZER);
|
||||||
|
}
|
||||||
|
}
|
||||||
public IASTStatement getBody() {
|
public IASTStatement getBody() {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#setBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
|
||||||
*/
|
|
||||||
public void setBody(IASTStatement statement) {
|
public void setBody(IASTStatement statement) {
|
||||||
body = statement;
|
body = statement;
|
||||||
|
if (statement != null) {
|
||||||
|
statement.setParent(this);
|
||||||
|
statement.setPropertyInParent(BODY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#getScope()
|
|
||||||
*/
|
|
||||||
public IScope getScope() {
|
public IScope getScope() {
|
||||||
if( scope == null )
|
if( scope == null )
|
||||||
scope = new CScope( this );
|
scope = new CScope( this );
|
||||||
|
@ -133,14 +145,4 @@ public class CASTForStatement extends CASTNode implements IASTForStatement, IAST
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public IASTStatement getInitializerStatement() {
|
|
||||||
return init;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInitializerStatement(IASTStatement statement) {
|
|
||||||
init = statement;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -27,8 +27,21 @@ public class CASTFunctionCallExpression extends CASTNode implements
|
||||||
private IASTExpression functionName;
|
private IASTExpression functionName;
|
||||||
private IASTExpression parameter;
|
private IASTExpression parameter;
|
||||||
|
|
||||||
public void setFunctionNameExpression(IASTExpression expression) {
|
|
||||||
|
public CASTFunctionCallExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CASTFunctionCallExpression(IASTExpression functionName, IASTExpression parameter) {
|
||||||
|
setFunctionNameExpression(functionName);
|
||||||
|
setParameterExpression(parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFunctionNameExpression(IASTExpression expression) {
|
||||||
this.functionName = expression;
|
this.functionName = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(FUNCTION_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTExpression getFunctionNameExpression() {
|
public IASTExpression getFunctionNameExpression() {
|
||||||
|
@ -37,6 +50,10 @@ public class CASTFunctionCallExpression extends CASTNode implements
|
||||||
|
|
||||||
public void setParameterExpression(IASTExpression expression) {
|
public void setParameterExpression(IASTExpression expression) {
|
||||||
this.parameter = expression;
|
this.parameter = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(PARAMETERS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTExpression getParameterExpression() {
|
public IASTExpression getParameterExpression() {
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
|
@ -19,8 +20,7 @@ import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTFunctionDeclarator extends CASTDeclarator implements
|
public class CASTFunctionDeclarator extends CASTDeclarator implements IASTStandardFunctionDeclarator {
|
||||||
IASTStandardFunctionDeclarator {
|
|
||||||
|
|
||||||
private IASTParameterDeclaration [] parameters = null;
|
private IASTParameterDeclaration [] parameters = null;
|
||||||
private int parametersPos=-1;
|
private int parametersPos=-1;
|
||||||
|
@ -28,34 +28,31 @@ public class CASTFunctionDeclarator extends CASTDeclarator implements
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public CASTFunctionDeclarator() {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#getParameters()
|
}
|
||||||
*/
|
|
||||||
public IASTParameterDeclaration[] getParameters() {
|
public CASTFunctionDeclarator(IASTName name) {
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTParameterDeclaration[] getParameters() {
|
||||||
if( parameters == null ) return IASTParameterDeclaration.EMPTY_PARAMETERDECLARATION_ARRAY;
|
if( parameters == null ) return IASTParameterDeclaration.EMPTY_PARAMETERDECLARATION_ARRAY;
|
||||||
parameters = (IASTParameterDeclaration[]) ArrayUtil.removeNullsAfter( IASTParameterDeclaration.class, parameters, parametersPos );
|
parameters = (IASTParameterDeclaration[]) ArrayUtil.removeNullsAfter( IASTParameterDeclaration.class, parameters, parametersPos );
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#addParameterDeclaration(org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration)
|
|
||||||
*/
|
|
||||||
public void addParameterDeclaration(IASTParameterDeclaration parameter) {
|
public void addParameterDeclaration(IASTParameterDeclaration parameter) {
|
||||||
if (parameter != null) {
|
if (parameter != null) {
|
||||||
|
parameter.setParent(this);
|
||||||
|
parameter.setPropertyInParent(FUNCTION_PARAMETER);
|
||||||
parameters = (IASTParameterDeclaration[]) ArrayUtil.append( IASTParameterDeclaration.class, parameters, ++parametersPos, parameter );
|
parameters = (IASTParameterDeclaration[]) ArrayUtil.append( IASTParameterDeclaration.class, parameters, ++parametersPos, parameter );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#takesVarArgs()
|
|
||||||
*/
|
|
||||||
public boolean takesVarArgs() {
|
public boolean takesVarArgs() {
|
||||||
return varArgs;
|
return varArgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#setVarArgs(boolean)
|
|
||||||
*/
|
|
||||||
public void setVarArgs(boolean value) {
|
public void setVarArgs(boolean value) {
|
||||||
varArgs = value;
|
varArgs = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,51 +31,53 @@ public class CASTFunctionDefinition extends CASTNode implements
|
||||||
private IASTStatement bodyStatement;
|
private IASTStatement bodyStatement;
|
||||||
private ICFunctionScope scope;
|
private ICFunctionScope scope;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition#getDeclSpecifier()
|
public CASTFunctionDefinition() {
|
||||||
*/
|
}
|
||||||
public IASTDeclSpecifier getDeclSpecifier() {
|
|
||||||
|
public CASTFunctionDefinition(IASTDeclSpecifier declSpecifier,
|
||||||
|
IASTFunctionDeclarator declarator, IASTStatement bodyStatement) {
|
||||||
|
setDeclSpecifier(declSpecifier);
|
||||||
|
setDeclarator(declarator);
|
||||||
|
setBody(bodyStatement);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTDeclSpecifier getDeclSpecifier() {
|
||||||
return declSpecifier;
|
return declSpecifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition#setDeclSpecifier(org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier)
|
|
||||||
*/
|
|
||||||
public void setDeclSpecifier(IASTDeclSpecifier declSpec) {
|
public void setDeclSpecifier(IASTDeclSpecifier declSpec) {
|
||||||
declSpecifier = declSpec;
|
declSpecifier = declSpec;
|
||||||
|
if (declSpec != null) {
|
||||||
|
declSpec.setParent(this);
|
||||||
|
declSpec.setPropertyInParent(DECL_SPECIFIER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition#getDeclarator()
|
|
||||||
*/
|
|
||||||
public IASTFunctionDeclarator getDeclarator() {
|
public IASTFunctionDeclarator getDeclarator() {
|
||||||
return declarator;
|
return declarator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition#setDeclarator(org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator)
|
|
||||||
*/
|
|
||||||
public void setDeclarator(IASTFunctionDeclarator declarator) {
|
public void setDeclarator(IASTFunctionDeclarator declarator) {
|
||||||
this.declarator = declarator;
|
this.declarator = declarator;
|
||||||
|
if (declarator != null) {
|
||||||
|
declarator.setParent(this);
|
||||||
|
declarator.setPropertyInParent(DECLARATOR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition#getBody()
|
|
||||||
*/
|
|
||||||
public IASTStatement getBody() {
|
public IASTStatement getBody() {
|
||||||
return bodyStatement;
|
return bodyStatement;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition#setBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
|
||||||
*/
|
|
||||||
public void setBody(IASTStatement statement) {
|
public void setBody(IASTStatement statement) {
|
||||||
bodyStatement = statement;
|
bodyStatement = statement;
|
||||||
|
if (statement != null) {
|
||||||
|
statement.setParent(this);
|
||||||
|
statement.setPropertyInParent(FUNCTION_BODY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition#getScope()
|
|
||||||
*/
|
|
||||||
public IScope getScope() {
|
public IScope getScope() {
|
||||||
if( scope == null )
|
if( scope == null )
|
||||||
scope = new CFunctionScope( this );
|
scope = new CFunctionScope( this );
|
||||||
|
|
|
@ -22,18 +22,23 @@ public class CASTGotoStatement extends CASTNode implements IASTGotoStatement {
|
||||||
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public CASTGotoStatement() {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTGotoStatement#getName()
|
}
|
||||||
*/
|
|
||||||
public IASTName getName() {
|
public CASTGotoStatement(IASTName name) {
|
||||||
|
setName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTName getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTGotoStatement#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
@ -56,9 +61,6 @@ public class CASTGotoStatement extends CASTNode implements IASTGotoStatement {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public int getRoleForName(IASTName n) {
|
public int getRoleForName(IASTName n) {
|
||||||
if( n == name ) return r_reference;
|
if( n == name ) return r_reference;
|
||||||
return r_unclear;
|
return r_unclear;
|
||||||
|
|
|
@ -26,12 +26,24 @@ public class CASTIdExpression extends CASTNode implements IASTIdExpression, IAST
|
||||||
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
public IASTName getName() {
|
|
||||||
|
public CASTIdExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CASTIdExpression(IASTName name) {
|
||||||
|
setName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTName getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(ID_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -27,46 +27,56 @@ public class CASTIfStatement extends CASTNode implements IASTIfStatement, IASTAm
|
||||||
private IASTStatement thenClause;
|
private IASTStatement thenClause;
|
||||||
private IASTStatement elseClause;
|
private IASTStatement elseClause;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTIfStatement#getCondition()
|
|
||||||
*/
|
public CASTIfStatement() {
|
||||||
public IASTExpression getConditionExpression() {
|
}
|
||||||
|
|
||||||
|
public CASTIfStatement(IASTExpression condition, IASTStatement thenClause) {
|
||||||
|
setConditionExpression(condition);
|
||||||
|
setThenClause(thenClause);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public CASTIfStatement(IASTExpression condition, IASTStatement thenClause, IASTStatement elseClause) {
|
||||||
|
this(condition, thenClause);
|
||||||
|
setElseClause(elseClause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getConditionExpression() {
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTIfStatement#setCondition(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setConditionExpression(IASTExpression condition) {
|
public void setConditionExpression(IASTExpression condition) {
|
||||||
this.condition = condition;
|
this.condition = condition;
|
||||||
|
if (condition != null) {
|
||||||
|
condition.setParent(this);
|
||||||
|
condition.setPropertyInParent(CONDITION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTIfStatement#getThenClause()
|
|
||||||
*/
|
|
||||||
public IASTStatement getThenClause() {
|
public IASTStatement getThenClause() {
|
||||||
return thenClause;
|
return thenClause;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTIfStatement#setThenClause(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
|
||||||
*/
|
|
||||||
public void setThenClause(IASTStatement thenClause) {
|
public void setThenClause(IASTStatement thenClause) {
|
||||||
this.thenClause = thenClause;
|
this.thenClause = thenClause;
|
||||||
|
if (thenClause != null) {
|
||||||
|
thenClause.setParent(this);
|
||||||
|
thenClause.setPropertyInParent(THEN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTIfStatement#getElseClause()
|
|
||||||
*/
|
|
||||||
public IASTStatement getElseClause() {
|
public IASTStatement getElseClause() {
|
||||||
return elseClause;
|
return elseClause;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTIfStatement#setElseClause(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
|
||||||
*/
|
|
||||||
public void setElseClause(IASTStatement elseClause) {
|
public void setElseClause(IASTStatement elseClause) {
|
||||||
this.elseClause = elseClause;
|
this.elseClause = elseClause;
|
||||||
|
if (elseClause != null) {
|
||||||
|
elseClause.setParent(this);
|
||||||
|
elseClause.setPropertyInParent(ELSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -25,18 +25,24 @@ public class CASTInitializerExpression extends CASTNode implements
|
||||||
|
|
||||||
private IASTExpression expression;
|
private IASTExpression expression;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTInitializerExpression#getExpression()
|
public CASTInitializerExpression() {
|
||||||
*/
|
}
|
||||||
public IASTExpression getExpression() {
|
|
||||||
|
public CASTInitializerExpression(IASTExpression expression) {
|
||||||
|
setExpression(expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getExpression() {
|
||||||
return expression;
|
return expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTInitializerExpression#setExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setExpression(IASTExpression expression) {
|
public void setExpression(IASTExpression expression) {
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(INITIALIZER_EXPRESSION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -24,19 +24,17 @@ public class CASTInitializerList extends CASTNode implements
|
||||||
IASTInitializerList {
|
IASTInitializerList {
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration#getDeclarators()
|
|
||||||
*/
|
|
||||||
public IASTInitializer[] getInitializers() {
|
public IASTInitializer[] getInitializers() {
|
||||||
if( initializers == null ) return IASTInitializer.EMPTY_INITIALIZER_ARRAY;
|
if( initializers == null ) return IASTInitializer.EMPTY_INITIALIZER_ARRAY;
|
||||||
initializers = (IASTInitializer[]) ArrayUtil.removeNullsAfter( IASTInitializer.class, initializers, initializersPos );
|
initializers = (IASTInitializer[]) ArrayUtil.removeNullsAfter( IASTInitializer.class, initializers, initializersPos );
|
||||||
return initializers;
|
return initializers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInitializer( IASTInitializer d )
|
public void addInitializer( IASTInitializer d ) {
|
||||||
{
|
|
||||||
if (d != null) {
|
if (d != null) {
|
||||||
initializers = (IASTInitializer[]) ArrayUtil.append( IASTInitializer.class, initializers, ++initializersPos, d );
|
initializers = (IASTInitializer[]) ArrayUtil.append( IASTInitializer.class, initializers, ++initializersPos, d );
|
||||||
|
d.setParent(this);
|
||||||
|
d.setPropertyInParent(NESTED_INITIALIZER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,30 +28,45 @@ public class CASTKnRFunctionDeclarator extends CASTDeclarator implements ICASTKn
|
||||||
IASTName[] parameterNames = IASTName.EMPTY_NAME_ARRAY;
|
IASTName[] parameterNames = IASTName.EMPTY_NAME_ARRAY;
|
||||||
IASTDeclaration[] parameterDeclarations = IASTDeclaration.EMPTY_DECLARATION_ARRAY;
|
IASTDeclaration[] parameterDeclarations = IASTDeclaration.EMPTY_DECLARATION_ARRAY;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator#setParameterNames(org.eclipse.cdt.core.dom.ast.IASTName[])
|
public CASTKnRFunctionDeclarator() {
|
||||||
*/
|
|
||||||
public void setParameterNames(IASTName[] names) {
|
|
||||||
parameterNames = names;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public CASTKnRFunctionDeclarator(IASTName[] parameterNames, IASTDeclaration[] parameterDeclarations) {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator#getParameterNames()
|
setParameterNames(parameterNames);
|
||||||
*/
|
setParameterDeclarations(parameterDeclarations);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setParameterNames(IASTName[] names) {
|
||||||
|
parameterNames = names;
|
||||||
|
for(int i = 0; i < names.length; i++) {
|
||||||
|
IASTName name = names[i];
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(PARAMETER_NAME);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public IASTName[] getParameterNames() {
|
public IASTName[] getParameterNames() {
|
||||||
return parameterNames;
|
return parameterNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator#setParameterDeclarations(org.eclipse.cdt.core.dom.ast.IASTDeclaration[])
|
|
||||||
*/
|
|
||||||
public void setParameterDeclarations(IASTDeclaration[] decls) {
|
public void setParameterDeclarations(IASTDeclaration[] decls) {
|
||||||
parameterDeclarations = decls;
|
parameterDeclarations = decls;
|
||||||
|
for(int i = 0; i < parameterDeclarations.length; i++) {
|
||||||
|
IASTDeclaration decl = parameterDeclarations[i];
|
||||||
|
if (decl != null) {
|
||||||
|
decl.setParent(this);
|
||||||
|
decl.setPropertyInParent(FUNCTION_PARAMETER);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator#getParameterDeclarations()
|
|
||||||
*/
|
|
||||||
public IASTDeclaration[] getParameterDeclarations() {
|
public IASTDeclaration[] getParameterDeclarations() {
|
||||||
return parameterDeclarations;
|
return parameterDeclarations;
|
||||||
}
|
}
|
||||||
|
@ -70,9 +85,6 @@ public class CASTKnRFunctionDeclarator extends CASTDeclarator implements ICASTKn
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator#getDeclaratorForParameterName()
|
|
||||||
*/
|
|
||||||
public IASTDeclarator getDeclaratorForParameterName(IASTName name) {
|
public IASTDeclarator getDeclaratorForParameterName(IASTName name) {
|
||||||
boolean found=false;
|
boolean found=false;
|
||||||
for(int i=0; i<parameterNames.length; i++) {
|
for(int i=0; i<parameterNames.length; i++) {
|
||||||
|
@ -93,9 +105,6 @@ public class CASTKnRFunctionDeclarator extends CASTDeclarator implements ICASTKn
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CASTDeclarator#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public int getRoleForName(IASTName name) {
|
public int getRoleForName(IASTName name) {
|
||||||
IASTName [] n = getParameterNames();
|
IASTName [] n = getParameterNames();
|
||||||
for( int i = 0; i < n.length; ++i )
|
for( int i = 0; i < n.length; ++i )
|
||||||
|
|
|
@ -26,18 +26,25 @@ public class CASTLabelStatement extends CASTNode implements IASTLabelStatement,
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
private IASTStatement nestedStatement;
|
private IASTStatement nestedStatement;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTLabelStatement#getName()
|
public CASTLabelStatement() {
|
||||||
*/
|
}
|
||||||
public IASTName getName() {
|
|
||||||
|
public CASTLabelStatement(IASTName name, IASTStatement nestedStatement) {
|
||||||
|
setName(name);
|
||||||
|
setNestedStatement(nestedStatement);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTName getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTLabelStatement#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
@ -60,9 +67,7 @@ public class CASTLabelStatement extends CASTNode implements IASTLabelStatement,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public int getRoleForName(IASTName n) {
|
public int getRoleForName(IASTName n) {
|
||||||
if( n == name ) return r_declaration;
|
if( n == name ) return r_declaration;
|
||||||
return r_unclear;
|
return r_unclear;
|
||||||
|
@ -74,6 +79,10 @@ public class CASTLabelStatement extends CASTNode implements IASTLabelStatement,
|
||||||
|
|
||||||
public void setNestedStatement(IASTStatement s) {
|
public void setNestedStatement(IASTStatement s) {
|
||||||
nestedStatement = s;
|
nestedStatement = s;
|
||||||
|
if (s != null) {
|
||||||
|
s.setParent(this);
|
||||||
|
s.setPropertyInParent(NESTED_STATEMENT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
|
|
|
@ -18,13 +18,22 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTLiteralExpression extends CASTNode implements
|
public class CASTLiteralExpression extends CASTNode implements IASTLiteralExpression {
|
||||||
IASTLiteralExpression {
|
|
||||||
|
|
||||||
private int kind;
|
private int kind;
|
||||||
private String value = ""; //$NON-NLS-1$
|
private String value = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
public int getKind() {
|
|
||||||
|
|
||||||
|
public CASTLiteralExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CASTLiteralExpression(int kind, String value) {
|
||||||
|
this.kind = kind;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getKind() {
|
||||||
return kind;
|
return kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,13 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTModifiedArrayModifier extends CASTArrayModifier implements
|
public class CASTModifiedArrayModifier extends CASTArrayModifier implements ICASTArrayModifier {
|
||||||
ICASTArrayModifier {
|
|
||||||
|
|
||||||
private boolean isVolatile;
|
private boolean isVolatile;
|
||||||
private boolean isRestrict;
|
private boolean isRestrict;
|
||||||
|
@ -24,74 +24,50 @@ public class CASTModifiedArrayModifier extends CASTArrayModifier implements
|
||||||
private boolean isConst;
|
private boolean isConst;
|
||||||
private boolean varSized;
|
private boolean varSized;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public CASTModifiedArrayModifier() {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#isConst()
|
}
|
||||||
*/
|
|
||||||
public boolean isConst() {
|
public CASTModifiedArrayModifier(IASTExpression exp) {
|
||||||
|
super(exp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isConst() {
|
||||||
return isConst;
|
return isConst;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#isStatic()
|
|
||||||
*/
|
|
||||||
public boolean isStatic() {
|
public boolean isStatic() {
|
||||||
return isStatic;
|
return isStatic;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#isRestrict()
|
|
||||||
*/
|
|
||||||
public boolean isRestrict() {
|
public boolean isRestrict() {
|
||||||
return isRestrict;
|
return isRestrict;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#isVolatile()
|
|
||||||
*/
|
|
||||||
public boolean isVolatile() {
|
public boolean isVolatile() {
|
||||||
return isVolatile;
|
return isVolatile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#setConst(boolean)
|
|
||||||
*/
|
|
||||||
public void setConst(boolean value) {
|
public void setConst(boolean value) {
|
||||||
this.isConst = value;
|
this.isConst = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#setVolatile(boolean)
|
|
||||||
*/
|
|
||||||
public void setVolatile(boolean value) {
|
public void setVolatile(boolean value) {
|
||||||
this.isVolatile = value;
|
this.isVolatile = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#setRestrict(boolean)
|
|
||||||
*/
|
|
||||||
public void setRestrict(boolean value) {
|
public void setRestrict(boolean value) {
|
||||||
this.isRestrict = value;
|
this.isRestrict = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#setStatic(boolean)
|
|
||||||
*/
|
|
||||||
public void setStatic(boolean value) {
|
public void setStatic(boolean value) {
|
||||||
this.isStatic = value;
|
this.isStatic = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#isVariableSized()
|
|
||||||
*/
|
|
||||||
public boolean isVariableSized() {
|
public boolean isVariableSized() {
|
||||||
return varSized;
|
return varSized;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#setVariableSized(boolean)
|
|
||||||
*/
|
|
||||||
public void setVariableSized(boolean value) {
|
public void setVariableSized(boolean value) {
|
||||||
varSized = value;
|
varSized = value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
|
@ -34,9 +34,7 @@ public class CASTName extends CASTNode implements IASTName {
|
||||||
|
|
||||||
private IBinding binding = null;
|
private IBinding binding = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param name
|
|
||||||
*/
|
|
||||||
public CASTName(char[] name) {
|
public CASTName(char[] name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
@ -73,11 +71,7 @@ public class CASTName extends CASTNode implements IASTName {
|
||||||
this.binding = binding;
|
this.binding = binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see java.lang.Object#toString()
|
|
||||||
*/
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (name == EMPTY_CHAR_ARRAY)
|
if (name == EMPTY_CHAR_ARRAY)
|
||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
|
@ -113,11 +107,7 @@ public class CASTName extends CASTNode implements IASTName {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTName#isDeclaration()
|
|
||||||
*/
|
|
||||||
public boolean isDeclaration() {
|
public boolean isDeclaration() {
|
||||||
IASTNode parent = getParent();
|
IASTNode parent = getParent();
|
||||||
if (parent instanceof IASTNameOwner) {
|
if (parent instanceof IASTNameOwner) {
|
||||||
|
@ -133,11 +123,7 @@ public class CASTName extends CASTNode implements IASTName {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTName#isReference()
|
|
||||||
*/
|
|
||||||
public boolean isReference() {
|
public boolean isReference() {
|
||||||
IASTNode parent = getParent();
|
IASTNode parent = getParent();
|
||||||
if (parent instanceof IASTNameOwner) {
|
if (parent instanceof IASTNameOwner) {
|
||||||
|
|
|
@ -25,32 +25,37 @@ public class CASTParameterDeclaration extends CASTNode implements
|
||||||
private IASTDeclSpecifier declSpec;
|
private IASTDeclSpecifier declSpec;
|
||||||
private IASTDeclarator declarator;
|
private IASTDeclarator declarator;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration#getDeclSpecifier()
|
public CASTParameterDeclaration() {
|
||||||
*/
|
}
|
||||||
public IASTDeclSpecifier getDeclSpecifier() {
|
|
||||||
|
public CASTParameterDeclaration(IASTDeclSpecifier declSpec, IASTDeclarator declarator) {
|
||||||
|
setDeclSpecifier(declSpec);
|
||||||
|
setDeclarator(declarator);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTDeclSpecifier getDeclSpecifier() {
|
||||||
return declSpec;
|
return declSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration#getDeclarator()
|
|
||||||
*/
|
|
||||||
public IASTDeclarator getDeclarator() {
|
public IASTDeclarator getDeclarator() {
|
||||||
return declarator;
|
return declarator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration#setDeclSpecifier(org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier)
|
|
||||||
*/
|
|
||||||
public void setDeclSpecifier(IASTDeclSpecifier declSpec) {
|
public void setDeclSpecifier(IASTDeclSpecifier declSpec) {
|
||||||
this.declSpec = declSpec;
|
this.declSpec = declSpec;
|
||||||
|
if (declSpec != null) {
|
||||||
|
declSpec.setParent(this);
|
||||||
|
declSpec.setPropertyInParent(DECL_SPECIFIER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration#setDeclarator(org.eclipse.cdt.core.dom.ast.IASTDeclarator)
|
|
||||||
*/
|
|
||||||
public void setDeclarator(IASTDeclarator declarator) {
|
public void setDeclarator(IASTDeclarator declarator) {
|
||||||
this.declarator = declarator;
|
this.declarator = declarator;
|
||||||
|
if (declarator != null) {
|
||||||
|
declarator.setParent(this);
|
||||||
|
declarator.setPropertyInParent(DECLARATOR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -22,44 +22,36 @@ public class CASTPointer extends CASTNode implements ICASTPointer {
|
||||||
private boolean isVolatile;
|
private boolean isVolatile;
|
||||||
private boolean isConst;
|
private boolean isConst;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTPointer#isRestrict()
|
public CASTPointer() {
|
||||||
*/
|
}
|
||||||
public boolean isRestrict() {
|
|
||||||
|
public CASTPointer(boolean isRestrict, boolean isVolatile, boolean isConst) {
|
||||||
|
this.isRestrict = isRestrict;
|
||||||
|
this.isVolatile = isVolatile;
|
||||||
|
this.isConst = isConst;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRestrict() {
|
||||||
return isRestrict;
|
return isRestrict;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTPointer#setRestrict(boolean)
|
|
||||||
*/
|
|
||||||
public void setRestrict(boolean value) {
|
public void setRestrict(boolean value) {
|
||||||
isRestrict = value;
|
isRestrict = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTPointer#isConst()
|
|
||||||
*/
|
|
||||||
public boolean isConst() {
|
public boolean isConst() {
|
||||||
return isConst;
|
return isConst;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTPointer#isVolatile()
|
|
||||||
*/
|
|
||||||
public boolean isVolatile() {
|
public boolean isVolatile() {
|
||||||
return isVolatile;
|
return isVolatile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTPointer#setConst(boolean)
|
|
||||||
*/
|
|
||||||
public void setConst(boolean value) {
|
public void setConst(boolean value) {
|
||||||
isConst = value;
|
isConst = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTPointer#setVolatile(boolean)
|
|
||||||
*/
|
|
||||||
public void setVolatile(boolean value) {
|
public void setVolatile(boolean value) {
|
||||||
isVolatile = value;
|
isVolatile = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import java.text.MessageFormat;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
|
@ -29,45 +28,6 @@ import org.eclipse.cdt.internal.core.parser.ParserMessages;
|
||||||
*/
|
*/
|
||||||
public class CASTProblem extends CASTNode implements IASTProblem {
|
public class CASTProblem extends CASTNode implements IASTProblem {
|
||||||
|
|
||||||
private IASTNode parent;
|
|
||||||
|
|
||||||
private ASTNodeProperty property;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNode#getParent()
|
|
||||||
*/
|
|
||||||
public IASTNode getParent() {
|
|
||||||
return parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNode#setParent(org.eclipse.cdt.core.dom.ast.IASTNode)
|
|
||||||
*/
|
|
||||||
public void setParent(IASTNode node) {
|
|
||||||
this.parent = node;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNode#getPropertyInParent()
|
|
||||||
*/
|
|
||||||
public ASTNodeProperty getPropertyInParent() {
|
|
||||||
return property;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNode#setPropertyInParent(org.eclipse.cdt.core.dom.ast.ASTNodeProperty)
|
|
||||||
*/
|
|
||||||
public void setPropertyInParent(ASTNodeProperty property) {
|
|
||||||
this.property = property;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final char[] arg;
|
private final char[] arg;
|
||||||
|
|
||||||
|
@ -86,29 +46,15 @@ public class CASTProblem extends CASTNode implements IASTProblem {
|
||||||
this.isError = error;
|
this.isError = error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.parser.IProblem#getID()
|
|
||||||
*/
|
|
||||||
public int getID() {
|
public int getID() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.parser.IProblem#isError()
|
|
||||||
*/
|
|
||||||
public boolean isError() {
|
public boolean isError() {
|
||||||
return isError;
|
return isError;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.parser.IProblem#isWarning()
|
|
||||||
*/
|
|
||||||
public boolean isWarning() {
|
public boolean isWarning() {
|
||||||
return isWarning;
|
return isWarning;
|
||||||
}
|
}
|
||||||
|
@ -293,29 +239,16 @@ public class CASTProblem extends CASTNode implements IASTProblem {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.parser.IASTProblem#checkCategory(int)
|
|
||||||
*/
|
|
||||||
public boolean checkCategory(int bitmask) {
|
public boolean checkCategory(int bitmask) {
|
||||||
return ((id & bitmask) != 0);
|
return ((id & bitmask) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.parser.IASTProblem#getArguments()
|
|
||||||
*/
|
|
||||||
public String getArguments() {
|
public String getArguments() {
|
||||||
return arg != null ? String.valueOf(arg) : ""; //$NON-NLS-1$
|
return arg != null ? String.valueOf(arg) : ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNode#getTranslationUnit()
|
|
||||||
*/
|
|
||||||
public IASTTranslationUnit getTranslationUnit() {
|
public IASTTranslationUnit getTranslationUnit() {
|
||||||
if (this instanceof IASTTranslationUnit)
|
if (this instanceof IASTTranslationUnit)
|
||||||
return (IASTTranslationUnit) this;
|
return (IASTTranslationUnit) this;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +21,15 @@ import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration;
|
||||||
public class CASTProblemDeclaration extends CASTProblemOwner implements
|
public class CASTProblemDeclaration extends CASTProblemOwner implements
|
||||||
IASTProblemDeclaration {
|
IASTProblemDeclaration {
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public CASTProblemDeclaration() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CASTProblemDeclaration(IASTProblem problem) {
|
||||||
|
super(problem);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
if( action.shouldVisitDeclarations ){
|
if( action.shouldVisitDeclarations ){
|
||||||
switch( action.visit( this ) ){
|
switch( action.visit( this ) ){
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
|
|
@ -12,16 +12,24 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTProblemExpression extends CASTProblemOwner implements
|
public class CASTProblemExpression extends CASTProblemOwner implements IASTProblemExpression {
|
||||||
IASTProblemExpression {
|
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public CASTProblemExpression() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CASTProblemExpression(IASTProblem problem) {
|
||||||
|
super(problem);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
if( action.shouldVisitExpressions ){
|
if( action.shouldVisitExpressions ){
|
||||||
switch( action.visit( this ) ){
|
switch( action.visit( this ) ){
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
|
|
@ -11,22 +11,32 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTProblem;
|
import org.eclipse.cdt.core.dom.ast.IASTProblem;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTProblemHolder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
abstract class CASTProblemOwner extends CASTNode {
|
abstract class CASTProblemOwner extends CASTNode implements IASTProblemHolder {
|
||||||
|
|
||||||
private IASTProblem problem;
|
private IASTProblem problem;
|
||||||
|
|
||||||
public IASTProblem getProblem()
|
public CASTProblemOwner() {
|
||||||
{
|
}
|
||||||
|
|
||||||
|
public CASTProblemOwner(IASTProblem problem) {
|
||||||
|
setProblem(problem);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTProblem getProblem() {
|
||||||
return problem;
|
return problem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProblem(IASTProblem p)
|
public void setProblem(IASTProblem p) {
|
||||||
{
|
|
||||||
problem = p;
|
problem = p;
|
||||||
|
if (p != null) {
|
||||||
|
p.setParent(this);
|
||||||
|
p.setPropertyInParent(PROBLEM);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,14 +12,23 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTProblemStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTProblemStatement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTProblemStatement extends CASTProblemOwner implements
|
public class CASTProblemStatement extends CASTProblemOwner implements IASTProblemStatement {
|
||||||
IASTProblemStatement {
|
|
||||||
public boolean accept( ASTVisitor action ){
|
|
||||||
|
public CASTProblemStatement() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CASTProblemStatement(IASTProblem problem) {
|
||||||
|
super(problem);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
if( action.shouldVisitStatements ){
|
if( action.shouldVisitStatements ){
|
||||||
switch( action.visit( this ) ){
|
switch( action.visit( this ) ){
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
|
|
@ -25,18 +25,24 @@ public class CASTReturnStatement extends CASTNode implements
|
||||||
|
|
||||||
private IASTExpression retValue;
|
private IASTExpression retValue;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public CASTReturnStatement() {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTReturnStatement#getReturnValue()
|
}
|
||||||
*/
|
|
||||||
public IASTExpression getReturnValue() {
|
public CASTReturnStatement(IASTExpression retValue) {
|
||||||
|
setReturnValue(retValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getReturnValue() {
|
||||||
return retValue;
|
return retValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTReturnStatement#setReturnValue(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setReturnValue(IASTExpression returnValue) {
|
public void setReturnValue(IASTExpression returnValue) {
|
||||||
retValue = returnValue;
|
retValue = returnValue;
|
||||||
|
if (returnValue != null) {
|
||||||
|
returnValue.setParent(this);
|
||||||
|
returnValue.setPropertyInParent(RETURNVALUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
@ -66,6 +72,4 @@ public class CASTReturnStatement extends CASTNode implements
|
||||||
retValue = (IASTExpression) other;
|
retValue = (IASTExpression) other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
|
@ -28,86 +28,50 @@ public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier implements IC
|
||||||
private boolean complex=false;
|
private boolean complex=false;
|
||||||
private boolean imaginary=false;
|
private boolean imaginary=false;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#getType()
|
|
||||||
*/
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return simpleType;
|
return simpleType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#isSigned()
|
|
||||||
*/
|
|
||||||
public boolean isSigned() {
|
public boolean isSigned() {
|
||||||
return isSigned;
|
return isSigned;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#isUnsigned()
|
|
||||||
*/
|
|
||||||
public boolean isUnsigned() {
|
public boolean isUnsigned() {
|
||||||
return isUnsigned;
|
return isUnsigned;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#isShort()
|
|
||||||
*/
|
|
||||||
public boolean isShort() {
|
public boolean isShort() {
|
||||||
return isShort;
|
return isShort;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#isLong()
|
|
||||||
*/
|
|
||||||
public boolean isLong() {
|
public boolean isLong() {
|
||||||
return isLong;
|
return isLong;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#setType(int)
|
|
||||||
*/
|
|
||||||
public void setType(int type) {
|
public void setType(int type) {
|
||||||
simpleType = type;
|
simpleType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#setShort(boolean)
|
|
||||||
*/
|
|
||||||
public void setShort(boolean value) {
|
public void setShort(boolean value) {
|
||||||
isShort = value;
|
isShort = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#setLong(boolean)
|
|
||||||
*/
|
|
||||||
public void setLong(boolean value) {
|
public void setLong(boolean value) {
|
||||||
isLong = value;
|
isLong = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#setUnsigned(boolean)
|
|
||||||
*/
|
|
||||||
public void setUnsigned(boolean value) {
|
public void setUnsigned(boolean value) {
|
||||||
isUnsigned = value;
|
isUnsigned = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#setSigned(boolean)
|
|
||||||
*/
|
|
||||||
public void setSigned(boolean value) {
|
public void setSigned(boolean value) {
|
||||||
isSigned = value;
|
isSigned = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier#isLongLong()
|
|
||||||
*/
|
|
||||||
public boolean isLongLong() {
|
public boolean isLongLong() {
|
||||||
return longlong;
|
return longlong;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier#setLongLong(boolean)
|
|
||||||
*/
|
|
||||||
public void setLongLong(boolean value) {
|
public void setLongLong(boolean value) {
|
||||||
longlong = value;
|
longlong = value;
|
||||||
}
|
}
|
||||||
|
@ -130,32 +94,19 @@ public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier implements IC
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier#isComplex()
|
|
||||||
*/
|
|
||||||
public boolean isComplex() {
|
public boolean isComplex() {
|
||||||
return complex;
|
return complex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier#setComplex(boolean)
|
|
||||||
*/
|
|
||||||
public void setComplex(boolean value) {
|
public void setComplex(boolean value) {
|
||||||
this.complex = value;
|
this.complex = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier#isImaginary()
|
|
||||||
*/
|
|
||||||
public boolean isImaginary() {
|
public boolean isImaginary() {
|
||||||
return imaginary;
|
return imaginary;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier#setImaginary(boolean)
|
|
||||||
*/
|
|
||||||
public void setImaginary(boolean value) {
|
public void setImaginary(boolean value) {
|
||||||
this.imaginary = value;
|
this.imaginary = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,29 +21,30 @@ import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTSimpleDeclaration extends CASTNode implements
|
public class CASTSimpleDeclaration extends CASTNode implements IASTSimpleDeclaration {
|
||||||
IASTSimpleDeclaration {
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration#getDeclSpecifier()
|
public CASTSimpleDeclaration() {
|
||||||
*/
|
}
|
||||||
public IASTDeclSpecifier getDeclSpecifier() {
|
|
||||||
|
public CASTSimpleDeclaration(IASTDeclSpecifier declSpecifier) {
|
||||||
|
setDeclSpecifier(declSpecifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTDeclSpecifier getDeclSpecifier() {
|
||||||
return declSpecifier;
|
return declSpecifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration#getDeclarators()
|
|
||||||
*/
|
|
||||||
public IASTDeclarator[] getDeclarators() {
|
public IASTDeclarator[] getDeclarators() {
|
||||||
if( declarators == null ) return IASTDeclarator.EMPTY_DECLARATOR_ARRAY;
|
if( declarators == null ) return IASTDeclarator.EMPTY_DECLARATOR_ARRAY;
|
||||||
declarators = (IASTDeclarator[]) ArrayUtil.removeNullsAfter( IASTDeclarator.class, declarators, declaratorsPos );
|
declarators = (IASTDeclarator[]) ArrayUtil.removeNullsAfter( IASTDeclarator.class, declarators, declaratorsPos );
|
||||||
return declarators;
|
return declarators;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDeclarator( IASTDeclarator d )
|
public void addDeclarator( IASTDeclarator d ) {
|
||||||
{
|
|
||||||
if (d != null) {
|
if (d != null) {
|
||||||
|
d.setParent(this);
|
||||||
|
d.setPropertyInParent(DECLARATOR);
|
||||||
declarators = (IASTDeclarator[]) ArrayUtil.append( IASTDeclarator.class, declarators, ++declaratorsPos, d );
|
declarators = (IASTDeclarator[]) ArrayUtil.append( IASTDeclarator.class, declarators, ++declaratorsPos, d );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,11 +54,13 @@ public class CASTSimpleDeclaration extends CASTNode implements
|
||||||
private int declaratorsPos=-1;
|
private int declaratorsPos=-1;
|
||||||
private IASTDeclSpecifier declSpecifier;
|
private IASTDeclSpecifier declSpecifier;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param declSpecifier The declSpecifier to set.
|
|
||||||
*/
|
|
||||||
public void setDeclSpecifier(IASTDeclSpecifier declSpecifier) {
|
public void setDeclSpecifier(IASTDeclSpecifier declSpecifier) {
|
||||||
this.declSpecifier = declSpecifier;
|
this.declSpecifier = declSpecifier;
|
||||||
|
if (declSpecifier != null) {
|
||||||
|
declSpecifier.setParent(this);
|
||||||
|
declSpecifier.setPropertyInParent(DECL_SPECIFIER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
@ -83,5 +86,4 @@ public class CASTSimpleDeclaration extends CASTNode implements
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
|
@ -27,32 +27,36 @@ public class CASTSwitchStatement extends CASTNode implements
|
||||||
private IASTExpression controller;
|
private IASTExpression controller;
|
||||||
private IASTStatement body;
|
private IASTStatement body;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public CASTSwitchStatement() {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTSwitchStatement#getController()
|
}
|
||||||
*/
|
|
||||||
public IASTExpression getControllerExpression() {
|
public CASTSwitchStatement(IASTExpression controller, IASTStatement body) {
|
||||||
|
setControllerExpression(controller);
|
||||||
|
setBody(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getControllerExpression() {
|
||||||
return controller;
|
return controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTSwitchStatement#setController(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setControllerExpression(IASTExpression controller) {
|
public void setControllerExpression(IASTExpression controller) {
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
|
if (controller != null) {
|
||||||
|
controller.setParent(this);
|
||||||
|
controller.setPropertyInParent(CONTROLLER_EXP);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTSwitchStatement#getBody()
|
|
||||||
*/
|
|
||||||
public IASTStatement getBody() {
|
public IASTStatement getBody() {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTSwitchStatement#setBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
|
||||||
*/
|
|
||||||
public void setBody(IASTStatement body) {
|
public void setBody(IASTStatement body) {
|
||||||
this.body = body;
|
this.body = body;
|
||||||
|
if (body != null) {
|
||||||
|
body.setParent(this);
|
||||||
|
body.setPropertyInParent(BODY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -91,6 +91,8 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
|
|
||||||
public void addDeclaration(IASTDeclaration d) {
|
public void addDeclaration(IASTDeclaration d) {
|
||||||
if (d != null) {
|
if (d != null) {
|
||||||
|
d.setParent(this);
|
||||||
|
d.setPropertyInParent(OWNED_DECLARATION);
|
||||||
decls = (IASTDeclaration[]) ArrayUtil.append( IASTDeclaration.class, decls, ++declsPos, d );
|
decls = (IASTDeclaration[]) ArrayUtil.append( IASTDeclaration.class, decls, ++declsPos, d );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,32 +24,36 @@ public class CASTTypeId extends CASTNode implements IASTTypeId {
|
||||||
private IASTDeclSpecifier declSpecifier;
|
private IASTDeclSpecifier declSpecifier;
|
||||||
private IASTDeclarator declarator;
|
private IASTDeclarator declarator;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public CASTTypeId() {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTTypeId#getDeclSpecifier()
|
}
|
||||||
*/
|
|
||||||
public IASTDeclSpecifier getDeclSpecifier() {
|
public CASTTypeId(IASTDeclSpecifier declSpecifier, IASTDeclarator declarator) {
|
||||||
|
setDeclSpecifier(declSpecifier);
|
||||||
|
setAbstractDeclarator(declarator);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTDeclSpecifier getDeclSpecifier() {
|
||||||
return declSpecifier;
|
return declSpecifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTTypeId#setDeclSpecifier(org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier)
|
|
||||||
*/
|
|
||||||
public void setDeclSpecifier(IASTDeclSpecifier declSpec) {
|
public void setDeclSpecifier(IASTDeclSpecifier declSpec) {
|
||||||
this.declSpecifier = declSpec;
|
this.declSpecifier = declSpec;
|
||||||
|
if (declSpec != null) {
|
||||||
|
declSpec.setParent(this);
|
||||||
|
declSpec.setPropertyInParent(DECL_SPECIFIER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTTypeId#getAbstractDeclarator()
|
|
||||||
*/
|
|
||||||
public IASTDeclarator getAbstractDeclarator() {
|
public IASTDeclarator getAbstractDeclarator() {
|
||||||
return declarator;
|
return declarator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTTypeId#setAbstractDeclarator(org.eclipse.cdt.core.dom.ast.IASTDeclarator)
|
|
||||||
*/
|
|
||||||
public void setAbstractDeclarator(IASTDeclarator abstractDeclarator) {
|
public void setAbstractDeclarator(IASTDeclarator abstractDeclarator) {
|
||||||
declarator = abstractDeclarator;
|
declarator = abstractDeclarator;
|
||||||
|
if (abstractDeclarator != null) {
|
||||||
|
abstractDeclarator.setParent(this);
|
||||||
|
abstractDeclarator.setPropertyInParent(ABSTRACT_DECLARATOR);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,15 @@ public class CASTTypeIdExpression extends CASTNode implements
|
||||||
private int op;
|
private int op;
|
||||||
private IASTTypeId typeId;
|
private IASTTypeId typeId;
|
||||||
|
|
||||||
public int getOperator() {
|
public CASTTypeIdExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CASTTypeIdExpression(int op, IASTTypeId typeId) {
|
||||||
|
this.op = op;
|
||||||
|
setTypeId(typeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOperator() {
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +43,10 @@ public class CASTTypeIdExpression extends CASTNode implements
|
||||||
|
|
||||||
public void setTypeId(IASTTypeId typeId) {
|
public void setTypeId(IASTTypeId typeId) {
|
||||||
this.typeId = typeId;
|
this.typeId = typeId;
|
||||||
|
if (typeId != null) {
|
||||||
|
typeId.setParent(this);
|
||||||
|
typeId.setPropertyInParent(TYPE_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTTypeId getTypeId() {
|
public IASTTypeId getTypeId() {
|
||||||
|
@ -65,5 +77,4 @@ public class CASTTypeIdExpression extends CASTNode implements
|
||||||
public IType getExpressionType() {
|
public IType getExpressionType() {
|
||||||
return CVisitor.getExpressionType(this);
|
return CVisitor.getExpressionType(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,23 +23,40 @@ import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression;
|
||||||
public class CASTTypeIdInitializerExpression extends CASTNode implements
|
public class CASTTypeIdInitializerExpression extends CASTNode implements
|
||||||
ICASTTypeIdInitializerExpression {
|
ICASTTypeIdInitializerExpression {
|
||||||
|
|
||||||
private IASTTypeId t;
|
private IASTTypeId typeId;
|
||||||
private IASTInitializer i;
|
private IASTInitializer initializer;
|
||||||
|
|
||||||
public IASTTypeId getTypeId() {
|
|
||||||
return t;
|
public CASTTypeIdInitializerExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CASTTypeIdInitializerExpression(IASTTypeId t, IASTInitializer i) {
|
||||||
|
setTypeId(t);
|
||||||
|
setInitializer(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTTypeId getTypeId() {
|
||||||
|
return typeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTypeId(IASTTypeId typeId) {
|
public void setTypeId(IASTTypeId typeId) {
|
||||||
t = typeId;
|
this.typeId = typeId;
|
||||||
|
if (typeId != null) {
|
||||||
|
typeId.setParent(this);
|
||||||
|
typeId.setPropertyInParent(TYPE_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTInitializer getInitializer() {
|
public IASTInitializer getInitializer() {
|
||||||
return i;
|
return initializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInitializer(IASTInitializer initializer) {
|
public void setInitializer(IASTInitializer initializer) {
|
||||||
i = initializer;
|
this.initializer = initializer;
|
||||||
|
if (initializer != null) {
|
||||||
|
initializer.setParent(this);
|
||||||
|
initializer.setPropertyInParent(INITIALIZER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
@ -51,8 +68,8 @@ public class CASTTypeIdInitializerExpression extends CASTNode implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( t != null ) if( !t.accept( action ) ) return false;
|
if( typeId != null ) if( !typeId.accept( action ) ) return false;
|
||||||
if( i != null ) if( !i.accept( action ) ) return false;
|
if( initializer != null ) if( !initializer.accept( action ) ) return false;
|
||||||
|
|
||||||
if( action.shouldVisitExpressions ){
|
if( action.shouldVisitExpressions ){
|
||||||
switch( action.leave( this ) ){
|
switch( action.leave( this ) ){
|
||||||
|
@ -67,5 +84,4 @@ public class CASTTypeIdInitializerExpression extends CASTNode implements
|
||||||
public IType getExpressionType() {
|
public IType getExpressionType() {
|
||||||
return CVisitor.getExpressionType(this);
|
return CVisitor.getExpressionType(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,18 +31,24 @@ public class CASTTypedefNameSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
ICASTTypedefNameSpecifier, IASTCompletionContext {
|
ICASTTypedefNameSpecifier, IASTCompletionContext {
|
||||||
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTTypedefNameSpecifier#getName()
|
public CASTTypedefNameSpecifier() {
|
||||||
*/
|
}
|
||||||
public IASTName getName() {
|
|
||||||
|
public CASTTypedefNameSpecifier(IASTName name) {
|
||||||
|
setName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTName getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTTypedefNameSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
@ -64,9 +70,6 @@ public class CASTTypedefNameSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public int getRoleForName(IASTName n) {
|
public int getRoleForName(IASTName n) {
|
||||||
if( n == name ) return r_reference;
|
if( n == name ) return r_reference;
|
||||||
return r_unclear;
|
return r_unclear;
|
||||||
|
|
|
@ -27,7 +27,16 @@ public class CASTUnaryExpression extends CASTNode implements
|
||||||
private int operator;
|
private int operator;
|
||||||
private IASTExpression operand;
|
private IASTExpression operand;
|
||||||
|
|
||||||
public int getOperator() {
|
|
||||||
|
public CASTUnaryExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CASTUnaryExpression(int operator, IASTExpression operand) {
|
||||||
|
this.operator = operator;
|
||||||
|
setOperand(operand);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOperator() {
|
||||||
return operator;
|
return operator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +50,10 @@ public class CASTUnaryExpression extends CASTNode implements
|
||||||
|
|
||||||
public void setOperand(IASTExpression expression) {
|
public void setOperand(IASTExpression expression) {
|
||||||
operand = expression;
|
operand = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(OPERAND);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -26,32 +26,37 @@ public class CASTWhileStatement extends CASTNode implements IASTWhileStatement,
|
||||||
private IASTExpression condition;
|
private IASTExpression condition;
|
||||||
private IASTStatement body;
|
private IASTStatement body;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTWhileStatement#getCondition()
|
public CASTWhileStatement() {
|
||||||
*/
|
}
|
||||||
public IASTExpression getCondition() {
|
|
||||||
|
public CASTWhileStatement(IASTExpression condition, IASTStatement body) {
|
||||||
|
setCondition(condition);
|
||||||
|
setBody(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getCondition() {
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTWhileStatement#setCondition(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setCondition(IASTExpression condition) {
|
public void setCondition(IASTExpression condition) {
|
||||||
this.condition = condition;
|
this.condition = condition;
|
||||||
|
if (condition != null) {
|
||||||
|
condition.setParent(this);
|
||||||
|
condition.setPropertyInParent(CONDITIONEXPRESSION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTWhileStatement#getBody()
|
|
||||||
*/
|
|
||||||
public IASTStatement getBody() {
|
public IASTStatement getBody() {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTWhileStatement#setBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
|
||||||
*/
|
|
||||||
public void setBody(IASTStatement body) {
|
public void setBody(IASTStatement body) {
|
||||||
this.body = body;
|
this.body = body;
|
||||||
|
if (body != null) {
|
||||||
|
body.setParent(this);
|
||||||
|
body.setPropertyInParent(BODY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -23,28 +23,25 @@ import org.eclipse.cdt.core.dom.ast.gnu.c.IGCCASTSimpleDeclSpecifier;
|
||||||
* @author aniefer
|
* @author aniefer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GCCASTSimpleDeclSpecifier extends CASTSimpleDeclSpecifier
|
public class GCCASTSimpleDeclSpecifier extends CASTSimpleDeclSpecifier implements IGCCASTSimpleDeclSpecifier {
|
||||||
implements IGCCASTSimpleDeclSpecifier {
|
|
||||||
|
|
||||||
private IASTExpression typeOfExpression;
|
private IASTExpression typeOfExpression;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public GCCASTSimpleDeclSpecifier() {
|
public GCCASTSimpleDeclSpecifier() {
|
||||||
super();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public GCCASTSimpleDeclSpecifier(IASTExpression typeofExpression) {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.gnu.c.IGCCASTSimpleDeclSpecifier#setTypeofExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
setTypeofExpression(typeofExpression);
|
||||||
*/
|
}
|
||||||
|
|
||||||
public void setTypeofExpression(IASTExpression typeofExpression) {
|
public void setTypeofExpression(IASTExpression typeofExpression) {
|
||||||
this.typeOfExpression = typeofExpression;
|
this.typeOfExpression = typeofExpression;
|
||||||
|
if (typeofExpression != null) {
|
||||||
|
typeofExpression.setParent(this);
|
||||||
|
typeofExpression.setPropertyInParent(TYPEOF_EXPRESSION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.gnu.c.IGCCASTSimpleDeclSpecifier#getTypeofExpression()
|
|
||||||
*/
|
|
||||||
public IASTExpression getTypeofExpression() {
|
public IASTExpression getTypeofExpression() {
|
||||||
return typeOfExpression;
|
return typeOfExpression;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -16,20 +16,22 @@ import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTASMDeclaration extends CPPASTNode implements
|
public class CPPASTASMDeclaration extends CPPASTNode implements IASTASMDeclaration {
|
||||||
IASTASMDeclaration {
|
|
||||||
char [] assembly = null;
|
char [] assembly = null;
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTASMDeclaration#getAssembly()
|
public CPPASTASMDeclaration() {
|
||||||
*/
|
}
|
||||||
public String getAssembly() {
|
|
||||||
if( assembly == null ) return ""; //$NON-NLS-1$
|
public CPPASTASMDeclaration(String assembly) {
|
||||||
|
setAssembly(assembly);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAssembly() {
|
||||||
|
if( assembly == null )
|
||||||
|
return ""; //$NON-NLS-1$
|
||||||
return new String( assembly );
|
return new String( assembly );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTASMDeclaration#setAssembly(java.lang.String)
|
|
||||||
*/
|
|
||||||
public void setAssembly(String assembly) {
|
public void setAssembly(String assembly) {
|
||||||
this.assembly = assembly.toCharArray();
|
this.assembly = assembly.toCharArray();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,7 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousDeclaration;
|
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousDeclaration;
|
||||||
|
|
||||||
public class CPPASTAmbiguousDeclaration extends CPPASTAmbiguity implements
|
public class CPPASTAmbiguousDeclaration extends CPPASTAmbiguity implements IASTAmbiguousDeclaration {
|
||||||
IASTAmbiguousDeclaration {
|
|
||||||
|
|
||||||
protected IASTNode[] getNodes() {
|
protected IASTNode[] getNodes() {
|
||||||
return getDeclarations();
|
return getDeclarations();
|
||||||
|
@ -28,6 +27,8 @@ public class CPPASTAmbiguousDeclaration extends CPPASTAmbiguity implements
|
||||||
public void addDeclaration(IASTDeclaration d) {
|
public void addDeclaration(IASTDeclaration d) {
|
||||||
if (d != null) {
|
if (d != null) {
|
||||||
decls = (IASTDeclaration[]) ArrayUtil.append(IASTDeclaration.class, decls, ++declsPos, d );
|
decls = (IASTDeclaration[]) ArrayUtil.append(IASTDeclaration.class, decls, ++declsPos, d );
|
||||||
|
d.setParent(this);
|
||||||
|
d.setPropertyInParent(SUBDECLARATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,9 @@ public class CPPASTAmbiguousExpression extends CPPASTAmbiguity implements
|
||||||
|
|
||||||
public void addExpression(IASTExpression e) {
|
public void addExpression(IASTExpression e) {
|
||||||
if (e != null) {
|
if (e != null) {
|
||||||
exp = (IASTExpression[]) ArrayUtil.append( IASTExpression.class, exp, ++expPos, e );
|
exp = (IASTExpression[]) ArrayUtil.append( IASTExpression.class, exp, ++expPos, e );
|
||||||
|
e.setParent(this);
|
||||||
|
e.setPropertyInParent(SUBEXPRESSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@ public class CPPASTAmbiguousStatement extends CPPASTAmbiguity implements
|
||||||
public void addStatement(IASTStatement s) {
|
public void addStatement(IASTStatement s) {
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
stmts = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, stmts, ++stmtsPos, s );
|
stmts = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, stmts, ++stmtsPos, s );
|
||||||
|
s.setParent(this);
|
||||||
|
s.setPropertyInParent(STATEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@ public class CPPASTArrayDeclarator extends CPPASTDeclarator implements
|
||||||
public void addArrayModifier(IASTArrayModifier arrayModifier) {
|
public void addArrayModifier(IASTArrayModifier arrayModifier) {
|
||||||
if (arrayModifier != null) {
|
if (arrayModifier != null) {
|
||||||
arrayMods = (IASTArrayModifier[]) ArrayUtil.append( IASTArrayModifier.class, arrayMods, ++arrayModsPos, arrayModifier );
|
arrayMods = (IASTArrayModifier[]) ArrayUtil.append( IASTArrayModifier.class, arrayMods, ++arrayModsPos, arrayModifier );
|
||||||
|
arrayModifier.setParent(this);
|
||||||
|
arrayModifier.setPropertyInParent(ARRAY_MODIFIER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,27 +19,27 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTArrayModifier extends CPPASTNode implements
|
public class CPPASTArrayModifier extends CPPASTNode implements IASTArrayModifier, IASTAmbiguityParent {
|
||||||
IASTArrayModifier, IASTAmbiguityParent {
|
|
||||||
|
|
||||||
private IASTExpression exp;
|
private IASTExpression exp;
|
||||||
|
|
||||||
/*
|
public CPPASTArrayModifier() {
|
||||||
* (non-Javadoc)
|
}
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTArrayModifier#getConstantExpression()
|
public CPPASTArrayModifier(IASTExpression exp) {
|
||||||
*/
|
setConstantExpression(exp);
|
||||||
public IASTExpression getConstantExpression() {
|
}
|
||||||
|
|
||||||
|
public IASTExpression getConstantExpression() {
|
||||||
return exp;
|
return exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTArrayModifier#setConstantExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setConstantExpression(IASTExpression expression) {
|
public void setConstantExpression(IASTExpression expression) {
|
||||||
exp = expression;
|
exp = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(CONSTANT_EXPRESSION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept(ASTVisitor action) {
|
public boolean accept(ASTVisitor action) {
|
||||||
|
|
|
@ -20,18 +20,30 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTArraySubscriptExpression extends CPPASTNode implements
|
public class CPPASTArraySubscriptExpression extends CPPASTNode implements IASTArraySubscriptExpression, IASTAmbiguityParent {
|
||||||
IASTArraySubscriptExpression, IASTAmbiguityParent {
|
|
||||||
|
|
||||||
private IASTExpression subscriptExp;
|
private IASTExpression subscriptExp;
|
||||||
private IASTExpression arrayExpression;
|
private IASTExpression arrayExpression;
|
||||||
|
|
||||||
public IASTExpression getArrayExpression() {
|
|
||||||
|
public CPPASTArraySubscriptExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CPPASTArraySubscriptExpression(IASTExpression arrayExpression, IASTExpression subscriptExp) {
|
||||||
|
setArrayExpression(arrayExpression);
|
||||||
|
setSubscriptExpression(subscriptExp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getArrayExpression() {
|
||||||
return arrayExpression;
|
return arrayExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setArrayExpression(IASTExpression expression) {
|
public void setArrayExpression(IASTExpression expression) {
|
||||||
arrayExpression = expression;
|
arrayExpression = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(ARRAY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTExpression getSubscriptExpression() {
|
public IASTExpression getSubscriptExpression() {
|
||||||
|
@ -40,6 +52,10 @@ public class CPPASTArraySubscriptExpression extends CPPASTNode implements
|
||||||
|
|
||||||
public void setSubscriptExpression(IASTExpression expression) {
|
public void setSubscriptExpression(IASTExpression expression) {
|
||||||
subscriptExp = expression;
|
subscriptExp = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(SUBSCRIPT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -15,8 +15,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public abstract class CPPASTBaseDeclSpecifier extends CPPASTNode implements
|
public abstract class CPPASTBaseDeclSpecifier extends CPPASTNode implements ICPPASTDeclSpecifier {
|
||||||
ICPPASTDeclSpecifier {
|
|
||||||
|
|
||||||
private boolean friend;
|
private boolean friend;
|
||||||
private boolean inline;
|
private boolean inline;
|
||||||
|
@ -26,100 +25,58 @@ public abstract class CPPASTBaseDeclSpecifier extends CPPASTNode implements
|
||||||
private boolean virtual;
|
private boolean virtual;
|
||||||
private boolean explicit;
|
private boolean explicit;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#isFriend()
|
|
||||||
*/
|
|
||||||
public boolean isFriend() {
|
public boolean isFriend() {
|
||||||
return friend;
|
return friend;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#getStorageClass()
|
|
||||||
*/
|
|
||||||
public int getStorageClass() {
|
public int getStorageClass() {
|
||||||
return sc;
|
return sc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setStorageClass(int)
|
|
||||||
*/
|
|
||||||
public void setStorageClass(int storageClass) {
|
public void setStorageClass(int storageClass) {
|
||||||
sc = storageClass;
|
sc = storageClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#isConst()
|
|
||||||
*/
|
|
||||||
public boolean isConst() {
|
public boolean isConst() {
|
||||||
return isConst;
|
return isConst;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setConst(boolean)
|
|
||||||
*/
|
|
||||||
public void setConst(boolean value) {
|
public void setConst(boolean value) {
|
||||||
isConst = value;
|
isConst = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#isVolatile()
|
|
||||||
*/
|
|
||||||
public boolean isVolatile() {
|
public boolean isVolatile() {
|
||||||
return volatil;
|
return volatil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setVolatile(boolean)
|
|
||||||
*/
|
|
||||||
public void setVolatile(boolean value) {
|
public void setVolatile(boolean value) {
|
||||||
volatil = value;
|
volatil = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#isInline()
|
|
||||||
*/
|
|
||||||
public boolean isInline() {
|
public boolean isInline() {
|
||||||
return inline;
|
return inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setInline(boolean)
|
|
||||||
*/
|
|
||||||
public void setInline(boolean value) {
|
public void setInline(boolean value) {
|
||||||
this.inline = value;
|
this.inline = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#setIsFriend(boolean)
|
|
||||||
*/
|
|
||||||
public void setFriend(boolean value) {
|
public void setFriend(boolean value) {
|
||||||
friend = value;
|
friend = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#isVirtual()
|
|
||||||
*/
|
|
||||||
public boolean isVirtual() {
|
public boolean isVirtual() {
|
||||||
return virtual;
|
return virtual;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#setVirtual(boolean)
|
|
||||||
*/
|
|
||||||
public void setVirtual(boolean value) {
|
public void setVirtual(boolean value) {
|
||||||
virtual = value;
|
virtual = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#isExplicit()
|
|
||||||
*/
|
|
||||||
public boolean isExplicit() {
|
public boolean isExplicit() {
|
||||||
return explicit;
|
return explicit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#setExplicit(boolean)
|
|
||||||
*/
|
|
||||||
public void setExplicit(boolean value) {
|
public void setExplicit(boolean value) {
|
||||||
this.explicit = value;
|
this.explicit = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,46 +33,32 @@ public class CPPASTBaseSpecifier extends CPPASTNode implements
|
||||||
private int visibility;
|
private int visibility;
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#isVirtual()
|
|
||||||
*/
|
|
||||||
public boolean isVirtual() {
|
public boolean isVirtual() {
|
||||||
return isVirtual;
|
return isVirtual;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#setVirtual(boolean)
|
|
||||||
*/
|
|
||||||
public void setVirtual(boolean value) {
|
public void setVirtual(boolean value) {
|
||||||
isVirtual = value;
|
isVirtual = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#getVisibility()
|
|
||||||
*/
|
|
||||||
public int getVisibility() {
|
public int getVisibility() {
|
||||||
return visibility;
|
return visibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#setVisibility(int)
|
|
||||||
*/
|
|
||||||
public void setVisibility(int visibility) {
|
public void setVisibility(int visibility) {
|
||||||
this.visibility = visibility;
|
this.visibility = visibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#getName()
|
|
||||||
*/
|
|
||||||
public IASTName getName() {
|
public IASTName getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
@ -98,9 +84,6 @@ public class CPPASTBaseSpecifier extends CPPASTNode implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public int getRoleForName(IASTName n) {
|
public int getRoleForName(IASTName n) {
|
||||||
if( name == n ) return r_reference;
|
if( name == n ) return r_reference;
|
||||||
return r_unclear;
|
return r_unclear;
|
||||||
|
|
|
@ -27,7 +27,16 @@ public class CPPASTBinaryExpression extends CPPASTNode implements
|
||||||
private IASTExpression operand1;
|
private IASTExpression operand1;
|
||||||
private IASTExpression operand2;
|
private IASTExpression operand2;
|
||||||
|
|
||||||
public int getOperator() {
|
public CPPASTBinaryExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CPPASTBinaryExpression(int op, IASTExpression operand1, IASTExpression operand2) {
|
||||||
|
this.op = op;
|
||||||
|
setOperand1(operand1);
|
||||||
|
setOperand2(operand2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOperator() {
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,10 +54,18 @@ public class CPPASTBinaryExpression extends CPPASTNode implements
|
||||||
|
|
||||||
public void setOperand1(IASTExpression expression) {
|
public void setOperand1(IASTExpression expression) {
|
||||||
operand1 = expression;
|
operand1 = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(OPERAND_ONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOperand2(IASTExpression expression) {
|
public void setOperand2(IASTExpression expression) {
|
||||||
operand2 = expression;
|
operand2 = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(OPERAND_TWO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -19,22 +19,27 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTCaseStatement extends CPPASTNode implements
|
public class CPPASTCaseStatement extends CPPASTNode implements IASTCaseStatement, IASTAmbiguityParent {
|
||||||
IASTCaseStatement, IASTAmbiguityParent {
|
|
||||||
private IASTExpression expression;
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
private IASTExpression expression;
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCaseStatement#getExpression()
|
|
||||||
*/
|
public CPPASTCaseStatement() {
|
||||||
public IASTExpression getExpression() {
|
}
|
||||||
|
|
||||||
|
public CPPASTCaseStatement(IASTExpression expression) {
|
||||||
|
setExpression(expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getExpression() {
|
||||||
return expression;
|
return expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCaseStatement#setExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setExpression(IASTExpression expression) {
|
public void setExpression(IASTExpression expression) {
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(EXPRESSION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -18,23 +18,39 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTCastExpression extends CPPASTUnaryExpression implements
|
public class CPPASTCastExpression extends CPPASTUnaryExpression implements ICPPASTCastExpression {
|
||||||
ICPPASTCastExpression {
|
|
||||||
private IASTTypeId typeId;
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
private IASTTypeId typeId;
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTUnaryTypeIdExpression#setTypeId(org.eclipse.cdt.core.dom.ast.IASTTypeId)
|
|
||||||
*/
|
public CPPASTCastExpression() {
|
||||||
public void setTypeId(IASTTypeId typeId) {
|
}
|
||||||
|
|
||||||
|
public CPPASTCastExpression(IASTTypeId typeId) {
|
||||||
|
setTypeId(typeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypeId(IASTTypeId typeId) {
|
||||||
this.typeId = typeId;
|
this.typeId = typeId;
|
||||||
|
if (typeId != null) {
|
||||||
|
typeId.setParent(this);
|
||||||
|
typeId.setPropertyInParent(TYPE_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTUnaryTypeIdExpression#getTypeId()
|
|
||||||
*/
|
|
||||||
public IASTTypeId getTypeId() {
|
public IASTTypeId getTypeId() {
|
||||||
return typeId;
|
return typeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOperand(IASTExpression expression) {
|
||||||
|
super.setOperand(expression);
|
||||||
|
// this needs to be overridden because CPPASTUnaryExpression sets
|
||||||
|
// propertyInParent to ICPPASTUnaryExpression.OPERAND, we want
|
||||||
|
// ICPPASTCastExpression.OPERAND
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(ICPPASTCastExpression.OPERAND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
if( action.shouldVisitExpressions ){
|
if( action.shouldVisitExpressions ){
|
||||||
|
|
|
@ -20,51 +20,49 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTCatchHandler extends CPPASTNode implements
|
public class CPPASTCatchHandler extends CPPASTNode implements ICPPASTCatchHandler, IASTAmbiguityParent {
|
||||||
ICPPASTCatchHandler, IASTAmbiguityParent {
|
|
||||||
|
|
||||||
private boolean isCatchAll;
|
private boolean isCatchAll;
|
||||||
private IASTStatement body;
|
private IASTStatement body;
|
||||||
private IASTDeclaration declaration;
|
private IASTDeclaration declaration;
|
||||||
|
|
||||||
|
public CPPASTCatchHandler() {
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public CPPASTCatchHandler(boolean isCatchAll, IASTStatement body, IASTDeclaration declaration) {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#setIsCatchAll(boolean)
|
this.isCatchAll = isCatchAll;
|
||||||
*/
|
setCatchBody(body);
|
||||||
public void setIsCatchAll(boolean isEllipsis) {
|
setDeclaration(declaration);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsCatchAll(boolean isEllipsis) {
|
||||||
isCatchAll = isEllipsis;
|
isCatchAll = isEllipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#isCatchAll()
|
|
||||||
*/
|
|
||||||
public boolean isCatchAll() {
|
public boolean isCatchAll() {
|
||||||
return isCatchAll;
|
return isCatchAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#setCatchBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
|
||||||
*/
|
|
||||||
public void setCatchBody(IASTStatement compoundStatement) {
|
public void setCatchBody(IASTStatement compoundStatement) {
|
||||||
body = compoundStatement;
|
body = compoundStatement;
|
||||||
|
if (compoundStatement != null) {
|
||||||
|
compoundStatement.setParent(this);
|
||||||
|
compoundStatement.setPropertyInParent(CATCH_BODY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#getCatchBody()
|
|
||||||
*/
|
|
||||||
public IASTStatement getCatchBody() {
|
public IASTStatement getCatchBody() {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#setDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
|
||||||
*/
|
|
||||||
public void setDeclaration(IASTDeclaration decl) {
|
public void setDeclaration(IASTDeclaration decl) {
|
||||||
declaration = decl;
|
declaration = decl;
|
||||||
|
if (decl != null) {
|
||||||
|
decl.setParent(this);
|
||||||
|
decl.setPropertyInParent(DECLARATION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#getDeclaration()
|
|
||||||
*/
|
|
||||||
public IASTDeclaration getDeclaration() {
|
public IASTDeclaration getDeclaration() {
|
||||||
return declaration;
|
return declaration;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,73 +29,65 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
private IASTName n;
|
private IASTName n;
|
||||||
private IScope scope;
|
private IScope scope;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#getRawSignature()
|
public CPPASTCompositeTypeSpecifier() {
|
||||||
*/
|
}
|
||||||
public String getRawSignature() {
|
|
||||||
|
public CPPASTCompositeTypeSpecifier(int k, IASTName n) {
|
||||||
|
this.k = k;
|
||||||
|
setName(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRawSignature() {
|
||||||
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
|
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier#getBaseSpecifiers()
|
|
||||||
*/
|
|
||||||
public ICPPASTBaseSpecifier[] getBaseSpecifiers() {
|
public ICPPASTBaseSpecifier[] getBaseSpecifiers() {
|
||||||
if( baseSpecs == null ) return ICPPASTBaseSpecifier.EMPTY_BASESPECIFIER_ARRAY;
|
if( baseSpecs == null ) return ICPPASTBaseSpecifier.EMPTY_BASESPECIFIER_ARRAY;
|
||||||
baseSpecs = (ICPPASTBaseSpecifier[]) ArrayUtil.removeNullsAfter( ICPPASTBaseSpecifier.class, baseSpecs, baseSpecsPos );
|
baseSpecs = (ICPPASTBaseSpecifier[]) ArrayUtil.removeNullsAfter( ICPPASTBaseSpecifier.class, baseSpecs, baseSpecsPos );
|
||||||
return baseSpecs;
|
return baseSpecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier#addBaseSpecifier(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier)
|
|
||||||
*/
|
|
||||||
public void addBaseSpecifier(ICPPASTBaseSpecifier baseSpec) {
|
public void addBaseSpecifier(ICPPASTBaseSpecifier baseSpec) {
|
||||||
if (baseSpec != null) {
|
if (baseSpec != null) {
|
||||||
|
baseSpec.setParent(this);
|
||||||
|
baseSpec.setPropertyInParent(BASE_SPECIFIER);
|
||||||
baseSpecs = (ICPPASTBaseSpecifier[]) ArrayUtil.append( ICPPASTBaseSpecifier.class, baseSpecs, ++baseSpecsPos, baseSpec );
|
baseSpecs = (ICPPASTBaseSpecifier[]) ArrayUtil.append( ICPPASTBaseSpecifier.class, baseSpecs, ++baseSpecsPos, baseSpec );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getKey()
|
|
||||||
*/
|
|
||||||
public int getKey() {
|
public int getKey() {
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#setKey(int)
|
|
||||||
*/
|
|
||||||
public void setKey(int key) {
|
public void setKey(int key) {
|
||||||
k = key;
|
k = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getName()
|
|
||||||
*/
|
|
||||||
public IASTName getName() {
|
public IASTName getName() {
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
this.n = name;
|
this.n = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(TYPE_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getMembers()
|
|
||||||
*/
|
|
||||||
public IASTDeclaration[] getMembers() {
|
public IASTDeclaration[] getMembers() {
|
||||||
if( declarations == null ) return IASTDeclaration.EMPTY_DECLARATION_ARRAY;
|
if( declarations == null ) return IASTDeclaration.EMPTY_DECLARATION_ARRAY;
|
||||||
return (IASTDeclaration[]) ArrayUtil.trim( IASTDeclaration.class, declarations );
|
return (IASTDeclaration[]) ArrayUtil.trim( IASTDeclaration.class, declarations );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#addMemberDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
|
||||||
*/
|
|
||||||
public void addMemberDeclaration(IASTDeclaration declaration) {
|
public void addMemberDeclaration(IASTDeclaration declaration) {
|
||||||
declarations = (IASTDeclaration[]) ArrayUtil.append( IASTDeclaration.class, declarations, declaration );
|
declarations = (IASTDeclaration[]) ArrayUtil.append( IASTDeclaration.class, declarations, declaration );
|
||||||
|
if(declaration != null) {
|
||||||
|
declaration.setParent(this);
|
||||||
|
declaration.setPropertyInParent(MEMBER_DECLARATION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,9 +95,6 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
private ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier [] baseSpecs = null;
|
private ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier [] baseSpecs = null;
|
||||||
private int baseSpecsPos=-1;
|
private int baseSpecsPos=-1;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getScope()
|
|
||||||
*/
|
|
||||||
public IScope getScope() {
|
public IScope getScope() {
|
||||||
if( scope == null )
|
if( scope == null )
|
||||||
scope = new CPPClassScope( this );
|
scope = new CPPClassScope( this );
|
||||||
|
@ -144,9 +133,6 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public int getRoleForName(IASTName name) {
|
public int getRoleForName(IASTName name) {
|
||||||
if( name == this.n )
|
if( name == this.n )
|
||||||
return r_definition;
|
return r_definition;
|
||||||
|
|
|
@ -29,24 +29,19 @@ public class CPPASTCompoundStatement extends CPPASTNode implements
|
||||||
private ICPPScope scope = null;
|
private ICPPScope scope = null;
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompoundStatement#getStatements()
|
|
||||||
*/
|
|
||||||
public IASTStatement[] getStatements() {
|
public IASTStatement[] getStatements() {
|
||||||
if( statements == null ) return IASTStatement.EMPTY_STATEMENT_ARRAY;
|
if( statements == null ) return IASTStatement.EMPTY_STATEMENT_ARRAY;
|
||||||
return (IASTStatement[]) ArrayUtil.trim( IASTStatement.class, statements );
|
return (IASTStatement[]) ArrayUtil.trim( IASTStatement.class, statements );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompoundStatement#addStatement(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
|
||||||
*/
|
|
||||||
public void addStatement(IASTStatement statement) {
|
public void addStatement(IASTStatement statement) {
|
||||||
statements = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, statements, statement );
|
statements = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, statements, statement );
|
||||||
|
if (statement != null) {
|
||||||
|
statement.setParent(this);
|
||||||
|
statement.setPropertyInParent(NESTED_STATEMENT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompoundStatement#resolveScope()
|
|
||||||
*/
|
|
||||||
public IScope getScope() {
|
public IScope getScope() {
|
||||||
if( scope == null )
|
if( scope == null )
|
||||||
scope = new CPPBlockScope( this );
|
scope = new CPPBlockScope( this );
|
||||||
|
|
|
@ -18,16 +18,28 @@ import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTCompoundStatementExpression extends CPPASTNode implements
|
public class CPPASTCompoundStatementExpression extends CPPASTNode implements IGNUASTCompoundStatementExpression {
|
||||||
IGNUASTCompoundStatementExpression {
|
|
||||||
private IASTCompoundStatement statement;
|
private IASTCompoundStatement statement;
|
||||||
|
|
||||||
public IASTCompoundStatement getCompoundStatement() {
|
|
||||||
|
public CPPASTCompoundStatementExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CPPASTCompoundStatementExpression(IASTCompoundStatement statement) {
|
||||||
|
setCompoundStatement(statement);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTCompoundStatement getCompoundStatement() {
|
||||||
return statement;
|
return statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCompoundStatement(IASTCompoundStatement statement) {
|
public void setCompoundStatement(IASTCompoundStatement statement) {
|
||||||
this.statement = statement;
|
this.statement = statement;
|
||||||
|
if (statement != null) {
|
||||||
|
statement.setParent(this);
|
||||||
|
statement.setPropertyInParent(STATEMENT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -22,16 +22,31 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
*/
|
*/
|
||||||
public class CPPASTConditionalExpression extends CPPASTNode implements
|
public class CPPASTConditionalExpression extends CPPASTNode implements
|
||||||
IASTConditionalExpression, IASTAmbiguityParent {
|
IASTConditionalExpression, IASTAmbiguityParent {
|
||||||
|
|
||||||
private IASTExpression condition;
|
private IASTExpression condition;
|
||||||
private IASTExpression negative;
|
private IASTExpression negative;
|
||||||
private IASTExpression postive;
|
private IASTExpression postive;
|
||||||
|
|
||||||
public IASTExpression getLogicalConditionExpression() {
|
|
||||||
|
public CPPASTConditionalExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CPPASTConditionalExpression(IASTExpression condition, IASTExpression postive, IASTExpression negative) {
|
||||||
|
setLogicalConditionExpression(condition);
|
||||||
|
setPositiveResultExpression(postive);
|
||||||
|
setNegativeResultExpression(negative);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getLogicalConditionExpression() {
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLogicalConditionExpression(IASTExpression expression) {
|
public void setLogicalConditionExpression(IASTExpression expression) {
|
||||||
condition = expression;
|
condition = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(LOGICAL_CONDITION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTExpression getPositiveResultExpression() {
|
public IASTExpression getPositiveResultExpression() {
|
||||||
|
@ -40,6 +55,10 @@ public class CPPASTConditionalExpression extends CPPASTNode implements
|
||||||
|
|
||||||
public void setPositiveResultExpression(IASTExpression expression) {
|
public void setPositiveResultExpression(IASTExpression expression) {
|
||||||
this.postive = expression;
|
this.postive = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(POSITIVE_RESULT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTExpression getNegativeResultExpression() {
|
public IASTExpression getNegativeResultExpression() {
|
||||||
|
@ -48,6 +67,10 @@ public class CPPASTConditionalExpression extends CPPASTNode implements
|
||||||
|
|
||||||
public void setNegativeResultExpression(IASTExpression expression) {
|
public void setNegativeResultExpression(IASTExpression expression) {
|
||||||
this.negative = expression;
|
this.negative = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(NEGATIVE_RESULT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -24,43 +24,40 @@ public class CPPASTConstructorChainInitializer extends CPPASTNode implements
|
||||||
ICPPASTConstructorChainInitializer, IASTAmbiguityParent {
|
ICPPASTConstructorChainInitializer, IASTAmbiguityParent {
|
||||||
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
private IASTExpression value;
|
private IASTExpression value;
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
public CPPASTConstructorChainInitializer() {
|
||||||
*
|
}
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer#getMemberInitializerId()
|
|
||||||
*/
|
public CPPASTConstructorChainInitializer(IASTName name, IASTExpression value) {
|
||||||
public IASTName getMemberInitializerId() {
|
setMemberInitializerId(name);
|
||||||
|
setInitializerValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTName getMemberInitializerId() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer#setMemberInitializerId(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public void setMemberInitializerId(IASTName name) {
|
public void setMemberInitializerId(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if(name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(MEMBER_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer#getInitializerValue()
|
|
||||||
*/
|
|
||||||
public IASTExpression getInitializerValue() {
|
public IASTExpression getInitializerValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer#setInitializerValue(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setInitializerValue(IASTExpression expression) {
|
public void setInitializerValue(IASTExpression expression) {
|
||||||
value = expression;
|
value = expression;
|
||||||
|
if(expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(INITIALIZER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept(ASTVisitor action) {
|
public boolean accept(ASTVisitor action) {
|
||||||
|
@ -73,11 +70,6 @@ public class CPPASTConstructorChainInitializer extends CPPASTNode implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public int getRoleForName(IASTName n) {
|
public int getRoleForName(IASTName n) {
|
||||||
if (name == n)
|
if (name == n)
|
||||||
return r_reference;
|
return r_reference;
|
||||||
|
|
|
@ -24,18 +24,24 @@ public class CPPASTConstructorInitializer extends CPPASTNode implements
|
||||||
|
|
||||||
private IASTExpression exp;
|
private IASTExpression exp;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorInitializer#getExpression()
|
public CPPASTConstructorInitializer() {
|
||||||
*/
|
}
|
||||||
public IASTExpression getExpression() {
|
|
||||||
|
public CPPASTConstructorInitializer(IASTExpression exp) {
|
||||||
|
setExpression(exp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getExpression() {
|
||||||
return exp;
|
return exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorInitializer#setExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setExpression(IASTExpression expression) {
|
public void setExpression(IASTExpression expression) {
|
||||||
this.exp = expression;
|
this.exp = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(EXPRESSION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -21,22 +21,31 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName;
|
||||||
* @author dsteffle
|
* @author dsteffle
|
||||||
*/
|
*/
|
||||||
public class CPPASTConversionName extends CPPASTName implements ICPPASTConversionName {
|
public class CPPASTConversionName extends CPPASTName implements ICPPASTConversionName {
|
||||||
private IASTTypeId typeId=null;
|
|
||||||
|
private IASTTypeId typeId = null;
|
||||||
|
|
||||||
public CPPASTConversionName() {
|
public CPPASTConversionName() {
|
||||||
super();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CPPASTConversionName(char[] name) {
|
public CPPASTConversionName(char[] name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CPPASTConversionName(char[] name, IASTTypeId typeId) {
|
||||||
|
super(name);
|
||||||
|
setTypeId(typeId);
|
||||||
|
}
|
||||||
|
|
||||||
public IASTTypeId getTypeId() {
|
public IASTTypeId getTypeId() {
|
||||||
return typeId;
|
return typeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTypeId(IASTTypeId typeId) {
|
public void setTypeId(IASTTypeId typeId) {
|
||||||
this.typeId=typeId;
|
this.typeId=typeId;
|
||||||
|
if (typeId != null) {
|
||||||
|
typeId.setParent(this);
|
||||||
|
typeId.setPropertyInParent(TYPE_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept(ASTVisitor action) {
|
public boolean accept(ASTVisitor action) {
|
||||||
|
|
|
@ -24,18 +24,24 @@ public class CPPASTDeclarationStatement extends CPPASTNode implements
|
||||||
|
|
||||||
private IASTDeclaration declaration;
|
private IASTDeclaration declaration;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement#getDeclaration()
|
public CPPASTDeclarationStatement() {
|
||||||
*/
|
}
|
||||||
public IASTDeclaration getDeclaration() {
|
|
||||||
|
public CPPASTDeclarationStatement(IASTDeclaration declaration) {
|
||||||
|
setDeclaration(declaration);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTDeclaration getDeclaration() {
|
||||||
return declaration;
|
return declaration;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement#setDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
|
||||||
*/
|
|
||||||
public void setDeclaration(IASTDeclaration declaration) {
|
public void setDeclaration(IASTDeclaration declaration) {
|
||||||
this.declaration = declaration;
|
this.declaration = declaration;
|
||||||
|
if (declaration != null) {
|
||||||
|
declaration.setParent(this);
|
||||||
|
declaration.setPropertyInParent(DECLARATION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -35,65 +35,68 @@ public class CPPASTDeclarator extends CPPASTNode implements IASTDeclarator {
|
||||||
private IASTPointerOperator [] pointerOps = null;
|
private IASTPointerOperator [] pointerOps = null;
|
||||||
private int pointerOpsPos=-1;
|
private int pointerOpsPos=-1;
|
||||||
|
|
||||||
|
|
||||||
|
public CPPASTDeclarator() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CPPASTDeclarator(IASTName name) {
|
||||||
|
setName(name);
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public CPPASTDeclarator(IASTName name, IASTInitializer initializer) {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getPointerOperators()
|
this(name);
|
||||||
*/
|
setInitializer(initializer);
|
||||||
public IASTPointerOperator[] getPointerOperators() {
|
}
|
||||||
|
|
||||||
|
public IASTPointerOperator[] getPointerOperators() {
|
||||||
if( pointerOps == null ) return IASTPointerOperator.EMPTY_ARRAY;
|
if( pointerOps == null ) return IASTPointerOperator.EMPTY_ARRAY;
|
||||||
pointerOps = (IASTPointerOperator[]) ArrayUtil.removeNullsAfter( IASTPointerOperator.class, pointerOps, pointerOpsPos );
|
pointerOps = (IASTPointerOperator[]) ArrayUtil.removeNullsAfter( IASTPointerOperator.class, pointerOps, pointerOpsPos );
|
||||||
return pointerOps;
|
return pointerOps;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getNestedDeclarator()
|
|
||||||
*/
|
|
||||||
public IASTDeclarator getNestedDeclarator() {
|
public IASTDeclarator getNestedDeclarator() {
|
||||||
return nestedDeclarator;
|
return nestedDeclarator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getName()
|
|
||||||
*/
|
|
||||||
public IASTName getName() {
|
public IASTName getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getInitializer()
|
|
||||||
*/
|
|
||||||
public IASTInitializer getInitializer() {
|
public IASTInitializer getInitializer() {
|
||||||
return initializer;
|
return initializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param initializer
|
|
||||||
*/
|
|
||||||
public void setInitializer(IASTInitializer initializer) {
|
public void setInitializer(IASTInitializer initializer) {
|
||||||
this.initializer = initializer;
|
this.initializer = initializer;
|
||||||
|
if (initializer != null) {
|
||||||
|
initializer.setParent(this);
|
||||||
|
initializer.setPropertyInParent(INITIALIZER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#addPointerOperator(org.eclipse.cdt.core.dom.ast.IASTPointerOperator)
|
|
||||||
*/
|
|
||||||
public void addPointerOperator(IASTPointerOperator operator) {
|
public void addPointerOperator(IASTPointerOperator operator) {
|
||||||
if (operator != null) {
|
if (operator != null) {
|
||||||
|
operator.setParent(this);
|
||||||
|
operator.setPropertyInParent(POINTER_OPERATOR);
|
||||||
pointerOps = (IASTPointerOperator[]) ArrayUtil.append( IASTPointerOperator.class, pointerOps, ++pointerOpsPos, operator );
|
pointerOps = (IASTPointerOperator[]) ArrayUtil.append( IASTPointerOperator.class, pointerOps, ++pointerOpsPos, operator );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#setNestedDeclarator(org.eclipse.cdt.core.dom.ast.IASTDeclarator)
|
|
||||||
*/
|
|
||||||
public void setNestedDeclarator(IASTDeclarator nested) {
|
public void setNestedDeclarator(IASTDeclarator nested) {
|
||||||
this.nestedDeclarator = nested;
|
this.nestedDeclarator = nested;
|
||||||
|
if (nested != null) {
|
||||||
|
nested.setParent(this);
|
||||||
|
nested.setPropertyInParent(NESTED_DECLARATOR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(DECLARATOR_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
@ -144,9 +147,6 @@ public class CPPASTDeclarator extends CPPASTNode implements IASTDeclarator {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public int getRoleForName(IASTName n) {
|
public int getRoleForName(IASTName n) {
|
||||||
IASTNode getParent = getParent();
|
IASTNode getParent = getParent();
|
||||||
boolean fnDtor = ( this instanceof IASTFunctionDeclarator );
|
boolean fnDtor = ( this instanceof IASTFunctionDeclarator );
|
||||||
|
|
|
@ -16,8 +16,8 @@ import org.eclipse.cdt.core.dom.ast.IASTDefaultStatement;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTDefaultStatement extends CPPASTNode implements
|
public class CPPASTDefaultStatement extends CPPASTNode implements IASTDefaultStatement {
|
||||||
IASTDefaultStatement {
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
if( action.shouldVisitStatements ){
|
if( action.shouldVisitStatements ){
|
||||||
switch( action.visit( this ) ){
|
switch( action.visit( this ) ){
|
||||||
|
|
|
@ -25,12 +25,26 @@ public class CPPASTDeleteExpression extends CPPASTNode implements
|
||||||
private boolean isGlobal;
|
private boolean isGlobal;
|
||||||
private boolean isVectored;
|
private boolean isVectored;
|
||||||
|
|
||||||
public IASTExpression getOperand() {
|
|
||||||
|
|
||||||
|
public CPPASTDeleteExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CPPASTDeleteExpression(IASTExpression operand) {
|
||||||
|
setOperand(operand);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public IASTExpression getOperand() {
|
||||||
return operand;
|
return operand;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOperand(IASTExpression expression) {
|
public void setOperand(IASTExpression expression) {
|
||||||
operand = expression;
|
operand = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(OPERAND);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsGlobal(boolean global) {
|
public void setIsGlobal(boolean global) {
|
||||||
|
|
|
@ -21,35 +21,41 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTDoStatement extends CPPASTNode implements IASTDoStatement, IASTAmbiguityParent {
|
public class CPPASTDoStatement extends CPPASTNode implements IASTDoStatement, IASTAmbiguityParent {
|
||||||
private IASTStatement body;
|
|
||||||
|
private IASTStatement body;
|
||||||
private IASTExpression condition;
|
private IASTExpression condition;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDoStatement#getBody()
|
public CPPASTDoStatement() {
|
||||||
*/
|
}
|
||||||
public IASTStatement getBody() {
|
|
||||||
|
public CPPASTDoStatement(IASTStatement body, IASTExpression condition) {
|
||||||
|
setBody(body);
|
||||||
|
setCondition(condition);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTStatement getBody() {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDoStatement#setBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
|
||||||
*/
|
|
||||||
public void setBody(IASTStatement body) {
|
public void setBody(IASTStatement body) {
|
||||||
this.body = body;
|
this.body = body;
|
||||||
|
if (body != null) {
|
||||||
|
body.setParent(this);
|
||||||
|
body.setPropertyInParent(BODY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDoStatement#getCondition()
|
|
||||||
*/
|
|
||||||
public IASTExpression getCondition() {
|
public IASTExpression getCondition() {
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDoStatement#setCondition(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setCondition(IASTExpression condition) {
|
public void setCondition(IASTExpression condition) {
|
||||||
this.condition = condition;
|
this.condition = condition;
|
||||||
|
if (condition != null) {
|
||||||
|
condition.setParent(this);
|
||||||
|
condition.setPropertyInParent(CONDITION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -29,32 +29,33 @@ public class CPPASTElaboratedTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
private int kind;
|
private int kind;
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#getKind()
|
public CPPASTElaboratedTypeSpecifier() {
|
||||||
*/
|
}
|
||||||
public int getKind() {
|
|
||||||
|
public CPPASTElaboratedTypeSpecifier(int kind, IASTName name) {
|
||||||
|
this.kind = kind;
|
||||||
|
setName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getKind() {
|
||||||
return kind;
|
return kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#setKind(int)
|
|
||||||
*/
|
|
||||||
public void setKind(int value) {
|
public void setKind(int value) {
|
||||||
this.kind = value;
|
this.kind = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#getName()
|
|
||||||
*/
|
|
||||||
public IASTName getName() {
|
public IASTName getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(TYPE_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
@ -76,9 +77,6 @@ public class CPPASTElaboratedTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public int getRoleForName(IASTName n) {
|
public int getRoleForName(IASTName n) {
|
||||||
if( n != name ) return r_unclear;
|
if( n != name ) return r_unclear;
|
||||||
|
|
||||||
|
|
|
@ -24,22 +24,22 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
public CPPASTEnumerationSpecifier() {
|
||||||
*
|
}
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#addEnumerator(org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator)
|
|
||||||
*/
|
public CPPASTEnumerationSpecifier(IASTName name) {
|
||||||
|
setName(name);
|
||||||
|
}
|
||||||
|
|
||||||
public void addEnumerator(IASTEnumerator enumerator) {
|
public void addEnumerator(IASTEnumerator enumerator) {
|
||||||
if (enumerator != null) {
|
if (enumerator != null) {
|
||||||
|
enumerator.setParent(this);
|
||||||
|
enumerator.setPropertyInParent(ENUMERATOR);
|
||||||
enumerators = (IASTEnumerator[]) ArrayUtil.append( IASTEnumerator.class, enumerators, ++enumeratorsPos, enumerator );
|
enumerators = (IASTEnumerator[]) ArrayUtil.append( IASTEnumerator.class, enumerators, ++enumeratorsPos, enumerator );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#getEnumerators()
|
|
||||||
*/
|
|
||||||
public IASTEnumerator[] getEnumerators() {
|
public IASTEnumerator[] getEnumerators() {
|
||||||
if (enumerators == null)
|
if (enumerators == null)
|
||||||
return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY;
|
return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY;
|
||||||
|
@ -51,29 +51,18 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
private IASTEnumerator[] enumerators = null;
|
private IASTEnumerator[] enumerators = null;
|
||||||
private int enumeratorsPos=-1;
|
private int enumeratorsPos=-1;
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(ENUMERATION_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#getName()
|
|
||||||
*/
|
|
||||||
public IASTName getName() {
|
public IASTName getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#getRawSignature()
|
|
||||||
*/
|
|
||||||
public String getRawSignature() {
|
public String getRawSignature() {
|
||||||
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
|
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -108,11 +97,6 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public int getRoleForName(IASTName n) {
|
public int getRoleForName(IASTName n) {
|
||||||
if (name == n)
|
if (name == n)
|
||||||
return r_definition;
|
return r_definition;
|
||||||
|
|
|
@ -21,33 +21,39 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTEnumerator extends CPPASTNode implements IASTEnumerator, IASTAmbiguityParent {
|
public class CPPASTEnumerator extends CPPASTNode implements IASTEnumerator, IASTAmbiguityParent {
|
||||||
private IASTName name;
|
|
||||||
|
private IASTName name;
|
||||||
private IASTExpression value;
|
private IASTExpression value;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
public CPPASTEnumerator() {
|
||||||
*/
|
}
|
||||||
public void setName(IASTName name) {
|
|
||||||
|
public CPPASTEnumerator(IASTName name, IASTExpression value) {
|
||||||
|
setName(name);
|
||||||
|
setValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(IASTName name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(ENUMERATOR_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator#getName()
|
|
||||||
*/
|
|
||||||
public IASTName getName() {
|
public IASTName getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator#setValue(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setValue(IASTExpression expression) {
|
public void setValue(IASTExpression expression) {
|
||||||
this.value = expression;
|
this.value = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(ENUMERATOR_VALUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator#getValue()
|
|
||||||
*/
|
|
||||||
public IASTExpression getValue() {
|
public IASTExpression getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -73,9 +79,6 @@ public class CPPASTEnumerator extends CPPASTNode implements IASTEnumerator, IAST
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
|
|
||||||
*/
|
|
||||||
public int getRoleForName(IASTName n) {
|
public int getRoleForName(IASTName n) {
|
||||||
if( name == n )
|
if( name == n )
|
||||||
return r_definition;
|
return r_definition;
|
||||||
|
@ -83,8 +86,7 @@ public class CPPASTEnumerator extends CPPASTNode implements IASTEnumerator, IAST
|
||||||
}
|
}
|
||||||
|
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
if( child == value )
|
if( child == value ) {
|
||||||
{
|
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setPropertyInParent( child.getPropertyInParent() );
|
||||||
other.setParent( child.getParent() );
|
other.setParent( child.getParent() );
|
||||||
value = (IASTExpression) other;
|
value = (IASTExpression) other;
|
||||||
|
|
|
@ -24,18 +24,24 @@ public class CPPASTExplicitTemplateInstantiation extends CPPASTNode implements
|
||||||
|
|
||||||
private IASTDeclaration declaration;
|
private IASTDeclaration declaration;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation#getDeclaration()
|
public CPPASTExplicitTemplateInstantiation() {
|
||||||
*/
|
}
|
||||||
public IASTDeclaration getDeclaration() {
|
|
||||||
|
public CPPASTExplicitTemplateInstantiation(IASTDeclaration declaration) {
|
||||||
|
setDeclaration(declaration);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTDeclaration getDeclaration() {
|
||||||
return declaration;
|
return declaration;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation#setDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
|
||||||
*/
|
|
||||||
public void setDeclaration(IASTDeclaration declaration) {
|
public void setDeclaration(IASTDeclaration declaration) {
|
||||||
this.declaration = declaration;
|
this.declaration = declaration;
|
||||||
|
if (declaration != null) {
|
||||||
|
declaration.setParent(this);
|
||||||
|
declaration.setPropertyInParent(OWNED_DECLARATION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -31,6 +31,10 @@ public class CPPASTExpressionList extends CPPASTNode implements
|
||||||
|
|
||||||
public void addExpression(IASTExpression expression) {
|
public void addExpression(IASTExpression expression) {
|
||||||
expressions = (IASTExpression [])ArrayUtil.append( IASTExpression.class, expressions, expression );
|
expressions = (IASTExpression [])ArrayUtil.append( IASTExpression.class, expressions, expression );
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(NESTED_EXPRESSION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IASTExpression [] expressions = new IASTExpression[2];
|
private IASTExpression [] expressions = new IASTExpression[2];
|
||||||
|
|
|
@ -21,20 +21,27 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
*/
|
*/
|
||||||
public class CPPASTExpressionStatement extends CPPASTNode implements
|
public class CPPASTExpressionStatement extends CPPASTNode implements
|
||||||
IASTExpressionStatement, IASTAmbiguityParent {
|
IASTExpressionStatement, IASTAmbiguityParent {
|
||||||
|
|
||||||
private IASTExpression expression;
|
private IASTExpression expression;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTExpressionStatement#getExpression()
|
public CPPASTExpressionStatement() {
|
||||||
*/
|
}
|
||||||
public IASTExpression getExpression() {
|
|
||||||
|
public CPPASTExpressionStatement(IASTExpression expression) {
|
||||||
|
setExpression(expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getExpression() {
|
||||||
return expression;
|
return expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTExpressionStatement#setExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setExpression(IASTExpression expression) {
|
public void setExpression(IASTExpression expression) {
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(EXPRESSION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
|
|
|
@ -25,18 +25,24 @@ public class CPPASTFieldDeclarator extends CPPASTDeclarator implements
|
||||||
|
|
||||||
private IASTExpression bitField;
|
private IASTExpression bitField;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator#getBitFieldSize()
|
public CPPASTFieldDeclarator() {
|
||||||
*/
|
}
|
||||||
public IASTExpression getBitFieldSize() {
|
|
||||||
|
public CPPASTFieldDeclarator(IASTExpression bitField) {
|
||||||
|
setBitFieldSize(bitField);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getBitFieldSize() {
|
||||||
return bitField;
|
return bitField;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator#setBitFieldSize(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setBitFieldSize(IASTExpression size) {
|
public void setBitFieldSize(IASTExpression size) {
|
||||||
this.bitField = size;
|
this.bitField = size;
|
||||||
|
if (size != null) {
|
||||||
|
size.setParent(this);
|
||||||
|
size.setPropertyInParent(FIELD_SIZE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean postAccept( ASTVisitor action ){
|
protected boolean postAccept( ASTVisitor action ){
|
||||||
|
|
|
@ -36,7 +36,16 @@ public class CPPASTFieldReference extends CPPASTNode implements
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
private boolean isDeref;
|
private boolean isDeref;
|
||||||
|
|
||||||
public boolean isTemplate() {
|
|
||||||
|
public CPPASTFieldReference() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CPPASTFieldReference(IASTName name, IASTExpression owner) {
|
||||||
|
setFieldName(name);
|
||||||
|
setFieldOwner(owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTemplate() {
|
||||||
return isTemplate;
|
return isTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +59,10 @@ public class CPPASTFieldReference extends CPPASTNode implements
|
||||||
|
|
||||||
public void setFieldOwner(IASTExpression expression) {
|
public void setFieldOwner(IASTExpression expression) {
|
||||||
owner = expression;
|
owner = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(FIELD_OWNER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTName getFieldName() {
|
public IASTName getFieldName() {
|
||||||
|
@ -57,7 +70,11 @@ public class CPPASTFieldReference extends CPPASTNode implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFieldName(IASTName name) {
|
public void setFieldName(IASTName name) {
|
||||||
this.name =name;
|
this.name = name;
|
||||||
|
if (name != null) {
|
||||||
|
name.setParent(this);
|
||||||
|
name.setPropertyInParent(FIELD_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPointerDereference() {
|
public boolean isPointerDereference() {
|
||||||
|
|
|
@ -32,52 +32,62 @@ public class CPPASTForStatement extends CPPASTNode implements ICPPASTForStatemen
|
||||||
|
|
||||||
private IASTDeclaration cond_declaration;
|
private IASTDeclaration cond_declaration;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#getCondition()
|
public CPPASTForStatement() {
|
||||||
*/
|
}
|
||||||
public IASTExpression getConditionExpression() {
|
|
||||||
|
public CPPASTForStatement(IASTStatement init, IASTDeclaration cond_declaration,
|
||||||
|
IASTExpression iterationExpression, IASTStatement body) {
|
||||||
|
setInitializerStatement(init);
|
||||||
|
setConditionDeclaration(cond_declaration);
|
||||||
|
setIterationExpression(iterationExpression);
|
||||||
|
setBody(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CPPASTForStatement(IASTStatement init, IASTExpression condition,
|
||||||
|
IASTExpression iterationExpression, IASTStatement body) {
|
||||||
|
setInitializerStatement(init);
|
||||||
|
setConditionExpression(iterationExpression);
|
||||||
|
setIterationExpression(iterationExpression);
|
||||||
|
setBody(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTExpression getConditionExpression() {
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#setCondition(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setConditionExpression(IASTExpression condition) {
|
public void setConditionExpression(IASTExpression condition) {
|
||||||
this.condition = condition;
|
this.condition = condition;
|
||||||
|
if (condition != null) {
|
||||||
|
condition.setParent(this);
|
||||||
|
condition.setPropertyInParent(CONDITION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#getIterationExpression()
|
|
||||||
*/
|
|
||||||
public IASTExpression getIterationExpression() {
|
public IASTExpression getIterationExpression() {
|
||||||
return iterationExpression;
|
return iterationExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#setIterationExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
|
||||||
*/
|
|
||||||
public void setIterationExpression(IASTExpression iterator) {
|
public void setIterationExpression(IASTExpression iterator) {
|
||||||
this.iterationExpression = iterator;
|
this.iterationExpression = iterator;
|
||||||
|
if (iterator != null) {
|
||||||
|
iterator.setParent(this);
|
||||||
|
iterator.setPropertyInParent(ITERATION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#getBody()
|
|
||||||
*/
|
|
||||||
public IASTStatement getBody() {
|
public IASTStatement getBody() {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#setBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
|
||||||
*/
|
|
||||||
public void setBody(IASTStatement statement) {
|
public void setBody(IASTStatement statement) {
|
||||||
body = statement;
|
body = statement;
|
||||||
|
if (statement != null) {
|
||||||
|
statement.setParent(this);
|
||||||
|
statement.setPropertyInParent(BODY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#getScope()
|
|
||||||
*/
|
|
||||||
public IScope getScope() {
|
public IScope getScope() {
|
||||||
if( scope == null )
|
if( scope == null )
|
||||||
scope = new CPPBlockScope( this );
|
scope = new CPPBlockScope( this );
|
||||||
|
@ -147,11 +157,19 @@ public class CPPASTForStatement extends CPPASTNode implements ICPPASTForStatemen
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInitializerStatement(IASTStatement statement) {
|
public void setInitializerStatement(IASTStatement statement) {
|
||||||
init = statement;
|
init = statement;
|
||||||
|
if (statement != null) {
|
||||||
|
statement.setParent(this);
|
||||||
|
statement.setPropertyInParent(INITIALIZER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConditionDeclaration(IASTDeclaration d) {
|
public void setConditionDeclaration(IASTDeclaration d) {
|
||||||
cond_declaration = d;
|
cond_declaration = d;
|
||||||
|
if (d != null) {
|
||||||
|
d.setParent(this);
|
||||||
|
d.setPropertyInParent(CONDITION_DECLARATION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTDeclaration getConditionDeclaration() {
|
public IASTDeclaration getConditionDeclaration() {
|
||||||
|
|
|
@ -22,11 +22,25 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
*/
|
*/
|
||||||
public class CPPASTFunctionCallExpression extends CPPASTNode implements
|
public class CPPASTFunctionCallExpression extends CPPASTNode implements
|
||||||
IASTFunctionCallExpression, IASTAmbiguityParent {
|
IASTFunctionCallExpression, IASTAmbiguityParent {
|
||||||
|
|
||||||
private IASTExpression functionName;
|
private IASTExpression functionName;
|
||||||
private IASTExpression parameter;
|
private IASTExpression parameter;
|
||||||
|
|
||||||
public void setFunctionNameExpression(IASTExpression expression) {
|
|
||||||
|
public CPPASTFunctionCallExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CPPASTFunctionCallExpression(IASTExpression functionName, IASTExpression parameter) {
|
||||||
|
setFunctionNameExpression(functionName);
|
||||||
|
setParameterExpression(parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFunctionNameExpression(IASTExpression expression) {
|
||||||
this.functionName = expression;
|
this.functionName = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(FUNCTION_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTExpression getFunctionNameExpression() {
|
public IASTExpression getFunctionNameExpression() {
|
||||||
|
@ -35,6 +49,10 @@ public class CPPASTFunctionCallExpression extends CPPASTNode implements
|
||||||
|
|
||||||
public void setParameterExpression(IASTExpression expression) {
|
public void setParameterExpression(IASTExpression expression) {
|
||||||
this.parameter = expression;
|
this.parameter = expression;
|
||||||
|
if (expression != null) {
|
||||||
|
expression.setParent(this);
|
||||||
|
expression.setPropertyInParent(PARAMETERS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTExpression getParameterExpression() {
|
public IASTExpression getParameterExpression() {
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
|
@ -25,8 +26,7 @@ import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements
|
public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPASTFunctionDeclarator {
|
||||||
ICPPASTFunctionDeclarator {
|
|
||||||
|
|
||||||
private IASTParameterDeclaration [] parameters = null;
|
private IASTParameterDeclaration [] parameters = null;
|
||||||
private int parametersPos=-1;
|
private int parametersPos=-1;
|
||||||
|
@ -35,78 +35,58 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements
|
||||||
private boolean pureVirtual;
|
private boolean pureVirtual;
|
||||||
private boolean isVolatile;
|
private boolean isVolatile;
|
||||||
private boolean isConst;
|
private boolean isConst;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public CPPASTFunctionDeclarator() {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#getParameters()
|
}
|
||||||
*/
|
|
||||||
public IASTParameterDeclaration [] getParameters() {
|
public CPPASTFunctionDeclarator(IASTName name) {
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTParameterDeclaration [] getParameters() {
|
||||||
if( parameters == null ) return IASTParameterDeclaration.EMPTY_PARAMETERDECLARATION_ARRAY;
|
if( parameters == null ) return IASTParameterDeclaration.EMPTY_PARAMETERDECLARATION_ARRAY;
|
||||||
parameters = (IASTParameterDeclaration[]) ArrayUtil.removeNullsAfter( IASTParameterDeclaration.class, parameters, parametersPos );
|
parameters = (IASTParameterDeclaration[]) ArrayUtil.removeNullsAfter( IASTParameterDeclaration.class, parameters, parametersPos );
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#addParameterDeclaration(org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration)
|
|
||||||
*/
|
|
||||||
public void addParameterDeclaration(IASTParameterDeclaration parameter) {
|
public void addParameterDeclaration(IASTParameterDeclaration parameter) {
|
||||||
if (parameter != null) {
|
if (parameter != null) {
|
||||||
|
parameter.setParent(this);
|
||||||
|
parameter.setPropertyInParent(FUNCTION_PARAMETER);
|
||||||
parameters = (IASTParameterDeclaration []) ArrayUtil.append( IASTParameterDeclaration.class, parameters, ++parametersPos, parameter );
|
parameters = (IASTParameterDeclaration []) ArrayUtil.append( IASTParameterDeclaration.class, parameters, ++parametersPos, parameter );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#takesVarArgs()
|
|
||||||
*/
|
|
||||||
public boolean takesVarArgs() {
|
public boolean takesVarArgs() {
|
||||||
return varArgs;
|
return varArgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#setVarArgs(boolean)
|
|
||||||
*/
|
|
||||||
public void setVarArgs(boolean value) {
|
public void setVarArgs(boolean value) {
|
||||||
varArgs = value;
|
varArgs = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#isConst()
|
|
||||||
*/
|
|
||||||
public boolean isConst() {
|
public boolean isConst() {
|
||||||
return isConst;
|
return isConst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#setConst(boolean)
|
|
||||||
*/
|
|
||||||
public void setConst(boolean value) {
|
public void setConst(boolean value) {
|
||||||
this.isConst = value;
|
this.isConst = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#isVolatile()
|
|
||||||
*/
|
|
||||||
public boolean isVolatile() {
|
public boolean isVolatile() {
|
||||||
return isVolatile;
|
return isVolatile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#setVolatile(boolean)
|
|
||||||
*/
|
|
||||||
public void setVolatile(boolean value) {
|
public void setVolatile(boolean value) {
|
||||||
this.isVolatile = value;
|
this.isVolatile = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IASTTypeId [] typeIds = null;
|
private IASTTypeId [] typeIds = null;
|
||||||
private int typeIdsPos=-1;
|
private int typeIdsPos=-1;
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#getExceptionSpecification()
|
|
||||||
*/
|
|
||||||
public IASTTypeId[] getExceptionSpecification() {
|
public IASTTypeId[] getExceptionSpecification() {
|
||||||
if( typeIds == null ) return IASTTypeId.EMPTY_TYPEID_ARRAY;
|
if( typeIds == null ) return IASTTypeId.EMPTY_TYPEID_ARRAY;
|
||||||
typeIds = (IASTTypeId[]) ArrayUtil.removeNullsAfter( IASTTypeId.class, typeIds, typeIdsPos );
|
typeIds = (IASTTypeId[]) ArrayUtil.removeNullsAfter( IASTTypeId.class, typeIds, typeIdsPos );
|
||||||
|
@ -114,27 +94,20 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#addExceptionSpecificationTypeId(org.eclipse.cdt.core.dom.ast.IASTTypeId)
|
|
||||||
*/
|
|
||||||
public void addExceptionSpecificationTypeId(IASTTypeId typeId) {
|
public void addExceptionSpecificationTypeId(IASTTypeId typeId) {
|
||||||
if (typeId != null) {
|
if (typeId != null) {
|
||||||
typeIds = (IASTTypeId[]) ArrayUtil.append( IASTTypeId.class, typeIds, ++typeIdsPos, typeId );
|
typeIds = (IASTTypeId[]) ArrayUtil.append( IASTTypeId.class, typeIds, ++typeIdsPos, typeId );
|
||||||
|
typeId.setParent(this);
|
||||||
|
typeId.setPropertyInParent(EXCEPTION_TYPEID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#isPureVirtual()
|
|
||||||
*/
|
|
||||||
public boolean isPureVirtual() {
|
public boolean isPureVirtual() {
|
||||||
return pureVirtual;
|
return pureVirtual;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#setPureVirtual(boolean)
|
|
||||||
*/
|
|
||||||
public void setPureVirtual(boolean isPureVirtual) {
|
public void setPureVirtual(boolean isPureVirtual) {
|
||||||
this.pureVirtual = isPureVirtual;
|
this.pureVirtual = isPureVirtual;
|
||||||
}
|
}
|
||||||
|
@ -143,9 +116,7 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements
|
||||||
private ICPPASTConstructorChainInitializer [] constructorChain = null;
|
private ICPPASTConstructorChainInitializer [] constructorChain = null;
|
||||||
private int constructorChainPos=-1;
|
private int constructorChainPos=-1;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#getConstructorChain()
|
|
||||||
*/
|
|
||||||
public ICPPASTConstructorChainInitializer[] getConstructorChain() {
|
public ICPPASTConstructorChainInitializer[] getConstructorChain() {
|
||||||
if( constructorChain == null ) return ICPPASTConstructorChainInitializer.EMPTY_CONSTRUCTORCHAININITIALIZER_ARRAY;
|
if( constructorChain == null ) return ICPPASTConstructorChainInitializer.EMPTY_CONSTRUCTORCHAININITIALIZER_ARRAY;
|
||||||
constructorChain = (ICPPASTConstructorChainInitializer[]) ArrayUtil.removeNullsAfter( ICPPASTConstructorChainInitializer.class, constructorChain, constructorChainPos );
|
constructorChain = (ICPPASTConstructorChainInitializer[]) ArrayUtil.removeNullsAfter( ICPPASTConstructorChainInitializer.class, constructorChain, constructorChainPos );
|
||||||
|
@ -153,12 +124,11 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#addConstructorToChain(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer)
|
|
||||||
*/
|
|
||||||
public void addConstructorToChain(ICPPASTConstructorChainInitializer initializer) {
|
public void addConstructorToChain(ICPPASTConstructorChainInitializer initializer) {
|
||||||
if (initializer != null) {
|
if (initializer != null) {
|
||||||
constructorChain = (ICPPASTConstructorChainInitializer[]) ArrayUtil.append(ICPPASTConstructorChainInitializer.class, constructorChain, ++constructorChainPos, initializer );
|
constructorChain = (ICPPASTConstructorChainInitializer[]) ArrayUtil.append(ICPPASTConstructorChainInitializer.class, constructorChain, ++constructorChainPos, initializer );
|
||||||
|
initializer.setParent(this);
|
||||||
|
initializer.setPropertyInParent(CONSTRUCTOR_CHAIN_MEMBER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue