mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
org.eclipse.cdt.core<BR><BR>
nbsp;Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=59134<BR> nbsp;Partially fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=58858<BR> nbsp;Added in additional CompletionKind's for STRUCT_REFERENCE, UNION_REFERENCE and ENUM_REFERENCE. <BR> <BR> org.eclipse.cdt.core.tests<BR> nbsp;Updated CompletionParseTest for CompletionKind updates.
This commit is contained in:
parent
dd0baea2ea
commit
93c7225abf
6 changed files with 34 additions and 24 deletions
|
@ -1,3 +1,6 @@
|
|||
2004-04-20 John Camelon
|
||||
Updated CompletionParseTest for CompletionKind updates.
|
||||
|
||||
2004-04-20 John Camelon
|
||||
Moved testBug39684() & testBug39695() from ASTFailedTests to QuickParseASTTests.
|
||||
Updated CompleteParseASTTest::testBug39697().
|
||||
|
|
|
@ -141,7 +141,7 @@ public class CompletionParseTest extends CompleteParseBaseTest {
|
|||
assertNotNull( node.getCompletionPrefix() );
|
||||
assertEquals( node.getCompletionScope(), ((Scope)callback.getCompilationUnit()).getScope() );
|
||||
assertEquals( node.getCompletionPrefix(), "");
|
||||
assertEquals( node.getCompletionKind(), IASTCompletionNode.CompletionKind.USER_SPECIFIED_NAME );
|
||||
assertEquals( node.getCompletionKind(), IASTCompletionNode.CompletionKind.CLASS_REFERENCE );
|
||||
keywords = node.getKeywords();
|
||||
assertFalse( keywords.hasNext() );
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2004-04-20 John Camelon
|
||||
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=59134
|
||||
Partially fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=58858
|
||||
Added in additional CompletionKind's for STRUCT_REFERENCE, UNION_REFERENCE and ENUM_REFERENCE.
|
||||
|
||||
2004-04-20 John Camelon
|
||||
Restructuring of the parser extension packages.
|
||||
Introduce IParserExtension and IASTFactory mechanisms w/partial implementation for GCC.
|
||||
|
|
|
@ -70,6 +70,15 @@ public interface IASTCompletionNode {
|
|||
// inside something that does not reach the parser - (#ifdefed out/comment)
|
||||
public static final CompletionKind UNREACHABLE_CODE = new CompletionKind( 17 );
|
||||
|
||||
// structs only
|
||||
public static final CompletionKind STRUCT_REFERENCE = new CompletionKind( 18 );
|
||||
|
||||
// unions only
|
||||
public static final CompletionKind UNION_REFERENCE = new CompletionKind( 19 );
|
||||
|
||||
// enums only
|
||||
public static final CompletionKind ENUM_REFERENCE = new CompletionKind( 20 );
|
||||
|
||||
// error condition -- a place in the grammar where there is nothing to lookup
|
||||
public static final CompletionKind NO_SUCH_KIND = new CompletionKind( 200 );
|
||||
/**
|
||||
|
|
|
@ -1691,26 +1691,32 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
// this is an elaborated class specifier
|
||||
IToken t = consume();
|
||||
ASTClassKind eck = null;
|
||||
CompletionKind completionKind = null;
|
||||
|
||||
switch (t.getType())
|
||||
{
|
||||
case IToken.t_class :
|
||||
eck = ASTClassKind.CLASS;
|
||||
completionKind = CompletionKind.CLASS_REFERENCE;
|
||||
break;
|
||||
case IToken.t_struct :
|
||||
eck = ASTClassKind.STRUCT;
|
||||
completionKind = CompletionKind.STRUCT_REFERENCE;
|
||||
break;
|
||||
case IToken.t_union :
|
||||
eck = ASTClassKind.UNION;
|
||||
completionKind = CompletionKind.UNION_REFERENCE;
|
||||
break;
|
||||
case IToken.t_enum :
|
||||
eck = ASTClassKind.ENUM;
|
||||
completionKind = CompletionKind.ENUM_REFERENCE;
|
||||
break;
|
||||
default :
|
||||
backup( t );
|
||||
throw backtrack;
|
||||
}
|
||||
|
||||
ITokenDuple d = name(sdw.getScope(), CompletionKind.TYPE_REFERENCE);
|
||||
ITokenDuple d = name(sdw.getScope(), completionKind);
|
||||
IASTTypeSpecifier elaboratedTypeSpec = null;
|
||||
final boolean isForewardDecl = ( LT(1) == IToken.tSEMI );
|
||||
|
||||
|
@ -1749,26 +1755,6 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
IToken first = consume(IToken.tIDENTIFIER); // throws backtrack if its not that
|
||||
return first;
|
||||
}
|
||||
/**
|
||||
* Parses a className.
|
||||
*
|
||||
* class-name: identifier | template-id
|
||||
*
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected ITokenDuple className(IASTScope scope) throws EndOfFileException, BacktrackException
|
||||
{
|
||||
// ITokenDuple duple = name(scope, CompletionKind.USER_SPECIFIED_NAME );
|
||||
// IToken last = duple.getLastToken();
|
||||
// if (LT(1) == IToken.tLT) {
|
||||
// last = consumeTemplateParameters(duple.getLastToken());
|
||||
// //last = templateArgumentList( scope, duple.getLastToken() );
|
||||
// }
|
||||
//
|
||||
// return new TokenDuple(duple.getFirstToken(), last);
|
||||
return name( scope, CompletionKind.USER_SPECIFIED_NAME );
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the initDeclarator construct of the ANSI C++ spec.
|
||||
*
|
||||
|
@ -2341,9 +2327,11 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
IToken mark = mark();
|
||||
IToken identifier = null;
|
||||
consume( IToken.t_enum );
|
||||
setCompletionValues( sdw.getScope(), CompletionKind.ENUM_REFERENCE );
|
||||
if (LT(1) == IToken.tIDENTIFIER)
|
||||
{
|
||||
identifier = identifier();
|
||||
setCompletionValues( sdw.getScope(), CompletionKind.ENUM_REFERENCE );
|
||||
}
|
||||
if (LT(1) == IToken.tLBRACE)
|
||||
{
|
||||
|
@ -2463,6 +2451,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
{
|
||||
ClassNameType nameType = ClassNameType.IDENTIFIER;
|
||||
ASTClassKind classKind = null;
|
||||
CompletionKind completionKind = null;
|
||||
ASTAccessVisibility access = ASTAccessVisibility.PUBLIC;
|
||||
IToken classKey = null;
|
||||
IToken mark = mark();
|
||||
|
@ -2474,14 +2463,17 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
classKey = consume();
|
||||
classKind = ASTClassKind.CLASS;
|
||||
access = ASTAccessVisibility.PRIVATE;
|
||||
completionKind = CompletionKind.CLASS_REFERENCE;
|
||||
break;
|
||||
case IToken.t_struct :
|
||||
classKey = consume();
|
||||
classKind = ASTClassKind.STRUCT;
|
||||
completionKind = CompletionKind.STRUCT_REFERENCE;
|
||||
break;
|
||||
case IToken.t_union :
|
||||
classKey = consume();
|
||||
classKind = ASTClassKind.UNION;
|
||||
completionKind = CompletionKind.UNION_REFERENCE;
|
||||
break;
|
||||
default :
|
||||
throw backtrack;
|
||||
|
@ -2490,10 +2482,10 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
|
||||
ITokenDuple duple = null;
|
||||
|
||||
setCompletionValues(sdw.getScope(), CompletionKind.USER_SPECIFIED_NAME, Key.EMPTY );
|
||||
setCompletionValues(sdw.getScope(), completionKind, Key.EMPTY );
|
||||
// class name
|
||||
if (LT(1) == IToken.tIDENTIFIER)
|
||||
duple = className(sdw.getScope());
|
||||
duple = name( sdw.getScope(), completionKind );
|
||||
if (duple != null && !duple.isIdentifier())
|
||||
nameType = ClassNameType.TEMPLATE;
|
||||
if (LT(1) != IToken.tCOLON && LT(1) != IToken.tLBRACE)
|
||||
|
|
|
@ -275,6 +275,7 @@ public class KeywordSets {
|
|||
EXPRESSION_C.add( Keywords.UNSIGNED);
|
||||
EXPRESSION_C.add( Keywords.FLOAT);
|
||||
EXPRESSION_C.add( Keywords.DOUBLE);
|
||||
EXPRESSION_C.add( Keywords.SIZEOF );
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue