mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-06 07:45:50 +02:00
org.eclipse.cdt.core
Fixed Bug 50487 - Wrong completion kind and prefix after "#ifdef" org.eclipse.cdt.ui.tests Updated CompletionFailedTest_MacroRef_NoPrefix_Bug50487, renamed it to CompletionTest_MacroRef_NoPrefix and moved to passed test package. Updated CompletionFailedTest_MacroRef_Prefix_Bug50487, renamed it to Y and moved to passed test package.
This commit is contained in:
parent
9d0e717ea4
commit
fbda3f7d9a
12 changed files with 186 additions and 46 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
2004-01-30 John Camelon
|
||||||
|
Fixed Bug 50487 - Wrong completion kind and prefix after "#ifdef"
|
||||||
|
|
||||||
2004-01-29 Hoda Amer
|
2004-01-29 Hoda Amer
|
||||||
Removed CompletionKind.KEYWORD.
|
Removed CompletionKind.KEYWORD.
|
||||||
|
|
||||||
|
|
|
@ -169,13 +169,36 @@ public class ContextualParser extends Parser implements IParser {
|
||||||
* @see org.eclipse.cdt.internal.core.parser.Parser#handleOffsetLimitException()
|
* @see org.eclipse.cdt.internal.core.parser.Parser#handleOffsetLimitException()
|
||||||
*/
|
*/
|
||||||
protected void handleOffsetLimitException(OffsetLimitReachedException exception) throws OffsetLimitReachedException {
|
protected void handleOffsetLimitException(OffsetLimitReachedException exception) throws OffsetLimitReachedException {
|
||||||
setCompletionToken( exception.getFinalToken() );
|
if( exception.getCompletionNode() == null )
|
||||||
if( (finalToken!= null )&& (finalToken.isKeywordOrOperator() ))
|
{
|
||||||
setCompletionToken(null);
|
setCompletionToken( exception.getFinalToken() );
|
||||||
|
if( (finalToken!= null )&& (finalToken.isKeywordOrOperator() ))
|
||||||
|
setCompletionToken(null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ASTCompletionNode node = (ASTCompletionNode) exception.getCompletionNode();
|
||||||
|
setCompletionValues( node.getCompletionKind(), node.getKeywordSet(), node.getCompletionPrefix() );
|
||||||
|
}
|
||||||
|
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param compilationUnit
|
||||||
|
* @param kind2
|
||||||
|
* @param set
|
||||||
|
* @param object
|
||||||
|
* @param string
|
||||||
|
*/
|
||||||
|
private void setCompletionValues(CompletionKind kind, Set keywordSet, String prefix ) {
|
||||||
|
setCompletionScope(compilationUnit);
|
||||||
|
this.keywordSet = keywordSet;
|
||||||
|
setCompletionKind(kind);
|
||||||
|
setCompletionContext(null);
|
||||||
|
setCompletionToken( new Token( IToken.tIDENTIFIER, prefix ) );
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.Parser#setCompletionKeywords(java.lang.String[])
|
* @see org.eclipse.cdt.internal.core.parser.Parser#setCompletionKeywords(java.lang.String[])
|
||||||
*/
|
*/
|
||||||
|
@ -217,8 +240,8 @@ public class ContextualParser extends Parser implements IParser {
|
||||||
CompletionKind kind,
|
CompletionKind kind,
|
||||||
Key key,
|
Key key,
|
||||||
IASTNode node, String prefix) throws EndOfFileException {
|
IASTNode node, String prefix) throws EndOfFileException {
|
||||||
setCompletionValues(scope, kind, key, node );
|
|
||||||
setCompletionToken( new Token( IToken.tIDENTIFIER, prefix ) );
|
setCompletionToken( new Token( IToken.tIDENTIFIER, prefix ) );
|
||||||
|
setCompletionValues(scope, kind, key, node );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -256,7 +279,6 @@ public class ContextualParser extends Parser implements IParser {
|
||||||
else if( scope instanceof IASTClassSpecifier )
|
else if( scope instanceof IASTClassSpecifier )
|
||||||
kind = CompletionKind.FIELD_TYPE;
|
kind = CompletionKind.FIELD_TYPE;
|
||||||
else if (scope instanceof IASTCodeScope)
|
else if (scope instanceof IASTCodeScope)
|
||||||
// kind = CompletionKind.STATEMENT_START;
|
|
||||||
kind = CompletionKind.SINGLE_NAME_REFERENCE;
|
kind = CompletionKind.SINGLE_NAME_REFERENCE;
|
||||||
else
|
else
|
||||||
kind = CompletionKind.VARIABLE_TYPE;
|
kind = CompletionKind.VARIABLE_TYPE;
|
||||||
|
|
|
@ -161,7 +161,6 @@ public abstract class Parser implements IParser
|
||||||
*/
|
*/
|
||||||
protected void translationUnit()
|
protected void translationUnit()
|
||||||
{
|
{
|
||||||
IASTCompilationUnit compilationUnit;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
compilationUnit = astFactory.createCompilationUnit();
|
compilationUnit = astFactory.createCompilationUnit();
|
||||||
|
@ -5275,6 +5274,7 @@ public abstract class Parser implements IParser
|
||||||
protected IToken currToken, // current token we plan to consume next
|
protected IToken currToken, // current token we plan to consume next
|
||||||
lastToken; // last token we consumed
|
lastToken; // last token we consumed
|
||||||
private boolean limitReached = false;
|
private boolean limitReached = false;
|
||||||
|
protected IASTCompilationUnit compilationUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches a token from the scanner.
|
* Fetches a token from the scanner.
|
||||||
|
|
|
@ -73,5 +73,11 @@ public class ASTCompletionNode implements IASTCompletionNode {
|
||||||
return new EmptyIterator();
|
return new EmptyIterator();
|
||||||
return keywordSet.iterator();
|
return keywordSet.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Set getKeywordSet()
|
||||||
|
{
|
||||||
|
return keywordSet;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,10 @@ import org.eclipse.cdt.internal.core.parser.scanner.IScannerContext.ContextKind;
|
||||||
public class ContextStack {
|
public class ContextStack {
|
||||||
|
|
||||||
private final IParserLogService log;
|
private final IParserLogService log;
|
||||||
|
private Scanner scanner;
|
||||||
|
|
||||||
public ContextStack( IParserLogService l ) {
|
public ContextStack( Scanner s, IParserLogService l ) {
|
||||||
|
scanner = s;
|
||||||
log = l;
|
log = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,4 +195,9 @@ public class ContextStack {
|
||||||
{
|
{
|
||||||
return topContext.getLine();
|
return topContext.getLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Scanner getScanner()
|
||||||
|
{
|
||||||
|
return scanner;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ public class LimitedScannerContext
|
||||||
implements IScannerContext {
|
implements IScannerContext {
|
||||||
|
|
||||||
private final int limit;
|
private final int limit;
|
||||||
|
private final Scanner scanner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param reader
|
* @param reader
|
||||||
|
@ -29,8 +30,9 @@ public class LimitedScannerContext
|
||||||
* @param object
|
* @param object
|
||||||
* @param offsetLimit
|
* @param offsetLimit
|
||||||
*/
|
*/
|
||||||
public LimitedScannerContext(Reader reader, String string, ContextKind kind, int offsetLimit) {
|
public LimitedScannerContext(Scanner scanner, Reader reader, String string, ContextKind kind, int offsetLimit) {
|
||||||
super( reader, string, kind, null );
|
super( reader, string, kind, null );
|
||||||
|
this.scanner = scanner;
|
||||||
limit = offsetLimit;
|
limit = offsetLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +42,11 @@ public class LimitedScannerContext
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IScannerContext#read()
|
* @see org.eclipse.cdt.internal.core.parser.IScannerContext#read()
|
||||||
*/
|
*/
|
||||||
public int read() throws IOException {
|
public int read() throws IOException {
|
||||||
if( getOffset() == limit ) throw new IOException();
|
if( getOffset() == limit )
|
||||||
|
{
|
||||||
|
scanner.setOffsetLimitReached(true);
|
||||||
|
throw new IOException();
|
||||||
|
}
|
||||||
return super.read();
|
return super.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,11 +49,14 @@ import org.eclipse.cdt.core.parser.ScannerException;
|
||||||
import org.eclipse.cdt.core.parser.ScannerInfo;
|
import org.eclipse.cdt.core.parser.ScannerInfo;
|
||||||
import org.eclipse.cdt.core.parser.IMacroDescriptor.MacroType;
|
import org.eclipse.cdt.core.parser.IMacroDescriptor.MacroType;
|
||||||
import org.eclipse.cdt.core.parser.ast.ASTExpressionEvaluationException;
|
import org.eclipse.cdt.core.parser.ast.ASTExpressionEvaluationException;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTExpression;
|
import org.eclipse.cdt.core.parser.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTFactory;
|
import org.eclipse.cdt.core.parser.ast.IASTFactory;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
|
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
|
||||||
import org.eclipse.cdt.core.parser.extension.IScannerExtension;
|
import org.eclipse.cdt.core.parser.extension.IScannerExtension;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.ast.ASTCompletionNode;
|
||||||
import org.eclipse.cdt.internal.core.parser.problem.IProblemFactory;
|
import org.eclipse.cdt.internal.core.parser.problem.IProblemFactory;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.token.KeywordSets;
|
||||||
import org.eclipse.cdt.internal.core.parser.token.Token;
|
import org.eclipse.cdt.internal.core.parser.token.Token;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,7 +112,7 @@ public class Scanner implements IScanner {
|
||||||
scannerExtension = extension;
|
scannerExtension = extension;
|
||||||
scannerExtension.setScanner( this );
|
scannerExtension.setScanner( this );
|
||||||
astFactory = ParserFactory.createASTFactory( mode, language );
|
astFactory = ParserFactory.createASTFactory( mode, language );
|
||||||
contextStack = new ContextStack( log );
|
contextStack = new ContextStack( this, log );
|
||||||
try {
|
try {
|
||||||
//this is a hack to get around a sudden EOF experience
|
//this is a hack to get around a sudden EOF experience
|
||||||
contextStack.push(
|
contextStack.push(
|
||||||
|
@ -277,7 +280,7 @@ public class Scanner implements IScanner {
|
||||||
if( offsetLimit == NO_OFFSET_LIMIT )
|
if( offsetLimit == NO_OFFSET_LIMIT )
|
||||||
context = new ScannerContext(reader, resolvedFilename, ScannerContext.ContextKind.TOP, null );
|
context = new ScannerContext(reader, resolvedFilename, ScannerContext.ContextKind.TOP, null );
|
||||||
else
|
else
|
||||||
context = new LimitedScannerContext( reader, resolvedFilename, ScannerContext.ContextKind.TOP, offsetLimit );
|
context = new LimitedScannerContext( this, reader, resolvedFilename, ScannerContext.ContextKind.TOP, offsetLimit );
|
||||||
contextStack.push( context, requestor );
|
contextStack.push( context, requestor );
|
||||||
} catch( ContextException ce )
|
} catch( ContextException ce )
|
||||||
{
|
{
|
||||||
|
@ -633,6 +636,7 @@ public class Scanner implements IScanner {
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ParserMode mode;
|
private final ParserMode mode;
|
||||||
|
private static final IScannerInfo EMPTY_INFO = new ScannerInfo();
|
||||||
|
|
||||||
public int getCharacter() throws ScannerException
|
public int getCharacter() throws ScannerException
|
||||||
{
|
{
|
||||||
|
@ -1328,6 +1332,10 @@ public class Scanner implements IScanner {
|
||||||
// get the rest of the line
|
// get the rest of the line
|
||||||
int currentOffset = getCurrentOffset();
|
int currentOffset = getCurrentOffset();
|
||||||
String expression = getRestOfPreprocessorLine();
|
String expression = getRestOfPreprocessorLine();
|
||||||
|
|
||||||
|
|
||||||
|
if( isLimitReached() )
|
||||||
|
handleCompletionOnExpression( expression );
|
||||||
|
|
||||||
if (expression.trim().equals(""))
|
if (expression.trim().equals(""))
|
||||||
handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#if", beginningOffset, false, true );
|
handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#if", beginningOffset, false, true );
|
||||||
|
@ -1344,7 +1352,12 @@ public class Scanner implements IScanner {
|
||||||
case PreprocessorDirectives.IFDEF :
|
case PreprocessorDirectives.IFDEF :
|
||||||
//TODO add in content assist stuff here
|
//TODO add in content assist stuff here
|
||||||
skipOverWhitespace();
|
skipOverWhitespace();
|
||||||
if (getDefinition(getNextIdentifier()) == null) {
|
|
||||||
|
String definition = getNextIdentifier();
|
||||||
|
if( isLimitReached() )
|
||||||
|
handleCompletionOnDefinition( definition );
|
||||||
|
|
||||||
|
if (getDefinition(definition) == null) {
|
||||||
// not defined
|
// not defined
|
||||||
passOnToClient = branches.poundIf( false );
|
passOnToClient = branches.poundIf( false );
|
||||||
skipOverTextUntilNewline();
|
skipOverTextUntilNewline();
|
||||||
|
@ -1369,7 +1382,12 @@ public class Scanner implements IScanner {
|
||||||
case PreprocessorDirectives.IFNDEF :
|
case PreprocessorDirectives.IFNDEF :
|
||||||
//TODO add in content assist stuff here
|
//TODO add in content assist stuff here
|
||||||
skipOverWhitespace();
|
skipOverWhitespace();
|
||||||
if (getDefinition(getNextIdentifier()) != null) {
|
|
||||||
|
String definition2 = getNextIdentifier();
|
||||||
|
if( isLimitReached() )
|
||||||
|
handleCompletionOnDefinition( definition2 );
|
||||||
|
|
||||||
|
if (getDefinition(definition2) != null) {
|
||||||
// not defined
|
// not defined
|
||||||
skipOverTextUntilNewline();
|
skipOverTextUntilNewline();
|
||||||
passOnToClient = branches.poundIf( false );
|
passOnToClient = branches.poundIf( false );
|
||||||
|
@ -1401,14 +1419,17 @@ public class Scanner implements IScanner {
|
||||||
case PreprocessorDirectives.ELIF :
|
case PreprocessorDirectives.ELIF :
|
||||||
//TODO add in content assist stuff here
|
//TODO add in content assist stuff here
|
||||||
int co = getCurrentOffset();
|
int co = getCurrentOffset();
|
||||||
String elsifExpression = getRestOfPreprocessorLine().trim();
|
String elifExpression = getRestOfPreprocessorLine();
|
||||||
|
if( isLimitReached() )
|
||||||
if (elsifExpression.equals(""))
|
handleCompletionOnExpression( elifExpression );
|
||||||
|
|
||||||
|
|
||||||
|
if (elifExpression.equals(""))
|
||||||
handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#elif", beginningOffset, false, true );
|
handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#elif", beginningOffset, false, true );
|
||||||
|
|
||||||
boolean elsifResult = false;
|
boolean elsifResult = false;
|
||||||
if( branches.queryCurrentBranchForElif() )
|
if( branches.queryCurrentBranchForElif() )
|
||||||
elsifResult = evaluateExpression(elsifExpression, co );
|
elsifResult = evaluateExpression(elifExpression, co );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1418,7 +1439,7 @@ public class Scanner implements IScanner {
|
||||||
{
|
{
|
||||||
StringBuffer buffer = new StringBuffer( token );
|
StringBuffer buffer = new StringBuffer( token );
|
||||||
buffer.append( ' ' );
|
buffer.append( ' ' );
|
||||||
buffer.append( elsifExpression );
|
buffer.append( elifExpression );
|
||||||
handleProblem( IProblem.PREPROCESSOR_UNBALANCE_CONDITION,
|
handleProblem( IProblem.PREPROCESSOR_UNBALANCE_CONDITION,
|
||||||
buffer.toString(),
|
buffer.toString(),
|
||||||
beginningOffset,
|
beginningOffset,
|
||||||
|
@ -1784,7 +1805,7 @@ public class Scanner implements IScanner {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
throwEOF();
|
throwEOF(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1795,13 +1816,57 @@ public class Scanner implements IScanner {
|
||||||
}
|
}
|
||||||
|
|
||||||
// we're done
|
// we're done
|
||||||
throwEOF();
|
throwEOF(null);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param definition
|
||||||
|
*/
|
||||||
|
private void handleCompletionOnDefinition(String definition) throws EndOfFileException {
|
||||||
|
IASTCompletionNode node = new ASTCompletionNode( IASTCompletionNode.CompletionKind.MACRO_REFERENCE,
|
||||||
|
null, null, definition, KeywordSets.getKeywords(KeywordSets.Key.MACRO, language) );
|
||||||
|
|
||||||
|
throwEOF( node );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param expression2
|
||||||
|
*/
|
||||||
|
private void handleCompletionOnExpression(String expression) throws EndOfFileException {
|
||||||
|
int completionPoint = expression.length();
|
||||||
|
IScanner subScanner = ParserFactory.createScanner( new StringReader(expression), SCRATCH, EMPTY_INFO, ParserMode.QUICK_PARSE, language, new NullSourceElementRequestor(), new NullLogService());
|
||||||
|
IToken lastToken = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lastToken = subScanner.nextToken();
|
||||||
|
}
|
||||||
|
catch( EndOfFileException eof )
|
||||||
|
{
|
||||||
|
// ok
|
||||||
|
} catch (ScannerException e) {
|
||||||
|
handleInternalError();
|
||||||
|
}
|
||||||
|
|
||||||
|
String prefix = "";
|
||||||
|
if( ( lastToken != null ))
|
||||||
|
{
|
||||||
|
if( ( lastToken.getType() == IToken.tIDENTIFIER )
|
||||||
|
&& ( lastToken.getEndOffset() == completionPoint ) )
|
||||||
|
{
|
||||||
|
prefix = lastToken.getImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IASTCompletionNode node = new ASTCompletionNode( IASTCompletionNode.CompletionKind.MACRO_REFERENCE,
|
||||||
|
null, null, prefix, KeywordSets.getKeywords(KeywordSets.Key.MACRO, language) );
|
||||||
|
|
||||||
|
throwEOF( node );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* @param key
|
* @param key
|
||||||
*/
|
*/
|
||||||
protected void removeSymbol(String key) {
|
protected void removeSymbol(String key) {
|
||||||
|
@ -1961,7 +2026,7 @@ public class Scanner implements IScanner {
|
||||||
}
|
}
|
||||||
|
|
||||||
// we're done
|
// we're done
|
||||||
throwEOF();
|
throwEOF(null);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1969,13 +2034,17 @@ public class Scanner implements IScanner {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected void throwEOF() throws EndOfFileException, OffsetLimitReachedException {
|
protected void throwEOF(IASTCompletionNode node) throws EndOfFileException, OffsetLimitReachedException {
|
||||||
if( offsetLimit == NO_OFFSET_LIMIT )
|
if( node == null )
|
||||||
throw new EndOfFileException();
|
{
|
||||||
|
if( offsetLimit == NO_OFFSET_LIMIT )
|
||||||
if( finalToken.getEndOffset() == offsetLimit )
|
throw new EndOfFileException();
|
||||||
throw new OffsetLimitReachedException(finalToken);
|
|
||||||
throw new OffsetLimitReachedException( (IToken)null );
|
if( finalToken.getEndOffset() == offsetLimit )
|
||||||
|
throw new OffsetLimitReachedException(finalToken);
|
||||||
|
throw new OffsetLimitReachedException( (IToken)null );
|
||||||
|
}
|
||||||
|
throw new OffsetLimitReachedException( node );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2973,7 +3042,8 @@ public class Scanner implements IScanner {
|
||||||
private final ISourceElementRequestor requestor;
|
private final ISourceElementRequestor requestor;
|
||||||
private IASTFactory astFactory = null;
|
private IASTFactory astFactory = null;
|
||||||
private static final int NO_OFFSET_LIMIT = -1;
|
private static final int NO_OFFSET_LIMIT = -1;
|
||||||
private int offsetLimit = NO_OFFSET_LIMIT;
|
private int offsetLimit = NO_OFFSET_LIMIT;
|
||||||
|
private boolean limitReached = false;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.IScanner#setASTFactory(org.eclipse.cdt.internal.core.parser.ast.IASTFactory)
|
* @see org.eclipse.cdt.core.parser.IScanner#setASTFactory(org.eclipse.cdt.internal.core.parser.ast.IASTFactory)
|
||||||
|
@ -2996,4 +3066,17 @@ public class Scanner implements IScanner {
|
||||||
return definitions;
|
return definitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param b
|
||||||
|
*/
|
||||||
|
public void setOffsetLimitReached(boolean b) {
|
||||||
|
limitReached = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isLimitReached()
|
||||||
|
{
|
||||||
|
if( offsetLimit == NO_OFFSET_LIMIT ) return false;
|
||||||
|
return limitReached;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ public class KeywordSets {
|
||||||
public static final Key POST_USING = new Key( 5 );
|
public static final Key POST_USING = new Key( 5 );
|
||||||
public static final Key FUNCTION_MODIFIER = new Key( 6 );
|
public static final Key FUNCTION_MODIFIER = new Key( 6 );
|
||||||
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 );
|
||||||
/**
|
/**
|
||||||
* @param enumValue
|
* @param enumValue
|
||||||
*/
|
*/
|
||||||
|
@ -62,6 +63,8 @@ public class KeywordSets {
|
||||||
return (Set) FUNCTION_MODIFIER.get( language );
|
return (Set) FUNCTION_MODIFIER.get( language );
|
||||||
if( kind == Key.NAMESPACE_ONLY )
|
if( kind == Key.NAMESPACE_ONLY )
|
||||||
return NAMESPACE_ONLY;
|
return NAMESPACE_ONLY;
|
||||||
|
if( kind == Key.MACRO )
|
||||||
|
return MACRO_ONLY;
|
||||||
|
|
||||||
//TODO finish this
|
//TODO finish this
|
||||||
return null;
|
return null;
|
||||||
|
@ -76,6 +79,14 @@ public class KeywordSets {
|
||||||
NAMESPACE_ONLY.add(Keywords.NAMESPACE );
|
NAMESPACE_ONLY.add(Keywords.NAMESPACE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Set MACRO_ONLY;
|
||||||
|
static
|
||||||
|
{
|
||||||
|
MACRO_ONLY = new HashSet();
|
||||||
|
MACRO_ONLY.add("defined()" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static final Set DECL_SPECIFIER_SEQUENCE_C;
|
private static final Set DECL_SPECIFIER_SEQUENCE_C;
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2004-01-30 John Camelon
|
||||||
|
Updated CompletionFailedTest_MacroRef_NoPrefix_Bug50487, renamed it to CompletionTest_MacroRef_NoPrefix and moved to passed test package.
|
||||||
|
Updated CompletionFailedTest_MacroRef_Prefix_Bug50487, renamed it to Y and moved to passed test package.
|
||||||
|
|
||||||
2004-01-29 Hoda Amer
|
2004-01-29 Hoda Amer
|
||||||
-Added CompletionTest_SingleName_Parameter test to success tests.
|
-Added CompletionTest_SingleName_Parameter test to success tests.
|
||||||
-Changed BaseTest to check if the expected values exist in the proposed values
|
-Changed BaseTest to check if the expected values exist in the proposed values
|
||||||
|
|
|
@ -71,8 +71,8 @@ public class AutomatedSuite extends TestSuite {
|
||||||
// Failed Tests
|
// Failed Tests
|
||||||
addTest(CompletionFailedTest_ScopedReference_NoPrefix_Bug50152.suite());
|
addTest(CompletionFailedTest_ScopedReference_NoPrefix_Bug50152.suite());
|
||||||
addTest(CompletionFailedTest_ScopedReference_Prefix_Bug50152.suite());
|
addTest(CompletionFailedTest_ScopedReference_Prefix_Bug50152.suite());
|
||||||
addTest(CompletionFailedTest_MacroRef_NoPrefix_Bug50487.suite());
|
addTest(CompletionTest_MacroRef_NoPrefix.suite());
|
||||||
addTest(CompletionFailedTest_MacroRef_Prefix_Bug50487.suite());
|
addTest(CompletionTest_MacroRef_Prefix.suite());
|
||||||
addTest(CompletionFailedTest_FunctionReference_Bug50807.suite());
|
addTest(CompletionFailedTest_FunctionReference_Bug50807.suite());
|
||||||
addTest(CompletionFailedTest_ConstructorReference_Bug50808.suite());
|
addTest(CompletionFailedTest_ConstructorReference_Bug50808.suite());
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,11 @@
|
||||||
* 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
|
||||||
|
@ -22,7 +21,7 @@ import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
||||||
* Bug#50487 :Wrong completion kind and prefix after "#ifdef"
|
* Bug#50487 :Wrong completion kind and prefix after "#ifdef"
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CompletionFailedTest_MacroRef_NoPrefix_Bug50487 extends CompletionProposalsBaseTest{
|
public class CompletionTest_MacroRef_NoPrefix extends CompletionProposalsBaseTest{
|
||||||
|
|
||||||
private final String fileName = "CompletionTestStart26.cpp";
|
private final String fileName = "CompletionTestStart26.cpp";
|
||||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||||
|
@ -30,7 +29,7 @@ public class CompletionFailedTest_MacroRef_NoPrefix_Bug50487 extends Completion
|
||||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||||
private final String expectedScopeName = "ASTCompilationUnit";
|
private final String expectedScopeName = "ASTCompilationUnit";
|
||||||
private final String expectedContextName = "null";
|
private final String expectedContextName = "null";
|
||||||
private final CompletionKind expectedKind = CompletionKind.VARIABLE_TYPE; // should be CompletionKind.MACRO_REFERENCE;
|
private final CompletionKind expectedKind = CompletionKind.MACRO_REFERENCE;
|
||||||
private final String expectedPrefix = "";
|
private final String expectedPrefix = "";
|
||||||
private final String[] expectedResults = {
|
private final String[] expectedResults = {
|
||||||
// Should be
|
// Should be
|
||||||
|
@ -39,13 +38,13 @@ public class CompletionFailedTest_MacroRef_NoPrefix_Bug50487 extends Completion
|
||||||
// "xMacro(x,y)"
|
// "xMacro(x,y)"
|
||||||
};
|
};
|
||||||
|
|
||||||
public CompletionFailedTest_MacroRef_NoPrefix_Bug50487(String name) {
|
public CompletionTest_MacroRef_NoPrefix(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
TestSuite suite= new TestSuite(CompletionFailedTest_MacroRef_NoPrefix_Bug50487.class.getName());
|
TestSuite suite= new TestSuite(CompletionTest_MacroRef_NoPrefix.class.getName());
|
||||||
suite.addTest(new CompletionFailedTest_MacroRef_NoPrefix_Bug50487("testCompletionProposals"));
|
suite.addTest(new CompletionTest_MacroRef_NoPrefix("testCompletionProposals"));
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,11 @@
|
||||||
* 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
|
||||||
|
@ -22,7 +21,7 @@ import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
||||||
* Bug#50487 :Wrong completion kind and prefix after "#ifdef"
|
* Bug#50487 :Wrong completion kind and prefix after "#ifdef"
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CompletionFailedTest_MacroRef_Prefix_Bug50487 extends CompletionProposalsBaseTest{
|
public class CompletionTest_MacroRef_Prefix extends CompletionProposalsBaseTest{
|
||||||
|
|
||||||
private final String fileName = "CompletionTestStart27.cpp";
|
private final String fileName = "CompletionTestStart27.cpp";
|
||||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||||
|
@ -30,20 +29,20 @@ public class CompletionFailedTest_MacroRef_Prefix_Bug50487 extends CompletionPr
|
||||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||||
private final String expectedScopeName = "ASTCompilationUnit";
|
private final String expectedScopeName = "ASTCompilationUnit";
|
||||||
private final String expectedContextName = "null";
|
private final String expectedContextName = "null";
|
||||||
private final CompletionKind expectedKind = CompletionKind.VARIABLE_TYPE; // should be CompletionKind.MACRO_REFERENCE;
|
private final CompletionKind expectedKind = CompletionKind.MACRO_REFERENCE;
|
||||||
private final String expectedPrefix = ""; // should be "D";
|
private final String expectedPrefix = "D";
|
||||||
private final String[] expectedResults = {
|
private final String[] expectedResults = {
|
||||||
// Should be
|
// Should be
|
||||||
// "Debug"
|
// "Debug"
|
||||||
};
|
};
|
||||||
|
|
||||||
public CompletionFailedTest_MacroRef_Prefix_Bug50487(String name) {
|
public CompletionTest_MacroRef_Prefix(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
TestSuite suite= new TestSuite(CompletionFailedTest_MacroRef_Prefix_Bug50487.class.getName());
|
TestSuite suite= new TestSuite(CompletionTest_MacroRef_Prefix.class.getName());
|
||||||
suite.addTest(new CompletionFailedTest_MacroRef_Prefix_Bug50487("testCompletionProposals"));
|
suite.addTest(new CompletionTest_MacroRef_Prefix("testCompletionProposals"));
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue