1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-30 21:55:31 +02:00

Infrastructure to help fix all the ambiguity bugs.

This commit is contained in:
John Camelon 2005-04-08 15:08:30 +00:00
parent 7fec8ae423
commit a65769ef8a
15 changed files with 106 additions and 22 deletions

View file

@ -383,18 +383,22 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
public IASTTranslationUnit parse() {
long startTime = System.currentTimeMillis();
translationUnit();
// For the debuglog to take place, you have to call
// Util.setDebugging(true);
// Or set debug to true in the core plugin preference
log.traceLog("Parse " //$NON-NLS-1$
+ (++parseCount) + ": " //$NON-NLS-1$
+ (System.currentTimeMillis() - startTime) + "ms" //$NON-NLS-1$
+ (parsePassed ? "" : " - parse failure")); //$NON-NLS-1$ //$NON-NLS-2$
startTime = System.currentTimeMillis();
resolveAmbiguities();
log.traceLog("Ambiguity resolution : " //$NON-NLS-1$
+ (System.currentTimeMillis() - startTime) + "ms" //$NON-NLS-1$
); //$NON-NLS-1$ //$NON-NLS-2$
IASTTranslationUnit result = getTranslationUnit();
nullifyTranslationUnit();
return result;
}
protected abstract void resolveAmbiguities();
/**
*
*/

View file

@ -0,0 +1,17 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.internal.core.dom.parser;
import org.eclipse.cdt.core.dom.ast.IASTNode;
public interface IASTAmbiguity extends IASTNode {
}

View file

@ -0,0 +1,31 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.internal.core.dom.parser;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
/**
* @author jcamelon
*/
public interface IASTDeclarationAmbiguity extends IASTDeclaration,
IASTAmbiguity {
/**
* @param decl
*/
public void addDeclaration( IASTDeclaration decl );
/**
* @return
*/
public IASTDeclaration [] getDeclarations();
}

View file

@ -15,7 +15,7 @@ import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier;
/**
* @author jcamelon
*/
public class CASTBaseDeclSpecifier extends CASTNode implements ICASTDeclSpecifier {
public abstract class CASTBaseDeclSpecifier extends CASTNode implements ICASTDeclSpecifier {
protected int storageClass;
protected boolean isConst;

View file

@ -10,7 +10,6 @@
package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
@ -18,7 +17,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
/**
* @author jcamelon
*/
public class CASTNode extends ASTNode implements IASTNode {
public abstract class CASTNode extends ASTNode implements IASTNode {
private IASTNode parent;
private ASTNodeProperty property;
@ -63,7 +62,7 @@ public class CASTNode extends ASTNode implements IASTNode {
return (IASTTranslationUnit) node;
}
public boolean accept( ASTVisitor action ){
return true;
}
// public boolean accept( ASTVisitor action ){
// return true;
// }
}

View file

@ -9,6 +9,7 @@
* IBM Rational Software - Initial API and implementation */
package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.c.ICASTPointer;
/**
@ -62,4 +63,8 @@ public class CASTPointer extends CASTNode implements ICASTPointer {
isVolatile = value;
}
public boolean accept(ASTVisitor visitor) {
return true;
}
}

View file

@ -15,7 +15,7 @@ import org.eclipse.cdt.core.dom.ast.IASTProblem;
/**
* @author jcamelon
*/
class CASTProblemOwner extends CASTNode {
abstract class CASTProblemOwner extends CASTNode {
private IASTProblem problem;

View file

@ -2600,4 +2600,9 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
return nc.result;
}
protected void resolveAmbiguities() {
// TODO Auto-generated method stub
}
}

View file

@ -15,7 +15,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
/**
* @author jcamelon
*/
public class CPPASTBaseDeclSpecifier extends CPPASTNode implements
public abstract class CPPASTBaseDeclSpecifier extends CPPASTNode implements
ICPPASTDeclSpecifier {
private boolean friend;

View file

@ -11,7 +11,6 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
@ -19,7 +18,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
/**
* @author jcamelon
*/
public class CPPASTNode extends ASTNode implements IASTNode {
public abstract class CPPASTNode extends ASTNode implements IASTNode {
private IASTNode parent;
private ASTNodeProperty property;
@ -64,7 +63,4 @@ public class CPPASTNode extends ASTNode implements IASTNode {
this.property = property;
}
public boolean accept( ASTVisitor action ){
return true;
}
}

View file

@ -10,6 +10,7 @@
**********************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTPointer;
/**
@ -18,34 +19,46 @@ import org.eclipse.cdt.core.dom.ast.IASTPointer;
public class CPPASTPointer extends CPPASTNode implements IASTPointer {
private boolean isConst;
private boolean isVolatile;
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTPointer#isConst()
*/
public boolean isConst() {
return isConst;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTPointer#isVolatile()
*/
public boolean isVolatile() {
return isVolatile;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTPointer#setConst(boolean)
*/
public void setConst(boolean value) {
isConst = value;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTPointer#setVolatile(boolean)
*/
public void setVolatile(boolean value) {
isVolatile = value;
}
public boolean accept(ASTVisitor action) {
return true;
}
}

View file

@ -15,7 +15,7 @@ import org.eclipse.cdt.core.dom.ast.IASTProblem;
/**
* @author jcamelon
*/
class CPPASTProblemOwner extends CPPASTNode {
abstract class CPPASTProblemOwner extends CPPASTNode {
private IASTProblem problem;

View file

@ -10,6 +10,7 @@
**********************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator;
/**
@ -17,5 +18,9 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator;
*/
public class CPPASTReferenceOperator extends CPPASTNode implements
ICPPASTReferenceOperator {
public boolean accept( ASTVisitor action ){
return true;
}
}

View file

@ -10,6 +10,7 @@
**********************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisiblityLabel;
/**
@ -34,4 +35,7 @@ public class CPPASTVisibilityLabel extends CPPASTNode implements
this.visibility = visibility;
}
public boolean accept( ASTVisitor action ){
return true;
}
}

View file

@ -5070,4 +5070,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
return visitor.found;
}
protected void resolveAmbiguities() {
// TODO Auto-generated method stub
}
}