mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
org.eclipse.cdt.core <BR>
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=50808. <BR> Provided partial fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=50807. <BR> Provided partial fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=52988. <BR> Introduced EMPTY_STRING, a single constant that replaced > 100'S O literal "" in the code. <BR> Updated IASTCompletionNode interface to provide better support for FUNCTION_REFERENCE and CONSTRUCTOR_REFERENCE. <BR> Implemented IASTTypeId.getFullSignature() for both QUICK_PARSE and COMPLETE_PARSE. <BR> Tweaked ASTNode.lookup() so that it would work for FUNCTION_REFERENCE. <BR><BR> org.eclipse.cdt.ui <BR> Updated CompletionEngine to use the extended IASTCompletionNode interface for FUNCTION_REFERENCE. <BR><BR> org.eclipse.cdt.ui.tests <BR> Updated CompletionFailedTest_ConstructorReference_Bug50808, renamed it to CompletionTest_ConstructorReference and moved it out of the failed tests folder. <BR> Updated CompletionFailedTest_TypeDef_Bug52948, renamed it to CompletionTest_TypeDef_Prefix and moved it out of the failed tests folder. <BR> Renamed CompletionTest_TypeDef_Bug52948 it to CompletionTest_TypeDef_NoPrefix. <BR> Updated CompletionTest_SingleName_Parameter and renamed it to CompletionTest_FunctionReference_Prefix. <BR> Updated CompletionFailedTest_FunctionReference_Bug50807, renamed it to CompletionTest_FunctionReference_NoPrefix and moved it out of the failed tests folder. <BR>
This commit is contained in:
parent
d7664718ae
commit
5cc0a37e2b
30 changed files with 447 additions and 158 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2004-04-07 John Camelon
|
||||||
|
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=50808.
|
||||||
|
Provided partial fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=50807.
|
||||||
|
Provided partial fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=52988.
|
||||||
|
Introduced EMPTY_STRING, a single constant that replaced > 100'S O literal "" in the code.
|
||||||
|
Updated IASTCompletionNode interface to provide better support for FUNCTION_REFERENCE and CONSTRUCTOR_REFERENCE.
|
||||||
|
Implemented IASTTypeId.getFullSignature() for both QUICK_PARSE and COMPLETE_PARSE.
|
||||||
|
Tweaked ASTNode.lookup() so that it would work for FUNCTION_REFERENCE.
|
||||||
|
|
||||||
2004-04-07 Andrew Niefer
|
2004-04-07 Andrew Niefer
|
||||||
fix lookup in parents when the parent is a deferred template instance, enables content assist on list (from <list>)
|
fix lookup in parents when the parent is a deferred template instance, enables content assist on list (from <list>)
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,13 @@ public interface IASTCompletionNode {
|
||||||
*/
|
*/
|
||||||
public IASTNode getCompletionContext();
|
public IASTNode getCompletionContext();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name of the function/constructor being completed in
|
||||||
|
* CONSTRUCTOR_REFERENCE
|
||||||
|
* FUNCTION_REFERENCE
|
||||||
|
*/
|
||||||
|
public String getFunctionName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the prefix
|
* @return the prefix
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -232,7 +232,7 @@ public interface IASTFactory
|
||||||
public IASTCodeScope createNewCodeBlock(IASTScope scope);
|
public IASTCodeScope createNewCodeBlock(IASTScope scope);
|
||||||
|
|
||||||
public IASTTypeId createTypeId( IASTScope scope, IASTSimpleTypeSpecifier.Type kind, boolean isConst, boolean isVolatile, boolean isShort,
|
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, String completeSignature ) throws ASTSemanticException;
|
||||||
/**
|
/**
|
||||||
* @param astClassSpecifier
|
* @param astClassSpecifier
|
||||||
*/
|
*/
|
||||||
|
@ -250,4 +250,12 @@ public interface IASTFactory
|
||||||
* @param log
|
* @param log
|
||||||
*/
|
*/
|
||||||
public void setLogger(IParserLogService log);
|
public void setLogger(IParserLogService log);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param scope TODO
|
||||||
|
* @param expression
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public IASTNode expressionToASTNode(IASTScope scope, IASTExpression expression);
|
||||||
|
|
||||||
}
|
}
|
|
@ -35,6 +35,6 @@ public interface IASTTypeId extends ISourceElementCallbackDelegate
|
||||||
public boolean isTypename();
|
public boolean isTypename();
|
||||||
|
|
||||||
|
|
||||||
public String getFullSignature() throws ASTNotImplementedException;
|
public String getFullSignature();
|
||||||
public ISymbol getTypeSymbol() throws ASTNotImplementedException;
|
public ISymbol getTypeSymbol() throws ASTNotImplementedException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class CompletionParser extends ContextualParser implements IParser {
|
||||||
public IASTCompletionNode parse(int offset) {
|
public IASTCompletionNode parse(int offset) {
|
||||||
scanner.setOffsetBoundary(offset);
|
scanner.setOffsetBoundary(offset);
|
||||||
translationUnit();
|
translationUnit();
|
||||||
return new ASTCompletionNode( getCompletionKind(), getCompletionScope(), getCompletionContext(), getCompletionPrefix(), reconcileKeywords( getKeywordSet(), getCompletionPrefix() ) );
|
return new ASTCompletionNode( getCompletionKind(), getCompletionScope(), getCompletionContext(), getCompletionPrefix(), reconcileKeywords( getKeywordSet(), getCompletionPrefix() ), getCompletionFunctionName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -70,12 +70,13 @@ public class ContextualParser extends CompleteParser {
|
||||||
protected IASTNode context;
|
protected IASTNode context;
|
||||||
protected IToken finalToken;
|
protected IToken finalToken;
|
||||||
protected Set keywordSet;
|
protected Set keywordSet;
|
||||||
|
protected String functionOrConstructorName = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected String getCompletionPrefix() {
|
protected String getCompletionPrefix() {
|
||||||
return ( finalToken == null ? "" : finalToken.getImage() ); //$NON-NLS-1$
|
return ( finalToken == null ? EMPTY_STRING : finalToken.getImage() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,9 +106,16 @@ public class ContextualParser extends CompleteParser {
|
||||||
this.keywordSet = keywordSet;
|
this.keywordSet = keywordSet;
|
||||||
setCompletionKind(kind);
|
setCompletionKind(kind);
|
||||||
setCompletionContext(null);
|
setCompletionContext(null);
|
||||||
|
setCompletionFunctionName( );
|
||||||
setCompletionToken( new Token( IToken.tIDENTIFIER, prefix ) );
|
setCompletionToken( new Token( IToken.tIDENTIFIER, prefix ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
protected void setCompletionFunctionName() {
|
||||||
|
functionOrConstructorName = currentFunctionName;
|
||||||
|
}
|
||||||
|
|
||||||
protected void setCompletionKeywords(KeywordSets.Key key) {
|
protected void setCompletionKeywords(KeywordSets.Key key) {
|
||||||
this.keywordSet = KeywordSets.getKeywords( key, language );
|
this.keywordSet = KeywordSets.getKeywords( key, language );
|
||||||
}
|
}
|
||||||
|
@ -139,6 +147,7 @@ public class ContextualParser extends CompleteParser {
|
||||||
setCompletionKeywords(key);
|
setCompletionKeywords(key);
|
||||||
setCompletionKind(kind);
|
setCompletionKind(kind);
|
||||||
setCompletionContext(node);
|
setCompletionContext(node);
|
||||||
|
setCompletionFunctionName( );
|
||||||
checkEndOfFile();
|
checkEndOfFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,9 +162,12 @@ public class ContextualParser extends CompleteParser {
|
||||||
setCompletionContext( astFactory.lookupSymbolInContext( scope, duple ) );
|
setCompletionContext( astFactory.lookupSymbolInContext( scope, duple ) );
|
||||||
} catch (ASTNotImplementedException e) {
|
} catch (ASTNotImplementedException e) {
|
||||||
}
|
}
|
||||||
|
setCompletionFunctionName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String currentFunctionName = EMPTY_STRING;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void setCompletionValues(IASTScope scope, CompletionKind kind, Key key, IASTExpression firstExpression, boolean isTemplate) throws EndOfFileException {
|
protected void setCompletionValues(IASTScope scope, CompletionKind kind, Key key, IASTExpression firstExpression, boolean isTemplate) throws EndOfFileException {
|
||||||
setCompletionValues(scope,kind,key, getCompletionContextForExpression(firstExpression,isTemplate) );
|
setCompletionValues(scope,kind,key, getCompletionContextForExpression(firstExpression,isTemplate) );
|
||||||
|
@ -171,6 +183,7 @@ public class ContextualParser extends CompleteParser {
|
||||||
protected void setCompletionValues(IASTScope scope, CompletionKind kind) throws EndOfFileException {
|
protected void setCompletionValues(IASTScope scope, CompletionKind kind) throws EndOfFileException {
|
||||||
setCompletionScope(scope);
|
setCompletionScope(scope);
|
||||||
setCompletionKind(kind);
|
setCompletionKind(kind);
|
||||||
|
setCompletionFunctionName( );
|
||||||
checkEndOfFile();
|
checkEndOfFile();
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -181,5 +194,21 @@ public class ContextualParser extends CompleteParser {
|
||||||
setCompletionScope(scope);
|
setCompletionScope(scope);
|
||||||
setCompletionKind(kind);
|
setCompletionKind(kind);
|
||||||
setCompletionContext(context);
|
setCompletionContext(context);
|
||||||
|
setCompletionFunctionName( );
|
||||||
checkEndOfFile(); }
|
checkEndOfFile(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected String getCompletionFunctionName() {
|
||||||
|
return functionOrConstructorName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.ExpressionParser#setCurrentFunctionName(java.lang.String)
|
||||||
|
*/
|
||||||
|
protected void setCurrentFunctionName(String functionName) {
|
||||||
|
currentFunctionName = functionName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ import org.eclipse.cdt.internal.core.parser.util.TraceUtil;
|
||||||
*/
|
*/
|
||||||
public class ExpressionParser implements IExpressionParser {
|
public class ExpressionParser implements IExpressionParser {
|
||||||
|
|
||||||
|
protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||||
protected final IParserLogService log;
|
protected final IParserLogService log;
|
||||||
private static int FIRST_ERROR_OFFSET_UNSET = -1;
|
private static int FIRST_ERROR_OFFSET_UNSET = -1;
|
||||||
protected int firstErrorOffset = FIRST_ERROR_OFFSET_UNSET;
|
protected int firstErrorOffset = FIRST_ERROR_OFFSET_UNSET;
|
||||||
|
@ -59,6 +60,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
|
|
||||||
private Stack templateIdScopes = null;
|
private Stack templateIdScopes = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param scanner2
|
* @param scanner2
|
||||||
* @param callback
|
* @param callback
|
||||||
|
@ -177,7 +179,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
IASTTypeId typeId = typeId( scope, false, CompletionKind.TYPE_REFERENCE );
|
IASTTypeId typeId = typeId( scope, false, CompletionKind.TYPE_REFERENCE );
|
||||||
|
|
||||||
expression = astFactory.createExpression( scope, IASTExpression.Kind.POSTFIX_TYPEID_TYPEID,
|
expression = astFactory.createExpression( scope, IASTExpression.Kind.POSTFIX_TYPEID_TYPEID,
|
||||||
null, null, null, typeId, null, "", null); //$NON-NLS-1$
|
null, null, null, typeId, null, EMPTY_STRING, null);
|
||||||
list.add( expression );
|
list.add( expression );
|
||||||
completedArg = true;
|
completedArg = true;
|
||||||
} catch( BacktrackException e ){
|
} catch( BacktrackException e ){
|
||||||
|
@ -202,7 +204,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
try{
|
try{
|
||||||
ITokenDuple nameDuple = name( scope, null );
|
ITokenDuple nameDuple = name( scope, null );
|
||||||
expression = astFactory.createExpression( scope, IASTExpression.Kind.ID_EXPRESSION,
|
expression = astFactory.createExpression( scope, IASTExpression.Kind.ID_EXPRESSION,
|
||||||
null, null, null, null, nameDuple, "", null); //$NON-NLS-1$
|
null, null, null, null, nameDuple, EMPTY_STRING, null);
|
||||||
list.add( expression );
|
list.add( expression );
|
||||||
continue;
|
continue;
|
||||||
} catch( ASTSemanticException e ){
|
} catch( ASTSemanticException e ){
|
||||||
|
@ -265,7 +267,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
*
|
*
|
||||||
* @throws BacktrackException request a backtrack
|
* @throws BacktrackException request a backtrack
|
||||||
*/
|
*/
|
||||||
protected ITokenDuple name(IASTScope scope, IASTCompletionNode.CompletionKind kind) throws BacktrackException, EndOfFileException {
|
protected ITokenDuple name(IASTScope scope, IASTCompletionNode.CompletionKind kind ) throws BacktrackException, EndOfFileException {
|
||||||
|
|
||||||
IToken first = LA(1);
|
IToken first = LA(1);
|
||||||
IToken last = null;
|
IToken last = null;
|
||||||
|
@ -325,7 +327,9 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
backup(mark);
|
backup(mark);
|
||||||
throw backtrack;
|
throw backtrack;
|
||||||
case IToken.tIDENTIFIER :
|
case IToken.tIDENTIFIER :
|
||||||
|
prev = last;
|
||||||
last = consume();
|
last = consume();
|
||||||
|
setCompletionValues( scope, kind, first, prev );
|
||||||
last = consumeTemplateArguments(scope, last, argumentList);
|
last = consumeTemplateArguments(scope, last, argumentList);
|
||||||
if( last.getType() == IToken.tGT )
|
if( last.getType() == IToken.tGT )
|
||||||
hasTemplateId = true;
|
hasTemplateId = true;
|
||||||
|
@ -540,7 +544,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
nameDuple = name(d.getScope(), CompletionKind.NO_SUCH_KIND );
|
nameDuple = name(d.getScope(), CompletionKind.USER_SPECIFIED_NAME );
|
||||||
}
|
}
|
||||||
catch( BacktrackException bt )
|
catch( BacktrackException bt )
|
||||||
{
|
{
|
||||||
|
@ -550,7 +554,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
}
|
}
|
||||||
if ( LT(1) == IToken.tSTAR)
|
if ( LT(1) == IToken.tSTAR)
|
||||||
{
|
{
|
||||||
result = consume(IToken.tSTAR); // tokenType = "*"
|
result = consume(IToken.tSTAR);
|
||||||
|
|
||||||
d.setPointerOperatorName(nameDuple);
|
d.setPointerOperatorName(nameDuple);
|
||||||
|
|
||||||
|
@ -598,7 +602,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -616,6 +620,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
* @throws BacktrackException
|
* @throws BacktrackException
|
||||||
*/
|
*/
|
||||||
protected IASTExpression assignmentExpression(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException {
|
protected IASTExpression assignmentExpression(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException {
|
||||||
|
setCompletionValues(scope, kind, Key.EXPRESSION );
|
||||||
if (LT(1) == IToken.t_throw) {
|
if (LT(1) == IToken.t_throw) {
|
||||||
return throwExpression(scope);
|
return throwExpression(scope);
|
||||||
}
|
}
|
||||||
|
@ -691,6 +696,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
*/
|
*/
|
||||||
protected IASTExpression throwExpression(IASTScope scope) throws EndOfFileException, BacktrackException {
|
protected IASTExpression throwExpression(IASTScope scope) throws EndOfFileException, BacktrackException {
|
||||||
consume(IToken.t_throw);
|
consume(IToken.t_throw);
|
||||||
|
setCompletionValues( scope, CompletionKind.SINGLE_NAME_REFERENCE, Key.EXPRESSION );
|
||||||
IASTExpression throwExpression = null;
|
IASTExpression throwExpression = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -708,7 +714,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -741,7 +747,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
secondExpression,
|
secondExpression,
|
||||||
thirdExpression,
|
thirdExpression,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -776,7 +782,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -809,7 +815,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -843,7 +849,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -878,7 +884,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -912,7 +918,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -953,7 +959,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -1033,7 +1039,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -1077,7 +1083,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -1120,7 +1126,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -1174,7 +1180,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -1217,7 +1223,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -1263,7 +1269,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
typeId,
|
typeId,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -1289,6 +1295,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
*/
|
*/
|
||||||
protected IASTTypeId typeId(IASTScope scope, boolean skipArrayModifiers, CompletionKind completionKind) throws EndOfFileException, BacktrackException {
|
protected IASTTypeId typeId(IASTScope scope, boolean skipArrayModifiers, CompletionKind completionKind) throws EndOfFileException, BacktrackException {
|
||||||
IToken mark = mark();
|
IToken mark = mark();
|
||||||
|
IToken start = mark;
|
||||||
ITokenDuple name = null;
|
ITokenDuple name = null;
|
||||||
boolean isConst = false, isVolatile = false;
|
boolean isConst = false, isVolatile = false;
|
||||||
boolean isSigned = false, isUnsigned = false;
|
boolean isSigned = false, isUnsigned = false;
|
||||||
|
@ -1464,7 +1471,10 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return astFactory.createTypeId( scope, kind, isConst, isVolatile, isShort, isLong, isSigned, isUnsigned, isTypename, name, id.getPointerOperators(), id.getArrayModifiers());
|
String signature = "";
|
||||||
|
if( start != null && lastToken != null )
|
||||||
|
signature = new TokenDuple( start, lastToken ).toString();
|
||||||
|
return astFactory.createTypeId( scope, kind, isConst, isVolatile, isShort, isLong, isSigned, isUnsigned, isTypename, name, id.getPointerOperators(), id.getArrayModifiers(), signature);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -1481,12 +1491,14 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
* @throws BacktrackException
|
* @throws BacktrackException
|
||||||
*/
|
*/
|
||||||
protected IASTExpression deleteExpression(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException {
|
protected IASTExpression deleteExpression(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException {
|
||||||
if (LT(1) == IToken.tCOLONCOLON)
|
if (LT(1) == IToken.tCOLONCOLON)
|
||||||
{
|
{
|
||||||
// global scope
|
// global scope
|
||||||
consume();
|
consume(IToken.tCOLONCOLON);
|
||||||
}
|
}
|
||||||
|
|
||||||
consume(IToken.t_delete);
|
consume(IToken.t_delete);
|
||||||
|
|
||||||
boolean vectored = false;
|
boolean vectored = false;
|
||||||
if (LT(1) == IToken.tLBRACKET)
|
if (LT(1) == IToken.tLBRACKET)
|
||||||
{
|
{
|
||||||
|
@ -1507,7 +1519,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -1539,7 +1551,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
if (LT(1) == IToken.tCOLONCOLON)
|
if (LT(1) == IToken.tCOLONCOLON)
|
||||||
{
|
{
|
||||||
// global scope
|
// global scope
|
||||||
consume();
|
consume(IToken.tCOLONCOLON);
|
||||||
}
|
}
|
||||||
consume(IToken.t_new);
|
consume(IToken.t_new);
|
||||||
boolean typeIdInParen = false;
|
boolean typeIdInParen = false;
|
||||||
|
@ -1650,7 +1662,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
return astFactory.createExpression(
|
return astFactory.createExpression(
|
||||||
scope, IASTExpression.Kind.NEW_TYPEID,
|
scope, IASTExpression.Kind.NEW_TYPEID,
|
||||||
null, null, null, typeId, null,
|
null, null, null, typeId, null,
|
||||||
"", astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions)); //$NON-NLS-1$
|
EMPTY_STRING, astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions));
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -1694,11 +1706,14 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
if (LT(1) == IToken.tLPAREN)
|
if (LT(1) == IToken.tLPAREN)
|
||||||
{
|
{
|
||||||
consume(IToken.tLPAREN);
|
consume(IToken.tLPAREN);
|
||||||
|
setCurrentFunctionName( (( typeId != null ) ? typeId.getFullSignature() : EMPTY_STRING));
|
||||||
|
setCompletionValues( scope, CompletionKind.CONSTRUCTOR_REFERENCE );
|
||||||
if( templateIdScopes != null ){ templateIdScopes.push( new Integer( IToken.tLPAREN ) ); }
|
if( templateIdScopes != null ){ templateIdScopes.push( new Integer( IToken.tLPAREN ) ); }
|
||||||
|
|
||||||
if (LT(1) != IToken.tRPAREN)
|
if ( queryLookaheadCapability() && (LT(1) != IToken.tRPAREN))
|
||||||
newInitializerExpressions.add(expression(scope, CompletionKind.SINGLE_NAME_REFERENCE));
|
newInitializerExpressions.add(expression(scope, CompletionKind.CONSTRUCTOR_REFERENCE));
|
||||||
|
|
||||||
|
setCurrentFunctionName( EMPTY_STRING );
|
||||||
consume(IToken.tRPAREN);
|
consume(IToken.tRPAREN);
|
||||||
if( templateIdScopes != null ){ templateIdScopes.pop(); }
|
if( templateIdScopes != null ){ templateIdScopes.pop(); }
|
||||||
}
|
}
|
||||||
|
@ -1708,7 +1723,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
return astFactory.createExpression(
|
return astFactory.createExpression(
|
||||||
scope, IASTExpression.Kind.NEW_TYPEID,
|
scope, IASTExpression.Kind.NEW_TYPEID,
|
||||||
null, null, null, typeId, null,
|
null, null, null, typeId, null,
|
||||||
"", astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions)); //$NON-NLS-1$
|
EMPTY_STRING, astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions));
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -1720,6 +1735,12 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param functionName
|
||||||
|
*/
|
||||||
|
protected void setCurrentFunctionName(String functionName ) {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param expression
|
* @param expression
|
||||||
* @throws BacktrackException
|
* @throws BacktrackException
|
||||||
|
@ -1792,7 +1813,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
d,
|
d,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -1811,7 +1832,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e1)
|
catch (ASTSemanticException e1)
|
||||||
{
|
{
|
||||||
|
@ -1851,7 +1872,8 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
protected IASTExpression postfixExpression(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException {
|
protected IASTExpression postfixExpression(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException {
|
||||||
IASTExpression firstExpression = null;
|
IASTExpression firstExpression = null;
|
||||||
boolean isTemplate = false;
|
boolean isTemplate = false;
|
||||||
checkEndOfFile();
|
|
||||||
|
setCompletionValues( scope, kind, Key.EXPRESSION );
|
||||||
switch (LT(1))
|
switch (LT(1))
|
||||||
{
|
{
|
||||||
case IToken.t_typename :
|
case IToken.t_typename :
|
||||||
|
@ -1889,7 +1911,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
nestedName,
|
nestedName,
|
||||||
"", //$NON-NLS-1$
|
EMPTY_STRING,
|
||||||
null );
|
null );
|
||||||
} catch (ASTSemanticException ase ) {
|
} catch (ASTSemanticException ase ) {
|
||||||
throw backtrack;
|
throw backtrack;
|
||||||
|
@ -1999,7 +2021,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
typeId,
|
typeId,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e6)
|
catch (ASTSemanticException e6)
|
||||||
{
|
{
|
||||||
|
@ -2020,7 +2042,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
{
|
{
|
||||||
case IToken.tLBRACKET :
|
case IToken.tLBRACKET :
|
||||||
// array access
|
// array access
|
||||||
consume();
|
consume(IToken.tLBRACKET);
|
||||||
if( templateIdScopes != null ){ templateIdScopes.push( new Integer( IToken.tLBRACKET ) ); }
|
if( templateIdScopes != null ){ templateIdScopes.push( new Integer( IToken.tLBRACKET ) ); }
|
||||||
secondExpression = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE);
|
secondExpression = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE);
|
||||||
consume(IToken.tRBRACKET);
|
consume(IToken.tRBRACKET);
|
||||||
|
@ -2035,7 +2057,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e2)
|
catch (ASTSemanticException e2)
|
||||||
{
|
{
|
||||||
|
@ -2049,8 +2071,23 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
case IToken.tLPAREN :
|
case IToken.tLPAREN :
|
||||||
// function call
|
// function call
|
||||||
consume(IToken.tLPAREN);
|
consume(IToken.tLPAREN);
|
||||||
|
IASTNode context = null;
|
||||||
|
if( firstExpression != null )
|
||||||
|
{
|
||||||
|
if( firstExpression.getExpressionKind() == IASTExpression.Kind.ID_EXPRESSION )
|
||||||
|
setCurrentFunctionName( firstExpression.getIdExpression() );
|
||||||
|
else if( firstExpression.getRHSExpression() != null &&
|
||||||
|
firstExpression.getRHSExpression().getIdExpression() != null )
|
||||||
|
{
|
||||||
|
setCurrentFunctionName( firstExpression.getRHSExpression().getIdExpression() );
|
||||||
|
context = astFactory.expressionToASTNode( scope, firstExpression.getLHSExpression() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( templateIdScopes != null ){ templateIdScopes.push( new Integer( IToken.tLPAREN ) ); }
|
if( templateIdScopes != null ){ templateIdScopes.push( new Integer( IToken.tLPAREN ) ); }
|
||||||
secondExpression = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE);
|
setCompletionValues(scope, CompletionKind.FUNCTION_REFERENCE, context );
|
||||||
|
secondExpression = expression(scope, CompletionKind.FUNCTION_REFERENCE);
|
||||||
|
setCurrentFunctionName( EMPTY_STRING );
|
||||||
consume(IToken.tRPAREN);
|
consume(IToken.tRPAREN);
|
||||||
if( templateIdScopes != null ){ templateIdScopes.pop(); }
|
if( templateIdScopes != null ){ templateIdScopes.pop(); }
|
||||||
try
|
try
|
||||||
|
@ -2063,7 +2100,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e3)
|
catch (ASTSemanticException e3)
|
||||||
{
|
{
|
||||||
|
@ -2075,7 +2112,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IToken.tINCR :
|
case IToken.tINCR :
|
||||||
consume();
|
consume(IToken.tINCR);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
firstExpression =
|
firstExpression =
|
||||||
|
@ -2086,7 +2123,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e1)
|
catch (ASTSemanticException e1)
|
||||||
{
|
{
|
||||||
|
@ -2109,7 +2146,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e4)
|
catch (ASTSemanticException e4)
|
||||||
{
|
{
|
||||||
|
@ -2150,7 +2187,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e5)
|
catch (ASTSemanticException e5)
|
||||||
{
|
{
|
||||||
|
@ -2190,7 +2227,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -2234,9 +2271,11 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IASTExpression simpleTypeConstructorExpression(IASTScope scope, Kind type ) throws EndOfFileException, BacktrackException {
|
protected IASTExpression simpleTypeConstructorExpression(IASTScope scope, Kind type ) throws EndOfFileException, BacktrackException {
|
||||||
consume();
|
String typeName = consume().getImage();
|
||||||
consume(IToken.tLPAREN);
|
consume(IToken.tLPAREN);
|
||||||
IASTExpression inside = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE);
|
setCurrentFunctionName( typeName );
|
||||||
|
IASTExpression inside = expression(scope, CompletionKind.CONSTRUCTOR_REFERENCE);
|
||||||
|
setCurrentFunctionName( EMPTY_STRING );
|
||||||
consume(IToken.tRPAREN);
|
consume(IToken.tRPAREN);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -2247,7 +2286,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -2379,7 +2418,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e7)
|
catch (ASTSemanticException e7)
|
||||||
{
|
{
|
||||||
|
@ -2403,7 +2442,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e6)
|
catch (ASTSemanticException e6)
|
||||||
{
|
{
|
||||||
|
@ -2462,7 +2501,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
duple, "", null); //$NON-NLS-1$
|
duple, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e8)
|
catch (ASTSemanticException e8)
|
||||||
{
|
{
|
||||||
|
@ -2481,7 +2520,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
} catch (ASTSemanticException e9) {
|
} catch (ASTSemanticException e9) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e9.printStackTrace();
|
e9.printStackTrace();
|
||||||
|
@ -2522,7 +2561,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
catch (ScannerException e)
|
catch (ScannerException e)
|
||||||
{
|
{
|
||||||
TraceUtil.outputTrace(log, "ScannerException thrown : ", e.getProblem(), null, null, null); //$NON-NLS-1$
|
TraceUtil.outputTrace(log, "ScannerException thrown : ", e.getProblem(), null, null, null); //$NON-NLS-1$
|
||||||
log.errorLog( "Scanner Exception: " + e.getProblem().getMessage()); //$NON-NLS-1$h
|
log.errorLog( "Scanner Exception: " + e.getProblem().getMessage()); //$NON-NLS-1$
|
||||||
failParse();
|
failParse();
|
||||||
return fetchToken();
|
return fetchToken();
|
||||||
}
|
}
|
||||||
|
@ -2643,7 +2682,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
assignmentExpression,
|
assignmentExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -2678,7 +2717,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -2706,7 +2745,7 @@ public class ExpressionParser implements IExpressionParser {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
duple,
|
duple,
|
||||||
null, "", null); //$NON-NLS-1$
|
null, EMPTY_STRING, null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3046,7 +3046,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.ExpressionParser#parserTimeout()
|
* @see org.eclipse.cdt.internal.core.parser.ExpressionParser#parserTimeout()
|
||||||
*/
|
*/
|
||||||
protected boolean parserTimeout() {
|
protected final boolean parserTimeout() {
|
||||||
return requestor.parserTimeout();
|
return requestor.parserTimeout();
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -27,14 +27,16 @@ public class ASTCompletionNode implements IASTCompletionNode {
|
||||||
private final IASTScope scope;
|
private final IASTScope scope;
|
||||||
private final CompletionKind kind;
|
private final CompletionKind kind;
|
||||||
private final Set keywordSet;
|
private final Set keywordSet;
|
||||||
|
private final String functionName;
|
||||||
|
|
||||||
public ASTCompletionNode( CompletionKind kind, IASTScope scope, IASTNode context, String prefix, Set keywords )
|
public ASTCompletionNode( CompletionKind kind, IASTScope scope, IASTNode context, String prefix, Set keywords, String functionName )
|
||||||
{
|
{
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
this.prefix = prefix;
|
this.prefix = prefix;
|
||||||
this.keywordSet = keywords;
|
this.keywordSet = keywords;
|
||||||
|
this.functionName = functionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -80,4 +82,11 @@ public class ASTCompletionNode implements IASTCompletionNode {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTCompletionNode#getFunctionName()
|
||||||
|
*/
|
||||||
|
public String getFunctionName() {
|
||||||
|
return functionName;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,8 @@ import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||||
import org.eclipse.cdt.core.parser.ITokenDuple;
|
import org.eclipse.cdt.core.parser.ITokenDuple;
|
||||||
import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
|
|
||||||
import org.eclipse.cdt.core.parser.ast.ASTExpressionEvaluationException;
|
import org.eclipse.cdt.core.parser.ast.ASTExpressionEvaluationException;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTExpression;
|
import org.eclipse.cdt.core.parser.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTReference;
|
import org.eclipse.cdt.core.parser.ast.IASTReference;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTTypeId;
|
import org.eclipse.cdt.core.parser.ast.IASTTypeId;
|
||||||
|
@ -37,6 +37,7 @@ public class ASTExpression implements IASTExpression
|
||||||
private final IASTNewExpressionDescriptor newDescriptor;
|
private final IASTNewExpressionDescriptor newDescriptor;
|
||||||
private final List references;
|
private final List references;
|
||||||
private ExpressionResult resultType;
|
private ExpressionResult resultType;
|
||||||
|
private String stringRepresentation;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -257,4 +258,54 @@ public class ASTExpression implements IASTExpression
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.lang.Object#toString()
|
||||||
|
*/
|
||||||
|
public String toString() {
|
||||||
|
if( stringRepresentation == null )
|
||||||
|
{
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
buffer.append( "ASTExpression w/Kind=" ); //$NON-NLS-1$
|
||||||
|
buffer.append( kind.getKindName() );
|
||||||
|
|
||||||
|
if( !literal.equals( "" )) //$NON-NLS-1$
|
||||||
|
{
|
||||||
|
buffer.append( " LITERAL="); //$NON-NLS-1$
|
||||||
|
buffer.append( literal );
|
||||||
|
}
|
||||||
|
if( idExpressionDuple != null )
|
||||||
|
{
|
||||||
|
buffer.append( " IDEXPRESSION="); //$NON-NLS-1$
|
||||||
|
buffer.append( idExpressionDuple.toString() );
|
||||||
|
}
|
||||||
|
if( typeId != null )
|
||||||
|
{
|
||||||
|
buffer.append( " TYPEID="); //$NON-NLS-1$
|
||||||
|
buffer.append( typeId.getFullSignature() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( lhs != null )
|
||||||
|
{
|
||||||
|
buffer.append( "\n\tLHS=**"); //$NON-NLS-1$
|
||||||
|
buffer.append( lhs.toString() );
|
||||||
|
buffer.append( "**");//$NON-NLS-1$
|
||||||
|
}
|
||||||
|
if( rhs != null )
|
||||||
|
{
|
||||||
|
buffer.append( "\n\tRHS=="); //$NON-NLS-1$
|
||||||
|
buffer.append( rhs.toString() );
|
||||||
|
buffer.append( "==");//$NON-NLS-1$
|
||||||
|
}
|
||||||
|
if( thirdExpression != null )
|
||||||
|
{
|
||||||
|
buffer.append( "\n\t3rd Expression =::"); //$NON-NLS-1$
|
||||||
|
buffer.append( thirdExpression.toString() );
|
||||||
|
buffer.append( "::");//$NON-NLS-1$
|
||||||
|
}
|
||||||
|
stringRepresentation = buffer.toString();
|
||||||
|
}
|
||||||
|
return stringRepresentation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.core.parser.ParserMode;
|
||||||
import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
|
import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTNode;
|
import org.eclipse.cdt.core.parser.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
|
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTVariable;
|
||||||
import org.eclipse.cdt.internal.core.parser.ast.SymbolIterator;
|
import org.eclipse.cdt.internal.core.parser.ast.SymbolIterator;
|
||||||
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
|
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
|
||||||
import org.eclipse.cdt.internal.core.parser.pst.IExtensibleSymbol;
|
import org.eclipse.cdt.internal.core.parser.pst.IExtensibleSymbol;
|
||||||
|
@ -55,7 +56,11 @@ public class ASTNode implements IASTNode {
|
||||||
ISymbol typedef = ((ISymbolOwner)context).getSymbol();
|
ISymbol typedef = ((ISymbolOwner)context).getSymbol();
|
||||||
TypeInfo info = typedef.getTypeInfo().getFinalType();
|
TypeInfo info = typedef.getTypeInfo().getFinalType();
|
||||||
sym = info.getTypeSymbol();
|
sym = info.getTypeSymbol();
|
||||||
} else {
|
} else if ( context instanceof IASTVariable ){
|
||||||
|
sym = ((ISymbolOwner)context).getSymbol().getTypeSymbol(); // good enough for now
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
sym = (IContainerSymbol) ((ISymbolOwner)context).getSymbol();
|
sym = (IContainerSymbol) ((ISymbolOwner)context).getSymbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,8 +105,8 @@ import org.eclipse.cdt.internal.core.parser.util.TraceUtil;
|
||||||
*/
|
*/
|
||||||
public class CompleteParseASTFactory extends BaseASTFactory implements IASTFactory
|
public class CompleteParseASTFactory extends BaseASTFactory implements IASTFactory
|
||||||
{
|
{
|
||||||
|
protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||||
private final static List SUBSCRIPT;
|
private final static List SUBSCRIPT;
|
||||||
private final static IProblemFactory problemFactory = new ASTProblemFactory();
|
private final static IProblemFactory problemFactory = new ASTProblemFactory();
|
||||||
//private final IASTExtensionFactory extensionFactory;
|
//private final IASTExtensionFactory extensionFactory;
|
||||||
private final IFilenameProvider fileProvider;
|
private final IFilenameProvider fileProvider;
|
||||||
|
@ -558,7 +558,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
IContainerSymbol pstScope = scopeToSymbol(scope);
|
IContainerSymbol pstScope = scopeToSymbol(scope);
|
||||||
ISymbol namespaceSymbol = null;
|
ISymbol namespaceSymbol = null;
|
||||||
|
|
||||||
if( ! identifier.equals( "" ) ) //$NON-NLS-1$
|
if( ! identifier.equals( EMPTY_STRING ) )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -578,7 +578,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
namespaceSymbol = pst.newContainerSymbol( identifier, TypeInfo.t_namespace );
|
namespaceSymbol = pst.newContainerSymbol( identifier, TypeInfo.t_namespace );
|
||||||
if( identifier.equals( "" ) ) //$NON-NLS-1$
|
if( identifier.equals( EMPTY_STRING ) )
|
||||||
namespaceSymbol.setContainingSymbol( pstScope );
|
namespaceSymbol.setContainingSymbol( pstScope );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -672,7 +672,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
TypeInfo.eType pstType = classKindToTypeInfo(kind);
|
TypeInfo.eType pstType = classKindToTypeInfo(kind);
|
||||||
List references = new ArrayList();
|
List references = new ArrayList();
|
||||||
|
|
||||||
String newSymbolName = ""; //$NON-NLS-1$
|
String newSymbolName = EMPTY_STRING;
|
||||||
List templateIdArgList = null;
|
List templateIdArgList = null;
|
||||||
boolean isTemplateId = false;
|
boolean isTemplateId = false;
|
||||||
|
|
||||||
|
@ -702,9 +702,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
|
|
||||||
newSymbolName = nameToken.getImage();
|
newSymbolName = nameToken.getImage();
|
||||||
}
|
}
|
||||||
int i = 0;
|
|
||||||
ISymbol classSymbol = null;
|
ISymbol classSymbol = null;
|
||||||
if( !newSymbolName.equals("") && !isTemplateId ){ //$NON-NLS-1$
|
if( !newSymbolName.equals(EMPTY_STRING) && !isTemplateId ){
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
classSymbol = currentScopeSymbol.lookupMemberForDefinition(newSymbolName);
|
classSymbol = currentScopeSymbol.lookupMemberForDefinition(newSymbolName);
|
||||||
|
@ -1011,7 +1010,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
idExpression.toString()
|
idExpression.toString()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if( literal != null && !literal.equals( "" )) //$NON-NLS-1$
|
else if( literal != null && !literal.equals( EMPTY_STRING ))
|
||||||
{
|
{
|
||||||
TraceUtil.outputTrace(
|
TraceUtil.outputTrace(
|
||||||
logService,
|
logService,
|
||||||
|
@ -1264,7 +1263,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
|
|
||||||
ExpressionResult result = null;
|
ExpressionResult result = null;
|
||||||
TypeInfo info = new TypeInfo();
|
TypeInfo info = new TypeInfo();
|
||||||
if( literal != null && !literal.equals("") ){ //$NON-NLS-1$
|
if( literal != null && !literal.equals(EMPTY_STRING) ){
|
||||||
info.setDefault( literal );
|
info.setDefault( literal );
|
||||||
}
|
}
|
||||||
// types that resolve to void
|
// types that resolve to void
|
||||||
|
@ -1704,7 +1703,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
getExpressionReferences( expressionList, references );
|
getExpressionReferences( expressionList, references );
|
||||||
return new ASTConstructorMemberInitializer(
|
return new ASTConstructorMemberInitializer(
|
||||||
expressionList,
|
expressionList,
|
||||||
duple == null ? "" : duple.toString(), //$NON-NLS-1$
|
duple == null ? EMPTY_STRING : duple.toString(),
|
||||||
duple == null ? 0 : duple.getFirstToken().getOffset(),
|
duple == null ? 0 : duple.getFirstToken().getOffset(),
|
||||||
references, requireReferenceResolution );
|
references, requireReferenceResolution );
|
||||||
}
|
}
|
||||||
|
@ -1744,7 +1743,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
type = TypeInfo.t__Bool;
|
type = TypeInfo.t__Bool;
|
||||||
|
|
||||||
List references = new ArrayList();
|
List references = new ArrayList();
|
||||||
ISymbol s = pst.newSymbol( "", type ); //$NON-NLS-1$
|
ISymbol s = pst.newSymbol( EMPTY_STRING, type );
|
||||||
if( kind == IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME )
|
if( kind == IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME )
|
||||||
{
|
{
|
||||||
// lookup the duple
|
// lookup the duple
|
||||||
|
@ -2078,7 +2077,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
newReferences.add( createReference( xrefSymbol, elab.getName(), elab.getNameOffset()) );
|
newReferences.add( createReference( xrefSymbol, elab.getName(), elab.getNameOffset()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
String paramName = ""; //$NON-NLS-1$
|
String paramName = EMPTY_STRING;
|
||||||
if(absDecl instanceof IASTParameterDeclaration){
|
if(absDecl instanceof IASTParameterDeclaration){
|
||||||
paramName = ((IASTParameterDeclaration)absDecl).getName();
|
paramName = ((IASTParameterDeclaration)absDecl).getName();
|
||||||
}
|
}
|
||||||
|
@ -2313,7 +2312,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
while( initializers.hasNext())
|
while( initializers.hasNext())
|
||||||
{
|
{
|
||||||
IASTConstructorMemberInitializer initializer = (IASTConstructorMemberInitializer)initializers.next();
|
IASTConstructorMemberInitializer initializer = (IASTConstructorMemberInitializer)initializers.next();
|
||||||
if( !initializer.getName().equals( "") && //$NON-NLS-1$
|
if( !initializer.getName().equals( EMPTY_STRING) &&
|
||||||
initializer instanceof ASTConstructorMemberInitializer &&
|
initializer instanceof ASTConstructorMemberInitializer &&
|
||||||
((ASTConstructorMemberInitializer)initializer).requiresNameResolution() )
|
((ASTConstructorMemberInitializer)initializer).requiresNameResolution() )
|
||||||
{
|
{
|
||||||
|
@ -2778,7 +2777,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
ISymbol newSymbol = pst.newSymbol( name, TypeInfo.t_type);
|
ISymbol newSymbol = pst.newSymbol( name, TypeInfo.t_type);
|
||||||
newSymbol.getTypeInfo().setBit( true,TypeInfo.isTypedef );
|
newSymbol.getTypeInfo().setBit( true,TypeInfo.isTypedef );
|
||||||
|
|
||||||
ISymbol typeSymbol = cloneSimpleTypeSymbol( "", mapping, new ArrayList() ); //$NON-NLS-1$
|
ISymbol typeSymbol = cloneSimpleTypeSymbol( EMPTY_STRING, mapping, new ArrayList() );
|
||||||
setPointerOperators( typeSymbol, mapping.getPointerOperators(), mapping.getArrayModifiers() );
|
setPointerOperators( typeSymbol, mapping.getPointerOperators(), mapping.getArrayModifiers() );
|
||||||
|
|
||||||
newSymbol.setTypeSymbol( typeSymbol );
|
newSymbol.setTypeSymbol( typeSymbol );
|
||||||
|
@ -2821,7 +2820,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
TypeInfo.eType pstType = classKindToTypeInfo(kind);
|
TypeInfo.eType pstType = classKindToTypeInfo(kind);
|
||||||
List references = new ArrayList();
|
List references = new ArrayList();
|
||||||
IToken nameToken = name.getFirstToken();
|
IToken nameToken = name.getFirstToken();
|
||||||
String newSymbolName = ""; //$NON-NLS-1$
|
String newSymbolName = EMPTY_STRING;
|
||||||
List templateIdArgList = null;
|
List templateIdArgList = null;
|
||||||
boolean isTemplateId = false;
|
boolean isTemplateId = false;
|
||||||
if (name.getSegmentCount() != 1) // qualified name
|
if (name.getSegmentCount() != 1) // qualified name
|
||||||
|
@ -2986,7 +2985,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
public IASTCodeScope createNewCodeBlock(IASTScope scope) {
|
public IASTCodeScope createNewCodeBlock(IASTScope scope) {
|
||||||
IContainerSymbol symbol = scopeToSymbol( scope );
|
IContainerSymbol symbol = scopeToSymbol( scope );
|
||||||
|
|
||||||
IContainerSymbol newScope = pst.newContainerSymbol("", TypeInfo.t_block); //$NON-NLS-1$
|
IContainerSymbol newScope = pst.newContainerSymbol(EMPTY_STRING, TypeInfo.t_block);
|
||||||
newScope.setContainingSymbol(symbol);
|
newScope.setContainingSymbol(symbol);
|
||||||
|
|
||||||
ASTCodeScope codeScope = new ASTCodeScope( newScope );
|
ASTCodeScope codeScope = new ASTCodeScope( newScope );
|
||||||
|
@ -3028,10 +3027,10 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypeId(org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type, org.eclipse.cdt.core.parser.ITokenDuple, java.util.List, java.util.List)
|
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypeId(org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type, org.eclipse.cdt.core.parser.ITokenDuple, java.util.List, java.util.List)
|
||||||
*/
|
*/
|
||||||
public IASTTypeId createTypeId(IASTScope scope, Type kind, boolean isConst, boolean isVolatile, boolean isShort,
|
public IASTTypeId createTypeId(IASTScope scope, 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, String completeSignature) throws ASTSemanticException
|
||||||
{
|
{
|
||||||
ASTTypeId result =
|
ASTTypeId result =
|
||||||
new ASTTypeId( kind, name, pointerOps, arrayMods, "", //TODO //$NON-NLS-1$
|
new ASTTypeId( kind, name, pointerOps, arrayMods, completeSignature,
|
||||||
isConst, isVolatile, isUnsigned, isSigned, isShort, isLong, isTypename );
|
isConst, isVolatile, isUnsigned, isSigned, isShort, isLong, isTypename );
|
||||||
result.setTypeSymbol( createSymbolForTypeId( scope, result ) );
|
result.setTypeSymbol( createSymbolForTypeId( scope, result ) );
|
||||||
return result;
|
return result;
|
||||||
|
@ -3071,7 +3070,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
if( id == null ) return null;
|
if( id == null ) return null;
|
||||||
|
|
||||||
ASTTypeId typeId = (ASTTypeId)id;
|
ASTTypeId typeId = (ASTTypeId)id;
|
||||||
ISymbol result = pst.newSymbol( "", CompleteParseASTFactory.getTypeKind(id)); //$NON-NLS-1$
|
ISymbol result = pst.newSymbol( EMPTY_STRING, CompleteParseASTFactory.getTypeKind(id));
|
||||||
|
|
||||||
result.getTypeInfo().setBit( id.isConst(), TypeInfo.isConst );
|
result.getTypeInfo().setBit( id.isConst(), TypeInfo.isConst );
|
||||||
result.getTypeInfo().setBit( id.isVolatile(), TypeInfo.isVolatile );
|
result.getTypeInfo().setBit( id.isVolatile(), TypeInfo.isVolatile );
|
||||||
|
@ -3177,4 +3176,22 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
if ( s == null ) return null;
|
if ( s == null ) return null;
|
||||||
return s.getASTExtension().getPrimaryDeclaration();
|
return s.getASTExtension().getPrimaryDeclaration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#getNodeForThisExpression(org.eclipse.cdt.core.parser.ast.IASTExpression)
|
||||||
|
*/
|
||||||
|
public IASTNode expressionToASTNode(IASTScope scope, IASTExpression expression) {
|
||||||
|
if( expression == null ) return null;
|
||||||
|
if( expression.getExpressionKind() == IASTExpression.Kind.ID_EXPRESSION )
|
||||||
|
if( expression instanceof ASTExpression)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return lookupSymbolInContext(scope, ((ASTExpression)expression).getIdExpressionTokenDuple());
|
||||||
|
} catch (ASTNotImplementedException e) {
|
||||||
|
// assert false : e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -875,7 +875,7 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac
|
||||||
boolean isTypename,
|
boolean isTypename,
|
||||||
ITokenDuple name,
|
ITokenDuple name,
|
||||||
List pointerOps,
|
List pointerOps,
|
||||||
List arrayMods)
|
List arrayMods, String completeSignature)
|
||||||
throws ASTSemanticException {
|
throws ASTSemanticException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
|
@ -900,7 +900,6 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac
|
||||||
public IASTNode getCompletionContext(
|
public IASTNode getCompletionContext(
|
||||||
Kind kind,
|
Kind kind,
|
||||||
IASTExpression expression) {
|
IASTExpression expression) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -912,6 +911,13 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac
|
||||||
*/
|
*/
|
||||||
public IASTNode lookupSymbolInContext(IASTScope scope, ITokenDuple duple)
|
public IASTNode lookupSymbolInContext(IASTScope scope, ITokenDuple duple)
|
||||||
throws ASTNotImplementedException {
|
throws ASTNotImplementedException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#getNodeForThisExpression(org.eclipse.cdt.core.parser.ast.IASTExpression)
|
||||||
|
*/
|
||||||
|
public IASTNode expressionToASTNode(IASTScope scope, IASTExpression expression) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ public class ASTTypeId implements IASTTypeId
|
||||||
private final String name;
|
private final String name;
|
||||||
private final List pointerOps;
|
private final List pointerOps;
|
||||||
private final List arrayMods;
|
private final List arrayMods;
|
||||||
|
private final String completeSignature;
|
||||||
/**
|
/**
|
||||||
* @param kind
|
* @param kind
|
||||||
* @param string
|
* @param string
|
||||||
|
@ -43,7 +44,7 @@ public class ASTTypeId implements IASTTypeId
|
||||||
* @param arrayMods
|
* @param arrayMods
|
||||||
*/
|
*/
|
||||||
public ASTTypeId(Type kind, String string, List pointerOps, List arrayMods, boolean isConst, boolean isVolatile,
|
public ASTTypeId(Type kind, String string, List pointerOps, List arrayMods, boolean isConst, boolean isVolatile,
|
||||||
boolean isUnsigned, boolean isSigned, boolean isShort, boolean isLong, boolean isTypeName)
|
boolean isUnsigned, boolean isSigned, boolean isShort, boolean isLong, boolean isTypeName, String completeSignature)
|
||||||
{
|
{
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
this.name = string;
|
this.name = string;
|
||||||
|
@ -56,6 +57,7 @@ public class ASTTypeId implements IASTTypeId
|
||||||
this.isShort =isShort;
|
this.isShort =isShort;
|
||||||
this.isLong =isLong;
|
this.isLong =isLong;
|
||||||
this.isConst =isConst;
|
this.isConst =isConst;
|
||||||
|
this.completeSignature = completeSignature;
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTTypeId#getKind()
|
* @see org.eclipse.cdt.core.parser.ast.IASTTypeId#getKind()
|
||||||
|
@ -88,9 +90,9 @@ public class ASTTypeId implements IASTTypeId
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTTypeId#getFullSignature()
|
* @see org.eclipse.cdt.core.parser.ast.IASTTypeId#getFullSignature()
|
||||||
*/
|
*/
|
||||||
public String getFullSignature() throws ASTNotImplementedException
|
public String getFullSignature()
|
||||||
{
|
{
|
||||||
throw new ASTNotImplementedException();
|
return completeSignature;
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTTypeId#createTypeSymbol(org.eclipse.cdt.core.parser.ast.IASTFactory)
|
* @see org.eclipse.cdt.core.parser.ast.IASTTypeId#createTypeSymbol(org.eclipse.cdt.core.parser.ast.IASTFactory)
|
||||||
|
|
|
@ -329,10 +329,10 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypeId(org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type, org.eclipse.cdt.core.parser.ITokenDuple, java.util.List, java.util.List)
|
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypeId(org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type, org.eclipse.cdt.core.parser.ITokenDuple, java.util.List, java.util.List)
|
||||||
*/
|
*/
|
||||||
public IASTTypeId createTypeId(IASTScope scope, Type kind, boolean isConst, boolean isVolatile, boolean isShort,
|
public IASTTypeId createTypeId(IASTScope scope, Type kind, boolean isConst, boolean isVolatile, boolean isShort,
|
||||||
boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, ITokenDuple name, List pointerOps, List arrayMods)
|
boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, ITokenDuple name, List pointerOps, List arrayMods, String completeSignature)
|
||||||
{
|
{
|
||||||
return new ASTTypeId( kind, name == null ? "" : name.toString(), pointerOps, arrayMods, isConst, //$NON-NLS-1$
|
return new ASTTypeId( kind, name == null ? "" : name.toString(), pointerOps, arrayMods, isConst, //$NON-NLS-1$
|
||||||
isVolatile, isUnsigned, isSigned, isShort, isLong, isTypename );
|
isVolatile, isUnsigned, isSigned, isShort, isLong, isTypename, completeSignature );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -363,4 +363,11 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
||||||
public IASTNode lookupSymbolInContext(IASTScope scope, ITokenDuple duple) throws ASTNotImplementedException {
|
public IASTNode lookupSymbolInContext(IASTScope scope, ITokenDuple duple) throws ASTNotImplementedException {
|
||||||
throw new ASTNotImplementedException();
|
throw new ASTNotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#getNodeForThisExpression(org.eclipse.cdt.core.parser.ast.IASTExpression)
|
||||||
|
*/
|
||||||
|
public IASTNode expressionToASTNode(IASTScope scope, IASTExpression expression) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,8 +41,8 @@ public abstract class BaseProblemFactory {
|
||||||
* @param file
|
* @param file
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String createInternalMessage(int id, String arg, int line, char[] file)
|
// private String createInternalMessage(int id, String arg, int line, char[] file)
|
||||||
{
|
// {
|
||||||
// if( checkBitmask( id, IProblem.INTERNAL_RELATED ))
|
// if( checkBitmask( id, IProblem.INTERNAL_RELATED ))
|
||||||
// {
|
// {
|
||||||
// StringBuffer buffer = new StringBuffer();
|
// StringBuffer buffer = new StringBuffer();
|
||||||
|
@ -53,7 +53,7 @@ public abstract class BaseProblemFactory {
|
||||||
//
|
//
|
||||||
// return buffer.toString();
|
// return buffer.toString();
|
||||||
// }
|
// }
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -712,6 +712,7 @@ public class Scanner implements IScanner {
|
||||||
private boolean atEOF = false;
|
private boolean atEOF = false;
|
||||||
|
|
||||||
private boolean tokenizingMacroReplacementList = false;
|
private boolean tokenizingMacroReplacementList = false;
|
||||||
|
protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||||
public void setTokenizingMacroReplacementList( boolean mr ){
|
public void setTokenizingMacroReplacementList( boolean mr ){
|
||||||
tokenizingMacroReplacementList = mr;
|
tokenizingMacroReplacementList = mr;
|
||||||
}
|
}
|
||||||
|
@ -1457,12 +1458,12 @@ public class Scanner implements IScanner {
|
||||||
if( v.size() == 4 )
|
if( v.size() == 4 )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < 4; ++i )
|
for( int i = 0; i < 4; ++i )
|
||||||
buff.append( (char)((Character)v.get(i)).charValue());
|
buff.append( ((Character)v.get(i)).charValue());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( int i = v.size() - 1; i >= 0; --i )
|
for( int i = v.size() - 1; i >= 0; --i )
|
||||||
ungetChar( (char) ((Character)v.get(i)).charValue() );
|
ungetChar( ((Character)v.get(i)).charValue() );
|
||||||
}
|
}
|
||||||
return buff;
|
return buff;
|
||||||
}
|
}
|
||||||
|
@ -2018,7 +2019,7 @@ public class Scanner implements IScanner {
|
||||||
*/
|
*/
|
||||||
protected void handleCompletionOnDefinition(String definition) throws EndOfFileException {
|
protected void handleCompletionOnDefinition(String definition) throws EndOfFileException {
|
||||||
IASTCompletionNode node = new ASTCompletionNode( IASTCompletionNode.CompletionKind.MACRO_REFERENCE,
|
IASTCompletionNode node = new ASTCompletionNode( IASTCompletionNode.CompletionKind.MACRO_REFERENCE,
|
||||||
null, null, definition, KeywordSets.getKeywords(KeywordSets.Key.EMPTY, scannerData.getLanguage()) );
|
null, null, definition, KeywordSets.getKeywords(KeywordSets.Key.EMPTY, scannerData.getLanguage()), EMPTY_STRING );
|
||||||
|
|
||||||
throwEOF( node );
|
throwEOF( node );
|
||||||
}
|
}
|
||||||
|
@ -2077,19 +2078,19 @@ public class Scanner implements IScanner {
|
||||||
|
|
||||||
IASTCompletionNode node = new ASTCompletionNode( kind,
|
IASTCompletionNode node = new ASTCompletionNode( kind,
|
||||||
null, null, prefix,
|
null, null, prefix,
|
||||||
KeywordSets.getKeywords(((kind == IASTCompletionNode.CompletionKind.NO_SUCH_KIND )? KeywordSets.Key.EMPTY : KeywordSets.Key.MACRO), scannerData.getLanguage()) );
|
KeywordSets.getKeywords(((kind == IASTCompletionNode.CompletionKind.NO_SUCH_KIND )? KeywordSets.Key.EMPTY : KeywordSets.Key.MACRO), scannerData.getLanguage()), EMPTY_STRING );
|
||||||
|
|
||||||
throwEOF( node );
|
throwEOF( node );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleInvalidCompletion() throws EndOfFileException
|
protected void handleInvalidCompletion() throws EndOfFileException
|
||||||
{
|
{
|
||||||
throwEOF( new ASTCompletionNode( IASTCompletionNode.CompletionKind.UNREACHABLE_CODE, null, null, "", KeywordSets.getKeywords(KeywordSets.Key.EMPTY, scannerData.getLanguage()) )); //$NON-NLS-1$
|
throwEOF( new ASTCompletionNode( IASTCompletionNode.CompletionKind.UNREACHABLE_CODE, null, null, EMPTY_STRING, KeywordSets.getKeywords(KeywordSets.Key.EMPTY, scannerData.getLanguage()) , EMPTY_STRING));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleCompletionOnPreprocessorDirective( String prefix ) throws EndOfFileException
|
protected void handleCompletionOnPreprocessorDirective( String prefix ) throws EndOfFileException
|
||||||
{
|
{
|
||||||
throwEOF( new ASTCompletionNode( IASTCompletionNode.CompletionKind.NO_SUCH_KIND, null, null, prefix, KeywordSets.getKeywords(KeywordSets.Key.PP_DIRECTIVE, scannerData.getLanguage() )));
|
throwEOF( new ASTCompletionNode( IASTCompletionNode.CompletionKind.NO_SUCH_KIND, null, null, prefix, KeywordSets.getKeywords(KeywordSets.Key.PP_DIRECTIVE, scannerData.getLanguage() ), EMPTY_STRING));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param key
|
* @param key
|
||||||
|
|
|
@ -38,6 +38,7 @@ public class KeywordSets {
|
||||||
public static final Key NAMESPACE_ONLY = new Key(6);
|
public static final Key NAMESPACE_ONLY = new Key(6);
|
||||||
public static final Key MACRO = new Key( 7 );
|
public static final Key MACRO = new Key( 7 );
|
||||||
public static final Key PP_DIRECTIVE = new Key( 8 );
|
public static final Key PP_DIRECTIVE = new Key( 8 );
|
||||||
|
public static final Key EXPRESSION = new Key( 9 );
|
||||||
/**
|
/**
|
||||||
* @param enumValue
|
* @param enumValue
|
||||||
*/
|
*/
|
||||||
|
@ -69,7 +70,8 @@ public class KeywordSets {
|
||||||
return MACRO_ONLY;
|
return MACRO_ONLY;
|
||||||
if( kind == Key.PP_DIRECTIVE )
|
if( kind == Key.PP_DIRECTIVE )
|
||||||
return PP_DIRECTIVES;
|
return PP_DIRECTIVES;
|
||||||
|
if( kind == Key.EXPRESSION )
|
||||||
|
return (Set) EXPRESSION.get( language );
|
||||||
//TODO finish this
|
//TODO finish this
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -259,4 +261,48 @@ public class KeywordSets {
|
||||||
PP_DIRECTIVES.add(Directives.POUND_PRAGMA);
|
PP_DIRECTIVES.add(Directives.POUND_PRAGMA);
|
||||||
PP_DIRECTIVES.add(Directives.POUND_ELIF);
|
PP_DIRECTIVES.add(Directives.POUND_ELIF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Set EXPRESSION_C;
|
||||||
|
static
|
||||||
|
{
|
||||||
|
EXPRESSION_C = new TreeSet();
|
||||||
|
EXPRESSION_C.add( Keywords.CHAR );
|
||||||
|
EXPRESSION_C.add( Keywords.WCHAR_T);
|
||||||
|
EXPRESSION_C.add( Keywords.SHORT);
|
||||||
|
EXPRESSION_C.add( Keywords.INT);
|
||||||
|
EXPRESSION_C.add( Keywords.LONG);
|
||||||
|
EXPRESSION_C.add( Keywords.SIGNED);
|
||||||
|
EXPRESSION_C.add( Keywords.UNSIGNED);
|
||||||
|
EXPRESSION_C.add( Keywords.FLOAT);
|
||||||
|
EXPRESSION_C.add( Keywords.DOUBLE);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Set EXPRESSION_CPP;
|
||||||
|
static
|
||||||
|
{
|
||||||
|
EXPRESSION_CPP = new TreeSet(EXPRESSION_C);
|
||||||
|
EXPRESSION_CPP.add( Keywords.BOOL );
|
||||||
|
EXPRESSION_CPP.add( Keywords.NEW );
|
||||||
|
EXPRESSION_CPP.add( Keywords.DELETE );
|
||||||
|
EXPRESSION_CPP.add( Keywords.TYPENAME );
|
||||||
|
EXPRESSION_CPP.add( Keywords.DYNAMIC_CAST );
|
||||||
|
EXPRESSION_CPP.add( Keywords.STATIC_CAST );
|
||||||
|
EXPRESSION_CPP.add( Keywords.REINTERPRET_CAST );
|
||||||
|
EXPRESSION_CPP.add( Keywords.CONST_CAST );
|
||||||
|
EXPRESSION_CPP.add( Keywords.TYPEID );
|
||||||
|
EXPRESSION_CPP.add( Keywords.TRUE );
|
||||||
|
EXPRESSION_CPP.add( Keywords.FALSE );
|
||||||
|
EXPRESSION_CPP.add( Keywords.THIS );
|
||||||
|
EXPRESSION_CPP.add( Keywords.OPERATOR );
|
||||||
|
EXPRESSION_CPP.add( Keywords.THROW );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Hashtable EXPRESSION;
|
||||||
|
static
|
||||||
|
{
|
||||||
|
EXPRESSION = new Hashtable();
|
||||||
|
EXPRESSION.put( ParserLanguage.CPP, EXPRESSION_CPP );
|
||||||
|
EXPRESSION.put( ParserLanguage.C, EXPRESSION_C );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,4 +49,17 @@ public class TraceUtil {
|
||||||
log.traceLog( preface );
|
log.traceLog( preface );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @param logService
|
||||||
|
* @param preface
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
public static void outputTrace(IParserLogService logService, String preface, String data) {
|
||||||
|
if( logService.isTracing() ) {
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
if( preface != null ) buffer.append( preface );
|
||||||
|
if( data != null ) buffer.append( data );
|
||||||
|
logService.traceLog( buffer.toString() );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
2004-04-07 John Camelon
|
||||||
|
Updated CompletionFailedTest_ConstructorReference_Bug50808, renamed it to CompletionTest_ConstructorReference and moved it out of the failed tests folder.
|
||||||
|
Updated CompletionFailedTest_TypeDef_Bug52948, renamed it to CompletionTest_TypeDef_Prefix and moved it out of the failed tests folder.
|
||||||
|
Renamed CompletionTest_TypeDef_Bug52948 it to CompletionTest_TypeDef_NoPrefix.
|
||||||
|
Updated CompletionTest_SingleName_Parameter and renamed it to CompletionTest_FunctionReference_Prefix.
|
||||||
|
Updated CompletionFailedTest_FunctionReference_Bug50807, renamed it to CompletionTest_FunctionReference_NoPrefix and moved it out of the failed tests folder.
|
||||||
|
|
||||||
2004-04-07 John Camelon
|
2004-04-07 John Camelon
|
||||||
Updated CompletionFailedTest_ScopedReference_Prefix_Bug50152, moved it out of failed tests package and renamed it to CompletionTest_ScopedReference_Prefix_Bug50152.
|
Updated CompletionFailedTest_ScopedReference_Prefix_Bug50152, moved it out of failed tests package and renamed it to CompletionTest_ScopedReference_Prefix_Bug50152.
|
||||||
Updated CompletionFailedTest_TypeDef_Bug52948, moved it out of failed tests package and renamed it to CompletionTest_TypeDef_Bug52948.
|
Updated CompletionFailedTest_TypeDef_Bug52948, moved it out of failed tests package and renamed it to CompletionTest_TypeDef_Bug52948.
|
||||||
|
|
|
@ -66,16 +66,16 @@ public class AutomatedSuite extends TestSuite {
|
||||||
addTest(CompletionTest_NewTypeReference_Prefix.suite());
|
addTest(CompletionTest_NewTypeReference_Prefix.suite());
|
||||||
addTest(CompletionTest_ExceptionReference_NoPrefix.suite());
|
addTest(CompletionTest_ExceptionReference_NoPrefix.suite());
|
||||||
addTest(CompletionTest_ExceptionReference_Prefix.suite());
|
addTest(CompletionTest_ExceptionReference_Prefix.suite());
|
||||||
addTest(CompletionTest_SingleName_Parameter.suite());
|
addTest(CompletionTest_FunctionReference_Prefix.suite());
|
||||||
|
|
||||||
// Failed Tests
|
// Failed Tests
|
||||||
addTest(CompletionFailedTest_ScopedReference_NoPrefix_Bug50152.suite());
|
addTest(CompletionFailedTest_ScopedReference_NoPrefix_Bug50152.suite());
|
||||||
addTest(CompletionTest_ScopedReference_Prefix_Bug50152.suite());
|
addTest(CompletionTest_ScopedReference_Prefix_Bug50152.suite());
|
||||||
addTest(CompletionTest_MacroRef_NoPrefix.suite());
|
addTest(CompletionTest_MacroRef_NoPrefix.suite());
|
||||||
addTest(CompletionTest_MacroRef_Prefix.suite());
|
addTest(CompletionTest_MacroRef_Prefix.suite());
|
||||||
addTest(CompletionFailedTest_FunctionReference_Bug50807.suite());
|
addTest(CompletionTest_FunctionReference_NoPrefix.suite());
|
||||||
addTest(CompletionFailedTest_ConstructorReference_Bug50808.suite());
|
addTest(CompletionTest_ConstructorReference.suite());
|
||||||
addTest(CompletionTest_TypeDef_Bug52948.suite());
|
addTest(CompletionTest_TypeDef_NoPrefix.suite());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.eclipse.jface.text.Document;
|
||||||
import org.eclipse.jface.text.contentassist.ICompletionProposal;
|
import org.eclipse.jface.text.contentassist.ICompletionProposal;
|
||||||
|
|
||||||
public abstract class CompletionProposalsBaseTest extends TestCase{
|
public abstract class CompletionProposalsBaseTest extends TestCase{
|
||||||
private final String pluginName = "org.eclipse.cdt.ui.tests";
|
protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||||
private final String projectName = "TestProject1";
|
private final String projectName = "TestProject1";
|
||||||
private final String projectType = "bin";
|
private final String projectType = "bin";
|
||||||
private ICProject fCProject;
|
private ICProject fCProject;
|
||||||
|
@ -52,7 +52,7 @@ public abstract class CompletionProposalsBaseTest extends TestCase{
|
||||||
private IFile fHeaderFile;
|
private IFile fHeaderFile;
|
||||||
private NullProgressMonitor monitor;
|
private NullProgressMonitor monitor;
|
||||||
private TranslationUnit tu = null;
|
private TranslationUnit tu = null;
|
||||||
private String buffer = "";
|
private String buffer = EMPTY_STRING;
|
||||||
private Document document = null;
|
private Document document = null;
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ public abstract class CompletionProposalsBaseTest extends TestCase{
|
||||||
protected abstract String getExpectedPrefix();
|
protected abstract String getExpectedPrefix();
|
||||||
protected abstract IASTCompletionNode.CompletionKind getExpectedKind();
|
protected abstract IASTCompletionNode.CompletionKind getExpectedKind();
|
||||||
protected abstract String[] getExpectedResultsValues();
|
protected abstract String[] getExpectedResultsValues();
|
||||||
|
protected String getFunctionOrConstructorName() { return EMPTY_STRING; }
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
|
@ -144,7 +145,6 @@ public abstract class CompletionProposalsBaseTest extends TestCase{
|
||||||
// scope
|
// scope
|
||||||
IASTScope scope = completionNode.getCompletionScope();
|
IASTScope scope = completionNode.getCompletionScope();
|
||||||
assertNotNull(scope);
|
assertNotNull(scope);
|
||||||
String scopeClassName = scope.getClass().getName();
|
|
||||||
assertTrue(scope.getClass().getName().endsWith(getExpectedScopeClassName()));
|
assertTrue(scope.getClass().getName().endsWith(getExpectedScopeClassName()));
|
||||||
// context
|
// context
|
||||||
IASTNode context = completionNode.getCompletionContext();
|
IASTNode context = completionNode.getCompletionContext();
|
||||||
|
@ -159,6 +159,8 @@ public abstract class CompletionProposalsBaseTest extends TestCase{
|
||||||
String prefix = completionNode.getCompletionPrefix();
|
String prefix = completionNode.getCompletionPrefix();
|
||||||
assertEquals(prefix, getExpectedPrefix());
|
assertEquals(prefix, getExpectedPrefix());
|
||||||
|
|
||||||
|
assertEquals( completionNode.getFunctionName(), getFunctionOrConstructorName() );
|
||||||
|
|
||||||
String[] expected = getExpectedResultsValues();
|
String[] expected = getExpectedResultsValues();
|
||||||
assertTrue(results.length >= expected.length);
|
assertTrue(results.length >= expected.length);
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.ui.tests.text.contentassist.failedtests;
|
package org.eclipse.cdt.ui.tests.text.contentassist;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ import junit.framework.Test;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hamer
|
* @author hamer
|
||||||
|
@ -25,15 +24,15 @@ import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
||||||
* Bug#
|
* Bug#
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CompletionFailedTest_ConstructorReference_Bug50808 extends CompletionProposalsBaseTest{
|
public class CompletionTest_ConstructorReference extends CompletionProposalsBaseTest{
|
||||||
|
|
||||||
private final String fileName = "CompletionTestStart35.cpp";
|
private final String fileName = "CompletionTestStart35.cpp";
|
||||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||||
private final String headerFileName = "CompletionTestStart.h";
|
private final String headerFileName = "CompletionTestStart.h";
|
||||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||||
private final String expectedScopeName = "ASTMethod";
|
private final String expectedScopeName = "ASTMethod";
|
||||||
private final String expectedContextName = "null"; // should be "ASTClassSpecifier"
|
private final String expectedContextName = "null";
|
||||||
private final CompletionKind expectedKind = CompletionKind.NEW_TYPE_REFERENCE; // should be CompletionKind.CONSTRUCTOR_REFERENCE;
|
private final CompletionKind expectedKind = CompletionKind.CONSTRUCTOR_REFERENCE;
|
||||||
private final String expectedPrefix = "";
|
private final String expectedPrefix = "";
|
||||||
private final String[] expectedResults = {
|
private final String[] expectedResults = {
|
||||||
// should be
|
// should be
|
||||||
|
@ -41,13 +40,13 @@ public class CompletionFailedTest_ConstructorReference_Bug50808 extends Complet
|
||||||
// "xOtherClass(int)"
|
// "xOtherClass(int)"
|
||||||
};
|
};
|
||||||
|
|
||||||
public CompletionFailedTest_ConstructorReference_Bug50808(String name) {
|
public CompletionTest_ConstructorReference(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
TestSuite suite= new TestSuite(CompletionFailedTest_ConstructorReference_Bug50808.class.getName());
|
TestSuite suite= new TestSuite(CompletionTest_ConstructorReference.class.getName());
|
||||||
suite.addTest(new CompletionFailedTest_ConstructorReference_Bug50808("testCompletionProposals"));
|
suite.addTest(new CompletionTest_ConstructorReference("testCompletionProposals"));
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,5 +119,12 @@ public class CompletionFailedTest_ConstructorReference_Bug50808 extends Complet
|
||||||
return headerFileName;
|
return headerFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest#getFunctionOrConstructorName()
|
||||||
|
*/
|
||||||
|
protected String getFunctionOrConstructorName() {
|
||||||
|
return "xOtherClass";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,14 +8,13 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.ui.tests.text.contentassist.failedtests;
|
package org.eclipse.cdt.ui.tests.text.contentassist;
|
||||||
|
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hamer
|
* @author hamer
|
||||||
|
@ -24,34 +23,33 @@ import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
||||||
* Bug#
|
* Bug#
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CompletionFailedTest_FunctionReference_Bug50807 extends CompletionProposalsBaseTest{
|
public class CompletionTest_FunctionReference_NoPrefix extends CompletionProposalsBaseTest{
|
||||||
|
|
||||||
private final String fileName = "CompletionTestStart34.cpp";
|
private final String fileName = "CompletionTestStart34.cpp";
|
||||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||||
private final String headerFileName = "CompletionTestStart.h";
|
private final String headerFileName = "CompletionTestStart.h";
|
||||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||||
private final String expectedScopeName = "ASTMethod";
|
private final String expectedScopeName = "ASTMethod";
|
||||||
private final String expectedContextName = "null"; // either the context or the prefix should be meaningful "ASTMethod"
|
private final String expectedContextName = "ASTVariable"; // variables are more precise to lookup upon than the variable's type is
|
||||||
private final CompletionKind expectedKind = CompletionKind.NO_SUCH_KIND; // should be CompletionKind.FUNCTION_REFERENCE;
|
private final CompletionKind expectedKind = CompletionKind.FUNCTION_REFERENCE;
|
||||||
private final String expectedPrefix = ""; // should be "xAClassMethod"
|
private final String expectedPrefix = "";
|
||||||
private final String[] expectedResults = {
|
private final String[] expectedResults = {
|
||||||
// should be
|
"xOtherMethod() void",
|
||||||
// "xOtherMethod() void",
|
"xOtherMethod(int) void"
|
||||||
// "xOtherMethod(int) void"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public CompletionFailedTest_FunctionReference_Bug50807(String name) {
|
public CompletionTest_FunctionReference_NoPrefix(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
TestSuite suite= new TestSuite(CompletionFailedTest_FunctionReference_Bug50807.class.getName());
|
TestSuite suite= new TestSuite(CompletionTest_FunctionReference_NoPrefix.class.getName());
|
||||||
suite.addTest(new CompletionFailedTest_FunctionReference_Bug50807("testCompletionProposals"));
|
suite.addTest(new CompletionTest_FunctionReference_NoPrefix("testCompletionProposals"));
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
|
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
|
||||||
*/
|
*/
|
||||||
protected int getCompletionPosition() {
|
protected int getCompletionPosition() {
|
||||||
return getBuffer().indexOf("( ") + 2;
|
return getBuffer().indexOf("( ") + 2;
|
||||||
|
@ -119,4 +117,12 @@ public class CompletionFailedTest_FunctionReference_Bug50807 extends Completion
|
||||||
return headerFileName;
|
return headerFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest#getFunctionOrConstructorName()
|
||||||
|
*/
|
||||||
|
protected String getFunctionOrConstructorName() {
|
||||||
|
return "xOtherMethod";
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -23,14 +23,14 @@ import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||||
* Bug#
|
* Bug#
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CompletionTest_SingleName_Parameter extends CompletionProposalsBaseTest{
|
public class CompletionTest_FunctionReference_Prefix extends CompletionProposalsBaseTest{
|
||||||
private final String fileName = "CompletionTestStart36.cpp";
|
private final String fileName = "CompletionTestStart36.cpp";
|
||||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||||
private final String headerFileName = "CompletionTestStart.h";
|
private final String headerFileName = "CompletionTestStart.h";
|
||||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||||
private final String expectedScopeName = "ASTMethod";
|
private final String expectedScopeName = "ASTMethod";
|
||||||
private final String expectedContextName = "null";
|
private final String expectedContextName = "null";
|
||||||
private final CompletionKind expectedKind = CompletionKind.SINGLE_NAME_REFERENCE;
|
private final CompletionKind expectedKind = CompletionKind.FUNCTION_REFERENCE;
|
||||||
private final String expectedPrefix = "x";
|
private final String expectedPrefix = "x";
|
||||||
private final String[] expectedResults = {
|
private final String[] expectedResults = {
|
||||||
"xLocal : int",
|
"xLocal : int",
|
||||||
|
@ -48,13 +48,13 @@ public class CompletionTest_SingleName_Parameter extends CompletionProposalsBas
|
||||||
"XMacro(x,y)"
|
"XMacro(x,y)"
|
||||||
};
|
};
|
||||||
|
|
||||||
public CompletionTest_SingleName_Parameter(String name) {
|
public CompletionTest_FunctionReference_Prefix(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
TestSuite suite= new TestSuite(CompletionTest_SingleName_Parameter.class.getName());
|
TestSuite suite= new TestSuite(CompletionTest_FunctionReference_Prefix.class.getName());
|
||||||
suite.addTest(new CompletionTest_SingleName_Parameter("testCompletionProposals"));
|
suite.addTest(new CompletionTest_FunctionReference_Prefix("testCompletionProposals"));
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -126,4 +126,14 @@ public class CompletionTest_SingleName_Parameter extends CompletionProposalsBas
|
||||||
return headerFileName;
|
return headerFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest#getFunctionOrConstructorName()
|
||||||
|
*/
|
||||||
|
protected String getFunctionOrConstructorName() {
|
||||||
|
return "xAClassMethod";
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -24,7 +24,7 @@ import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||||
* Bug#52948
|
* Bug#52948
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CompletionTest_TypeDef_Bug52948 extends CompletionProposalsBaseTest{
|
public class CompletionTest_TypeDef_NoPrefix extends CompletionProposalsBaseTest{
|
||||||
|
|
||||||
private final String fileName = "CompletionTestStart37.cpp";
|
private final String fileName = "CompletionTestStart37.cpp";
|
||||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||||
|
@ -38,13 +38,13 @@ public class CompletionTest_TypeDef_Bug52948 extends CompletionProposalsBaseTes
|
||||||
"myType"
|
"myType"
|
||||||
};
|
};
|
||||||
|
|
||||||
public CompletionTest_TypeDef_Bug52948(String name) {
|
public CompletionTest_TypeDef_NoPrefix(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
TestSuite suite= new TestSuite(CompletionTest_TypeDef_Bug52948.class.getName());
|
TestSuite suite= new TestSuite(CompletionTest_TypeDef_NoPrefix.class.getName());
|
||||||
suite.addTest(new CompletionTest_TypeDef_Bug52948("testCompletionProposals"));
|
suite.addTest(new CompletionTest_TypeDef_NoPrefix("testCompletionProposals"));
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.ui.tests.text.contentassist.failedtests;
|
package org.eclipse.cdt.ui.tests.text.contentassist;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ import junit.framework.Test;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hamer
|
* @author hamer
|
||||||
|
@ -25,7 +24,7 @@ import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
||||||
* Bug#52948
|
* Bug#52948
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CompletionFailedTest_TypeDef_Bug52948 extends CompletionProposalsBaseTest{
|
public class CompletionTest_TypeDef_Prefix extends CompletionProposalsBaseTest{
|
||||||
|
|
||||||
private final String fileName = "CompletionTestStart37.cpp";
|
private final String fileName = "CompletionTestStart37.cpp";
|
||||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||||
|
@ -36,17 +35,16 @@ public class CompletionFailedTest_TypeDef_Bug52948 extends CompletionProposalsB
|
||||||
private final CompletionKind expectedKind = CompletionKind.VARIABLE_TYPE;
|
private final CompletionKind expectedKind = CompletionKind.VARIABLE_TYPE;
|
||||||
private final String expectedPrefix = "m";
|
private final String expectedPrefix = "m";
|
||||||
private final String[] expectedResults = {
|
private final String[] expectedResults = {
|
||||||
// should be
|
"myType"
|
||||||
// "myType"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public CompletionFailedTest_TypeDef_Bug52948(String name) {
|
public CompletionTest_TypeDef_Prefix(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
TestSuite suite= new TestSuite(CompletionFailedTest_TypeDef_Bug52948.class.getName());
|
TestSuite suite= new TestSuite(CompletionTest_TypeDef_Prefix.class.getName());
|
||||||
suite.addTest(new CompletionFailedTest_TypeDef_Bug52948("testCompletionProposals"));
|
suite.addTest(new CompletionTest_TypeDef_Prefix("testCompletionProposals"));
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
2004-04-07 John Camelon
|
||||||
|
Updated CompletionEngine to use the extended IASTCompletionNode interface for FUNCTION_REFERENCE.
|
||||||
|
|
||||||
2004-04-07 David Inglis
|
2004-04-07 David Inglis
|
||||||
|
|
||||||
Begining of new Include/Symbols UI pages.
|
Begining of new Include/Symbols UI pages.
|
||||||
|
|
|
@ -539,8 +539,8 @@ public class CompletionEngine implements RelevanceConstants {
|
||||||
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[1];
|
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[1];
|
||||||
kinds[0] = IASTNode.LookupKind.ALL;
|
kinds[0] = IASTNode.LookupKind.ALL;
|
||||||
String prefix = completionNode.getCompletionPrefix();
|
String prefix = completionNode.getCompletionPrefix();
|
||||||
if(prefix.equals("(")) //$NON-NLS-1$
|
// if(prefix.equals("(")) //$NON-NLS-1$
|
||||||
prefix = ""; //$NON-NLS-1$
|
// prefix = ""; //$NON-NLS-1$
|
||||||
result = lookup(searchNode, prefix, kinds, completionNode.getCompletionContext());
|
result = lookup(searchNode, prefix, kinds, completionNode.getCompletionContext());
|
||||||
addToCompletions(result);
|
addToCompletions(result);
|
||||||
|
|
||||||
|
@ -628,14 +628,22 @@ public class CompletionEngine implements RelevanceConstants {
|
||||||
addToCompletions(result);
|
addToCompletions(result);
|
||||||
}
|
}
|
||||||
private void completionOnFunctionReference(IASTCompletionNode completionNode){
|
private void completionOnFunctionReference(IASTCompletionNode completionNode){
|
||||||
// 1. Get the search scope node
|
//NOTE:
|
||||||
IASTScope searchNode = completionNode.getCompletionScope();
|
// Hoda, I changed this so it makes sense with regards to your JUnit tests
|
||||||
// only lookup this function
|
// and examples. If my assumptions are not correct as to what deserves to be
|
||||||
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[2];
|
// looked up for FUNCTION_REFRENCE then please update the documentation in
|
||||||
kinds[0] = IASTNode.LookupKind.FUNCTIONS;
|
// IASTCompletionNode.java.
|
||||||
kinds[1] = IASTNode.LookupKind.METHODS;
|
|
||||||
ILookupResult result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, completionNode.getCompletionContext());
|
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[1];
|
||||||
|
kinds[0] = IASTNode.LookupKind.ALL;
|
||||||
|
String prefix = completionNode.getCompletionPrefix();
|
||||||
|
|
||||||
|
ILookupResult result = lookup(completionNode.getCompletionScope(), prefix, kinds, completionNode.getCompletionContext());
|
||||||
addToCompletions(result);
|
addToCompletions(result);
|
||||||
|
|
||||||
|
List macros = lookupMacros(completionNode.getCompletionPrefix());
|
||||||
|
addMacrosToCompletions(macros.iterator());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTCompletionNode complete(IWorkingCopy sourceUnit, int completionOffset) {
|
public IASTCompletionNode complete(IWorkingCopy sourceUnit, int completionOffset) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue