mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
org.eclipse.cdt.core
Removed IASTCompletionKind.SCOPED_REFERENCE as it was obsolete. Did preliminary work to support content assist within qualified names. org.eclipse.cdt.ui Updated Content Assist feature to not use IASTCompletionKind.SCOPED_REFERENCE
This commit is contained in:
parent
e4929dfcd1
commit
385ac1b870
6 changed files with 56 additions and 48 deletions
|
@ -1,3 +1,7 @@
|
|||
2004-02-12 John Camelon
|
||||
Removed IASTCompletionKind.SCOPED_REFERENCE as it was obsolete.
|
||||
Did preliminary work to support content assist within qualified names.
|
||||
|
||||
2004-02-11 John Camelon
|
||||
Restructured Parser implementation to allow for better support of Selection Search.
|
||||
Restructured Parser implementation to allow for separation between parsing expressions (Scanner) and complete C/C++ source.
|
||||
|
|
|
@ -24,9 +24,6 @@ public interface IASTCompletionNode {
|
|||
{
|
||||
// x.[ ] x->[ ]
|
||||
public static final CompletionKind MEMBER_REFERENCE = new CompletionKind( 0 );
|
||||
|
||||
// x::[ ]
|
||||
public static final CompletionKind SCOPED_REFERENCE = new CompletionKind( 1 );
|
||||
|
||||
// class member declaration type reference
|
||||
public static final CompletionKind FIELD_TYPE = new CompletionKind( 2 );
|
||||
|
|
|
@ -158,8 +158,8 @@ public class ExpressionParser implements IExpressionParser {
|
|||
*
|
||||
* @throws BacktrackException request a backtrack
|
||||
*/
|
||||
protected IToken templateId(IASTScope scope) throws EndOfFileException, BacktrackException {
|
||||
ITokenDuple duple = name(scope);
|
||||
protected IToken templateId(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException {
|
||||
ITokenDuple duple = name(scope, kind );
|
||||
IToken last = consumeTemplateParameters(duple.getLastToken());
|
||||
return last;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ public class ExpressionParser implements IExpressionParser {
|
|||
*
|
||||
* @throws BacktrackException request a backtrack
|
||||
*/
|
||||
protected TokenDuple name(IASTScope scope) throws BacktrackException, EndOfFileException {
|
||||
protected TokenDuple name(IASTScope scope, IASTCompletionNode.CompletionKind kind) throws BacktrackException, EndOfFileException {
|
||||
IToken first = LA(1);
|
||||
IToken last = null;
|
||||
IToken mark = mark();
|
||||
|
@ -373,7 +373,7 @@ public class ExpressionParser implements IExpressionParser {
|
|||
{
|
||||
try
|
||||
{
|
||||
nameDuple = name(d.getScope());
|
||||
nameDuple = name(d.getScope(), CompletionKind.NO_SUCH_KIND );
|
||||
}
|
||||
catch( BacktrackException bt )
|
||||
{
|
||||
|
@ -1125,7 +1125,7 @@ public class ExpressionParser implements IExpressionParser {
|
|||
{
|
||||
try
|
||||
{
|
||||
name = name(scope);
|
||||
name = name(scope, CompletionKind.TYPE_REFERENCE );
|
||||
kind = IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME;
|
||||
break;
|
||||
}
|
||||
|
@ -1172,7 +1172,7 @@ public class ExpressionParser implements IExpressionParser {
|
|||
case IToken.tIDENTIFIER :
|
||||
if( encounteredType ) break simpleMods;
|
||||
encounteredType = true;
|
||||
name = name(scope);
|
||||
name = name(scope, CompletionKind.TYPE_REFERENCE);
|
||||
kind = IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME;
|
||||
break;
|
||||
|
||||
|
@ -1256,7 +1256,7 @@ public class ExpressionParser implements IExpressionParser {
|
|||
consume();
|
||||
try
|
||||
{
|
||||
name = name(scope);
|
||||
name = name(scope, CompletionKind.TYPE_REFERENCE );
|
||||
kind = IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME;
|
||||
} catch( BacktrackException b )
|
||||
{
|
||||
|
@ -1661,7 +1661,7 @@ public class ExpressionParser implements IExpressionParser {
|
|||
{
|
||||
case IToken.t_typename :
|
||||
consume(IToken.t_typename);
|
||||
ITokenDuple nestedName = name(scope);
|
||||
ITokenDuple nestedName = name(scope, CompletionKind.TYPE_REFERENCE);
|
||||
boolean templateTokenConsumed = false;
|
||||
if( LT(1) == IToken.t_template )
|
||||
{
|
||||
|
@ -1672,7 +1672,8 @@ public class ExpressionParser implements IExpressionParser {
|
|||
ITokenDuple templateId = null;
|
||||
try
|
||||
{
|
||||
templateId = new TokenDuple( current, templateId(scope) );
|
||||
templateId = new TokenDuple( current, templateId(scope, CompletionKind.SINGLE_NAME_REFERENCE
|
||||
) );
|
||||
}
|
||||
catch( BacktrackException bt )
|
||||
{
|
||||
|
@ -2215,7 +2216,7 @@ public class ExpressionParser implements IExpressionParser {
|
|||
IToken mark = mark();
|
||||
try
|
||||
{
|
||||
duple = name(scope);
|
||||
duple = name(scope, CompletionKind.SINGLE_NAME_REFERENCE);
|
||||
}
|
||||
catch( BacktrackException bt )
|
||||
{
|
||||
|
|
|
@ -235,7 +235,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
// optional :: and nested classes handled in name
|
||||
TokenDuple duple = null;
|
||||
if (LT(1) == IToken.tIDENTIFIER || LT(1) == IToken.tCOLONCOLON)
|
||||
duple = name(scope);
|
||||
duple = name(scope, CompletionKind.NAMESPACE_REFERENCE);
|
||||
else
|
||||
throw backtrack;
|
||||
if (LT(1) == IToken.tSEMI)
|
||||
|
@ -276,7 +276,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
if (LT(1) == IToken.tIDENTIFIER || LT(1) == IToken.tCOLONCOLON)
|
||||
{
|
||||
// optional :: and nested classes handled in name
|
||||
name = name(scope);
|
||||
name = name(scope, CompletionKind.TYPE_REFERENCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -876,7 +876,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
if( identifier == null )
|
||||
throw backtrack;
|
||||
|
||||
ITokenDuple duple = name(scope);
|
||||
ITokenDuple duple = name(scope, CompletionKind.NAMESPACE_REFERENCE);
|
||||
consume( IToken.tSEMI );
|
||||
setCompletionValues(scope, kind, Key.DECLARATION );
|
||||
try
|
||||
|
@ -1111,7 +1111,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
break;
|
||||
|
||||
|
||||
ITokenDuple duple = name(scope);
|
||||
ITokenDuple duple = name(scope, CompletionKind.SINGLE_NAME_REFERENCE );
|
||||
|
||||
consume(IToken.tLPAREN);
|
||||
IASTExpression expressionList = null;
|
||||
|
@ -1529,11 +1529,11 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
consume(IToken.t_typename );
|
||||
IToken first = LA(1);
|
||||
IToken last = null;
|
||||
last = name(sdw.getScope()).getLastToken();
|
||||
last = name(sdw.getScope(), CompletionKind.TYPE_REFERENCE).getLastToken();
|
||||
if (LT(1) == IToken.t_template)
|
||||
{
|
||||
consume(IToken.t_template);
|
||||
last = templateId(sdw.getScope());
|
||||
last = templateId(sdw.getScope(), CompletionKind.SINGLE_NAME_REFERENCE );
|
||||
}
|
||||
ITokenDuple duple = new TokenDuple(first, last);
|
||||
sdw.setTypeName(duple);
|
||||
|
@ -1573,7 +1573,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
return;
|
||||
}
|
||||
|
||||
ITokenDuple d = name(sdw.getScope());
|
||||
ITokenDuple d = name(sdw.getScope(), CompletionKind.TYPE_REFERENCE );
|
||||
sdw.setTypeName(d);
|
||||
sdw.setSimpleType( IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME );
|
||||
flags.setEncounteredTypename(true);
|
||||
|
@ -1644,7 +1644,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
break;
|
||||
}
|
||||
|
||||
ITokenDuple d = name(sdw.getScope());
|
||||
ITokenDuple d = name(sdw.getScope(), CompletionKind.TYPE_REFERENCE);
|
||||
IASTTypeSpecifier elaboratedTypeSpec = null;
|
||||
final boolean isForewardDecl = ( LT(1) == IToken.tSEMI );
|
||||
|
||||
|
@ -1691,7 +1691,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
*/
|
||||
protected ITokenDuple className(IASTScope scope) throws EndOfFileException, BacktrackException
|
||||
{
|
||||
ITokenDuple duple = name(scope);
|
||||
ITokenDuple duple = name(scope, CompletionKind.USER_SPECIFIED_NAME );
|
||||
IToken last = duple.getLastToken();
|
||||
if (LT(1) == IToken.tLT) {
|
||||
last = consumeTemplateParameters(duple.getLastToken());
|
||||
|
@ -2007,7 +2007,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
{
|
||||
try
|
||||
{
|
||||
if( ! astFactory.queryIsTypeName( scope, name(scope) ) )
|
||||
if( ! astFactory.queryIsTypeName( scope, name(scope, CompletionKind.TYPE_REFERENCE ) ) )
|
||||
failed = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -2189,7 +2189,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
{
|
||||
try
|
||||
{
|
||||
ITokenDuple duple = name(d.getDeclarationWrapper().getScope());
|
||||
ITokenDuple duple = name(d.getDeclarationWrapper().getScope(), CompletionKind.SINGLE_NAME_REFERENCE );
|
||||
d.setName(duple);
|
||||
|
||||
}
|
||||
|
@ -2542,7 +2542,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
break;
|
||||
case IToken.tCOLONCOLON :
|
||||
case IToken.tIDENTIFIER :
|
||||
nameDuple = name(astClassSpec);
|
||||
nameDuple = name(astClassSpec, CompletionKind.CLASS_REFERENCE );
|
||||
break;
|
||||
case IToken.tCOMMA :
|
||||
try
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
2004-02-12 John Camelon
|
||||
Updated Content Assist feature to not use IASTCompletionKind.SCOPED_REFERENCE
|
||||
|
||||
2004-02-11 Alain Magloire
|
||||
|
||||
* src/org/eclipse/cdt/internal/ui/cview/CView.java
|
||||
|
|
|
@ -435,22 +435,23 @@ public class CompletionEngine implements RelevanceConstants {
|
|||
result = lookup (searchNode, completionNode.getCompletionPrefix(), kinds, completionNode.getCompletionContext());
|
||||
addToCompletions (result);
|
||||
}
|
||||
private void completionOnScopedReference(IASTCompletionNode completionNode){
|
||||
// 1. Get the search scope node
|
||||
// the search node is the name before the qualification
|
||||
IASTScope searchNode = completionNode.getCompletionScope();
|
||||
// here we have to look for anything that could be referenced within this scope
|
||||
// 1. lookup local variables, global variables, functions, methods, structures, enums, and namespaces
|
||||
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[4];
|
||||
kinds[0] = IASTNode.LookupKind.VARIABLES;
|
||||
kinds[1] = IASTNode.LookupKind.STRUCTURES;
|
||||
kinds[2] = IASTNode.LookupKind.ENUMERATIONS;
|
||||
kinds[3] = IASTNode.LookupKind.NAMESPACES;
|
||||
ILookupResult result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, completionNode.getCompletionContext());
|
||||
addToCompletions(result);
|
||||
// TODO
|
||||
// lookup static members (field / methods) in type
|
||||
}
|
||||
|
||||
// private void completionOnScopedReference(IASTCompletionNode completionNode){
|
||||
// // 1. Get the search scope node
|
||||
// // the search node is the name before the qualification
|
||||
// IASTScope searchNode = completionNode.getCompletionScope();
|
||||
// // here we have to look for anything that could be referenced within this scope
|
||||
// // 1. lookup local variables, global variables, functions, methods, structures, enums, and namespaces
|
||||
// IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[4];
|
||||
// kinds[0] = IASTNode.LookupKind.VARIABLES;
|
||||
// kinds[1] = IASTNode.LookupKind.STRUCTURES;
|
||||
// kinds[2] = IASTNode.LookupKind.ENUMERATIONS;
|
||||
// kinds[3] = IASTNode.LookupKind.NAMESPACES;
|
||||
// ILookupResult result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, completionNode.getCompletionContext());
|
||||
// addToCompletions(result);
|
||||
// // TODO
|
||||
// // lookup static members (field / methods) in type
|
||||
// }
|
||||
private void completionOnTypeReference(IASTCompletionNode completionNode){
|
||||
// completing on a type
|
||||
// 1. Get the search scope node
|
||||
|
@ -632,10 +633,10 @@ public class CompletionEngine implements RelevanceConstants {
|
|||
// completionOnMemberReference
|
||||
completionOnMemberReference(completionNode);
|
||||
}
|
||||
else if(kind == CompletionKind.SCOPED_REFERENCE){
|
||||
// completionOnMemberReference
|
||||
completionOnScopedReference(completionNode);
|
||||
}
|
||||
// else if(kind == CompletionKind.SCOPED_REFERENCE){
|
||||
// // completionOnMemberReference
|
||||
// completionOnScopedReference(completionNode);
|
||||
// }
|
||||
else if(kind == CompletionKind.FIELD_TYPE){
|
||||
// CompletionOnFieldType
|
||||
completionOnFieldType(completionNode);
|
||||
|
@ -686,7 +687,9 @@ public class CompletionEngine implements RelevanceConstants {
|
|||
}
|
||||
|
||||
// add keywords in all cases except for member and scoped reference cases.
|
||||
if((kind != CompletionKind.MEMBER_REFERENCE) &&(kind != CompletionKind.SCOPED_REFERENCE)){
|
||||
if((kind != CompletionKind.MEMBER_REFERENCE)
|
||||
// &&(kind != CompletionKind.SCOPED_REFERENCE)
|
||||
){
|
||||
addKeywordsToCompletions( completionNode.getKeywords());
|
||||
}
|
||||
|
||||
|
@ -701,8 +704,8 @@ public class CompletionEngine implements RelevanceConstants {
|
|||
String kindStr = "";
|
||||
if(kind == IASTCompletionNode.CompletionKind.MEMBER_REFERENCE)
|
||||
kindStr = "MEMBER_REFERENCE";
|
||||
else if(kind == IASTCompletionNode.CompletionKind.SCOPED_REFERENCE)
|
||||
kindStr = "SCOPED_REFERENCE";
|
||||
// else if(kind == IASTCompletionNode.CompletionKind.SCOPED_REFERENCE)
|
||||
// kindStr = "SCOPED_REFERENCE";
|
||||
else if(kind == IASTCompletionNode.CompletionKind.FIELD_TYPE)
|
||||
kindStr = "FIELD_TYPE Class Scope";
|
||||
else if(kind == IASTCompletionNode.CompletionKind.VARIABLE_TYPE)
|
||||
|
|
Loading…
Add table
Reference in a new issue