mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Cosmetics.
This commit is contained in:
parent
df5940c5fa
commit
f02e178d52
45 changed files with 603 additions and 580 deletions
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Doug Schaefer (IBM) - Initial API and implementation
|
* Doug Schaefer (IBM) - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.ast;
|
package org.eclipse.cdt.core.dom.ast;
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,6 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IASTStatement extends IASTNode {
|
public interface IASTStatement extends IASTNode {
|
||||||
/**
|
|
||||||
* Constant.
|
|
||||||
*/
|
|
||||||
public static final IASTStatement[] EMPTY_STATEMENT_ARRAY = {};
|
public static final IASTStatement[] EMPTY_STATEMENT_ARRAY = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM) - Initial API and implementation
|
* John Camelon (IBM) - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
|
|
||||||
|
@ -16,14 +16,13 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface represents a namespace alias in C++. e.g. namespace ABC { int
|
* This interface represents a namespace alias in C++,
|
||||||
* x; } namspace DEF = ABC;
|
* e.g. namespace ABC { int* x; } namespace DEF = ABC;
|
||||||
*
|
*
|
||||||
* @noextend This interface is not intended to be extended by clients.
|
* @noextend This interface is not intended to be extended by clients.
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTNamespaceAlias extends IASTDeclaration, IASTNameOwner {
|
public interface ICPPASTNamespaceAlias extends IASTDeclaration, IASTNameOwner {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>ALIAS_NAME</code> represents the new namespace name being
|
* <code>ALIAS_NAME</code> represents the new namespace name being
|
||||||
* introduced.
|
* introduced.
|
||||||
|
@ -68,7 +67,6 @@ public interface ICPPASTNamespaceAlias extends IASTDeclaration, IASTNameOwner {
|
||||||
*/
|
*/
|
||||||
public void setMappingName(IASTName qualifiedName);
|
public void setMappingName(IASTName qualifiedName);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
|
@ -80,5 +78,4 @@ public interface ICPPASTNamespaceAlias extends IASTDeclaration, IASTNameOwner {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ICPPASTNamespaceAlias copy(CopyStyle style);
|
public ICPPASTNamespaceAlias copy(CopyStyle style);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2012 Google, Inc and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Sergey Prigogin (Google) - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.core.dom.parser;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTToken;
|
||||||
|
import org.eclipse.cdt.core.parser.IToken;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.scanner.Token;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for C and C++ attributes.
|
||||||
|
*/
|
||||||
|
public class ASTToken extends ASTNode implements IASTToken {
|
||||||
|
private final IToken token;
|
||||||
|
|
||||||
|
public ASTToken(IToken token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ASTToken copy() {
|
||||||
|
return copy(CopyStyle.withoutLocations);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ASTToken copy(CopyStyle style) {
|
||||||
|
Token tokenCopy = ((Token) token).clone();
|
||||||
|
tokenCopy.setNext(null);
|
||||||
|
return super.copy(new ASTToken(tokenCopy), style);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IToken getToken() {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2012 Google, Inc and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Sergey Prigogin (Google) - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.core.dom.parser;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTToken;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTTokenList;
|
||||||
|
import org.eclipse.cdt.core.parser.IToken;
|
||||||
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a sequence of code tokens.
|
||||||
|
*/
|
||||||
|
public class ASTTokenList extends ASTNode implements IASTTokenList {
|
||||||
|
private IASTToken[] tokens = IASTToken.EMPTY_TOKEN_ARRAY;
|
||||||
|
|
||||||
|
public ASTTokenList() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ASTTokenList copy() {
|
||||||
|
return copy(CopyStyle.withoutLocations);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ASTTokenList copy(CopyStyle style) {
|
||||||
|
ASTTokenList copy = super.copy(new ASTTokenList(), style);
|
||||||
|
for (IASTToken token : tokens) {
|
||||||
|
if (token == null)
|
||||||
|
break;
|
||||||
|
copy.addToken(token.copy(style));
|
||||||
|
}
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IASTToken[] getTokens() {
|
||||||
|
tokens = ArrayUtil.trim(tokens);
|
||||||
|
return tokens;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addToken(IASTToken token) {
|
||||||
|
tokens = ArrayUtil.append(tokens, token);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IToken getToken() {
|
||||||
|
IASTToken[] tok = getTokens();
|
||||||
|
return tok != null && tok.length == 1 ? tok[0].getToken() : null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,15 +6,13 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser;
|
package org.eclipse.cdt.internal.core.dom.parser;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
|
|
||||||
|
|
||||||
public interface IASTAmbiguityParent {
|
public interface IASTAmbiguityParent {
|
||||||
|
|
||||||
public void replace( IASTNode child, IASTNode other );
|
public void replace(IASTNode child, IASTNode other);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser;
|
package org.eclipse.cdt.internal.core.dom.parser;
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
|
|
||||||
public interface IASTAmbiguousStatement extends IASTStatement {
|
public interface IASTAmbiguousStatement extends IASTStatement {
|
||||||
|
public static final ASTNodeProperty STATEMENT = new ASTNodeProperty("IASTAmbiguousStatement.STATEMENT - Ambiguous statement."); //$NON-NLS-1$
|
||||||
|
|
||||||
public static final ASTNodeProperty STATEMENT = new ASTNodeProperty( "IASTAmbiguousStatement.STATEMENT - Ambiguous statement." ); //$NON-NLS-1$
|
public void addStatement(IASTStatement s);
|
||||||
public void addStatement( IASTStatement s );
|
|
||||||
public IASTStatement [] getStatements();
|
|
||||||
|
|
||||||
|
public IASTStatement[] getStatements();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - Initial API and implementation
|
* Markus Schorn - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTInternalScope;
|
||||||
* @since 5.0.1
|
* @since 5.0.1
|
||||||
*/
|
*/
|
||||||
public class CASTAmbiguousSimpleDeclaration extends ASTAmbiguousNode implements IASTAmbiguousSimpleDeclaration {
|
public class CASTAmbiguousSimpleDeclaration extends ASTAmbiguousNode implements IASTAmbiguousSimpleDeclaration {
|
||||||
|
|
||||||
private IASTSimpleDeclaration fSimpleDecl;
|
private IASTSimpleDeclaration fSimpleDecl;
|
||||||
private IASTDeclSpecifier fAltDeclSpec;
|
private IASTDeclSpecifier fAltDeclSpec;
|
||||||
private IASTDeclarator fAltDtor;
|
private IASTDeclarator fAltDtor;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -24,9 +24,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTInternalScope;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPASTInternalScope;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPASTInternalScope;
|
||||||
|
|
||||||
public class CASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbiguousStatement {
|
public class CASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbiguousStatement {
|
||||||
|
private IASTStatement[] stmts = new IASTStatement[2];
|
||||||
private IASTStatement [] stmts = new IASTStatement[2];
|
private int stmtsPos= -1;
|
||||||
private int stmtsPos=-1;
|
|
||||||
private IScope fScope;
|
private IScope fScope;
|
||||||
private IASTDeclaration fDeclaration;
|
private IASTDeclaration fDeclaration;
|
||||||
|
|
||||||
|
@ -73,7 +72,7 @@ public class CASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbi
|
||||||
public void addStatement(IASTStatement s) {
|
public void addStatement(IASTStatement s) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
stmts = ArrayUtil.appendAt( IASTStatement.class, stmts, ++stmtsPos, s );
|
stmts = ArrayUtil.appendAt(IASTStatement.class, stmts, ++stmtsPos, s);
|
||||||
s.setParent(this);
|
s.setParent(this);
|
||||||
s.setPropertyInParent(STATEMENT);
|
s.setPropertyInParent(STATEMENT);
|
||||||
}
|
}
|
||||||
|
@ -81,7 +80,7 @@ public class CASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTStatement[] getStatements() {
|
public IASTStatement[] getStatements() {
|
||||||
stmts = ArrayUtil.trimAt( IASTStatement.class, stmts, stmtsPos );
|
stmts = ArrayUtil.trimAt(IASTStatement.class, stmts, stmtsPos);
|
||||||
return stmts;
|
return stmts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +89,6 @@ public class CASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbi
|
||||||
return getStatements();
|
return getStatements();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTStatement copy() {
|
public IASTStatement copy() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
@ -100,5 +98,4 @@ public class CASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbi
|
||||||
public IASTStatement copy(CopyStyle style) {
|
public IASTStatement copy(CopyStyle style) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -19,22 +19,21 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTBreakStatement extends ASTNode implements IASTBreakStatement {
|
public class CASTBreakStatement extends ASTNode implements IASTBreakStatement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( action.shouldVisitStatements ){
|
if (action.shouldVisitStatements) {
|
||||||
switch( action.leave( this ) ){
|
switch (action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -22,10 +22,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTCaseStatement extends ASTNode implements IASTCaseStatement, IASTAmbiguityParent {
|
public class CASTCaseStatement extends ASTNode implements IASTCaseStatement, IASTAmbiguityParent {
|
||||||
|
|
||||||
private IASTExpression expression;
|
private IASTExpression expression;
|
||||||
|
|
||||||
|
|
||||||
public CASTCaseStatement() {
|
public CASTCaseStatement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,20 +62,20 @@ public class CASTCaseStatement extends ASTNode implements IASTCaseStatement, IAS
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( expression != null ) if( !expression.accept( action ) ) return false;
|
if (expression != null) if (!expression.accept(action)) return false;
|
||||||
if( action.shouldVisitStatements ){
|
if (action.shouldVisitStatements) {
|
||||||
switch( action.leave( this ) ){
|
switch (action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,10 +84,9 @@ public class CASTCaseStatement extends ASTNode implements IASTCaseStatement, IAS
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
if( child == expression )
|
if (child == expression) {
|
||||||
{
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
|
||||||
expression = (IASTExpression) other;
|
expression = (IASTExpression) other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -19,21 +19,20 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTDefaultStatement extends ASTNode implements IASTDefaultStatement {
|
public class CASTDefaultStatement extends ASTNode implements IASTDefaultStatement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( action.shouldVisitStatements ){
|
if (action.shouldVisitStatements) {
|
||||||
switch( action.leave( this ) ){
|
switch (action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -23,11 +23,9 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmbiguityParent {
|
public class CASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmbiguityParent {
|
||||||
|
|
||||||
private IASTStatement body;
|
private IASTStatement body;
|
||||||
private IASTExpression condition;
|
private IASTExpression condition;
|
||||||
|
|
||||||
|
|
||||||
public CASTDoStatement() {
|
public CASTDoStatement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,13 +66,11 @@ public class CASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTExpression getCondition() {
|
public IASTExpression getCondition() {
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCondition(IASTExpression condition) {
|
public void setCondition(IASTExpression condition) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
|
@ -86,21 +82,23 @@ public class CASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmb
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( body != null ) if( !body.accept( action ) ) return false;
|
|
||||||
if( condition != null ) if( !condition.accept( action ) ) return false;
|
if (body != null && !body.accept(action)) return false;
|
||||||
if( action.shouldVisitStatements ){
|
if (condition != null && !condition.accept(action)) return false;
|
||||||
switch( action.leave( this ) ){
|
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
if (action.shouldVisitStatements) {
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
switch (action.leave(this)) {
|
||||||
default : break;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -108,16 +106,14 @@ public class CASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmb
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
if( body == child )
|
if (body == child) {
|
||||||
{
|
other.setPropertyInParent(body.getPropertyInParent());
|
||||||
other.setPropertyInParent( body.getPropertyInParent() );
|
other.setParent(body.getParent());
|
||||||
other.setParent( body.getParent() );
|
|
||||||
body = (IASTStatement) other;
|
body = (IASTStatement) other;
|
||||||
}
|
}
|
||||||
if( child == condition )
|
if (child == condition) {
|
||||||
{
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
|
||||||
condition = (IASTExpression) other;
|
condition = (IASTExpression) other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -23,10 +23,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
*/
|
*/
|
||||||
public class CASTExpressionStatement extends ASTNode implements
|
public class CASTExpressionStatement extends ASTNode implements
|
||||||
IASTExpressionStatement, IASTAmbiguityParent {
|
IASTExpressionStatement, IASTAmbiguityParent {
|
||||||
|
|
||||||
private IASTExpression expression;
|
private IASTExpression expression;
|
||||||
|
|
||||||
|
|
||||||
public CASTExpressionStatement() {
|
public CASTExpressionStatement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,26 +67,19 @@ public class CASTExpressionStatement extends ASTNode implements
|
||||||
public boolean accept(ASTVisitor action) {
|
public boolean accept(ASTVisitor action) {
|
||||||
if (action.shouldVisitStatements) {
|
if (action.shouldVisitStatements) {
|
||||||
switch (action.visit(this)) {
|
switch (action.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT:
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
return false;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
case ASTVisitor.PROCESS_SKIP:
|
default: break;
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (expression != null)
|
|
||||||
if (!expression.accept(action))
|
if (expression != null && !expression.accept(action)) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
if (action.shouldVisitStatements) {
|
if (action.shouldVisitStatements) {
|
||||||
switch (action.leave(this)) {
|
switch (action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT:
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
return false;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
case ASTVisitor.PROCESS_SKIP:
|
default: break;
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,5 +94,4 @@ public class CASTExpressionStatement extends ASTNode implements
|
||||||
expression = (IASTExpression) other;
|
expression = (IASTExpression) other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -25,12 +25,11 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTForStatement extends ASTNode implements IASTForStatement, IASTAmbiguityParent {
|
public class CASTForStatement extends ASTNode implements IASTForStatement, IASTAmbiguityParent {
|
||||||
private IScope scope = null;
|
private IScope scope;
|
||||||
|
|
||||||
private IASTExpression condition;
|
private IASTExpression condition;
|
||||||
private IASTExpression iterationExpression;
|
private IASTExpression iterationExpression;
|
||||||
private IASTStatement body, init;
|
private IASTStatement body;
|
||||||
|
private IASTStatement init;
|
||||||
|
|
||||||
public CASTForStatement() {
|
public CASTForStatement() {
|
||||||
}
|
}
|
||||||
|
@ -61,8 +60,8 @@ public class CASTForStatement extends ASTNode implements IASTForStatement, IASTA
|
||||||
protected void copyForStatement(CASTForStatement copy, CopyStyle style) {
|
protected void copyForStatement(CASTForStatement copy, CopyStyle style) {
|
||||||
copy.setInitializerStatement(init == null ? null : init.copy(style));
|
copy.setInitializerStatement(init == null ? null : init.copy(style));
|
||||||
copy.setConditionExpression(condition == null ? null : condition.copy(style));
|
copy.setConditionExpression(condition == null ? null : condition.copy(style));
|
||||||
copy.setIterationExpression(iterationExpression == null ? null : iterationExpression
|
copy.setIterationExpression(iterationExpression == null ?
|
||||||
.copy(style));
|
null : iterationExpression.copy(style));
|
||||||
copy.setBody(body == null ? null : body.copy(style));
|
copy.setBody(body == null ? null : body.copy(style));
|
||||||
copy.setOffsetAndLength(this);
|
copy.setOffsetAndLength(this);
|
||||||
}
|
}
|
||||||
|
@ -128,62 +127,56 @@ public class CASTForStatement extends ASTNode implements IASTForStatement, IASTA
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IScope getScope() {
|
public IScope getScope() {
|
||||||
if( scope == null )
|
if (scope == null)
|
||||||
scope = new CScope( this, EScopeKind.eLocal);
|
scope = new CScope(this, EScopeKind.eLocal);
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( init != null ) if( !init.accept( action ) ) return false;
|
if (init != null && !init.accept(action)) return false;
|
||||||
if( condition != null ) if( !condition.accept( action ) ) return false;
|
if (condition != null && !condition.accept(action)) return false;
|
||||||
if( iterationExpression != null ) if( !iterationExpression.accept( action ) ) return false;
|
if (iterationExpression != null && !iterationExpression.accept(action)) return false;
|
||||||
if( body != null ) if( !body.accept( action ) ) return false;
|
if (body != null && !body.accept(action)) return false;
|
||||||
|
|
||||||
if( action.shouldVisitStatements ){
|
if (action.shouldVisitStatements) {
|
||||||
switch( action.leave( this ) ){
|
switch (action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
if( body == child )
|
if (body == child) {
|
||||||
{
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
|
||||||
body = (IASTStatement) other;
|
body = (IASTStatement) other;
|
||||||
}
|
}
|
||||||
if( child == init )
|
if (child == init) {
|
||||||
{
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
|
||||||
init = (IASTStatement) other;
|
init = (IASTStatement) other;
|
||||||
}
|
}
|
||||||
if( child == iterationExpression)
|
if (child == iterationExpression) {
|
||||||
{
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
|
||||||
iterationExpression = (IASTExpression) other;
|
iterationExpression = (IASTExpression) other;
|
||||||
}
|
}
|
||||||
if( child == condition)
|
if (child == condition) {
|
||||||
{
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
|
||||||
condition = (IASTExpression) other;
|
condition = (IASTExpression) other;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTGotoStatement extends ASTNode implements IASTGotoStatement {
|
public class CASTGotoStatement extends ASTNode implements IASTGotoStatement {
|
||||||
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
public CASTGotoStatement() {
|
public CASTGotoStatement() {
|
||||||
|
@ -51,31 +50,32 @@ public class CASTGotoStatement extends ASTNode implements IASTGotoStatement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
name.setParent(this);
|
name.setParent(this);
|
||||||
name.setPropertyInParent(NAME);
|
name.setPropertyInParent(NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
|
||||||
|
|
||||||
if( action.shouldVisitStatements ){
|
if (name != null && !name.accept(action)) return false;
|
||||||
switch( action.leave( this ) ){
|
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
if (action.shouldVisitStatements) {
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
switch (action.leave(this)) {
|
||||||
default : break;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -83,7 +83,7 @@ public class CASTGotoStatement extends ASTNode implements IASTGotoStatement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -24,13 +24,10 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
* If statements for C.
|
* If statements for C.
|
||||||
*/
|
*/
|
||||||
public class CASTIfStatement extends ASTNode implements IASTIfStatement, IASTAmbiguityParent {
|
public class CASTIfStatement extends ASTNode implements IASTIfStatement, IASTAmbiguityParent {
|
||||||
|
|
||||||
private IASTExpression condition;
|
private IASTExpression condition;
|
||||||
private IASTStatement thenClause;
|
private IASTStatement thenClause;
|
||||||
private IASTStatement elseClause;
|
private IASTStatement elseClause;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public CASTIfStatement() {
|
public CASTIfStatement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +36,6 @@ public class CASTIfStatement extends ASTNode implements IASTIfStatement, IASTAmb
|
||||||
setThenClause(thenClause);
|
setThenClause(thenClause);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public CASTIfStatement(IASTExpression condition, IASTStatement thenClause, IASTStatement elseClause) {
|
public CASTIfStatement(IASTExpression condition, IASTStatement thenClause, IASTStatement elseClause) {
|
||||||
this(condition, thenClause);
|
this(condition, thenClause);
|
||||||
setElseClause(elseClause);
|
setElseClause(elseClause);
|
||||||
|
@ -165,22 +161,19 @@ public class CASTIfStatement extends ASTNode implements IASTIfStatement, IASTAmb
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
if( thenClause == child )
|
if (thenClause == child) {
|
||||||
{
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
|
||||||
thenClause = (IASTStatement) other;
|
thenClause = (IASTStatement) other;
|
||||||
}
|
}
|
||||||
if( elseClause == child )
|
if (elseClause == child) {
|
||||||
{
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
|
||||||
elseClause = (IASTStatement) other;
|
elseClause = (IASTStatement) other;
|
||||||
}
|
}
|
||||||
if( child == condition )
|
if (child == condition) {
|
||||||
{
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
|
||||||
condition = (IASTExpression) other;
|
condition = (IASTExpression) other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -19,21 +19,21 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTNullStatement extends ASTNode implements IASTNullStatement {
|
public class CASTNullStatement extends ASTNode implements IASTNullStatement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( action.shouldVisitStatements ){
|
|
||||||
switch( action.leave( this ) ){
|
if (action.shouldVisitStatements) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
switch (action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
default : break;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -19,8 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTProblemDeclaration extends CASTProblemOwner implements
|
public class CASTProblemDeclaration extends CASTProblemOwner implements IASTProblemDeclaration {
|
||||||
IASTProblemDeclaration {
|
|
||||||
|
|
||||||
public CASTProblemDeclaration() {
|
public CASTProblemDeclaration() {
|
||||||
super();
|
super();
|
||||||
|
@ -46,20 +45,22 @@ public class CASTProblemDeclaration extends CASTProblemOwner implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.accept(action); // visits the problem
|
super.accept(action); // visits the problem
|
||||||
if( action.shouldVisitDeclarations ){
|
|
||||||
switch( action.leave( this ) ){
|
if (action.shouldVisitDeclarations) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
switch (action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
default : break;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM) - Initial API and implementation
|
* John Camelon (IBM) - Initial API and implementation
|
||||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -45,20 +45,22 @@ public class CASTProblemExpression extends CASTProblemOwner implements IASTProbl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.accept(action); // visits the problem
|
super.accept(action); // visits the problem
|
||||||
if( action.shouldVisitExpressions ){
|
|
||||||
switch( action.leave( this ) ){
|
if (action.shouldVisitExpressions) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
switch (action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
default : break;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
abstract class CASTProblemOwner extends ASTNode implements IASTProblemHolder {
|
abstract class CASTProblemOwner extends ASTNode implements IASTProblemHolder {
|
||||||
|
|
||||||
private IASTProblem problem;
|
private IASTProblem problem;
|
||||||
|
|
||||||
public CASTProblemOwner() {
|
public CASTProblemOwner() {
|
||||||
|
@ -51,17 +50,17 @@ abstract class CASTProblemOwner extends ASTNode implements IASTProblemHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept(ASTVisitor action){
|
||||||
if( action.shouldVisitProblems ){
|
if (action.shouldVisitProblems) {
|
||||||
switch( action.visit( getProblem() ) ){
|
switch (action.visit(getProblem())) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
switch( action.leave( getProblem() ) ){
|
switch (action.leave(getProblem())) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -44,20 +44,22 @@ public class CASTProblemStatement extends CASTProblemOwner implements IASTProble
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.accept(action); // visits the problem
|
super.accept(action); // visits the problem
|
||||||
if( action.shouldVisitStatements ){
|
|
||||||
switch( action.leave( this ) ){
|
if (action.shouldVisitStatements) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
switch (action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
default : break;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -22,9 +22,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CASTSwitchStatement extends ASTNode implements
|
public class CASTSwitchStatement extends ASTNode
|
||||||
IASTSwitchStatement, IASTAmbiguityParent {
|
implements IASTSwitchStatement, IASTAmbiguityParent {
|
||||||
|
|
||||||
private IASTExpression controller;
|
private IASTExpression controller;
|
||||||
private IASTStatement body;
|
private IASTStatement body;
|
||||||
|
|
||||||
|
@ -84,22 +83,23 @@ public class CASTSwitchStatement extends ASTNode implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( controller != null ) if( !controller.accept( action ) ) return false;
|
|
||||||
if( body != null ) if( !body.accept( action ) ) return false;
|
|
||||||
|
|
||||||
if( action.shouldVisitStatements ){
|
if (controller != null && !controller.accept(action)) return false;
|
||||||
switch( action.leave( this ) ){
|
if (body != null && !body.accept(action)) return false;
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
if (action.shouldVisitStatements) {
|
||||||
default : break;
|
switch (action.leave(this)) {
|
||||||
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -107,16 +107,14 @@ public class CASTSwitchStatement extends ASTNode implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
if( body == child )
|
if (body == child) {
|
||||||
{
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
|
||||||
body = (IASTStatement) other;
|
body = (IASTStatement) other;
|
||||||
}
|
}
|
||||||
if( child == controller )
|
if (child == controller) {
|
||||||
{
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
|
||||||
controller = (IASTExpression) other;
|
controller = (IASTExpression) other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - Initial API and implementation
|
* Markus Schorn - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
* };
|
* };
|
||||||
*/
|
*/
|
||||||
public class CPPASTAmbiguousSimpleDeclaration extends ASTAmbiguousNode implements IASTAmbiguousSimpleDeclaration {
|
public class CPPASTAmbiguousSimpleDeclaration extends ASTAmbiguousNode implements IASTAmbiguousSimpleDeclaration {
|
||||||
|
|
||||||
private IASTSimpleDeclaration fSimpleDecl;
|
private IASTSimpleDeclaration fSimpleDecl;
|
||||||
private IASTDeclSpecifier fAltDeclSpec;
|
private IASTDeclSpecifier fAltDeclSpec;
|
||||||
private IASTDeclarator fAltDtor;
|
private IASTDeclarator fAltDtor;
|
||||||
|
@ -55,7 +54,7 @@ public class CPPASTAmbiguousSimpleDeclaration extends ASTAmbiguousNode implement
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTNode[] getNodes() {
|
public IASTNode[] getNodes() {
|
||||||
return new IASTNode[] {fSimpleDecl, fAltDeclSpec, fAltDtor};
|
return new IASTNode[] { fSimpleDecl, fAltDeclSpec, fAltDtor };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -98,7 +97,6 @@ public class CPPASTAmbiguousSimpleDeclaration extends ASTAmbiguousNode implement
|
||||||
IASTDeclarator dtor= fSimpleDecl.getDeclarators()[0];
|
IASTDeclarator dtor= fSimpleDecl.getDeclarators()[0];
|
||||||
dtor.accept(resolver);
|
dtor.accept(resolver);
|
||||||
|
|
||||||
|
|
||||||
// find nested names
|
// find nested names
|
||||||
final NameCollector nameCollector= new NameCollector();
|
final NameCollector nameCollector= new NameCollector();
|
||||||
dtor.accept(nameCollector);
|
dtor.accept(nameCollector);
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -23,16 +23,14 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousStatement;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
|
|
||||||
public class CPPASTAmbiguousStatement extends ASTAmbiguousNode implements
|
public class CPPASTAmbiguousStatement extends ASTAmbiguousNode implements IASTAmbiguousStatement {
|
||||||
IASTAmbiguousStatement {
|
private IASTStatement[] stmts = new IASTStatement[2];
|
||||||
|
private int stmtsPos= -1;
|
||||||
private IASTStatement [] stmts = new IASTStatement[2];
|
|
||||||
private int stmtsPos=-1;
|
|
||||||
private IScope fScope;
|
private IScope fScope;
|
||||||
private IASTDeclaration fDeclaration;
|
private IASTDeclaration fDeclaration;
|
||||||
|
|
||||||
public CPPASTAmbiguousStatement(IASTStatement... statements) {
|
public CPPASTAmbiguousStatement(IASTStatement... statements) {
|
||||||
for(IASTStatement s : statements)
|
for (IASTStatement s : statements)
|
||||||
addStatement(s);
|
addStatement(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +82,7 @@ public class CPPASTAmbiguousStatement extends ASTAmbiguousNode implements
|
||||||
public void addStatement(IASTStatement s) {
|
public void addStatement(IASTStatement s) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
stmts = ArrayUtil.appendAt( IASTStatement.class, stmts, ++stmtsPos, s );
|
stmts = ArrayUtil.appendAt(IASTStatement.class, stmts, ++stmtsPos, s);
|
||||||
s.setParent(this);
|
s.setParent(this);
|
||||||
s.setPropertyInParent(STATEMENT);
|
s.setPropertyInParent(STATEMENT);
|
||||||
}
|
}
|
||||||
|
@ -92,7 +90,7 @@ public class CPPASTAmbiguousStatement extends ASTAmbiguousNode implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTStatement[] getStatements() {
|
public IASTStatement[] getStatements() {
|
||||||
stmts = ArrayUtil.trimAt( IASTStatement.class, stmts, stmtsPos );
|
stmts = ArrayUtil.trimAt(IASTStatement.class, stmts, stmtsPos);
|
||||||
return stmts;
|
return stmts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTCaseStatement extends ASTNode implements IASTCaseStatement, IASTAmbiguityParent {
|
public class CPPASTCaseStatement extends ASTNode implements IASTCaseStatement, IASTAmbiguityParent {
|
||||||
|
|
||||||
private IASTExpression expression;
|
private IASTExpression expression;
|
||||||
|
|
||||||
public CPPASTCaseStatement() {
|
public CPPASTCaseStatement() {
|
||||||
|
@ -38,8 +37,8 @@ public class CPPASTCaseStatement extends ASTNode implements IASTCaseStatement, I
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CPPASTCaseStatement copy(CopyStyle style) {
|
public CPPASTCaseStatement copy(CopyStyle style) {
|
||||||
CPPASTCaseStatement copy = new CPPASTCaseStatement(expression == null ? null
|
CPPASTCaseStatement copy =
|
||||||
: expression.copy(style));
|
new CPPASTCaseStatement(expression == null ? null : expression.copy(style));
|
||||||
copy.setOffsetAndLength(this);
|
copy.setOffsetAndLength(this);
|
||||||
if (style == CopyStyle.withLocations) {
|
if (style == CopyStyle.withLocations) {
|
||||||
copy.setCopyLocation(this);
|
copy.setCopyLocation(this);
|
||||||
|
@ -63,18 +62,19 @@ public class CPPASTCaseStatement extends ASTNode implements IASTCaseStatement, I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
default : break;
|
default : break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( expression != null ) if( !expression.accept( action ) ) return false;
|
|
||||||
|
|
||||||
if( action.shouldVisitStatements ){
|
if (expression != null && !expression.accept(action)) return false;
|
||||||
switch( action.leave( this ) ){
|
|
||||||
|
if (action.shouldVisitStatements) {
|
||||||
|
switch(action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
default : break;
|
default : break;
|
||||||
|
@ -85,10 +85,9 @@ public class CPPASTCaseStatement extends ASTNode implements IASTCaseStatement, I
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
if( child == expression )
|
if (child == expression) {
|
||||||
{
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
|
||||||
expression = (IASTExpression) other;
|
expression = (IASTExpression) other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -22,11 +22,9 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmbiguityParent {
|
public class CPPASTDoStatement extends ASTNode implements IASTDoStatement, IASTAmbiguityParent {
|
||||||
|
|
||||||
private IASTStatement body;
|
private IASTStatement body;
|
||||||
private IASTExpression condition;
|
private IASTExpression condition;
|
||||||
|
|
||||||
|
|
||||||
public CPPASTDoStatement() {
|
public CPPASTDoStatement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,21 +81,23 @@ public class CPPASTDoStatement extends ASTNode implements IASTDoStatement, IASTA
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( body != null ) if( !body.accept( action ) ) return false;
|
|
||||||
if( condition != null ) if( !condition.accept( action ) ) return false;
|
if (body != null && !body.accept(action)) return false;
|
||||||
if( action.shouldVisitStatements ){
|
if (condition != null && !condition.accept(action)) return false;
|
||||||
switch( action.leave( this ) ){
|
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
if (action.shouldVisitStatements) {
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
switch (action.leave(this)) {
|
||||||
default : break;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -105,16 +105,14 @@ public class CPPASTDoStatement extends ASTNode implements IASTDoStatement, IASTA
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
if( body == child )
|
if (body == child) {
|
||||||
{
|
other.setPropertyInParent(body.getPropertyInParent());
|
||||||
other.setPropertyInParent( body.getPropertyInParent() );
|
other.setParent(body.getParent());
|
||||||
other.setParent( body.getParent() );
|
|
||||||
body = (IASTStatement) other;
|
body = (IASTStatement) other;
|
||||||
}
|
}
|
||||||
if( child == condition )
|
if (child == condition) {
|
||||||
{
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
|
||||||
condition = (IASTExpression) other;
|
condition = (IASTExpression) other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
*/
|
*/
|
||||||
public class CPPASTExpressionStatement extends ASTNode implements
|
public class CPPASTExpressionStatement extends ASTNode implements
|
||||||
IASTExpressionStatement, IASTAmbiguityParent {
|
IASTExpressionStatement, IASTAmbiguityParent {
|
||||||
|
|
||||||
private IASTExpression expression;
|
private IASTExpression expression;
|
||||||
|
|
||||||
public CPPASTExpressionStatement() {
|
public CPPASTExpressionStatement() {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -19,10 +19,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTGotoStatement extends ASTNode implements IASTGotoStatement {
|
public class CPPASTGotoStatement extends ASTNode implements IASTGotoStatement {
|
||||||
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
|
|
||||||
public CPPASTGotoStatement() {
|
public CPPASTGotoStatement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,28 +49,29 @@ public class CPPASTGotoStatement extends ASTNode implements IASTGotoStatement {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setName(IASTName name) {
|
public void setName(IASTName name) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
name.setParent(this);
|
name.setParent(this);
|
||||||
name.setPropertyInParent(NAME);
|
name.setPropertyInParent(NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
default : break;
|
default : break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
|
||||||
|
|
||||||
if( action.shouldVisitStatements ){
|
if (name != null && !name.accept(action)) return false;
|
||||||
switch( action.leave( this ) ){
|
|
||||||
|
if (action.shouldVisitStatements) {
|
||||||
|
switch (action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
default : break;
|
default : break;
|
||||||
|
@ -83,7 +82,7 @@ public class CPPASTGotoStatement extends ASTNode implements IASTGotoStatement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM) - Initial API and implementation
|
* John Camelon (IBM) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -158,6 +158,7 @@ public class CPPASTIfStatement extends ASTNode implements ICPPASTIfStatement, IA
|
||||||
break loop;
|
break loop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action.shouldVisitStatements) {
|
if (action.shouldVisitStatements) {
|
||||||
if (stmt != null && action.leave(stmt) == ASTVisitor.PROCESS_ABORT)
|
if (stmt != null && action.leave(stmt) == ASTVisitor.PROCESS_ABORT)
|
||||||
return false;
|
return false;
|
||||||
|
@ -207,8 +208,8 @@ public class CPPASTIfStatement extends ASTNode implements ICPPASTIfStatement, IA
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IScope getScope() {
|
public IScope getScope() {
|
||||||
if( scope == null )
|
if (scope == null)
|
||||||
scope = new CPPBlockScope( this );
|
scope = new CPPBlockScope(this);
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM) - Initial API and implementation
|
* John Camelon (IBM) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -26,9 +26,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
* e.g.: int a[]= {1,2,3};
|
* e.g.: int a[]= {1,2,3};
|
||||||
*/
|
*/
|
||||||
public class CPPASTInitializerList extends ASTNode implements ICPPASTInitializerList, IASTAmbiguityParent {
|
public class CPPASTInitializerList extends ASTNode implements ICPPASTInitializerList, IASTAmbiguityParent {
|
||||||
|
private IASTInitializerClause [] initializers;
|
||||||
private IASTInitializerClause [] initializers = null;
|
private int initializersPos= -1;
|
||||||
private int initializersPos=-1;
|
|
||||||
private int actualSize;
|
private int actualSize;
|
||||||
private boolean fIsPackExpansion;
|
private boolean fIsPackExpansion;
|
||||||
|
|
||||||
|
@ -40,8 +39,9 @@ public class CPPASTInitializerList extends ASTNode implements ICPPASTInitializer
|
||||||
@Override
|
@Override
|
||||||
public CPPASTInitializerList copy(CopyStyle style) {
|
public CPPASTInitializerList copy(CopyStyle style) {
|
||||||
CPPASTInitializerList copy = new CPPASTInitializerList();
|
CPPASTInitializerList copy = new CPPASTInitializerList();
|
||||||
for (IASTInitializerClause initializer : getClauses())
|
for (IASTInitializerClause initializer : getClauses()) {
|
||||||
copy.addClause(initializer == null ? null : initializer.copy(style));
|
copy.addClause(initializer == null ? null : initializer.copy(style));
|
||||||
|
}
|
||||||
copy.setOffsetAndLength(this);
|
copy.setOffsetAndLength(this);
|
||||||
copy.actualSize = getSize();
|
copy.actualSize = getSize();
|
||||||
copy.fIsPackExpansion = fIsPackExpansion;
|
copy.fIsPackExpansion = fIsPackExpansion;
|
||||||
|
@ -114,9 +114,9 @@ public class CPPASTInitializerList extends ASTNode implements ICPPASTInitializer
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
if (action.shouldVisitInitializers) {
|
if (action.shouldVisitInitializers) {
|
||||||
switch (action.visit(this)) {
|
switch (action.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IASTInitializerClause[] list = getClauses();
|
IASTInitializerClause[] list = getClauses();
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -21,13 +21,11 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTLabelStatement extends ASTNode implements
|
public class CPPASTLabelStatement extends ASTNode
|
||||||
IASTLabelStatement, IASTAmbiguityParent {
|
implements IASTLabelStatement, IASTAmbiguityParent {
|
||||||
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
private IASTStatement nestedStatement;
|
private IASTStatement nestedStatement;
|
||||||
|
|
||||||
|
|
||||||
public CPPASTLabelStatement() {
|
public CPPASTLabelStatement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,22 +67,23 @@ public class CPPASTLabelStatement extends ASTNode implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
|
||||||
if( nestedStatement != null ) if( !nestedStatement.accept( action ) ) return false;
|
|
||||||
|
|
||||||
if( action.shouldVisitStatements ){
|
if (name != null && !name.accept(action)) return false;
|
||||||
switch( action.leave( this ) ){
|
if (nestedStatement != null && !nestedStatement.accept(action)) return false;
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
if (action.shouldVisitStatements) {
|
||||||
default : break;
|
switch (action.leave(this)) {
|
||||||
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -92,7 +91,7 @@ public class CPPASTLabelStatement extends ASTNode implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,12 +112,10 @@ public class CPPASTLabelStatement extends ASTNode implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
if( child == nestedStatement )
|
if (child == nestedStatement) {
|
||||||
{
|
other.setParent(this);
|
||||||
other.setParent( this );
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
|
||||||
setNestedStatement((IASTStatement) other);
|
setNestedStatement((IASTStatement) other);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -44,23 +44,22 @@ public class CPPASTProblemDeclaration extends CPPASTProblemOwner implements IAST
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.accept(action); // visits the problem
|
super.accept(action); // visits the problem
|
||||||
if( action.shouldVisitDeclarations ){
|
if (action.shouldVisitDeclarations) {
|
||||||
switch( action.leave( this ) ){
|
switch (action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM) - Initial API and implementation
|
* John Camelon (IBM) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -44,20 +44,20 @@ public class CPPASTProblemExpression extends CPPASTProblemOwner implements IASTP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.accept(action); // visits the problem
|
super.accept(action); // visits the problem
|
||||||
if( action.shouldVisitExpressions ){
|
if (action.shouldVisitExpressions) {
|
||||||
switch( action.leave( this ) ){
|
switch (action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -20,10 +20,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
abstract class CPPASTProblemOwner extends ASTNode implements IASTProblemHolder {
|
abstract class CPPASTProblemOwner extends ASTNode implements IASTProblemHolder {
|
||||||
|
|
||||||
private IASTProblem problem;
|
private IASTProblem problem;
|
||||||
|
|
||||||
|
|
||||||
public CPPASTProblemOwner() {
|
public CPPASTProblemOwner() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,17 +50,17 @@ abstract class CPPASTProblemOwner extends ASTNode implements IASTProblemHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept(ASTVisitor action) {
|
||||||
if( action.shouldVisitProblems ){
|
if (action.shouldVisitProblems) {
|
||||||
switch( action.visit( getProblem() ) ){
|
switch (action.visit(getProblem())) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
switch( action.leave( getProblem() ) ){
|
switch (action.leave(getProblem())) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -44,20 +44,20 @@ public class CPPASTProblemStatement extends CPPASTProblemOwner implements IASTPr
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.accept(action); // visits the problem
|
super.accept(action); // visits the problem
|
||||||
if( action.shouldVisitStatements ){
|
if (action.shouldVisitStatements) {
|
||||||
switch( action.leave( this ) ){
|
switch (action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IASTProblemTypeId;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTProblemTypeId extends CPPASTProblemOwner implements IASTProblemTypeId {
|
public class CPPASTProblemTypeId extends CPPASTProblemOwner implements IASTProblemTypeId {
|
||||||
|
|
||||||
public CPPASTProblemTypeId() {
|
public CPPASTProblemTypeId() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ public class CPPASTProblemTypeId extends CPPASTProblemOwner implements IASTProbl
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Visits the problem
|
// Visit the problem
|
||||||
if (!super.accept(action))
|
if (!super.accept(action))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - Initial API and implementation
|
* Markus Schorn - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -178,9 +178,9 @@ public class CPPASTRangeBasedForStatement extends ASTNode implements ICPPASTRang
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fDeclaration != null && !fDeclaration.accept(action))
|
if (fDeclaration != null && !fDeclaration.accept(action))
|
||||||
|
|
|
@ -77,16 +77,13 @@ public class CPPASTReturnStatement extends ASTNode implements IASTReturnStatemen
|
||||||
public boolean accept(ASTVisitor action) {
|
public boolean accept(ASTVisitor action) {
|
||||||
if (action.shouldVisitStatements) {
|
if (action.shouldVisitStatements) {
|
||||||
switch (action.visit(this)) {
|
switch (action.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT:
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
return false;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
case ASTVisitor.PROCESS_SKIP:
|
default: break;
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (retValue != null && !retValue.accept(action))
|
|
||||||
return false;
|
if (retValue != null && !retValue.accept(action)) return false;
|
||||||
|
|
||||||
if (action.shouldVisitStatements) {
|
if (action.shouldVisitStatements) {
|
||||||
switch (action.leave(this)) {
|
switch (action.leave(this)) {
|
||||||
|
|
|
@ -41,8 +41,9 @@ public class CPPASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclar
|
||||||
public CPPASTSimpleDeclaration copy(CopyStyle style) {
|
public CPPASTSimpleDeclaration copy(CopyStyle style) {
|
||||||
CPPASTSimpleDeclaration copy = new CPPASTSimpleDeclaration();
|
CPPASTSimpleDeclaration copy = new CPPASTSimpleDeclaration();
|
||||||
copy.setDeclSpecifier(declSpecifier == null ? null : declSpecifier.copy(style));
|
copy.setDeclSpecifier(declSpecifier == null ? null : declSpecifier.copy(style));
|
||||||
for (IASTDeclarator declarator : getDeclarators())
|
for (IASTDeclarator declarator : getDeclarators()) {
|
||||||
copy.addDeclarator(declarator == null ? null : declarator.copy(style));
|
copy.addDeclarator(declarator == null ? null : declarator.copy(style));
|
||||||
|
}
|
||||||
copy.setOffsetAndLength(this);
|
copy.setOffsetAndLength(this);
|
||||||
if (style == CopyStyle.withLocations) {
|
if (style == CopyStyle.withLocations) {
|
||||||
copy.setCopyLocation(this);
|
copy.setCopyLocation(this);
|
||||||
|
@ -129,5 +130,4 @@ public class CPPASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM) - Initial API and implementation
|
* John Camelon (IBM) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -104,6 +104,7 @@ public class CPPASTSwitchStatement extends ASTNode
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (controllerExpression != null && !controllerExpression.accept(action)) return false;
|
if (controllerExpression != null && !controllerExpression.accept(action)) return false;
|
||||||
if (controllerDeclaration != null && !controllerDeclaration.accept(action)) return false;
|
if (controllerDeclaration != null && !controllerDeclaration.accept(action)) return false;
|
||||||
if (body != null && !body.accept(action)) return false;
|
if (body != null && !body.accept(action)) return false;
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2011 IBM Corporation and others.
|
* Copyright (c) 2004, 2011 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM) - Initial API and implementation
|
* John Camelon (IBM) - Initial API and implementation
|
||||||
* Bryan Wilkinson (QNX)
|
* Bryan Wilkinson (QNX)
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -24,10 +24,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
|
||||||
|
|
||||||
|
|
||||||
public class CPPASTUsingDeclaration extends ASTNode
|
public class CPPASTUsingDeclaration extends ASTNode
|
||||||
implements ICPPASTUsingDeclaration, ICPPASTCompletionContext {
|
implements ICPPASTUsingDeclaration, ICPPASTCompletionContext {
|
||||||
|
|
||||||
private boolean typeName;
|
private boolean typeName;
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
|
@ -45,8 +43,8 @@ public class CPPASTUsingDeclaration extends ASTNode
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CPPASTUsingDeclaration copy(CopyStyle style) {
|
public CPPASTUsingDeclaration copy(CopyStyle style) {
|
||||||
CPPASTUsingDeclaration copy = new CPPASTUsingDeclaration(name == null ? null
|
CPPASTUsingDeclaration copy =
|
||||||
: name.copy(style));
|
new CPPASTUsingDeclaration(name == null ? null : name.copy(style));
|
||||||
copy.typeName = typeName;
|
copy.typeName = typeName;
|
||||||
copy.setOffsetAndLength(this);
|
copy.setOffsetAndLength(this);
|
||||||
if (style == CopyStyle.withLocations) {
|
if (style == CopyStyle.withLocations) {
|
||||||
|
@ -85,19 +83,19 @@ public class CPPASTUsingDeclaration extends ASTNode
|
||||||
public boolean accept(ASTVisitor action) {
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name != null) if (!name.accept(action)) return false;
|
if (name != null && !name.accept(action)) return false;
|
||||||
|
|
||||||
if (action.shouldVisitDeclarations) {
|
if (action.shouldVisitDeclarations) {
|
||||||
switch(action.leave(this)) {
|
switch(action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM) - Initial API and implementation
|
* John Camelon (IBM) - Initial API and implementation
|
||||||
* Bryan Wilkinson (QNX)
|
* Bryan Wilkinson (QNX)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -23,10 +23,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
|
||||||
|
|
||||||
|
public class CPPASTUsingDirective extends ASTNode
|
||||||
public class CPPASTUsingDirective extends ASTNode implements
|
implements ICPPASTUsingDirective, ICPPASTCompletionContext {
|
||||||
ICPPASTUsingDirective, ICPPASTCompletionContext {
|
|
||||||
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
public CPPASTUsingDirective() {
|
public CPPASTUsingDirective() {
|
||||||
|
@ -64,35 +62,33 @@ public class CPPASTUsingDirective extends ASTNode implements
|
||||||
qualifiedName.setParent(this);
|
qualifiedName.setParent(this);
|
||||||
qualifiedName.setPropertyInParent(QUALIFIED_NAME);
|
qualifiedName.setPropertyInParent(QUALIFIED_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
if (name != null && !name.accept(action)) return false;
|
||||||
|
|
||||||
if( action.shouldVisitDeclarations ){
|
if (action.shouldVisitDeclarations) {
|
||||||
switch( action.leave( this ) ){
|
switch (action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Override
|
|
||||||
public int getRoleForName(IASTName n) {
|
public int getRoleForName(IASTName n) {
|
||||||
if( n == name )
|
if (n == name)
|
||||||
return r_reference;
|
return r_reference;
|
||||||
return r_unclear;
|
return r_unclear;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.upc.ast;
|
package org.eclipse.cdt.internal.core.dom.parser.upc.ast;
|
||||||
|
|
||||||
|
@ -18,11 +18,9 @@ import org.eclipse.cdt.internal.core.dom.parser.c.CASTForStatement;
|
||||||
|
|
||||||
@SuppressWarnings("restriction")
|
@SuppressWarnings("restriction")
|
||||||
public class UPCASTForallStatement extends CASTForStatement implements IUPCASTForallStatement {
|
public class UPCASTForallStatement extends CASTForStatement implements IUPCASTForallStatement {
|
||||||
|
|
||||||
private IASTExpression affinity;
|
private IASTExpression affinity;
|
||||||
private boolean affinityContinue;
|
private boolean affinityContinue;
|
||||||
|
|
||||||
|
|
||||||
public UPCASTForallStatement() {
|
public UPCASTForallStatement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,15 +38,14 @@ public class UPCASTForallStatement extends CASTForStatement implements IUPCASTFo
|
||||||
@Override
|
@Override
|
||||||
public UPCASTForallStatement copy(CopyStyle style) {
|
public UPCASTForallStatement copy(CopyStyle style) {
|
||||||
UPCASTForallStatement copy = new UPCASTForallStatement();
|
UPCASTForallStatement copy = new UPCASTForallStatement();
|
||||||
copyForStatement(copy, style);
|
|
||||||
copy.setAffinityExpression(affinity == null ? null : affinity.copy(style));
|
copy.setAffinityExpression(affinity == null ? null : affinity.copy(style));
|
||||||
|
copyForStatement(copy, style);
|
||||||
if (style == CopyStyle.withLocations) {
|
if (style == CopyStyle.withLocations) {
|
||||||
copy.setCopyLocation(this);
|
copy.setCopyLocation(this);
|
||||||
}
|
}
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAffinityContinue() {
|
public boolean isAffinityContinue() {
|
||||||
return affinityContinue;
|
return affinityContinue;
|
||||||
|
@ -61,10 +58,10 @@ public class UPCASTForallStatement extends CASTForStatement implements IUPCASTFo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAffinityExpression(IASTExpression affinity) {
|
public void setAffinityExpression(IASTExpression affinity) {
|
||||||
if(affinity != null)
|
if (affinity != null)
|
||||||
this.affinityContinue = false;
|
this.affinityContinue = false;
|
||||||
this.affinity = affinity;
|
this.affinity = affinity;
|
||||||
if(affinity != null) {
|
if (affinity != null) {
|
||||||
affinity.setParent(this);
|
affinity.setParent(this);
|
||||||
affinity.setPropertyInParent(AFFINITY);
|
affinity.setPropertyInParent(AFFINITY);
|
||||||
}
|
}
|
||||||
|
@ -72,43 +69,40 @@ public class UPCASTForallStatement extends CASTForStatement implements IUPCASTFo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAffinityContinue(boolean affinityContinue) {
|
public void setAffinityContinue(boolean affinityContinue) {
|
||||||
if(affinityContinue)
|
if (affinityContinue)
|
||||||
this.affinity = null;
|
this.affinity = null;
|
||||||
this.affinityContinue = affinityContinue;
|
this.affinityContinue = affinityContinue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(ASTVisitor visitor) {
|
public boolean accept(ASTVisitor visitor) {
|
||||||
if(visitor.shouldVisitStatements) {
|
if (visitor.shouldVisitStatements) {
|
||||||
switch(visitor.visit(this)){
|
switch (visitor.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IASTStatement initializer = super.getInitializerStatement();
|
IASTStatement initializer = super.getInitializerStatement();
|
||||||
if(initializer != null) if(!initializer.accept(visitor)) return false;
|
if (initializer != null && !initializer.accept(visitor)) return false;
|
||||||
|
|
||||||
IASTExpression condition = super.getConditionExpression();
|
IASTExpression condition = super.getConditionExpression();
|
||||||
if(condition != null) if(!condition.accept(visitor)) return false;
|
if (condition != null && !condition.accept(visitor)) return false;
|
||||||
|
|
||||||
IASTExpression iteration = super.getIterationExpression();
|
IASTExpression iteration = super.getIterationExpression();
|
||||||
if(iteration != null) if(!iteration.accept(visitor)) return false;
|
if (iteration != null && !iteration.accept(visitor)) return false;
|
||||||
|
|
||||||
if(affinity != null) if(!affinity.accept(visitor)) return false;
|
if (affinity != null && !affinity.accept(visitor)) return false;
|
||||||
|
|
||||||
IASTStatement body = super.getBody();
|
IASTStatement body = super.getBody();
|
||||||
if(body != null) if(!body.accept(visitor)) return false;
|
if (body != null && !body.accept(visitor)) return false;
|
||||||
|
|
||||||
if(visitor.shouldVisitStatements) {
|
if (visitor.shouldVisitStatements) {
|
||||||
switch(visitor.leave(this)){
|
switch (visitor.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.upc.ast;
|
package org.eclipse.cdt.internal.core.dom.parser.upc.ast;
|
||||||
|
|
||||||
|
@ -17,10 +17,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
|
|
||||||
@SuppressWarnings("restriction")
|
@SuppressWarnings("restriction")
|
||||||
public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSynchronizationStatement {
|
public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSynchronizationStatement {
|
||||||
|
|
||||||
private int statmentKind;
|
private int statmentKind;
|
||||||
private IASTExpression barrierExpression = null;
|
private IASTExpression barrierExpression;
|
||||||
|
|
||||||
|
|
||||||
public UPCASTSynchronizationStatement() {
|
public UPCASTSynchronizationStatement() {
|
||||||
}
|
}
|
||||||
|
@ -41,7 +39,7 @@ public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSy
|
||||||
copy.statmentKind = statmentKind;
|
copy.statmentKind = statmentKind;
|
||||||
copy.setBarrierExpression(barrierExpression == null ? null : barrierExpression.copy(style));
|
copy.setBarrierExpression(barrierExpression == null ? null : barrierExpression.copy(style));
|
||||||
copy.setOffsetAndLength(this);
|
copy.setOffsetAndLength(this);
|
||||||
if(style == CopyStyle.withLocations) {
|
if (style == CopyStyle.withLocations) {
|
||||||
copy.setCopyLocation(this);
|
copy.setCopyLocation(this);
|
||||||
}
|
}
|
||||||
return copy;
|
return copy;
|
||||||
|
@ -60,7 +58,7 @@ public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSy
|
||||||
@Override
|
@Override
|
||||||
public void setBarrierExpression(IASTExpression expr) {
|
public void setBarrierExpression(IASTExpression expr) {
|
||||||
this.barrierExpression = expr;
|
this.barrierExpression = expr;
|
||||||
if(expr != null) {
|
if (expr != null) {
|
||||||
expr.setParent(this);
|
expr.setParent(this);
|
||||||
expr.setPropertyInParent(BARRIER_EXPRESSION);
|
expr.setPropertyInParent(BARRIER_EXPRESSION);
|
||||||
}
|
}
|
||||||
|
@ -71,30 +69,23 @@ public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSy
|
||||||
this.statmentKind = kind;
|
this.statmentKind = kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(ASTVisitor visitor) {
|
public boolean accept(ASTVisitor visitor) {
|
||||||
if(visitor.shouldVisitStatements) {
|
if (visitor.shouldVisitStatements) {
|
||||||
switch(visitor.visit(this)) {
|
switch (visitor.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(barrierExpression != null) {
|
if (barrierExpression != null && !barrierExpression.accept(visitor)) return false;
|
||||||
boolean abort = !barrierExpression.accept(visitor);
|
|
||||||
if(abort)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(visitor.shouldVisitStatements) {
|
if (visitor.shouldVisitStatements) {
|
||||||
switch(visitor.leave(this)) {
|
switch (visitor.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue