1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Patch for Devin Steffler.

Fixed 77379[IProblems][line: -1] IProblem with line: -1 in basic_string.tcc (template related?)
Fixed 77382[IProblems][line: -1] 'this->' in basic_string.tcc has invalid IProblem
Fixed 77389[IProblems] no filename associated with IProblem (ambiguity encountered during lookup)
Fixed 77390 [IProblems] no filename associated with IProblem (Invalid arithmetic conversion in file)
Fixed 77391 [IProblems] no filename/message associated with IProblem in list.tcc
This commit is contained in:
John Camelon 2004-11-05 21:39:39 +00:00
parent 4706348f12
commit 05788b2494
13 changed files with 482 additions and 90 deletions

View file

@ -20,7 +20,7 @@ import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
* @author jcamelon * @author jcamelon
* *
*/ */
public interface IASTExpression extends ISourceElementCallbackDelegate, IASTNode public interface IASTExpression extends ISourceElementCallbackDelegate, IASTNode, IASTOffsetableElement
{ {
public class Kind extends Enum public class Kind extends Enum
{ {

View file

@ -118,7 +118,7 @@ public interface IASTFactory
IASTExpression rhs, IASTExpression rhs,
IASTExpression thirdExpression, IASTExpression thirdExpression,
IASTTypeId typeId, IASTTypeId typeId,
ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException; ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor, ITokenDuple extra) throws ASTSemanticException;
public IASTExpression.IASTNewExpressionDescriptor createNewDescriptor(List newPlacementExpressions,List newTypeIdExpressions,List newInitializerExpressions); public IASTExpression.IASTNewExpressionDescriptor createNewDescriptor(List newPlacementExpressions,List newTypeIdExpressions,List newInitializerExpressions);

View file

@ -171,7 +171,7 @@ public class GCCParserExtension implements IParserExtension {
null, null,
null, null,
d, d,
null, EMPTY_STRING, null); null, EMPTY_STRING, null, null);
} }
catch (ASTSemanticException e) catch (ASTSemanticException e)
{ {
@ -199,7 +199,7 @@ public class GCCParserExtension implements IParserExtension {
null, null,
null, null,
null, null,
null, EMPTY_STRING, null); null, EMPTY_STRING, null, null);
} }
catch (ASTSemanticException e1) catch (ASTSemanticException e1)
{ {
@ -374,7 +374,7 @@ public class GCCParserExtension implements IParserExtension {
try { try {
IASTExpression resultExpression = data.getAstFactory().createExpression( IASTExpression resultExpression = data.getAstFactory().createExpression(
scope, expressionKind, lhsExpression, secondExpression, null, null, null, EMPTY_STRING, null ); scope, expressionKind, lhsExpression, secondExpression, null, null, null, EMPTY_STRING, null, null );
return resultExpression; return resultExpression;
} catch (ASTSemanticException e1) { } catch (ASTSemanticException e1) {
data.backup( mark ); data.backup( mark );

View file

@ -371,7 +371,7 @@ public class Parser implements IParserData, IParser
expression = astFactory.createExpression(scope, expression = astFactory.createExpression(scope,
IASTExpression.Kind.POSTFIX_TYPEID_TYPEID, null, null, IASTExpression.Kind.POSTFIX_TYPEID_TYPEID, null, null,
null, typeId, null, EMPTY_STRING, null); null, typeId, null, EMPTY_STRING, null, null);
list.add(expression); list.add(expression);
completedArg = true; completedArg = true;
} catch (BacktrackException e) { } catch (BacktrackException e) {
@ -404,7 +404,7 @@ public class Parser implements IParserData, IParser
KeywordSetKey.EMPTY); KeywordSetKey.EMPTY);
expression = astFactory.createExpression(scope, expression = astFactory.createExpression(scope,
IASTExpression.Kind.ID_EXPRESSION, null, null, IASTExpression.Kind.ID_EXPRESSION, null, null,
null, null, nameDuple, EMPTY_STRING, null); null, null, nameDuple, EMPTY_STRING, null, null);
list.add(expression); list.add(expression);
continue; continue;
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
@ -827,7 +827,7 @@ public class Parser implements IParserData, IParser
assignmentExpression = astFactory.createExpression(scope, assignmentExpression = astFactory.createExpression(scope,
IASTExpression.Kind.EXPRESSIONLIST, IASTExpression.Kind.EXPRESSIONLIST,
assignmentExpression, secondExpression, null, null, assignmentExpression, secondExpression, null, null,
null, EMPTY_STRING, null); null, EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -868,7 +868,7 @@ public class Parser implements IParserData, IParser
consume( IToken.tRPAREN ); consume( IToken.tRPAREN );
try try
{ {
resultExpression = astFactory.createExpression( scope, extension.getExpressionKindForStatement(), null, null, null, null, null,EMPTY_STRING, null ); resultExpression = astFactory.createExpression( scope, extension.getExpressionKindForStatement(), null, null, null, null, null,EMPTY_STRING, null, null );
} }
catch (ASTSemanticException e) { catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
@ -970,7 +970,7 @@ public class Parser implements IParserData, IParser
try { try {
return astFactory.createExpression(scope, return astFactory.createExpression(scope,
IASTExpression.Kind.THROWEXPRESSION, throwExpression, null, IASTExpression.Kind.THROWEXPRESSION, throwExpression, null,
null, null, null, EMPTY_STRING, null); null, null, null, EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -1006,7 +1006,7 @@ public class Parser implements IParserData, IParser
return astFactory.createExpression(scope, return astFactory.createExpression(scope,
IASTExpression.Kind.CONDITIONALEXPRESSION, IASTExpression.Kind.CONDITIONALEXPRESSION,
firstExpression, secondExpression, thirdExpression, firstExpression, secondExpression, thirdExpression,
null, null, EMPTY_STRING, null); null, null, EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -1038,7 +1038,7 @@ public class Parser implements IParserData, IParser
firstExpression = astFactory.createExpression(scope, firstExpression = astFactory.createExpression(scope,
IASTExpression.Kind.LOGICALOREXPRESSION, IASTExpression.Kind.LOGICALOREXPRESSION,
firstExpression, secondExpression, null, null, null, firstExpression, secondExpression, null, null, null,
EMPTY_STRING, null); EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -1070,7 +1070,7 @@ public class Parser implements IParserData, IParser
firstExpression = astFactory.createExpression(scope, firstExpression = astFactory.createExpression(scope,
IASTExpression.Kind.LOGICALANDEXPRESSION, IASTExpression.Kind.LOGICALANDEXPRESSION,
firstExpression, secondExpression, null, null, null, firstExpression, secondExpression, null, null, null,
EMPTY_STRING, null); EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -1103,7 +1103,7 @@ public class Parser implements IParserData, IParser
firstExpression = astFactory.createExpression(scope, firstExpression = astFactory.createExpression(scope,
IASTExpression.Kind.INCLUSIVEOREXPRESSION, IASTExpression.Kind.INCLUSIVEOREXPRESSION,
firstExpression, secondExpression, null, null, null, firstExpression, secondExpression, null, null, null,
EMPTY_STRING, null); EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -1136,7 +1136,7 @@ public class Parser implements IParserData, IParser
firstExpression = astFactory.createExpression(scope, firstExpression = astFactory.createExpression(scope,
IASTExpression.Kind.EXCLUSIVEOREXPRESSION, IASTExpression.Kind.EXCLUSIVEOREXPRESSION,
firstExpression, secondExpression, null, null, null, firstExpression, secondExpression, null, null, null,
EMPTY_STRING, null); EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -1168,7 +1168,7 @@ public class Parser implements IParserData, IParser
try { try {
firstExpression = astFactory.createExpression(scope, firstExpression = astFactory.createExpression(scope,
IASTExpression.Kind.ANDEXPRESSION, firstExpression, IASTExpression.Kind.ANDEXPRESSION, firstExpression,
secondExpression, null, null, null, EMPTY_STRING, null); secondExpression, null, null, null, EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -1226,7 +1226,7 @@ public class Parser implements IParserData, IParser
? IASTExpression.Kind.EQUALITY_EQUALS ? IASTExpression.Kind.EQUALITY_EQUALS
: IASTExpression.Kind.EQUALITY_NOTEQUALS, : IASTExpression.Kind.EQUALITY_NOTEQUALS,
firstExpression, secondExpression, null, null, firstExpression, secondExpression, null, null,
null, EMPTY_STRING, null); null, EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -1293,7 +1293,7 @@ public class Parser implements IParserData, IParser
firstExpression = astFactory.createExpression(scope, firstExpression = astFactory.createExpression(scope,
expressionKind, firstExpression, expressionKind, firstExpression,
secondExpression, null, null, null, secondExpression, null, null, null,
EMPTY_STRING, null); EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -1341,7 +1341,7 @@ public class Parser implements IParserData, IParser
? IASTExpression.Kind.SHIFT_LEFT ? IASTExpression.Kind.SHIFT_LEFT
: IASTExpression.Kind.SHIFT_RIGHT), : IASTExpression.Kind.SHIFT_RIGHT),
firstExpression, secondExpression, null, null, firstExpression, secondExpression, null, null,
null, EMPTY_STRING, null); null, EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -1382,7 +1382,7 @@ public class Parser implements IParserData, IParser
? IASTExpression.Kind.ADDITIVE_PLUS ? IASTExpression.Kind.ADDITIVE_PLUS
: IASTExpression.Kind.ADDITIVE_MINUS), : IASTExpression.Kind.ADDITIVE_MINUS),
firstExpression, secondExpression, null, null, firstExpression, secondExpression, null, null,
null, EMPTY_STRING, null); null, EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -1434,7 +1434,7 @@ public class Parser implements IParserData, IParser
firstExpression = astFactory.createExpression(scope, firstExpression = astFactory.createExpression(scope,
expressionKind, firstExpression, expressionKind, firstExpression,
secondExpression, null, null, null, secondExpression, null, null, null,
EMPTY_STRING, null); EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
firstExpression.freeReferences(); firstExpression.freeReferences();
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
@ -1476,7 +1476,7 @@ public class Parser implements IParserData, IParser
? IASTExpression.Kind.PM_DOTSTAR ? IASTExpression.Kind.PM_DOTSTAR
: IASTExpression.Kind.PM_ARROWSTAR), : IASTExpression.Kind.PM_ARROWSTAR),
firstExpression, secondExpression, null, null, firstExpression, secondExpression, null, null,
null, EMPTY_STRING, null); null, EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -1540,7 +1540,7 @@ public class Parser implements IParserData, IParser
try { try {
return astFactory.createExpression(scope, return astFactory.createExpression(scope,
IASTExpression.Kind.CASTEXPRESSION, castExpression, IASTExpression.Kind.CASTEXPRESSION, castExpression,
null, null, typeId, null, EMPTY_STRING, null); null, null, typeId, null, EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -1809,7 +1809,7 @@ public class Parser implements IParserData, IParser
return astFactory.createExpression(scope, (vectored return astFactory.createExpression(scope, (vectored
? IASTExpression.Kind.DELETE_VECTORCASTEXPRESSION ? IASTExpression.Kind.DELETE_VECTORCASTEXPRESSION
: IASTExpression.Kind.DELETE_CASTEXPRESSION), : IASTExpression.Kind.DELETE_CASTEXPRESSION),
castExpression, null, null, null, null, EMPTY_STRING, null); castExpression, null, null, null, null, EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -1953,7 +1953,7 @@ public class Parser implements IParserData, IParser
astFactory.createNewDescriptor( astFactory.createNewDescriptor(
newPlacementExpressions, newPlacementExpressions,
newTypeIdExpressions, newTypeIdExpressions,
newInitializerExpressions)); newInitializerExpressions), null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2023,7 +2023,7 @@ public class Parser implements IParserData, IParser
IASTExpression.Kind.NEW_TYPEID, null, null, null, typeId, IASTExpression.Kind.NEW_TYPEID, null, null, null, typeId,
null, EMPTY_STRING, astFactory.createNewDescriptor( null, EMPTY_STRING, astFactory.createNewDescriptor(
newPlacementExpressions, newTypeIdExpressions, newPlacementExpressions, newTypeIdExpressions,
newInitializerExpressions)); newInitializerExpressions), null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
return null; return null;
@ -2105,7 +2105,7 @@ public class Parser implements IParserData, IParser
try { try {
return astFactory.createExpression(scope, return astFactory.createExpression(scope,
IASTExpression.Kind.UNARY_SIZEOF_TYPEID, null, IASTExpression.Kind.UNARY_SIZEOF_TYPEID, null,
null, null, d, null, EMPTY_STRING, null); null, null, d, null, EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2116,7 +2116,7 @@ public class Parser implements IParserData, IParser
return astFactory.createExpression(scope, return astFactory.createExpression(scope,
IASTExpression.Kind.UNARY_SIZEOF_UNARYEXPRESSION, IASTExpression.Kind.UNARY_SIZEOF_UNARYEXPRESSION,
unaryExpression, null, null, null, null, unaryExpression, null, null, null, null,
EMPTY_STRING, null); EMPTY_STRING, null, null);
} catch (ASTSemanticException e1) { } catch (ASTSemanticException e1) {
throwBacktrack(e1.getProblem()); throwBacktrack(e1.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2195,7 +2195,7 @@ public class Parser implements IParserData, IParser
? IASTExpression.Kind.POSTFIX_TYPENAME_TEMPLATEID ? IASTExpression.Kind.POSTFIX_TYPENAME_TEMPLATEID
: IASTExpression.Kind.POSTFIX_TYPENAME_IDENTIFIER), : IASTExpression.Kind.POSTFIX_TYPENAME_IDENTIFIER),
expressionList, null, null, null, expressionList, null, null, null,
nestedName, EMPTY_STRING, null); nestedName, EMPTY_STRING, null, null);
} catch (ASTSemanticException ase) { } catch (ASTSemanticException ase) {
throwBacktrack(ase.getProblem()); throwBacktrack(ase.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2287,7 +2287,7 @@ public class Parser implements IParserData, IParser
? IASTExpression.Kind.POSTFIX_TYPEID_TYPEID ? IASTExpression.Kind.POSTFIX_TYPEID_TYPEID
: IASTExpression.Kind.POSTFIX_TYPEID_EXPRESSION), : IASTExpression.Kind.POSTFIX_TYPEID_EXPRESSION),
lhs, null, null, typeId, null, lhs, null, null, typeId, null,
EMPTY_STRING, null); EMPTY_STRING, null, null);
} catch (ASTSemanticException e6) { } catch (ASTSemanticException e6) {
throwBacktrack(e6.getProblem()); throwBacktrack(e6.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2317,7 +2317,7 @@ public class Parser implements IParserData, IParser
firstExpression = astFactory.createExpression(scope, firstExpression = astFactory.createExpression(scope,
IASTExpression.Kind.POSTFIX_SUBSCRIPT, IASTExpression.Kind.POSTFIX_SUBSCRIPT,
firstExpression, secondExpression, null, null, firstExpression, secondExpression, null, null,
null, EMPTY_STRING, null); null, EMPTY_STRING, null, null);
} catch (ASTSemanticException e2) { } catch (ASTSemanticException e2) {
throwBacktrack(e2.getProblem()); throwBacktrack(e2.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2361,7 +2361,7 @@ public class Parser implements IParserData, IParser
firstExpression = astFactory.createExpression(scope, firstExpression = astFactory.createExpression(scope,
IASTExpression.Kind.POSTFIX_FUNCTIONCALL, IASTExpression.Kind.POSTFIX_FUNCTIONCALL,
firstExpression, secondExpression, null, null, firstExpression, secondExpression, null, null,
null, EMPTY_STRING, null); null, EMPTY_STRING, null, null);
} catch (ASTSemanticException e3) { } catch (ASTSemanticException e3) {
throwBacktrack(e3.getProblem()); throwBacktrack(e3.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2376,7 +2376,7 @@ public class Parser implements IParserData, IParser
firstExpression = astFactory.createExpression(scope, firstExpression = astFactory.createExpression(scope,
IASTExpression.Kind.POSTFIX_INCREMENT, IASTExpression.Kind.POSTFIX_INCREMENT,
firstExpression, null, null, null, null, firstExpression, null, null, null, null,
EMPTY_STRING, null); EMPTY_STRING, null, null);
} catch (ASTSemanticException e1) { } catch (ASTSemanticException e1) {
throwBacktrack(e1.getProblem()); throwBacktrack(e1.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2391,7 +2391,7 @@ public class Parser implements IParserData, IParser
firstExpression = astFactory.createExpression(scope, firstExpression = astFactory.createExpression(scope,
IASTExpression.Kind.POSTFIX_DECREMENT, IASTExpression.Kind.POSTFIX_DECREMENT,
firstExpression, null, null, null, null, firstExpression, null, null, null, null,
EMPTY_STRING, null); EMPTY_STRING, null, null);
} catch (ASTSemanticException e4) { } catch (ASTSemanticException e4) {
throwBacktrack(e4.getProblem()); throwBacktrack(e4.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2429,7 +2429,7 @@ public class Parser implements IParserData, IParser
firstExpression = astFactory.createExpression(scope, firstExpression = astFactory.createExpression(scope,
memberCompletionKind, firstExpression, memberCompletionKind, firstExpression,
secondExpression, null, null, null, secondExpression, null, null, null,
EMPTY_STRING, null); EMPTY_STRING, null, null);
} catch (ASTSemanticException e5) { } catch (ASTSemanticException e5) {
throwBacktrack(e5.getProblem()); throwBacktrack(e5.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2466,7 +2466,7 @@ public class Parser implements IParserData, IParser
firstExpression = astFactory.createExpression(scope, firstExpression = astFactory.createExpression(scope,
arrowCompletionKind, firstExpression, arrowCompletionKind, firstExpression,
secondExpression, null, null, null, secondExpression, null, null, null,
EMPTY_STRING, null); EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2523,7 +2523,7 @@ public class Parser implements IParserData, IParser
int endOffset = consume(IToken.tRPAREN).getEndOffset(); int endOffset = consume(IToken.tRPAREN).getEndOffset();
try { try {
return astFactory.createExpression(scope, type, inside, null, null, return astFactory.createExpression(scope, type, inside, null, null,
null, null, EMPTY_STRING, null); null, null, EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2549,7 +2549,7 @@ public class Parser implements IParserData, IParser
try { try {
return astFactory.createExpression(scope, return astFactory.createExpression(scope,
IASTExpression.Kind.PRIMARY_INTEGER_LITERAL, null, IASTExpression.Kind.PRIMARY_INTEGER_LITERAL, null,
null, null, null, null, t.getCharImage(), null); null, null, null, null, t.getCharImage(), null, (ITokenDuple)t);
} catch (ASTSemanticException e1) { } catch (ASTSemanticException e1) {
throwBacktrack(e1.getProblem()); throwBacktrack(e1.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2561,7 +2561,7 @@ public class Parser implements IParserData, IParser
try { try {
return astFactory.createExpression(scope, return astFactory.createExpression(scope,
IASTExpression.Kind.PRIMARY_FLOAT_LITERAL, null, IASTExpression.Kind.PRIMARY_FLOAT_LITERAL, null,
null, null, null, null, t.getCharImage(), null); null, null, null, null, t.getCharImage(), null, (ITokenDuple)t);
} catch (ASTSemanticException e2) { } catch (ASTSemanticException e2) {
throwBacktrack(e2.getProblem()); throwBacktrack(e2.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2574,7 +2574,7 @@ public class Parser implements IParserData, IParser
try { try {
return astFactory.createExpression(scope, return astFactory.createExpression(scope,
IASTExpression.Kind.PRIMARY_STRING_LITERAL, null, IASTExpression.Kind.PRIMARY_STRING_LITERAL, null,
null, null, null, null, t.getCharImage(), null); null, null, null, null, t.getCharImage(), null, (ITokenDuple)t);
} catch (ASTSemanticException e5) { } catch (ASTSemanticException e5) {
throwBacktrack(e5.getProblem()); throwBacktrack(e5.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2588,7 +2588,7 @@ public class Parser implements IParserData, IParser
try { try {
return astFactory.createExpression(scope, return astFactory.createExpression(scope,
IASTExpression.Kind.PRIMARY_BOOLEAN_LITERAL, null, IASTExpression.Kind.PRIMARY_BOOLEAN_LITERAL, null,
null, null, null, null, t.getCharImage(), null); null, null, null, null, t.getCharImage(), null, (ITokenDuple)t);
} catch (ASTSemanticException e3) { } catch (ASTSemanticException e3) {
throwBacktrack(e3.getProblem()); throwBacktrack(e3.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2603,7 +2603,7 @@ public class Parser implements IParserData, IParser
try { try {
return astFactory.createExpression(scope, return astFactory.createExpression(scope,
IASTExpression.Kind.PRIMARY_CHAR_LITERAL, null, IASTExpression.Kind.PRIMARY_CHAR_LITERAL, null,
null, null, null, null, t.getCharImage(), null); null, null, null, null, t.getCharImage(), null, (ITokenDuple)t);
} catch (ASTSemanticException e4) { } catch (ASTSemanticException e4) {
throwBacktrack(e4.getProblem()); throwBacktrack(e4.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2616,7 +2616,7 @@ public class Parser implements IParserData, IParser
try { try {
return astFactory.createExpression(scope, return astFactory.createExpression(scope,
IASTExpression.Kind.PRIMARY_THIS, null, null, null, IASTExpression.Kind.PRIMARY_THIS, null, null, null,
null, null, EMPTY_STRING, null); null, null, EMPTY_STRING, null, (ITokenDuple)t);
} catch (ASTSemanticException e7) { } catch (ASTSemanticException e7) {
throwBacktrack(e7.getProblem()); throwBacktrack(e7.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2642,7 +2642,7 @@ public class Parser implements IParserData, IParser
try { try {
return astFactory.createExpression(scope, return astFactory.createExpression(scope,
IASTExpression.Kind.PRIMARY_BRACKETED_EXPRESSION, IASTExpression.Kind.PRIMARY_BRACKETED_EXPRESSION,
lhs, null, null, null, null, EMPTY_STRING, null); lhs, null, null, null, null, EMPTY_STRING, null, (ITokenDuple)t);
} catch (ASTSemanticException e6) { } catch (ASTSemanticException e6) {
throwBacktrack(e6.getProblem()); throwBacktrack(e6.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2691,7 +2691,7 @@ public class Parser implements IParserData, IParser
try { try {
return astFactory.createExpression(scope, return astFactory.createExpression(scope,
IASTExpression.Kind.ID_EXPRESSION, null, null, IASTExpression.Kind.ID_EXPRESSION, null, null,
null, null, duple, EMPTY_STRING, null); null, null, duple, EMPTY_STRING, null, duple);
} catch (ASTSemanticException e8) { } catch (ASTSemanticException e8) {
throwBacktrack(e8.getProblem()); throwBacktrack(e8.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2713,7 +2713,7 @@ public class Parser implements IParserData, IParser
try { try {
empty = astFactory.createExpression(scope, empty = astFactory.createExpression(scope,
IASTExpression.Kind.PRIMARY_EMPTY, null, null, IASTExpression.Kind.PRIMARY_EMPTY, null, null,
null, null, null, EMPTY_STRING, null); null, null, null, EMPTY_STRING, null, (ITokenDuple)la);
} catch (ASTSemanticException e9) { } catch (ASTSemanticException e9) {
throwBacktrack( e9.getProblem() ); throwBacktrack( e9.getProblem() );
return null; return null;
@ -2756,7 +2756,7 @@ public class Parser implements IParserData, IParser
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0; int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
try { try {
return astFactory.createExpression(scope, kind, lhs, return astFactory.createExpression(scope, kind, lhs,
assignmentExpression, null, null, null, EMPTY_STRING, null); assignmentExpression, null, null, null, EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2780,7 +2780,7 @@ public class Parser implements IParserData, IParser
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0; int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
try { try {
return astFactory.createExpression(scope, kind, castExpression, return astFactory.createExpression(scope, kind, castExpression,
null, null, null, null, EMPTY_STRING, null); null, null, null, null, EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -2809,7 +2809,7 @@ public class Parser implements IParserData, IParser
int endOffset = consume(IToken.tRPAREN).getEndOffset(); int endOffset = consume(IToken.tRPAREN).getEndOffset();
try { try {
return astFactory.createExpression(scope, kind, lhs, null, null, return astFactory.createExpression(scope, kind, lhs, null, null,
duple, null, EMPTY_STRING, null); duple, null, EMPTY_STRING, null, null);
} catch (ASTSemanticException e) { } catch (ASTSemanticException e) {
throwBacktrack(e.getProblem()); throwBacktrack(e.getProblem());
} catch (Exception e) { } catch (Exception e) {
@ -6926,4 +6926,5 @@ public class Parser implements IParserData, IParser
references.clear(); references.clear();
} }
} }

View file

@ -36,4 +36,60 @@ public class ASTEmptyExpression extends ASTExpression {
public String toString(){ public String toString(){
return ASTUtil.getExpressionString( this ); return ASTUtil.getExpressionString( this );
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffsetAndLineNumber(int, int)
*/
public void setStartingOffsetAndLineNumber(int offset, int lineNumber) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffsetAndLineNumber(int, int)
*/
public void setEndingOffsetAndLineNumber(int offset, int lineNumber) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
*/
public int getStartingOffset() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
*/
public int getEndingOffset() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingLine()
*/
public int getStartingLine() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingLine()
*/
public int getEndingLine() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename()
*/
public char[] getFilename() {
// TODO Auto-generated method stub
return null;
}
} }

View file

@ -52,4 +52,58 @@ public class ASTIdExpression extends ASTExpression {
public String toString(){ public String toString(){
return ASTUtil.getExpressionString( this ); return ASTUtil.getExpressionString( this );
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffsetAndLineNumber(int, int)
*/
public void setStartingOffsetAndLineNumber(int offset, int lineNumber) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffsetAndLineNumber(int, int)
*/
public void setEndingOffsetAndLineNumber(int offset, int lineNumber) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
*/
public int getStartingOffset() {
// TODO Auto-generated method stub
return idExpression.getStartOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
*/
public int getEndingOffset() {
// TODO Auto-generated method stub
return idExpression.getEndOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingLine()
*/
public int getStartingLine() {
// TODO Auto-generated method stub
return idExpression.getLineNumber();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingLine()
*/
public int getEndingLine() {
// TODO Auto-generated method stub
return idExpression.getLineNumber();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename()
*/
public char[] getFilename() {
// TODO Auto-generated method stub
return idExpression.getFilename();
}
} }

View file

@ -41,4 +41,60 @@ public class ASTLiteralExpression extends ASTExpression {
public String toString(){ public String toString(){
return ASTUtil.getExpressionString( this ); return ASTUtil.getExpressionString( this );
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffsetAndLineNumber(int, int)
*/
public void setStartingOffsetAndLineNumber(int offset, int lineNumber) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffsetAndLineNumber(int, int)
*/
public void setEndingOffsetAndLineNumber(int offset, int lineNumber) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
*/
public int getStartingOffset() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
*/
public int getEndingOffset() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingLine()
*/
public int getStartingLine() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingLine()
*/
public int getEndingLine() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename()
*/
public char[] getFilename() {
// TODO Auto-generated method stub
return null;
}
} }

View file

@ -111,4 +111,60 @@ public class ASTNewExpression extends ASTExpression {
return ownerExpression; return ownerExpression;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffsetAndLineNumber(int, int)
*/
public void setStartingOffsetAndLineNumber(int offset, int lineNumber) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffsetAndLineNumber(int, int)
*/
public void setEndingOffsetAndLineNumber(int offset, int lineNumber) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
*/
public int getStartingOffset() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
*/
public int getEndingOffset() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingLine()
*/
public int getStartingLine() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingLine()
*/
public int getEndingLine() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename()
*/
public char[] getFilename() {
// TODO Auto-generated method stub
return null;
}
} }

View file

@ -65,4 +65,53 @@ public class ASTTypeIdExpression extends ASTExpression {
return this; return this;
return super.findOwnerExpressionForIDExpression(duple); return super.findOwnerExpressionForIDExpression(duple);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffsetAndLineNumber(int, int)
*/
public void setStartingOffsetAndLineNumber(int offset, int lineNumber) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffsetAndLineNumber(int, int)
*/
public void setEndingOffsetAndLineNumber(int offset, int lineNumber) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
*/
public int getStartingOffset() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
*/
public int getEndingOffset() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingLine()
*/
public int getStartingLine() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingLine()
*/
public int getEndingLine() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename()
*/
public char[] getFilename() {
// TODO Auto-generated method stub
return null;
}
} }

View file

@ -88,4 +88,53 @@ public class ASTUnaryExpression extends ASTExpression {
public String toString(){ public String toString(){
return ASTUtil.getExpressionString( this ); return ASTUtil.getExpressionString( this );
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffsetAndLineNumber(int, int)
*/
public void setStartingOffsetAndLineNumber(int offset, int lineNumber) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffsetAndLineNumber(int, int)
*/
public void setEndingOffsetAndLineNumber(int offset, int lineNumber) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
*/
public int getStartingOffset() {
// TODO Auto-generated method stub
return lhs.getStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
*/
public int getEndingOffset() {
// TODO Auto-generated method stub
return lhs.getEndingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingLine()
*/
public int getStartingLine() {
// TODO Auto-generated method stub
return lhs.getStartingLine();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingLine()
*/
public int getEndingLine() {
// TODO Auto-generated method stub
return lhs.getEndingLine();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename()
*/
public char[] getFilename() {
// TODO Auto-generated method stub
return lhs.getFilename();
}
} }

View file

@ -123,6 +123,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
private final CharArrayObjectMap simpleTypeSpecCache = new CharArrayObjectMap( BUILTIN_TYPE_SIZE ); private final CharArrayObjectMap simpleTypeSpecCache = new CharArrayObjectMap( BUILTIN_TYPE_SIZE );
private static final int DEFAULT_QUALIFIEDNAME_REFERENCE_SIZE = 4; private static final int DEFAULT_QUALIFIEDNAME_REFERENCE_SIZE = 4;
private char[] filename; private char[] filename;
private int problemStartOffset = -1;
private int problemEndOffset = -1;
private int problemLineNumber = -1;
static static
{ {
@ -213,11 +216,11 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
return true; return true;
} }
private ISymbol lookupElement (IContainerSymbol startingScope, char[] name, ITypeInfo.eType type, List parameters, LookupType lookupType ) throws ASTSemanticException { private ISymbol lookupElement (IContainerSymbol startingScope, char[] name, ITypeInfo.eType type, List parameters, LookupType lookupType) throws ASTSemanticException {
return lookupElement( startingScope, name, type, parameters, null, lookupType ); return lookupElement( startingScope, name, type, parameters, null, lookupType);
} }
private ISymbol lookupElement (IContainerSymbol startingScope, char[] name, ITypeInfo.eType type, List parameters, List arguments, LookupType lookupType ) throws ASTSemanticException { private ISymbol lookupElement (IContainerSymbol startingScope, char[] name, ITypeInfo.eType type, List parameters, List arguments, LookupType lookupType) throws ASTSemanticException {
ISymbol result = null; ISymbol result = null;
if( startingScope == null ) return null; if( startingScope == null ) return null;
try { try {
@ -269,7 +272,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
return lookupQualifiedName(startingScope, name, ITypeInfo.t_any, null, 0, references, throwOnError, lookup ); return lookupQualifiedName(startingScope, name, ITypeInfo.t_any, null, 0, references, throwOnError, lookup );
} }
protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, char[] name, ITypeInfo.eType type, List parameters, int offset, List references, boolean throwOnError, LookupType lookup ) throws ASTSemanticException protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, char[] name, ITypeInfo.eType type, List parameters, int offset, List references, boolean throwOnError, LookupType lookup) throws ASTSemanticException
{ {
ISymbol result = null; ISymbol result = null;
if( name == null && throwOnError ) if( name == null && throwOnError )
@ -306,6 +309,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, ITokenDuple name, ITypeInfo.eType type, List parameters, List references, boolean throwOnError, LookupType lookup ) throws ASTSemanticException protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, ITokenDuple name, ITypeInfo.eType type, List parameters, List references, boolean throwOnError, LookupType lookup ) throws ASTSemanticException
{ {
setProblemInfo(name);
ISymbol result = null; ISymbol result = null;
if( name == null && throwOnError ) handleProblem( IProblem.SEMANTIC_NAME_NOT_PROVIDED, null ); if( name == null && throwOnError ) handleProblem( IProblem.SEMANTIC_NAME_NOT_PROVIDED, null );
else if( name == null ) return null; else if( name == null ) return null;
@ -466,7 +470,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
int startingLine, int endingOffset, int endingLine) int startingLine, int endingOffset, int endingLine)
throws ASTSemanticException throws ASTSemanticException
{ {
setFilename( duple ); setProblemInfo( duple );
List references = new ArrayList(); List references = new ArrayList();
ISymbol symbol = lookupQualifiedName( ISymbol symbol = lookupQualifiedName(
scopeToSymbol( scope), duple, references, true ); scopeToSymbol( scope), duple, references, true );
@ -485,14 +489,6 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
return using; return using;
} }
/**
* @param duple
*/
private void setFilename(ITokenDuple duple) {
filename = ( duple == null ) ? EMPTY_STRING : duple.getFilename();
}
protected IContainerSymbol getScopeToSearchUpon( protected IContainerSymbol getScopeToSearchUpon(
IASTScope currentScope, IASTScope currentScope,
@ -525,7 +521,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
int startingOffset, int startingOffset,
int startingLine, int endingOffset, int endingLine) throws ASTSemanticException int startingLine, int endingOffset, int endingLine) throws ASTSemanticException
{ {
setFilename( name ); setProblemInfo( name );
List references = new ArrayList(); List references = new ArrayList();
IUsingDeclarationSymbol endResult = null; IUsingDeclarationSymbol endResult = null;
@ -832,12 +828,12 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
protected void handleProblem( int id, char[] attribute ) throws ASTSemanticException protected void handleProblem( int id, char[] attribute ) throws ASTSemanticException
{ {
handleProblem( null, id, attribute, -1, -1, -1, true ); //TODO make this right handleProblem( null, id, attribute, problemStartOffset, problemEndOffset, problemLineNumber, true );
} }
protected void handleProblem( IASTScope scope, int id, char[] attribute ) throws ASTSemanticException protected void handleProblem( IASTScope scope, int id, char[] attribute ) throws ASTSemanticException
{ {
handleProblem( scope, id, attribute, -1, -1, -1, true); handleProblem( scope, id, attribute, problemStartOffset, problemEndOffset, problemLineNumber, true);
} }
protected void handleProblem( int id, char[] attribute, int startOffset, int endOffset, int lineNumber, boolean isError ) throws ASTSemanticException { protected void handleProblem( int id, char[] attribute, int startOffset, int endOffset, int lineNumber, boolean isError ) throws ASTSemanticException {
@ -905,7 +901,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
ASTAccessVisibility visibility, ASTAccessVisibility visibility,
ITokenDuple parentClassName) throws ASTSemanticException ITokenDuple parentClassName) throws ASTSemanticException
{ {
setFilename( parentClassName ); setProblemInfo( parentClassName );
IDerivableContainerSymbol classSymbol = (IDerivableContainerSymbol)scopeToSymbol( astClassSpec); IDerivableContainerSymbol classSymbol = (IDerivableContainerSymbol)scopeToSymbol( astClassSpec);
List references = new ArrayList(); List references = new ArrayList();
@ -1086,9 +1082,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
IASTExpression rhs, IASTExpression rhs,
IASTExpression thirdExpression, IASTExpression thirdExpression,
IASTTypeId typeId, IASTTypeId typeId,
ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor, ITokenDuple extra) throws ASTSemanticException
{ {
setFilename( idExpression ); setProblemInfo( extra );
if( idExpression != null && logService.isTracing() ) if( idExpression != null && logService.isTracing() )
{ {
TraceUtil.outputTrace( TraceUtil.outputTrace(
@ -1116,7 +1112,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
ISymbol symbol = getExpressionSymbol(scope, kind, lhs, rhs, idExpression, references ); ISymbol symbol = getExpressionSymbol(scope, kind, lhs, rhs, idExpression, references );
// Try to figure out the result that this expression evaluates to // Try to figure out the result that this expression evaluates to
ExpressionResult expressionResult = getExpressionResultType(scope, kind, lhs, rhs, thirdExpression, typeId, literal, symbol); ExpressionResult expressionResult = getExpressionResultType(scope, kind, lhs, rhs, thirdExpression, typeId, literal, symbol, extra);
if( newDescriptor != null ){ if( newDescriptor != null ){
createConstructorReference( newDescriptor, typeId, references ); createConstructorReference( newDescriptor, typeId, references );
@ -1372,7 +1368,12 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
* Apply the usual arithmetic conversions to find out the result of an expression * 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) * that has a lhs and a rhs as indicated in the specs (section 5.Expressions, page 64)
*/ */
protected ITypeInfo usualArithmeticConversions( IASTScope scope, ITypeInfo lhs, ITypeInfo rhs) throws ASTSemanticException{ protected ITypeInfo usualArithmeticConversions( IASTScope scope, ASTExpression lhsExp, ASTExpression rhsExp) throws ASTSemanticException{
setFilename(lhsExp.getFilename());
ITypeInfo lhs = lhsExp.getResultType().getResult();
ITypeInfo rhs = rhsExp.getResultType().getResult();
if( lhs == null ) return null; if( lhs == null ) return null;
if( rhs == null ) return null; if( rhs == null ) return null;
// if you have a variable of type basic type, then we need to go to the basic type first // if you have a variable of type basic type, then we need to go to the basic type first
@ -1382,12 +1383,11 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
while( (rhs.getType() == ITypeInfo.t_type) && (rhs.getTypeSymbol() != null)){ while( (rhs.getType() == ITypeInfo.t_type) && (rhs.getTypeSymbol() != null)){
rhs = rhs.getTypeSymbol().getTypeInfo(); rhs = rhs.getTypeSymbol().getTypeInfo();
} }
if( !lhs.isType(ITypeInfo.t__Bool, ITypeInfo.t_enumerator ) || if( !lhs.isType(ITypeInfo.t__Bool, ITypeInfo.t_enumerator ) )
!rhs.isType(ITypeInfo.t__Bool, ITypeInfo.t_enumerator ) ) handleProblem( scope, IProblem.SEMANTIC_INVALID_CONVERSION_TYPE, null, lhsExp.getStartingOffset(), lhsExp.getEndingOffset(), lhsExp.getStartingLine(), true );
{ if( !rhs.isType(ITypeInfo.t__Bool, ITypeInfo.t_enumerator ) )
handleProblem( scope, IProblem.SEMANTIC_INVALID_CONVERSION_TYPE, null ); handleProblem( scope, IProblem.SEMANTIC_INVALID_CONVERSION_TYPE, null, rhsExp.getStartingOffset(), rhsExp.getEndingOffset(), rhsExp.getStartingLine(), true );
}
ITypeInfo info = TypeInfoProvider.newTypeInfo( ); ITypeInfo info = TypeInfoProvider.newTypeInfo( );
if( if(
@ -1553,8 +1553,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
IASTExpression thirdExpression, IASTExpression thirdExpression,
IASTTypeId typeId, IASTTypeId typeId,
char[] literal, char[] literal,
ISymbol symbol) throws ASTSemanticException ISymbol symbol, ITokenDuple extra) throws ASTSemanticException
{ {
setProblemInfo(extra);
ITypeInfo info = null; ITypeInfo info = null;
ExpressionResult result = null; ExpressionResult result = null;
@ -1738,9 +1739,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
ASTExpression left = (ASTExpression)lhs; ASTExpression left = (ASTExpression)lhs;
ASTExpression right = (ASTExpression)rhs; ASTExpression right = (ASTExpression)rhs;
if((left != null ) && (right != null)){ if((left != null ) && (right != null)){
ITypeInfo leftType =left.getResultType().getResult(); info = usualArithmeticConversions( scope, left, right);
ITypeInfo rightType =right.getResultType().getResult();
info = usualArithmeticConversions( scope, leftType, rightType);
} }
else else
handleProblem( scope, IProblem.SEMANTIC_MALFORMED_EXPRESSION, null ); handleProblem( scope, IProblem.SEMANTIC_MALFORMED_EXPRESSION, null );
@ -1903,7 +1902,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
IASTScope scope, IASTScope scope,
ITokenDuple duple, IASTExpression expressionList) ITokenDuple duple, IASTExpression expressionList)
{ {
setFilename( duple ); setProblemInfo( duple );
List references = new ArrayList(); List references = new ArrayList();
IContainerSymbol scopeSymbol = scopeToSymbol(scope); IContainerSymbol scopeSymbol = scopeToSymbol(scope);
@ -1953,7 +1952,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
boolean isImaginary, boolean isImaginary,
boolean isGlobal, Map extensionParms ) throws ASTSemanticException boolean isGlobal, Map extensionParms ) throws ASTSemanticException
{ {
setFilename( typeName ); setProblemInfo( typeName );
if( extension.overrideCreateSimpleTypeSpecifierMethod( kind )) if( extension.overrideCreateSimpleTypeSpecifierMethod( kind ))
return extension.createSimpleTypeSpecifier(pst, scope, kind, typeName, isShort, isLong, isSigned, isUnsigned, isTypename, isComplex, isImaginary, isGlobal, extensionParms ); return extension.createSimpleTypeSpecifier(pst, scope, kind, typeName, isShort, isLong, isSigned, isUnsigned, isTypename, isComplex, isImaginary, isGlobal, extensionParms );
char[] typeNameAsString = typeName.toCharArray(); char[] typeNameAsString = typeName.toCharArray();
@ -2101,7 +2100,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
boolean isExplicit, boolean isExplicit,
boolean isPureVirtual, List constructorChain, boolean isFunctionDefinition, boolean hasFunctionTryBlock, boolean hasVariableArguments ) throws ASTSemanticException boolean isPureVirtual, List constructorChain, boolean isFunctionDefinition, boolean hasFunctionTryBlock, boolean hasVariableArguments ) throws ASTSemanticException
{ {
setFilename( name ); setProblemInfo( name );
List references = new ArrayList(); List references = new ArrayList();
IContainerSymbol ownerScope = scopeToSymbol( scope ); IContainerSymbol ownerScope = scopeToSymbol( scope );
@ -2469,7 +2468,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
boolean isPureVirtual, boolean isPureVirtual,
ASTAccessVisibility visibility, List constructorChain, List references, boolean isFunctionDefinition, boolean hasFunctionTryBlock, boolean hasVariableArguments ) throws ASTSemanticException ASTAccessVisibility visibility, List constructorChain, List references, boolean isFunctionDefinition, boolean hasFunctionTryBlock, boolean hasVariableArguments ) throws ASTSemanticException
{ {
setFilename( nameDuple ); setProblemInfo( nameDuple );
boolean isConstructor = false; boolean isConstructor = false;
boolean isDestructor = false; boolean isDestructor = false;
@ -2677,7 +2676,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
IContainerSymbol ownerScope = scopeToSymbol( scope ); IContainerSymbol ownerScope = scopeToSymbol( scope );
if( name == null ) if( name == null )
handleProblem( IProblem.SEMANTIC_NAME_NOT_PROVIDED, null, startingOffset, nameEndOffset, nameLine, true ); handleProblem( IProblem.SEMANTIC_NAME_NOT_PROVIDED, null, startingOffset, startingOffset + 1, startingLine, true );
if(name.getSegmentCount() > 1) if(name.getSegmentCount() > 1)
{ {
@ -2752,7 +2751,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
} }
catch (ParserSymbolTableException e) catch (ParserSymbolTableException e)
{ {
handleProblem(e.createProblemID(), name.getFirstToken().getCharImage() ); handleProblem(e.createProblemID(), name.getFirstToken().getCharImage(), name.getFirstToken().getOffset(), name.getFirstToken().getEndOffset(), name.getFirstToken().getLineNumber(), true );
} }
ASTVariable variable = new ASTVariable( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, references, constructorExpression, previouslyDeclared, filename ); ASTVariable variable = new ASTVariable( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, references, constructorExpression, previouslyDeclared, filename );
@ -2993,7 +2992,10 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
} }
catch (ParserSymbolTableException e) catch (ParserSymbolTableException e)
{ {
handleProblem(e.createProblemID(), image ); if (name==null)
handleProblem(e.createProblemID(), image );
else
handleProblem(e.createProblemID(), image, name.getStartOffset(), name.getEndOffset(), name.getLineNumber(), true );
} }
ASTField field = new ASTField( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, references, previouslyDeclared, constructorExpression, visibility, filename ); ASTField field = new ASTField( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, startingLine, nameOffset, nameEndOffset, nameLine, references, previouslyDeclared, constructorExpression, visibility, filename );
@ -3199,7 +3201,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
public IASTElaboratedTypeSpecifier createElaboratedTypeSpecifier(IASTScope scope, ASTClassKind kind, ITokenDuple name, int startingOffset, int startingLine, int endOffset, int endingLine, boolean isForewardDecl, boolean isFriend) throws ASTSemanticException public IASTElaboratedTypeSpecifier createElaboratedTypeSpecifier(IASTScope scope, ASTClassKind kind, ITokenDuple name, int startingOffset, int startingLine, int endOffset, int endingLine, boolean isForewardDecl, boolean isFriend) throws ASTSemanticException
{ {
setFilename( name ); setProblemInfo( name );
IContainerSymbol currentScopeSymbol = scopeToSymbol(scope); IContainerSymbol currentScopeSymbol = scopeToSymbol(scope);
IContainerSymbol originalScope = currentScopeSymbol; IContainerSymbol originalScope = currentScopeSymbol;
@ -3343,7 +3345,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
*/ */
public IASTNamespaceAlias createNamespaceAlias(IASTScope scope, char[] identifier, ITokenDuple alias, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endOffset, int endingLine) throws ASTSemanticException public IASTNamespaceAlias createNamespaceAlias(IASTScope scope, char[] identifier, ITokenDuple alias, int startingOffset, int startingLine, int nameOffset, int nameEndOffset, int nameLine, int endOffset, int endingLine) throws ASTSemanticException
{ {
setFilename( alias ); setProblemInfo( alias );
IContainerSymbol startingSymbol = scopeToSymbol(scope); IContainerSymbol startingSymbol = scopeToSymbol(scope);
List references = new ArrayList(); List references = new ArrayList();
@ -3797,4 +3799,17 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
return (pst.getTypeInfoProvider().numAllocated() == 0); return (pst.getTypeInfoProvider().numAllocated() == 0);
} }
private void setProblemInfo(ITokenDuple extra) {
if (extra != null) {
this.problemStartOffset = extra.getStartOffset();
this.problemEndOffset = extra.getEndOffset();
this.problemLineNumber = extra.getLineNumber();
this.filename = extra.getFilename();
} else {
this.problemStartOffset = -1;
this.problemEndOffset = -1;
this.problemLineNumber = -1;
this.filename = EMPTY_STRING;
}
}
} }

View file

@ -235,5 +235,61 @@ public class ASTExpression implements IASTExpression {
public void freeReferences() { public void freeReferences() {
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffsetAndLineNumber(int, int)
*/
public void setStartingOffsetAndLineNumber(int offset, int lineNumber) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffsetAndLineNumber(int, int)
*/
public void setEndingOffsetAndLineNumber(int offset, int lineNumber) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
*/
public int getStartingOffset() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
*/
public int getEndingOffset() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingLine()
*/
public int getStartingLine() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingLine()
*/
public int getEndingLine() {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getFilename()
*/
public char[] getFilename() {
// TODO Auto-generated method stub
return null;
}
} }

View file

@ -157,7 +157,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExpression(org.eclipse.cdt.core.parser.ast.IASTExpression.ExpressionKind, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTExpression, java.lang.String, java.lang.String, java.lang.String) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExpression(org.eclipse.cdt.core.parser.ast.IASTExpression.ExpressionKind, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTExpression, java.lang.String, java.lang.String, java.lang.String)
*/ */
public IASTExpression createExpression(IASTScope scope, Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor) { public IASTExpression createExpression(IASTScope scope, Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, char[] literal, IASTNewExpressionDescriptor newDescriptor, ITokenDuple extra) {
return temporarilyDisableNodeConstruction ? ExpressionFactory.createExpression( kind, lhs, rhs, thirdExpression, typeId, idExpression == null ? EMPTY_STRING : idExpression.toCharArray(), literal, newDescriptor ) : null; //$NON-NLS-1$ return temporarilyDisableNodeConstruction ? ExpressionFactory.createExpression( kind, lhs, rhs, thirdExpression, typeId, idExpression == null ? EMPTY_STRING : idExpression.toCharArray(), literal, newDescriptor ) : null; //$NON-NLS-1$
} }