[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Applied [HEAD] Error Handling/Ambiguity Parser bug fixes
|
CORE
Fixed Bug 43503 : Search:f_SD_01 cannot be found in ManyClasses20
Project
Fixed Bug 43680 : Fix Parser Error Handling
TESTS
Updated CompleteParseASTTest::testBug42872()
Moved FailedCompleteParseASTTest::testBug43503() to
CompleteParseASTTest::testBug43503A().
JohnC
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.125
diff -u -r1.125 ChangeLog
--- ChangeLog 30 Sep 2003 18:03:20 -0000 1.125
+++ ChangeLog 30 Sep 2003 20:36:39 -0000
@@ -1,3 +1,7 @@
+2003-09-30 John Camelon
+ Updated CompleteParseASTTest::testBug42872()
+ Moved FailedCompleteParseASTTest::testBug43503() to CompleteParseASTTest::testBug43503A().
+
2003-09-30 Andrew Niefer
added testBug43503_AmbiguousUsing() and testBug43503_UnableToResolveFunction() to
ParserSymbolTableTest
Index: failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTTest.java,v
retrieving revision 1.1
diff -u -r1.1 FailedCompleteParseASTTest.java
--- failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTTest.java 30 Sep 2003 13:51:56 -0000 1.1
+++ failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTTest.java 30 Sep 2003 20:36:39 -0000
@@ -114,20 +114,4 @@
assertFalse( i.hasNext() );
assertAllReferences( 4 /*should be 5 */, createTaskList( new Task( cl /* , 2 */ ), new Task( a), new Task( pm), new Task( f2)));
}
-
- public void testBug43503 () throws Exception {
- Iterator i = parse("class SD_01 { f_SD_01() {}}; int main(){ SD_01 * a = new SD_01(); a->f_SD_01(); } ").getDeclarations();
- IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
- Iterator j = getDeclarations(classA);
- IASTMethod f = (IASTMethod)j.next();
- assertFalse(j.hasNext());
- IASTFunction main = (IASTFunction) i.next();
- assertFalse(i.hasNext());
- Iterator k = getDeclarations(main);
-
- assertFalse(k.hasNext()); // this should be true, there is one declaration of "a"
- // "a" is found to be in a multiplication expression, not a declaration
- // not knowing "a" causes us to not find the reference to "f"
-
- }
}
Index: parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java,v
retrieving revision 1.36
diff -u -r1.36 CompleteParseASTTest.java
--- parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java 30 Sep 2003 13:51:56 -0000 1.36
+++ parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java 30 Sep 2003 20:36:40 -0000
@@ -745,8 +745,21 @@
IASTClassSpecifier structB = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
IASTClassSpecifier structD = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
IASTFunction foo = (IASTFunction)i.next();
+ IASTVariable bp = (IASTVariable)getDeclarations(foo).next();
assertFalse( i.hasNext() );
}
+
+ public void testBug43503A() throws Exception {
+ Iterator i = parse("class SD_01 { f_SD_01() {}}; int main(){ SD_01 * a = new SD_01(); a->f_SD_01(); } ").getDeclarations();
+ IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+ Iterator j = getDeclarations(classA);
+ IASTMethod f = (IASTMethod)j.next();
+ assertFalse(j.hasNext());
+ IASTFunction main = (IASTFunction) i.next();
+ assertFalse(i.hasNext());
+ Iterator k = getDeclarations(main);
+ assertTrue(k.hasNext());
+ }
public void testBug42979() throws Exception
Index: parser/ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/ChangeLog,v
retrieving revision 1.145
diff -u -r1.145 ChangeLog
--- parser/ChangeLog 30 Sep 2003 19:44:22 -0000 1.145
+++ parser/ChangeLog 30 Sep 2003 20:35:24 -0000
@@ -1,3 +1,7 @@
+2003-09-30 John Camelon
+ Fixed Bug 43503 : Search:f_SD_01 cannot be found in ManyClasses20 Project
+ Fixed Bug 43680 : Fix Parser Error Handling
+
2003-09-30 Hoda Amer
-Solution to [Bug 43053] require reference cleanup for expressions
Added purgeReferences() at the end of ASTExpression::acceptElement()
Index: parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java,v
retrieving revision 1.36
diff -u -r1.36 IASTFactory.java
--- parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java 29 Sep 2003 19:22:09 -0000 1.36
+++ parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java 30 Sep 2003 20:35:24 -0000
@@ -24,32 +24,32 @@
String name,
int startingOffset,
int nameOffset,
- int nameEndOffset, int endingOffset);
+ int nameEndOffset, int endingOffset) throws Exception;
public IASTInclusion createInclusion(
String name,
String fileName,
boolean local,
int startingOffset,
int nameOffset,
- int nameEndOffset, int endingOffset);
+ int nameEndOffset, int endingOffset) throws Exception;
public IASTUsingDirective createUsingDirective(
IASTScope scope,
ITokenDuple duple, int startingOffset, int endingOffset)
- throws ASTSemanticException;
+ throws ASTSemanticException, Exception;
public IASTUsingDeclaration createUsingDeclaration(
IASTScope scope,
boolean isTypeName,
- ITokenDuple name, int startingOffset, int endingOffset) throws ASTSemanticException;
+ ITokenDuple name, int startingOffset, int endingOffset) throws ASTSemanticException, Exception;
public IASTASMDefinition createASMDefinition(
IASTScope scope,
String assembly,
int first,
- int last);
+ int last)throws Exception;
public IASTNamespaceDefinition createNamespaceDefinition(
IASTScope scope,
String identifier,
int startingOffset,
- int nameOffset, int nameEndOffset) throws ASTSemanticException;
+ int nameOffset, int nameEndOffset) throws ASTSemanticException, Exception;
public IASTNamespaceAlias createNamespaceAlias(
IASTScope scope,
@@ -57,12 +57,12 @@
ITokenDuple alias,
int startingOffset,
int nameOffset,
- int nameEndOffset, int endOffset ) throws ASTSemanticException;
+ int nameEndOffset, int endOffset ) throws ASTSemanticException, Exception;
- public IASTCompilationUnit createCompilationUnit();
+ public IASTCompilationUnit createCompilationUnit() throws Exception;
public IASTLinkageSpecification createLinkageSpecification(
IASTScope scope,
- String spec, int startingOffset);
+ String spec, int startingOffset) throws Exception;
public IASTClassSpecifier createClassSpecifier(
IASTScope scope,
ITokenDuple name,
@@ -70,7 +70,7 @@
ClassNameType type,
ASTAccessVisibility access,
int startingOffset,
- int nameOffset, int nameEndOffset) throws ASTSemanticException;
+ int nameOffset, int nameEndOffset) throws ASTSemanticException, Exception;
/**
* @param astClassSpec
* @param isVirtual
@@ -81,21 +81,21 @@
IASTClassSpecifier astClassSpec,
boolean isVirtual,
ASTAccessVisibility visibility,
- ITokenDuple parentClassName) throws ASTSemanticException;
+ ITokenDuple parentClassName) throws ASTSemanticException, Exception;
public IASTElaboratedTypeSpecifier createElaboratedTypeSpecifier(
IASTScope scope,
ASTClassKind elaboratedClassKind,
ITokenDuple typeName,
- int startingOffset, int endOffset, boolean isForewardDecl) throws ASTSemanticException;
+ int startingOffset, int endOffset, boolean isForewardDecl) throws ASTSemanticException, Exception;
public IASTEnumerationSpecifier createEnumerationSpecifier(
IASTScope scope,
String name,
- int startingOffset, int nameOffset, int nameEndOffset) throws ASTSemanticException;
+ int startingOffset, int nameOffset, int nameEndOffset) throws ASTSemanticException, Exception;
public void addEnumerator(
IASTEnumerationSpecifier enumeration,
String string,
int startingOffset,
- int nameOffset, int nameEndOffset, int endingOffset, IASTExpression initialValue)throws ASTSemanticException;
+ int nameOffset, int nameEndOffset, int endingOffset, IASTExpression initialValue)throws ASTSemanticException, Exception;
public IASTExpression createExpression(
IASTScope scope,
IASTExpression.Kind kind,
@@ -103,17 +103,17 @@
IASTExpression rhs,
IASTExpression thirdExpression,
IASTTypeId typeId,
- ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException;
- public IASTExpression.IASTNewExpressionDescriptor createNewDescriptor(List newPlacementExpressions,List newTypeIdExpressions,List newInitializerExpressions);
+ ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException, Exception;
+ public IASTExpression.IASTNewExpressionDescriptor createNewDescriptor(List newPlacementExpressions,List newTypeIdExpressions,List newInitializerExpressions)throws Exception;
public IASTInitializerClause createInitializerClause(
IASTInitializerClause.Kind kind,
IASTExpression assignmentExpression,
- List initializerClauses);
- public IASTExceptionSpecification createExceptionSpecification(IASTScope scope, List typeIds) throws ASTSemanticException;
+ List initializerClauses) throws Exception;
+ public IASTExceptionSpecification createExceptionSpecification(IASTScope scope, List typeIds) throws ASTSemanticException, Exception;
/**
* @param exp
*/
- public IASTArrayModifier createArrayModifier(IASTExpression exp);
+ public IASTArrayModifier createArrayModifier(IASTExpression exp) throws Exception;
/**
* @param duple
* @param expressionList
@@ -121,7 +121,7 @@
*/
public IASTConstructorMemberInitializer createConstructorMemberInitializer(
IASTScope scope,
- ITokenDuple duple, IASTExpression expressionList) throws ASTSemanticException;
+ ITokenDuple duple, IASTExpression expressionList) throws ASTSemanticException, Exception;
public IASTSimpleTypeSpecifier createSimpleTypeSpecifier(
IASTScope scope,
IASTSimpleTypeSpecifier.Type kind,
@@ -129,7 +129,7 @@
boolean isShort,
boolean isLong,
boolean isSigned,
- boolean isUnsigned, boolean isTypename) throws ASTSemanticException;
+ boolean isUnsigned, boolean isTypename) throws ASTSemanticException, Exception;
public IASTFunction createFunction(
IASTScope scope,
String name,
@@ -147,12 +147,12 @@
boolean isVolatile,
boolean isVirtual,
boolean isExplicit,
- boolean isPureVirtual, List constructorChain, boolean isDefinition ) throws ASTSemanticException;
+ boolean isPureVirtual, List constructorChain, boolean isDefinition ) throws ASTSemanticException, Exception;
public IASTAbstractDeclaration createAbstractDeclaration(
boolean isConst,
boolean isVolatile,
IASTTypeSpecifier typeSpecifier,
- List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOperator);
+ List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOperator)throws Exception;
public IASTMethod createMethod(
IASTScope scope,
String name,
@@ -170,28 +170,28 @@
boolean isVolatile,
boolean isVirtual,
boolean isExplicit,
- boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChain, boolean isDefinition) throws ASTSemanticException;
+ boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChain, boolean isDefinition) throws ASTSemanticException, Exception;
public IASTVariable createVariable(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression,
- IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, int nameEndOffset, IASTExpression constructorExpression ) throws ASTSemanticException;
+ IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, int nameEndOffset, IASTExpression constructorExpression ) throws ASTSemanticException, Exception;
- public IASTField createField( IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, int nameEndOffset, IASTExpression constructorExpression, ASTAccessVisibility visibility) throws ASTSemanticException;
+ public IASTField createField( IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, int nameEndOffset, IASTExpression constructorExpression, ASTAccessVisibility visibility) throws ASTSemanticException, Exception;
- public IASTParameterDeclaration createParameterDeclaration( boolean isConst, boolean isVolatile, IASTTypeSpecifier getTypeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int nameOffset, int nameEndOffset, int endingOffset );
+ public IASTParameterDeclaration createParameterDeclaration( boolean isConst, boolean isVolatile, IASTTypeSpecifier getTypeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int nameOffset, int nameEndOffset, int endingOffset ) throws Exception;
- public IASTTemplateDeclaration createTemplateDeclaration( IASTScope scope, List templateParameters, boolean exported, int startingOffset );
+ public IASTTemplateDeclaration createTemplateDeclaration( IASTScope scope, List templateParameters, boolean exported, int startingOffset ) throws Exception;
- public IASTTemplateParameter createTemplateParameter( IASTTemplateParameter.ParamKind kind, String identifier, String defaultValue, IASTParameterDeclaration parameter, List parms );
+ public IASTTemplateParameter createTemplateParameter( IASTTemplateParameter.ParamKind kind, String identifier, String defaultValue, IASTParameterDeclaration parameter, List parms ) throws Exception;
- public IASTTemplateInstantiation createTemplateInstantiation(IASTScope scope, int startingOffset);
+ public IASTTemplateInstantiation createTemplateInstantiation(IASTScope scope, int startingOffset)throws Exception;
- public IASTTemplateSpecialization createTemplateSpecialization(IASTScope scope, int startingOffset);
+ public IASTTemplateSpecialization createTemplateSpecialization(IASTScope scope, int startingOffset)throws Exception;
- public IASTTypedefDeclaration createTypedef( IASTScope scope, String name, IASTAbstractDeclaration mapping, int startingOffset, int nameOffset, int nameEndOffset ) throws ASTSemanticException;
+ public IASTTypedefDeclaration createTypedef( IASTScope scope, String name, IASTAbstractDeclaration mapping, int startingOffset, int nameOffset, int nameEndOffset ) throws ASTSemanticException, Exception;
- public IASTAbstractTypeSpecifierDeclaration createTypeSpecDeclaration( IASTScope scope, IASTTypeSpecifier typeSpecifier, IASTTemplate template, int startingOffset, int endingOffset);
+ public IASTAbstractTypeSpecifierDeclaration createTypeSpecDeclaration( IASTScope scope, IASTTypeSpecifier typeSpecifier, IASTTemplate template, int startingOffset, int endingOffset)throws Exception;
- public boolean queryIsTypeName( IASTScope scope, ITokenDuple nameInQuestion );
+ public boolean queryIsTypeName( IASTScope scope, ITokenDuple nameInQuestion ) throws Exception;
static final String DOUBLE_COLON = "::";
static final String TELTA = "~";
@@ -199,14 +199,14 @@
* @param scope
* @return
*/
- public IASTCodeScope createNewCodeBlock(IASTScope scope);
+ public IASTCodeScope createNewCodeBlock(IASTScope scope)throws Exception;
public IASTTypeId createTypeId( IASTScope scope, IASTSimpleTypeSpecifier.Type kind, boolean isConst, boolean isVolatile, boolean isShort,
- boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, ITokenDuple name, List pointerOps, List arrayMods ) throws ASTSemanticException;
+ boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, ITokenDuple name, List pointerOps, List arrayMods ) throws ASTSemanticException, Exception;
/**
* @param astClassSpecifier
*/
- public void signalEndOfClassSpecifier(IASTClassSpecifier astClassSpecifier);
+ public void signalEndOfClassSpecifier(IASTClassSpecifier astClassSpecifier) throws Exception;
}
Index: parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java,v
retrieving revision 1.23
diff -u -r1.23 DeclarationWrapper.java
--- parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java 29 Sep 2003 19:22:09 -0000 1.23
+++ parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java 30 Sep 2003 20:35:25 -0000
@@ -373,17 +373,49 @@
}
List convertedParms = createParameterList( declarator.getParameters() );
- IASTAbstractDeclaration abs = astFactory.createAbstractDeclaration(
- constt, volatil, getTypeSpecifier(), declarator.getPointerOperators(), declarator.getArrayModifiers(),
- convertedParms, (ASTPointerOperator)i.next() );
+ IASTAbstractDeclaration abs = null;
+ try
+ {
+ abs =
+ astFactory.createAbstractDeclaration(
+ constt,
+ volatil,
+ getTypeSpecifier(),
+ declarator.getPointerOperators(),
+ declarator.getArrayModifiers(),
+ convertedParms,
+ (ASTPointerOperator)i.next());
+ }
+ catch (Exception e)
+ {
+ throw new ASTSemanticException();
+ }
String name = ( d.getPointerOperatorNameDuple() != null ) ? d.getPointerOperatorNameDuple().toString() + d.getName() : d.getName();
if( typedef )
- return astFactory.createTypedef(
- scope,
- name,
- abs, getStartingOffset(), d.getNameStartOffset(), d.getNameEndOffset() );
+ try
+ {
+ return astFactory.createTypedef(
+ scope,
+ name,
+ abs, getStartingOffset(), d.getNameStartOffset(), d.getNameEndOffset() );
+ }
+ catch (ASTSemanticException e1)
+ {
+ throw e1;
+ }
+ catch (Exception e1)
+ {
+ throw new ASTSemanticException();
+ }
else
- return astFactory.createVariable( scope, name, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), d.getNameStartOffset(), d.getNameEndOffset(), d.getConstructorExpression() );
+ try
+ {
+ return astFactory.createVariable( scope, name, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), d.getNameStartOffset(), d.getNameEndOffset(), d.getConstructorExpression() );
+ }
+ catch (Exception e2)
+ {
+ throw new ASTSemanticException();
+ }
}
else
@@ -399,14 +431,25 @@
*/
private IASTTypedefDeclaration createTypedef(Declarator declarator, boolean nested ) throws ASTSemanticException
{
- return astFactory.createTypedef(
- scope,
- nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
- astFactory.createAbstractDeclaration(
- constt,
- volatil,
- getTypeSpecifier(),
- declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null), startingOffset, declarator.getNameStartOffset(), declarator.getNameEndOffset());
+ try
+ {
+ return astFactory.createTypedef(
+ scope,
+ nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
+ astFactory.createAbstractDeclaration(
+ constt,
+ volatil,
+ getTypeSpecifier(),
+ declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null), startingOffset, declarator.getNameStartOffset(), declarator.getNameEndOffset());
+ }
+ catch (ASTSemanticException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new ASTSemanticException();
+ }
}
/**
* @param declarator
@@ -414,14 +457,57 @@
*/
private IASTMethod createMethodASTNode(Declarator declarator, boolean nested) throws ASTSemanticException
{
- return astFactory
- .createMethod(
+ try
+ {
+ return astFactory
+ .createMethod(
+ scope,
+ nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
+ createParameterList(declarator.getParameters()),
+ astFactory.createAbstractDeclaration(
+ constt,
+ volatil,
+ getTypeSpecifier(),
+ declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
+ declarator.getExceptionSpecification(),
+ inline,
+ friend,
+ staticc,
+ startingOffset,
+ declarator.getNameStartOffset(),
+ declarator.getNameEndOffset(),
+ templateDeclaration,
+ declarator.isConst(),
+ declarator.isVolatile(),
+ virtual,
+ explicit,
+ declarator.isPureVirtual(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode(),
+ declarator.getConstructorMemberInitializers(), declarator.hasFunctionBody());
+ }
+ catch (ASTSemanticException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new ASTSemanticException();
+ }
+ }
+ /**
+ * @param declarator
+ * @return
+ */
+ private IASTFunction createFunctionASTNode(Declarator declarator, boolean nested) throws ASTSemanticException
+ {
+ try
+ {
+ return astFactory.createFunction(
scope,
- nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
- createParameterList(declarator.getParameters()),
+ nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
+ createParameterList(declarator.getParameters()),
astFactory.createAbstractDeclaration(
constt,
- volatil,
+ volatil,
getTypeSpecifier(),
declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
declarator.getExceptionSpecification(),
@@ -431,43 +517,22 @@
startingOffset,
declarator.getNameStartOffset(),
declarator.getNameEndOffset(),
- templateDeclaration,
- declarator.isConst(),
- declarator.isVolatile(),
- virtual,
- explicit,
- declarator.isPureVirtual(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode(),
- declarator.getConstructorMemberInitializers(), declarator.hasFunctionBody());
- }
- /**
- * @param declarator
- * @return
- */
- private IASTFunction createFunctionASTNode(Declarator declarator, boolean nested) throws ASTSemanticException
- {
- return astFactory.createFunction(
- scope,
- nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
- createParameterList(declarator.getParameters()),
- astFactory.createAbstractDeclaration(
- constt,
- volatil,
- getTypeSpecifier(),
- declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
- declarator.getExceptionSpecification(),
- inline,
- friend,
- staticc,
- startingOffset,
- declarator.getNameStartOffset(),
- declarator.getNameEndOffset(),
- templateDeclaration,
- declarator.isConst(),
- declarator.isVolatile(),
- virtual,
- explicit,
- declarator.isPureVirtual(),
- declarator.getConstructorMemberInitializers(), declarator.hasFunctionBody() );
+ templateDeclaration,
+ declarator.isConst(),
+ declarator.isVolatile(),
+ virtual,
+ explicit,
+ declarator.isPureVirtual(),
+ declarator.getConstructorMemberInitializers(), declarator.hasFunctionBody() );
+ }
+ catch (ASTSemanticException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new ASTSemanticException();
+ }
}
/**
* @param declarator
@@ -475,26 +540,37 @@
*/
private IASTField createFieldASTNode(Declarator declarator, boolean nested) throws ASTSemanticException
{
- return astFactory.createField(
- scope,
- nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
- auto,
- declarator.getInitializerClause(),
- declarator.getBitFieldExpression(),
- astFactory.createAbstractDeclaration(
- constt,
- volatil,
- getTypeSpecifier(),
- declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
- mutable,
- extern,
- register,
- staticc,
- startingOffset,
- declarator.getNameStartOffset(),
- declarator.getNameEndOffset(), declarator.getConstructorExpression(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode());
+ try
+ {
+ return astFactory.createField(
+ scope,
+ nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
+ auto,
+ declarator.getInitializerClause(),
+ declarator.getBitFieldExpression(),
+ astFactory.createAbstractDeclaration(
+ constt,
+ volatil,
+ getTypeSpecifier(),
+ declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
+ mutable,
+ extern,
+ register,
+ staticc,
+ startingOffset,
+ declarator.getNameStartOffset(),
+ declarator.getNameEndOffset(), declarator.getConstructorExpression(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode());
+ }
+ catch (ASTSemanticException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new ASTSemanticException();
+ }
}
- private List createParameterList(List currentParameters)
+ private List createParameterList(List currentParameters) throws ASTSemanticException
{
List result = new ArrayList();
Iterator i = currentParameters.iterator();
@@ -505,16 +581,23 @@
while (j.hasNext())
{
Declarator declarator = (Declarator)j.next();
- result.add(
- astFactory.createParameterDeclaration(
- wrapper.isConst(),
- wrapper.isVolatile(),
- wrapper.getTypeSpecifier(),
- declarator.getPointerOperators(),
- declarator.getArrayModifiers(),
- null, null, declarator.getName() == null
- ? ""
- : declarator.getName(), declarator.getInitializerClause(), wrapper.getStartingOffset(), declarator.getNameStartOffset(), declarator.getNameEndOffset(), wrapper.getEndOffset()));
+ try
+ {
+ result.add(
+ astFactory.createParameterDeclaration(
+ wrapper.isConst(),
+ wrapper.isVolatile(),
+ wrapper.getTypeSpecifier(),
+ declarator.getPointerOperators(),
+ declarator.getArrayModifiers(),
+ null, null, declarator.getName() == null
+ ? ""
+ : declarator.getName(), declarator.getInitializerClause(), wrapper.getStartingOffset(), declarator.getNameStartOffset(), declarator.getNameEndOffset(), wrapper.getEndOffset()));
+ }
+ catch (Exception e)
+ {
+ throw new ASTSemanticException();
+ }
}
}
return result;
@@ -525,23 +608,34 @@
*/
private IASTVariable createVariableASTNode(Declarator declarator, boolean nested ) throws ASTSemanticException
{
- return astFactory.createVariable(
- scope,
- nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
- isAuto(),
- declarator.getInitializerClause(),
- declarator.getBitFieldExpression(),
- astFactory.createAbstractDeclaration(
- constt,
- volatil,
- getTypeSpecifier(),
- declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
- mutable,
- extern,
- register,
- staticc,
- getStartingOffset(),
- declarator.getNameStartOffset(), declarator.getNameEndOffset(), declarator.getConstructorExpression());
+ try
+ {
+ return astFactory.createVariable(
+ scope,
+ nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
+ isAuto(),
+ declarator.getInitializerClause(),
+ declarator.getBitFieldExpression(),
+ astFactory.createAbstractDeclaration(
+ constt,
+ volatil,
+ getTypeSpecifier(),
+ declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
+ mutable,
+ extern,
+ register,
+ staticc,
+ getStartingOffset(),
+ declarator.getNameStartOffset(), declarator.getNameEndOffset(), declarator.getConstructorExpression());
+ }
+ catch (ASTSemanticException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new ASTSemanticException();
+ }
}
/* (non-Javadoc)
Index: parser/org/eclipse/cdt/internal/core/parser/Parser.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java,v
retrieving revision 1.116
diff -u -r1.116 Parser.java
--- parser/org/eclipse/cdt/internal/core/parser/Parser.java 29 Sep 2003 19:22:09 -0000 1.116
+++ parser/org/eclipse/cdt/internal/core/parser/Parser.java 30 Sep 2003 20:35:30 -0000
@@ -164,8 +164,15 @@
*/
protected void translationUnit()
{
- IASTCompilationUnit compilationUnit =
- astFactory.createCompilationUnit();
+ IASTCompilationUnit compilationUnit;
+ try
+ {
+ compilationUnit = astFactory.createCompilationUnit();
+ }
+ catch (Exception e2)
+ {
+ return;
+ }
compilationUnit.enterScope( requestor );
IToken lastBacktrack = null;
@@ -281,10 +288,9 @@
{
astUD = astFactory.createUsingDirective(scope, duple, firstToken.getOffset(), last.getEndOffset());
}
- catch (ASTSemanticException e)
- {
- failParse();
- throw backtrack;
+ catch (Exception e1)
+ {
+ throw backtrack;
}
astUD.acceptElement(requestor);
return;
@@ -326,10 +332,9 @@
firstToken.getOffset(),
last.getEndOffset());
}
- catch (ASTSemanticException e)
+ catch (Exception e1)
{
- failParse();
- throw backtrack;
+ throw backtrack;
}
declaration.acceptElement( requestor );
}
@@ -360,8 +365,19 @@
if (LT(1) == IToken.tLBRACE)
{
consume(IToken.tLBRACE);
- IASTLinkageSpecification linkage =
- astFactory.createLinkageSpecification(scope, spec.getImage(), firstToken.getOffset());
+ IASTLinkageSpecification linkage;
+ try
+ {
+ linkage =
+ astFactory.createLinkageSpecification(
+ scope,
+ spec.getImage(),
+ firstToken.getOffset());
+ }
+ catch (Exception e)
+ {
+ throw backtrack;
+ }
linkage.enterScope( requestor );
linkageDeclarationLoop : while (LT(1) != IToken.tRBRACE)
@@ -394,8 +410,19 @@
}
else // single declaration
{
- IASTLinkageSpecification linkage =
- astFactory.createLinkageSpecification(scope, spec.getImage(), firstToken.getOffset());
+ IASTLinkageSpecification linkage;
+ try
+ {
+ linkage =
+ astFactory.createLinkageSpecification(
+ scope,
+ spec.getImage(),
+ firstToken.getOffset());
+ }
+ catch (Exception e)
+ {
+ throw backtrack;
+ }
linkage.enterScope( requestor );
declaration(linkage, null);
linkage.exitScope( requestor );
@@ -429,10 +456,18 @@
if (LT(1) != IToken.tLT)
{
// explicit-instantiation
- IASTTemplateInstantiation templateInstantiation =
- astFactory.createTemplateInstantiation(
- scope,
- firstToken.getOffset());
+ IASTTemplateInstantiation templateInstantiation;
+ try
+ {
+ templateInstantiation =
+ astFactory.createTemplateInstantiation(
+ scope,
+ firstToken.getOffset());
+ }
+ catch (Exception e)
+ {
+ throw backtrack;
+ }
templateInstantiation.enterScope( requestor );
declaration(scope, templateInstantiation);
templateInstantiation.setEndingOffset(lastToken.getEndOffset());
@@ -448,10 +483,18 @@
consume(IToken.tGT);
// explicit-specialization
- IASTTemplateSpecialization templateSpecialization =
- astFactory.createTemplateSpecialization(
- scope,
- firstToken.getOffset());
+ IASTTemplateSpecialization templateSpecialization;
+ try
+ {
+ templateSpecialization =
+ astFactory.createTemplateSpecialization(
+ scope,
+ firstToken.getOffset());
+ }
+ catch (Exception e)
+ {
+ throw backtrack;
+ }
templateSpecialization.enterScope(requestor);
declaration(scope, templateSpecialization);
templateSpecialization.setEndingOffset(
@@ -465,7 +508,20 @@
{
List parms = templateParameterList(scope);
consume(IToken.tGT);
- IASTTemplateDeclaration templateDecl = astFactory.createTemplateDeclaration( scope, parms, exported, firstToken.getOffset() );
+ IASTTemplateDeclaration templateDecl;
+ try
+ {
+ templateDecl =
+ astFactory.createTemplateDeclaration(
+ scope,
+ parms,
+ exported,
+ firstToken.getOffset());
+ }
+ catch (Exception e)
+ {
+ throw backtrack;
+ }
templateDecl.enterScope( requestor );
declaration(scope, templateDecl );
templateDecl.setEndingOffset(
@@ -541,13 +597,20 @@
{
throw bt;
}
- returnValue.add(
- astFactory.createTemplateParameter(
- kind,
- ( id == null )? "" : id.getImage(),
- (typeId == null) ? null : typeId.getTypeOrClassName(),
- null,
- null));
+ try
+ {
+ returnValue.add(
+ astFactory.createTemplateParameter(
+ kind,
+ ( id == null )? "" : id.getImage(),
+ (typeId == null) ? null : typeId.getTypeOrClassName(),
+ null,
+ null));
+ }
+ catch (Exception e)
+ {
+ throw backtrack;
+ }
}
else if (LT(1) == IToken.t_template)
@@ -572,13 +635,20 @@
}
}
- returnValue.add(
- astFactory.createTemplateParameter(
- IASTTemplateParameter.ParamKind.TEMPLATE_LIST,
- ( optionalId == null )? "" : optionalId.getImage(),
- ( optionalTypeId == null ) ? "" : optionalTypeId.toString(),
- null,
- subResult));
+ try
+ {
+ returnValue.add(
+ astFactory.createTemplateParameter(
+ IASTTemplateParameter.ParamKind.TEMPLATE_LIST,
+ ( optionalId == null )? "" : optionalId.getImage(),
+ ( optionalTypeId == null ) ? "" : optionalTypeId.toString(),
+ null,
+ subResult));
+ }
+ catch (Exception e)
+ {
+ throw backtrack;
+ }
}
else if (LT(1) == IToken.tCOMMA)
{
@@ -593,21 +663,28 @@
(DeclarationWrapper)c.getParameters().get(0);
Declarator declarator =
(Declarator)wrapper.getDeclarators().next();
- returnValue.add(
- astFactory.createTemplateParameter(
- IASTTemplateParameter.ParamKind.PARAMETER,
- null,
- null,
- astFactory.createParameterDeclaration(
- wrapper.isConst(),
- wrapper.isVolatile(),
- wrapper.getTypeSpecifier(),
- declarator.getPointerOperators(),
- declarator.getArrayModifiers(),
- null, null, declarator.getName() == null
- ? ""
- : declarator.getName(), declarator.getInitializerClause(), wrapper.getStartingOffset(), declarator.getNameStartOffset(), declarator.getNameEndOffset(), wrapper.getEndOffset()),
- null));
+ try
+ {
+ returnValue.add(
+ astFactory.createTemplateParameter(
+ IASTTemplateParameter.ParamKind.PARAMETER,
+ null,
+ null,
+ astFactory.createParameterDeclaration(
+ wrapper.isConst(),
+ wrapper.isVolatile(),
+ wrapper.getTypeSpecifier(),
+ declarator.getPointerOperators(),
+ declarator.getArrayModifiers(),
+ null, null, declarator.getName() == null
+ ? ""
+ : declarator.getName(), declarator.getInitializerClause(), wrapper.getStartingOffset(), declarator.getNameStartOffset(), declarator.getNameEndOffset(), wrapper.getEndOffset()),
+ null));
+ }
+ catch (Exception e)
+ {
+ throw backtrack;
+ }
}
}
}
@@ -647,12 +724,20 @@
String assembly = consume(IToken.tSTRING).getImage();
consume(IToken.tRPAREN);
IToken last = consume(IToken.tSEMI);
- IASTASMDefinition asmDefinition =
- astFactory.createASMDefinition(
- scope,
- assembly,
- first.getOffset(),
- last.getEndOffset());
+ IASTASMDefinition asmDefinition;
+ try
+ {
+ asmDefinition =
+ astFactory.createASMDefinition(
+ scope,
+ assembly,
+ first.getOffset(),
+ last.getEndOffset());
+ }
+ catch (Exception e)
+ {
+ throw backtrack;
+ }
// if we made it this far, then we have all we need
// do the callback
asmDefinition.acceptElement(requestor);
@@ -760,10 +845,9 @@
(identifier == null ? first.getOffset() : identifier.getOffset()),
(identifier == null ? first.getEndOffset() : identifier.getEndOffset() ));
}
- catch (ASTSemanticException e)
+ catch (Exception e1)
{
- failParse();
- throw backtrack;
+ throw backtrack;
}
namespaceDefinition.enterScope( requestor );
namepsaceDeclarationLoop : while (LT(1) != IToken.tRBRACE)
@@ -811,9 +895,8 @@
scope, identifier.toString(), duple, first.getOffset(),
identifier.getOffset(), identifier.getEndOffset(), duple.getLastToken().getEndOffset() );
}
- catch (ASTSemanticException e)
+ catch (Exception e1)
{
- failParse();
throw backtrack;
}
}
@@ -852,22 +935,23 @@
new DeclarationWrapper(scope, firstToken.getOffset(), ownerTemplate);
declSpecifierSeq(false, strategy == SimpleDeclarationStrategy.TRY_CONSTRUCTOR, sdw, forKR );
- try
- {
- if (sdw.getTypeSpecifier() == null && sdw.getSimpleType() != IASTSimpleTypeSpecifier.Type.UNSPECIFIED )
- sdw.setTypeSpecifier(
- astFactory.createSimpleTypeSpecifier(
- scope,
- sdw.getSimpleType(),
- sdw.getName(),
- sdw.isShort(),
- sdw.isLong(),
- sdw.isSigned(),
- sdw.isUnsigned(), sdw.isTypeNamed()));
- } catch( ASTSemanticException se )
- {
- throw backtrack;
- }
+ if (sdw.getTypeSpecifier() == null && sdw.getSimpleType() != IASTSimpleTypeSpecifier.Type.UNSPECIFIED )
+ try
+ {
+ sdw.setTypeSpecifier(
+ astFactory.createSimpleTypeSpecifier(
+ scope,
+ sdw.getSimpleType(),
+ sdw.getName(),
+ sdw.isShort(),
+ sdw.isLong(),
+ sdw.isSigned(),
+ sdw.isUnsigned(), sdw.isTypeNamed()));
+ }
+ catch (Exception e1)
+ {
+ throw backtrack;
+ }
Declarator declarator = null;
if (LT(1) != IToken.tSEMI)
@@ -950,14 +1034,21 @@
}
else
{
- astFactory
- .createTypeSpecDeclaration(
- sdw.getScope(),
- sdw.getTypeSpecifier(),
- ownerTemplate,
- sdw.getStartingOffset(),
- lastToken.getEndOffset())
- .acceptElement(requestor);
+ try
+ {
+ astFactory
+ .createTypeSpecDeclaration(
+ sdw.getScope(),
+ sdw.getTypeSpecifier(),
+ ownerTemplate,
+ sdw.getStartingOffset(),
+ lastToken.getEndOffset())
+ .acceptElement(requestor);
+ }
+ catch (Exception e1)
+ {
+ throw backtrack;
+ }
}
}
@@ -1027,9 +1118,8 @@
d.getDeclarationWrapper().getScope(),
duple, expressionList));
}
- catch (ASTSemanticException e)
+ catch (Exception e1)
{
- failParse();
throw backtrack;
}
if (LT(1) == IToken.tLBRACE)
@@ -1059,24 +1149,29 @@
DeclarationWrapper sdw =
new DeclarationWrapper(scope, current.getOffset(), null);
declSpecifierSeq(true, false, sdw, false);
- try
- {
- if (sdw.getTypeSpecifier() == null
- && sdw.getSimpleType()
- != IASTSimpleTypeSpecifier.Type.UNSPECIFIED)
- sdw.setTypeSpecifier(
- astFactory.createSimpleTypeSpecifier(
- scope,
- sdw.getSimpleType(),
- sdw.getName(),
- sdw.isShort(),
- sdw.isLong(),
- sdw.isSigned(),
- sdw.isUnsigned(), sdw.isTypeNamed()));
- }
- catch( ASTSemanticException se ) {
- throw backtrack;
- }
+ if (sdw.getTypeSpecifier() == null
+ && sdw.getSimpleType()
+ != IASTSimpleTypeSpecifier.Type.UNSPECIFIED)
+ try
+ {
+ sdw.setTypeSpecifier(
+ astFactory.createSimpleTypeSpecifier(
+ scope,
+ sdw.getSimpleType(),
+ sdw.getName(),
+ sdw.isShort(),
+ sdw.isLong(),
+ sdw.isSigned(),
+ sdw.isUnsigned(), sdw.isTypeNamed()));
+ }
+ catch (ASTSemanticException e)
+ {
+ throw backtrack;
+ }
+ catch (Exception e)
+ {
+ throw backtrack;
+ }
if (LT(1) != IToken.tSEMI)
initDeclarator(sdw, false, SimpleDeclarationStrategy.TRY_FUNCTION );
@@ -1563,6 +1658,9 @@
{
failParse();
throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
}
sdw.setTypeSpecifier(elaboratedTypeSpec);
@@ -1817,10 +1915,17 @@
if (LT(1) == (IToken.tRBRACE))
{
consume(IToken.tRBRACE);
- return astFactory.createInitializerClause(
- IASTInitializerClause.Kind.EMPTY,
- null,
- null);
+ try
+ {
+ return astFactory.createInitializerClause(
+ IASTInitializerClause.Kind.EMPTY,
+ null,
+ null);
+ }
+ catch (Exception e)
+ {
+ throw backtrack;
+ }
}
// otherwise it is a list of initializers
List initializerClauses = new ArrayList();
@@ -1833,10 +1938,17 @@
consume(IToken.tCOMMA);
}
consume(IToken.tRBRACE);
- return astFactory.createInitializerClause(
- IASTInitializerClause.Kind.INITIALIZER_LIST,
- null,
- initializerClauses);
+ try
+ {
+ return astFactory.createInitializerClause(
+ IASTInitializerClause.Kind.INITIALIZER_LIST,
+ null,
+ initializerClauses);
+ }
+ catch (Exception e)
+ {
+ throw backtrack;
+ }
}
// try this now instead
// assignmentExpression || { initializerList , } || { }
@@ -1845,10 +1957,17 @@
IASTExpression assignmentExpression =
assignmentExpression(scope);
- return astFactory.createInitializerClause(
- IASTInitializerClause.Kind.ASSIGNMENT_EXPRESSION,
- assignmentExpression,
- null);
+ try
+ {
+ return astFactory.createInitializerClause(
+ IASTInitializerClause.Kind.ASSIGNMENT_EXPRESSION,
+ assignmentExpression,
+ null);
+ }
+ catch (Exception e)
+ {
+ throw backtrack;
+ }
}
catch (Backtrack b)
{
@@ -1954,8 +2073,15 @@
try
{
- if( ! astFactory.queryIsTypeName( scope, name() ) )
- failed = true;
+ try
+ {
+ if( ! astFactory.queryIsTypeName( scope, name() ) )
+ failed = true;
+ }
+ catch (Exception e)
+ {
+ throw backtrack;
+ }
} catch( Backtrack b )
{
failed = true;
@@ -2063,6 +2189,9 @@
{
failParse();
throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
}
}
// check for optional pure virtual
@@ -2160,8 +2289,15 @@
exp = constantExpression(scope);
}
consume(IToken.tRBRACKET);
- IASTArrayModifier arrayMod =
- astFactory.createArrayModifier(exp);
+ IASTArrayModifier arrayMod;
+ try
+ {
+ arrayMod = astFactory.createArrayModifier(exp);
+ }
+ catch (Exception e)
+ {
+ throw backtrack;
+ }
d.addArrayModifier(arrayMod);
}
}
@@ -2324,6 +2460,9 @@
{
failParse();
throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
}
consume(IToken.tLBRACE);
while (LT(1) != IToken.tRBRACE)
@@ -2359,6 +2498,9 @@
{
failParse();
throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
}
break;
}
@@ -2379,6 +2521,9 @@
{
failParse();
throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
}
consume(IToken.tCOMMA);
}
@@ -2456,12 +2601,15 @@
access,
classKey.getOffset(),
duple == null ? classKey.getOffset() : duple.getFirstToken().getOffset(),
- duple == null ? classKey.getEndOffset() : duple.getFirstToken().getEndOffset() );
+ duple == null ? classKey.getEndOffset() : duple.getFirstToken().getOffset() );
}
catch (ASTSemanticException e)
{
failParse();
throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
}
sdw.setTypeSpecifier(astClassSpecifier);
// base clause
@@ -2516,7 +2664,14 @@
IToken lt = consume(IToken.tRBRACE);
astClassSpecifier.setEndingOffset(lt.getEndOffset());
- astFactory.signalEndOfClassSpecifier( astClassSpecifier );
+ try
+ {
+ astFactory.signalEndOfClassSpecifier( astClassSpecifier );
+ }
+ catch (Exception e1)
+ {
+ throw backtrack;
+ }
astClassSpecifier.exitScope( requestor );
@@ -2579,6 +2734,9 @@
{
failParse();
throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
}
isVirtual = false;
visibility = ASTAccessVisibility.PUBLIC;
@@ -2602,6 +2760,9 @@
{
failParse();
throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
}
}
/**
@@ -2767,7 +2928,15 @@
}
protected void singleStatementScope(IASTScope scope) throws Backtrack
{
- IASTCodeScope newScope = astFactory.createNewCodeBlock( scope );
+ IASTCodeScope newScope;
+ try
+ {
+ newScope = astFactory.createNewCodeBlock(scope);
+ }
+ catch (Exception e)
+ {
+ throw backtrack;
+ }
newScope.enterScope( requestor );
try
{
@@ -2823,7 +2992,14 @@
IASTCodeScope newScope = null;
if( createNewScope )
{
- newScope = astFactory.createNewCodeBlock(scope);
+ try
+ {
+ newScope = astFactory.createNewCodeBlock(scope);
+ }
+ catch (Exception e)
+ {
+ throw backtrack;
+ }
newScope.enterScope( requestor );
}
IToken checkToken = null;
@@ -2879,7 +3055,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
}
@@ -2980,7 +3158,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
}
@@ -3013,7 +3193,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
}
@@ -3045,7 +3227,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
}
@@ -3079,7 +3263,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
}
@@ -3111,7 +3297,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
}
@@ -3144,7 +3332,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
}
@@ -3177,7 +3367,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
}
@@ -3209,7 +3401,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
}
@@ -3249,7 +3443,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
break;
@@ -3325,7 +3521,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
}
@@ -3368,7 +3566,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
break;
@@ -3410,7 +3610,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
break;
@@ -3463,7 +3665,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
break;
@@ -3504,7 +3708,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
break;
@@ -3545,7 +3751,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
}
@@ -3733,6 +3941,9 @@
{
backup( mark );
throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
}
}
/**
@@ -3772,7 +3983,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
}
@@ -3898,16 +4111,18 @@
// new-expression ends here.
try
{
- return astFactory.createExpression(
- scope, IASTExpression.Kind.NEW_TYPEID,
- null, null, null, typeId, null,
- "", astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions));
+ return astFactory.createExpression(
+ scope, IASTExpression.Kind.NEW_TYPEID,
+ null, null, null, typeId, null,
+ "", astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions));
}
catch (ASTSemanticException e)
{
- failParse();
- return null;
- }
+ throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
+ }
}
}
catch (Backtrack e)
@@ -3950,9 +4165,11 @@
}
catch (ASTSemanticException e)
{
- failParse();
return null;
- }
+ } catch (Exception e)
+ {
+ throw backtrack;
+ }
}
protected IASTExpression unaryOperatorCastExpression( IASTScope scope,
IASTExpression.Kind kind)
@@ -3972,7 +4189,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
}
@@ -4054,7 +4273,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
else if (unaryExpression != null && d == null)
@@ -4071,7 +4292,9 @@
}
catch (ASTSemanticException e1)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
else
@@ -4141,9 +4364,11 @@
"",
null );
} catch (ASTSemanticException ase ) {
- failParse();
throw backtrack;
- }
+ } catch (Exception e)
+ {
+ throw backtrack;
+ }
break;
// simple-type-specifier ( assignment-expression , .. )
case IToken.t_char :
@@ -4250,6 +4475,9 @@
{
failParse();
throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
}
break;
default :
@@ -4281,6 +4509,9 @@
{
failParse();
throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
}
break;
case IToken.tLPAREN :
@@ -4304,6 +4535,9 @@
{
failParse();
throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
}
break;
case IToken.tINCR :
@@ -4324,6 +4558,9 @@
{
failParse();
throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
}
break;
case IToken.tDECR :
@@ -4344,6 +4581,9 @@
{
failParse();
throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
}
break;
case IToken.tDOT :
@@ -4373,6 +4613,9 @@
{
failParse();
throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
}
break;
case IToken.tARROW :
@@ -4402,6 +4645,9 @@
{
failParse();
throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
}
break;
default :
@@ -4433,7 +4679,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
}
@@ -4460,6 +4708,9 @@
{
failParse();
throw backtrack;
+ } catch (Exception e)
+ {
+ throw backtrack;
}
}
/**
@@ -4488,7 +4739,9 @@
}
catch (ASTSemanticException e1)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
case IToken.tFLOATINGPT :
@@ -4506,7 +4759,9 @@
}
catch (ASTSemanticException e2)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
case IToken.tSTRING :
@@ -4518,7 +4773,9 @@
}
catch (ASTSemanticException e5)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
@@ -4538,7 +4795,9 @@
}
catch (ASTSemanticException e3)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
@@ -4559,7 +4818,9 @@
}
catch (ASTSemanticException e4)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
@@ -4578,7 +4839,9 @@
}
catch (ASTSemanticException e7)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
case IToken.tLPAREN :
@@ -4598,7 +4861,9 @@
}
catch (ASTSemanticException e6)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
case IToken.tIDENTIFIER :
@@ -4618,7 +4883,9 @@
}
catch (ASTSemanticException e8)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
default :
@@ -4635,7 +4902,9 @@
}
catch (ASTSemanticException e)
{
- failParse();
+ throw backtrack;
+ } catch (Exception e)
+ {
throw backtrack;
}
}
Index: parser/org/eclipse/cdt/internal/core/parser/Scanner.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Scanner.java,v
retrieving revision 1.56
diff -u -r1.56 Scanner.java
--- parser/org/eclipse/cdt/internal/core/parser/Scanner.java 29 Sep 2003 19:22:09 -0000 1.56
+++ parser/org/eclipse/cdt/internal/core/parser/Scanner.java 30 Sep 2003 20:35:31 -0000
@@ -344,7 +344,23 @@
}
}
if (inclusionReader != null) {
- IASTInclusion inclusion = astFactory.createInclusion( fileName, newPath, !useIncludePaths, beginOffset, nameOffset, nameOffset + fileName.length(), endOffset );
+ IASTInclusion inclusion = null;
+ try
+ {
+ inclusion =
+ astFactory.createInclusion(
+ fileName,
+ newPath,
+ !useIncludePaths,
+ beginOffset,
+ nameOffset,
+ nameOffset + fileName.length(),
+ endOffset);
+ }
+ catch (Exception e)
+ {
+ /* do nothing */
+ }
contextStack.updateContext(inclusionReader, newPath, ScannerContext.INCLUSION, inclusion, requestor );
}
}
@@ -2010,10 +2026,28 @@
{
if( requestor != null )
{
- IASTInclusion i = astFactory.createInclusion( f, "", !useIncludePath, beginningOffset,
- startOffset, startOffset + f.length(), endOffset );
- i.enterScope( requestor );
- i.exitScope( requestor );
+ IASTInclusion i = null;
+ try
+ {
+ i =
+ astFactory.createInclusion(
+ f,
+ "",
+ !useIncludePath,
+ beginningOffset,
+ startOffset,
+ startOffset + f.length(),
+ endOffset);
+ }
+ catch (Exception e)
+ {
+ /* do nothing */
+ }
+ if( i != null )
+ {
+ i.enterScope( requestor );
+ i.exitScope( requestor );
+ }
}
}
else
@@ -2168,7 +2202,14 @@
throw new ScannerException( ScannerException.ErrorCode.INVALID_PREPROCESSOR_DIRECTIVE, getCurrentFile(), getCurrentOffset() );
}
- astFactory.createMacro( key, beginning, offset, offset + key.length(), contextStack.getCurrentContext().getOffset() ).acceptElement( requestor );
+ try
+ {
+ astFactory.createMacro( key, beginning, offset, offset + key.length(), contextStack.getCurrentContext().getOffset() ).acceptElement( requestor );
+ }
+ catch (Exception e)
+ {
+ /* do nothing */
+ }
}
protected Vector getMacroParameters (String params, boolean forStringizing) throws ScannerException {
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java,v
retrieving revision 1.50
diff -u -r1.50 CompleteParseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java 30 Sep 2003 13:51:51 -0000 1.50
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java 30 Sep 2003 20:35:32 -0000
@@ -154,7 +154,8 @@
result = startingScope.qualifiedLookup(name, type);
}
} catch (ParserSymbolTableException e) {
- throw e;
+ if( e.reason != ParserSymbolTableException.r_UnableToResolveFunction )
+ throw e;
}
return result;
}
@@ -215,14 +216,7 @@
try
{
result = lookupElement(startingScope, firstSymbol.getImage(), type, parameters);
-/* if(type == TypeInfo.t_function)
- if (validParameterList(parameters))
- result = startingScope.unqualifiedFunctionLookup( firstSymbol.getImage(), new LinkedList(parameters));
- else
- result = null;
- else
- result = startingScope.lookup( firstSymbol.getImage());
-*/ if( result != null )
+ if( result != null )
addReference( references, createReference( result, firstSymbol.getImage(), firstSymbol.getOffset() ));
else
throw new ASTSemanticException();
@@ -248,14 +242,7 @@
{
if( t == name.getLastToken() )
result = lookupElement((IContainerSymbol)result, t.getImage(), type, parameters);
-/* if((type == TypeInfo.t_function) || (type == TypeInfo.t_constructor))
- if (validParameterList(parameters))
- result = ((IContainerSymbol)result).qualifiedFunctionLookup( t.getImage(), new LinkedList(parameters) );
- else
- result = null;
- else
- result = ((IContainerSymbol)result).qualifiedLookup( t.getImage() );
-*/ else
+ else
result = ((IContainerSymbol)result).lookupNestedNameSpecifier( t.getImage() );
addReference( references, createReference( result, t.getImage(), t.getOffset() ));
}
@@ -857,7 +844,7 @@
* Apply the usual arithmetic conversions to find out the result of an expression
* that has a lhs and a rhs as indicated in the specs (section 5.Expressions, page 64)
*/
- protected TypeInfo usualArithmeticConversions(TypeInfo lhs, TypeInfo rhs){
+ protected TypeInfo usualArithmeticConversions(TypeInfo lhs, TypeInfo rhs) throws ASTSemanticException{
// if you have a variable of type basic type, then we need to go to the basic type first
while( (lhs.getType() == TypeInfo.t_type) && (lhs.getTypeSymbol() != null)){
@@ -866,6 +853,12 @@
while( (rhs.getType() == TypeInfo.t_type) && (rhs.getTypeSymbol() != null)){
rhs = rhs.getTypeSymbol().getTypeInfo();
}
+
+ if( lhs.isType(TypeInfo.t_class, TypeInfo.t_enumeration ) ||
+ rhs.isType(TypeInfo.t_class, TypeInfo.t_enumeration ) )
+ {
+ throw new ASTSemanticException();
+ }
TypeInfo info = new TypeInfo();
if(
@@ -929,6 +922,8 @@
}
}
protected List getExpressionResultType(IASTExpression expression, ISymbol symbol)throws ASTSemanticException{
+
+
List result = new ArrayList();
TypeInfo info = new TypeInfo();
try {
@@ -1163,8 +1158,10 @@
if((left != null ) && (right != null)){
TypeInfo leftType =(TypeInfo)left.getResultType().iterator().next();
TypeInfo rightType =(TypeInfo)right.getResultType().iterator().next();
- info = usualArithmeticConversions(leftType, rightType);
+ info = usualArithmeticConversions(leftType, rightType);
}
+ else
+ throw new ASTSemanticException();
result.add(info);
return result;
}