mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
CORE
Added OffsetLimitReachedException and restructured Parser exceptions. Continued support for code assist/selection search parser. Ensured all source in parser/ have copyright notices. TESTS Expanded ContextualParseTest::testBaseCase(). Updated tests to deal with new signatures/exceptions. UI Updated CompletionEngine to deal with new signatures/exceptions in parser.
This commit is contained in:
parent
e0485ec52b
commit
938c206289
34 changed files with 816 additions and 463 deletions
|
@ -1,3 +1,7 @@
|
|||
2003-12-11 John Camelon
|
||||
Expanded ContextualParseTest::testBaseCase().
|
||||
Updated tests to deal with new signatures/exceptions.
|
||||
|
||||
2003-12-11 Alain Magloire
|
||||
|
||||
New test files for the ICPathEntry in core model.
|
||||
|
|
|
@ -15,11 +15,12 @@ import java.io.StringReader;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.core.parser.EndOfFile;
|
||||
import org.eclipse.cdt.core.parser.EndOfFileException;
|
||||
import org.eclipse.cdt.core.parser.IScanner;
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.IToken;
|
||||
import org.eclipse.cdt.core.parser.NullSourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.OffsetLimitReachedException;
|
||||
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||
import org.eclipse.cdt.core.parser.ParserFactoryException;
|
||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
|
@ -72,7 +73,7 @@ public class BaseScannerTest extends TestCase {
|
|||
t= scanner.nextToken();
|
||||
}
|
||||
}
|
||||
catch ( EndOfFile e)
|
||||
catch ( EndOfFileException e)
|
||||
{
|
||||
}
|
||||
catch (ScannerException se)
|
||||
|
@ -87,9 +88,9 @@ public class BaseScannerTest extends TestCase {
|
|||
IToken t= scanner.nextToken();
|
||||
assertTrue(t.getType() == IToken.tIDENTIFIER);
|
||||
assertTrue(t.getImage().equals(expectedImage));
|
||||
} catch (EndOfFile e) {
|
||||
} catch (EndOfFileException e) {
|
||||
assertTrue(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void validateInteger(String expectedImage) throws ScannerException
|
||||
|
@ -98,7 +99,7 @@ public class BaseScannerTest extends TestCase {
|
|||
IToken t= scanner.nextToken();
|
||||
assertTrue(t.getType() == IToken.tINTEGER);
|
||||
assertTrue(t.getImage().equals(expectedImage));
|
||||
} catch (EndOfFile e) {
|
||||
} catch (EndOfFileException e) {
|
||||
assertTrue(false);
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +110,7 @@ public class BaseScannerTest extends TestCase {
|
|||
IToken t= scanner.nextToken();
|
||||
assertTrue(t.getType() == IToken.tFLOATINGPT);
|
||||
assertTrue(t.getImage().equals(expectedImage));
|
||||
} catch (EndOfFile e) {
|
||||
} catch (EndOfFileException e) {
|
||||
assertTrue(false);
|
||||
}
|
||||
}
|
||||
|
@ -121,9 +122,9 @@ public class BaseScannerTest extends TestCase {
|
|||
assertTrue(t.getType() == IToken.tCHAR );
|
||||
Character c = new Character( expected );
|
||||
assertEquals( t.getImage(), c.toString() );
|
||||
} catch (EndOfFile e) {
|
||||
} catch (EndOfFileException e) {
|
||||
assertTrue(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void validateChar( String expected ) throws ScannerException
|
||||
|
@ -132,9 +133,9 @@ public class BaseScannerTest extends TestCase {
|
|||
IToken t= scanner.nextToken();
|
||||
assertTrue(t.getType() == IToken.tCHAR );
|
||||
assertEquals( t.getImage(), expected );
|
||||
} catch (EndOfFile e) {
|
||||
} catch (EndOfFileException e) {
|
||||
assertTrue(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void validateString( String expectedImage ) throws ScannerException
|
||||
|
@ -151,9 +152,9 @@ public class BaseScannerTest extends TestCase {
|
|||
else
|
||||
assertTrue(t.getType() == IToken.tSTRING);
|
||||
assertTrue(t.getImage().equals(expectedImage));
|
||||
} catch (EndOfFile e) {
|
||||
} catch (EndOfFileException e) {
|
||||
assertTrue(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void validateToken(int tokenType) throws ScannerException
|
||||
|
@ -161,9 +162,11 @@ public class BaseScannerTest extends TestCase {
|
|||
try {
|
||||
IToken t= scanner.nextToken();
|
||||
assertTrue(t.getType() == tokenType);
|
||||
} catch (EndOfFile e) {
|
||||
} catch (OffsetLimitReachedException e) {
|
||||
assertTrue(false);
|
||||
}
|
||||
} catch (EndOfFileException e) {
|
||||
assertTrue(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void validateBalance(int expected)
|
||||
|
@ -180,8 +183,10 @@ public class BaseScannerTest extends TestCase {
|
|||
{
|
||||
try {
|
||||
assertNull(scanner.nextToken());
|
||||
} catch (EndOfFile e) {
|
||||
}
|
||||
}catch (OffsetLimitReachedException e) {
|
||||
assertTrue(false);
|
||||
} catch (EndOfFileException e) {
|
||||
}
|
||||
}
|
||||
|
||||
public void validateDefinition(String name, String value)
|
||||
|
@ -223,7 +228,7 @@ public class BaseScannerTest extends TestCase {
|
|||
IToken t= scanner.nextToken();
|
||||
assertTrue(t.getType() == IToken.tLCHAR );
|
||||
assertEquals( t.getImage(), string );
|
||||
} catch (EndOfFile e) {
|
||||
} catch (EndOfFileException e) {
|
||||
assertTrue(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,8 +65,6 @@ import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTVariable;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNode.LookupKind;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNode.LookupResult;
|
||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,17 +7,15 @@
|
|||
package org.eclipse.cdt.core.parser.tests;
|
||||
|
||||
import java.io.StringReader;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.eclipse.cdt.core.parser.IParser;
|
||||
import org.eclipse.cdt.core.parser.IParserLogService;
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.NullSourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.core.parser.ScannerInfo;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode;
|
||||
import org.eclipse.cdt.internal.core.parser.ParserLogService;
|
||||
|
||||
|
@ -27,17 +25,17 @@ import org.eclipse.cdt.internal.core.parser.ParserLogService;
|
|||
* To change the template for this generated type comment go to Window -
|
||||
* Preferences - Java - Code Generation - Code and Comments
|
||||
*/
|
||||
public class ContextualParseTest extends TestCase {
|
||||
public class ContextualParseTest extends CompleteParseBaseTest {
|
||||
|
||||
|
||||
public ContextualParseTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
protected IASTCompletionNode parse(String code, int offset)
|
||||
throws Exception {
|
||||
ISourceElementRequestor requestor = new NullSourceElementRequestor();
|
||||
IParserLogService log = new ParserLogService();
|
||||
|
||||
callback = new FullParseCallback();
|
||||
IParser parser = null;
|
||||
|
||||
parser =
|
||||
|
@ -48,9 +46,9 @@ public class ContextualParseTest extends TestCase {
|
|||
new ScannerInfo(),
|
||||
ParserMode.CONTEXTUAL_PARSE,
|
||||
ParserLanguage.CPP,
|
||||
requestor,
|
||||
callback,
|
||||
log),
|
||||
requestor,
|
||||
callback,
|
||||
ParserMode.CONTEXTUAL_PARSE,
|
||||
ParserLanguage.CPP,
|
||||
log);
|
||||
|
@ -61,9 +59,39 @@ public class ContextualParseTest extends TestCase {
|
|||
|
||||
public void testBaseCase() throws Exception
|
||||
{
|
||||
IASTCompletionNode node = parse( "class ABC { }; AB\n\n", 17);
|
||||
StringWriter writer = new StringWriter();
|
||||
writer.write( "class ABC " );
|
||||
writer.write( "{int x;}; " );
|
||||
writer.write( "AB\n\n" );
|
||||
|
||||
IASTCompletionNode node = parse( writer.toString(), 21);
|
||||
assertNotNull( node );
|
||||
assertNotNull( node.getCompletionPrefix() );
|
||||
assertEquals( node.getCompletionScope(), ((Scope)callback.getCompilationUnit()).getScope() );
|
||||
assertEquals( node.getCompletionPrefix(), "A");
|
||||
assertEquals( node.getCompletionKind(), IASTCompletionNode.CompletionKind.VARIABLE_TYPE );
|
||||
|
||||
node = parse( writer.toString(), 12);
|
||||
assertNotNull( node );
|
||||
assertNotNull( node.getCompletionPrefix() );
|
||||
assertTrue( node.getCompletionScope() instanceof IASTClassSpecifier );
|
||||
assertEquals( node.getCompletionPrefix(), "i");
|
||||
assertEquals( node.getCompletionKind(), IASTCompletionNode.CompletionKind.FIELD_TYPE );
|
||||
|
||||
|
||||
node = parse( writer.toString(), 22);
|
||||
assertNotNull( node );
|
||||
assertNotNull( node.getCompletionPrefix() );
|
||||
assertEquals( node.getCompletionScope(), ((Scope)callback.getCompilationUnit()).getScope() );
|
||||
assertEquals( node.getCompletionPrefix(), "AB");
|
||||
assertEquals( node.getCompletionKind(), IASTCompletionNode.CompletionKind.VARIABLE_TYPE );
|
||||
|
||||
node = parse( writer.toString(), 6);
|
||||
assertNotNull( node );
|
||||
assertNotNull( node.getCompletionPrefix() );
|
||||
assertEquals( node.getCompletionScope(), ((Scope)callback.getCompilationUnit()).getScope() );
|
||||
assertEquals( node.getCompletionPrefix(), "");
|
||||
assertEquals( node.getCompletionKind(), IASTCompletionNode.CompletionKind.USER_SPECIFIED_NAME );
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class ParserTestSuite extends TestCase {
|
|||
suite.addTestSuite(QuickParseASTTests.class);
|
||||
suite.addTestSuite(ParserSymbolTableTest.class);
|
||||
suite.addTestSuite(CModelElementsTests.class);
|
||||
// suite.addTestSuite(ContextualParseTest.class);
|
||||
suite.addTestSuite(ContextualParseTest.class);
|
||||
// suite.addTestSuite(MacroTests.class);
|
||||
suite.addTestSuite( PreprocessorTest.class );
|
||||
suite.addTestSuite( PreprocessorConditionalTest.class );
|
||||
|
@ -39,7 +39,5 @@ public class ParserTestSuite extends TestCase {
|
|||
suite.addTestSuite( CompleteParseASTTest.class );
|
||||
suite.addTestSuite( CompleteParseASTExpressionTest.class );
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,11 @@ import java.io.StringReader;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.parser.EndOfFile;
|
||||
import org.eclipse.cdt.core.parser.EndOfFileException;
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.IToken;
|
||||
import org.eclipse.cdt.core.parser.NullSourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.OffsetLimitReachedException;
|
||||
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
|
@ -79,7 +80,11 @@ public class PreprocessorConditionalTest extends BaseScannerTest
|
|||
{
|
||||
fail( "Got #error, should not have gotten that.");
|
||||
}
|
||||
catch( EndOfFile eof )
|
||||
catch( OffsetLimitReachedException olre )
|
||||
{
|
||||
fail( "Should never have reached OffsetLimitReachedException");
|
||||
}
|
||||
catch( EndOfFileException eof )
|
||||
{
|
||||
// expected
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.io.Writer;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.EndOfFile;
|
||||
import org.eclipse.cdt.core.parser.EndOfFileException;
|
||||
import org.eclipse.cdt.core.parser.IMacroDescriptor;
|
||||
import org.eclipse.cdt.core.parser.IProblem;
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
|
@ -853,7 +853,7 @@ public class ScannerTestCase extends BaseScannerTest
|
|||
}
|
||||
}
|
||||
|
||||
public void testQuickScan() throws EndOfFile, ParserFactoryException
|
||||
public void testQuickScan() throws EndOfFileException, ParserFactoryException
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2003-12-11 John Camelon
|
||||
Added OffsetLimitReachedException and restructured Parser exceptions.
|
||||
Continued support for code assist/selection search parser.
|
||||
Ensured all source in parser/ have copyright notices.
|
||||
|
||||
2003-12-09 Andrew Niefer
|
||||
-created TypeFilter to support support filtering of what kind of symbols to find (for prefix lookup 48306)
|
||||
-added IContainerSymbol.isVisible for bug 48294
|
||||
|
|
|
@ -14,6 +14,6 @@ package org.eclipse.cdt.core.parser;
|
|||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class Backtrack extends Exception
|
||||
public class BacktrackException extends Exception
|
||||
{
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
* Created on Dec 8, 2003
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Generation - Code and Comments
|
||||
*/
|
||||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Generation - Code and Comments
|
||||
*/
|
||||
public class CompletionNode implements IASTCompletionNode {
|
||||
|
||||
private final String prefix;
|
||||
private final IASTNode context;
|
||||
private final IASTScope scope;
|
||||
private final CompletionKind kind;
|
||||
|
||||
public CompletionNode( CompletionKind kind, IASTScope scope, IASTNode context, String prefix )
|
||||
{
|
||||
this.kind = kind;
|
||||
this.context = context;
|
||||
this.scope = scope;
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTCompletionNode#getCompletionKind()
|
||||
*/
|
||||
public CompletionKind getCompletionKind() {
|
||||
return kind;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTCompletionNode#getCompletionScope()
|
||||
*/
|
||||
public IASTScope getCompletionScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTCompletionNode#getCompletionContext()
|
||||
*/
|
||||
public IASTNode getCompletionContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTCompletionNode#getCompletionPrefix()
|
||||
*/
|
||||
public String getCompletionPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,28 +1,35 @@
|
|||
/*
|
||||
* Created on Dec 8, 2003
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Generation - Code and Comments
|
||||
*/
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||
import org.eclipse.cdt.internal.core.parser.Parser;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.*;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Generation - Code and Comments
|
||||
*/
|
||||
public class ContextualParser extends Parser implements IParser {
|
||||
|
||||
private CompletionKind kind;
|
||||
private IASTScope scope;
|
||||
private IASTNode context;
|
||||
protected CompletionKind kind;
|
||||
protected IASTScope scope;
|
||||
protected IASTNode context;
|
||||
protected IToken finalToken;
|
||||
private Set keywordSet = new HashSet();
|
||||
|
||||
/**
|
||||
* @param scanner
|
||||
|
@ -42,14 +49,21 @@ public class ContextualParser extends Parser implements IParser {
|
|||
public IASTCompletionNode parse(int offset) throws ParserNotImplementedException {
|
||||
scanner.setOffsetBoundary(offset);
|
||||
translationUnit();
|
||||
return new CompletionNode( getCompletionKind(), getCompletionScope(), getCompletionContext(), getCompletionPrefix() );
|
||||
return new ASTCompletionNode( getCompletionKind(), getCompletionScope(), getCompletionContext(), getCompletionPrefix(), getKeywordSet() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
private Set getKeywordSet() {
|
||||
return keywordSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
private String getCompletionPrefix() {
|
||||
return lastToken == null ? "" : lastToken.getImage();
|
||||
return ( finalToken == null ? "" : finalToken.getImage() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -101,7 +115,7 @@ public class ContextualParser extends Parser implements IParser {
|
|||
this.kind = kind;
|
||||
}
|
||||
|
||||
protected void handleFunctionBody(IASTScope scope, boolean isInlineFunction) throws Backtrack, EndOfFile
|
||||
protected void handleFunctionBody(IASTScope scope, boolean isInlineFunction) throws BacktrackException, EndOfFileException
|
||||
{
|
||||
if ( isInlineFunction )
|
||||
skipOverCompoundStatement();
|
||||
|
@ -109,9 +123,17 @@ public class ContextualParser extends Parser implements IParser {
|
|||
functionBody(scope);
|
||||
}
|
||||
|
||||
protected void catchBlockCompoundStatement(IASTScope scope) throws Backtrack, EndOfFile
|
||||
protected void catchBlockCompoundStatement(IASTScope scope) throws BacktrackException, EndOfFileException
|
||||
{
|
||||
compoundStatement(scope, true);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.Parser#handleOffsetLimitException()
|
||||
*/
|
||||
protected void handleOffsetLimitException(OffsetLimitReachedException exception) throws EndOfFileException, OffsetLimitReachedException {
|
||||
finalToken = exception.getFinalToken();
|
||||
throw exception;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,6 @@ package org.eclipse.cdt.core.parser;
|
|||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class EndOfFile extends Backtrack
|
||||
public class EndOfFileException extends Exception
|
||||
{
|
||||
}
|
|
@ -54,10 +54,10 @@ public interface IParser {
|
|||
* @param expression Optional parameter representing an expression object that
|
||||
* your particular IParserCallback instance would appreciate
|
||||
*
|
||||
* @throws Backtrack thrown if the Scanner/Stream provided does not yield a valid
|
||||
* @throws BacktrackException thrown if the Scanner/Stream provided does not yield a valid
|
||||
* expression
|
||||
*/
|
||||
public IASTExpression expression(IASTScope scope) throws Backtrack;
|
||||
public IASTExpression expression(IASTScope scope) throws BacktrackException, EndOfFileException;
|
||||
|
||||
/**
|
||||
* If an error was encountered, give us the offset of the token that caused the error.
|
||||
|
|
|
@ -22,13 +22,13 @@ public interface IScanner {
|
|||
public void addIncludePath(String includePath);
|
||||
public void overwriteIncludePath( String [] newIncludePaths );
|
||||
|
||||
public IToken nextToken() throws ScannerException, EndOfFile;
|
||||
public IToken nextToken( boolean next ) throws ScannerException, EndOfFile;
|
||||
public IToken nextToken() throws ScannerException, EndOfFileException, OffsetLimitReachedException;
|
||||
public IToken nextToken( boolean next ) throws ScannerException, EndOfFileException, OffsetLimitReachedException;
|
||||
|
||||
public int getCount();
|
||||
public int getDepth();
|
||||
|
||||
public IToken nextTokenForStringizing() throws ScannerException, EndOfFile;
|
||||
public IToken nextTokenForStringizing() throws ScannerException, EndOfFileException, OffsetLimitReachedException;
|
||||
public void setTokenizingMacroReplacementList(boolean b);
|
||||
public void setThrowExceptionOnBadCharacterRead( boolean throwOnBad );
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class OffsetLimitReachedException extends EndOfFileException {
|
||||
|
||||
private final IToken finalToken;
|
||||
|
||||
public OffsetLimitReachedException( IToken token )
|
||||
{
|
||||
finalToken = token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the finalToken.
|
||||
*/
|
||||
public IToken getFinalToken() {
|
||||
return finalToken;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,16 +1,17 @@
|
|||
/*
|
||||
* Created on Dec 8, 2003
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Generation - Code and Comments
|
||||
*/
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Generation - Code and Comments
|
||||
*/
|
||||
public class ParserNotImplementedException extends Exception {
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class SyntaxErrorException extends Exception {
|
||||
|
||||
private final IProblem problem;
|
||||
|
||||
public IProblem getProblem()
|
||||
{
|
||||
return problem;
|
||||
}
|
||||
|
||||
public SyntaxErrorException( IProblem problem )
|
||||
{
|
||||
this.problem = problem;
|
||||
}
|
||||
}
|
|
@ -10,6 +10,8 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.ast;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.cdt.core.parser.Enum;
|
||||
|
||||
/**
|
||||
|
@ -20,22 +22,55 @@ public interface IASTCompletionNode {
|
|||
|
||||
public static class CompletionKind extends Enum
|
||||
{
|
||||
// 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 );
|
||||
|
||||
// stand-alone declaration type reference
|
||||
public static final CompletionKind VARIABLE_TYPE = new CompletionKind( 3 );
|
||||
|
||||
// function/method argument type reference
|
||||
public static final CompletionKind ARGUMENT_TYPE = new CompletionKind( 4 );
|
||||
|
||||
// inside code body - name reference
|
||||
public static final CompletionKind SINGLE_NAME_REFERENCE = new CompletionKind( 5 );
|
||||
|
||||
// any place one can expect a type
|
||||
public static final CompletionKind TYPE_REFERENCE = new CompletionKind( 6 );
|
||||
|
||||
// any place where one can expect a class name
|
||||
public static final CompletionKind CLASS_REFERENCE = new CompletionKind( 7 );
|
||||
|
||||
// any place where a namespace name is expected
|
||||
public static final CompletionKind NAMESPACE_REFERENCE = new CompletionKind( 8 );
|
||||
|
||||
// any place where an exception name is expected
|
||||
public static final CompletionKind EXCEPTION_REFERENCE = new CompletionKind( 9 );
|
||||
|
||||
// any place where exclusively a preprocessor macro name would be expected
|
||||
public static final CompletionKind MACRO_REFERENCE = new CompletionKind( 10 );
|
||||
|
||||
// any place where function arguments are expected
|
||||
public static final CompletionKind FUNCTION_REFERENCE = new CompletionKind( 11 );
|
||||
|
||||
// any place where constructor arguments are expected
|
||||
public static final CompletionKind CONSTRUCTOR_REFERENCE = new CompletionKind( 12 );
|
||||
|
||||
// any place where exclusively a keyword is expected
|
||||
public static final CompletionKind KEYWORD = new CompletionKind( 13 );
|
||||
|
||||
//TODO MORE TO COME
|
||||
// any place where exclusively a preprocessor directive is expected
|
||||
public static final CompletionKind PREPROCESSOR_DIRECTIVE = new CompletionKind( 14 );
|
||||
|
||||
// any place where a type or variable name is expected to be introduced
|
||||
public static final CompletionKind USER_SPECIFIED_NAME = new CompletionKind( 15 );
|
||||
|
||||
// error condition -- a place in the grammar where there is nothing to lookup
|
||||
public static final CompletionKind NO_SUCH_KIND = new CompletionKind( 200 );
|
||||
/**
|
||||
* @param enumValue
|
||||
*/
|
||||
|
@ -68,4 +103,10 @@ public interface IASTCompletionNode {
|
|||
* @return the prefix
|
||||
*/
|
||||
public String getCompletionPrefix();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public Iterator getKeywords();
|
||||
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public interface IASTNode {
|
|||
}
|
||||
}
|
||||
|
||||
public static class InvalidLookupKind extends Exception
|
||||
public static class LookupException extends Exception
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -56,9 +56,8 @@ public interface IASTNode {
|
|||
{
|
||||
public String getPrefix();
|
||||
public Iterator getNodes();
|
||||
public Iterator getKeywords();
|
||||
}
|
||||
|
||||
public LookupResult lookup( String prefix, LookupKind kind );
|
||||
public LookupResult lookup( String prefix, LookupKind kind ) throws LookupException;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.eclipse.cdt.core.parser.IProblem;
|
|||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public abstract class BaseProblemFactory {
|
||||
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
/*
|
||||
* Created on Dec 5, 2003
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Generation - Code and Comments
|
||||
*/
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser;
|
||||
|
||||
import org.eclipse.cdt.core.parser.Backtrack;
|
||||
import org.eclipse.cdt.core.parser.EndOfFile;
|
||||
import org.eclipse.cdt.core.parser.BacktrackException;
|
||||
import org.eclipse.cdt.core.parser.EndOfFileException;
|
||||
import org.eclipse.cdt.core.parser.IParserLogService;
|
||||
import org.eclipse.cdt.core.parser.IScanner;
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
|
@ -21,9 +25,6 @@ import org.eclipse.cdt.core.parser.ast.IASTScope;
|
|||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Generation - Code and Comments
|
||||
*/
|
||||
public class CompleteParser extends Parser {
|
||||
|
||||
|
@ -40,7 +41,7 @@ public class CompleteParser extends Parser {
|
|||
scanner.setASTFactory(astFactory);
|
||||
}
|
||||
|
||||
protected void handleFunctionBody(IASTScope scope, boolean isInlineFunction) throws Backtrack, EndOfFile
|
||||
protected void handleFunctionBody(IASTScope scope, boolean isInlineFunction) throws BacktrackException, EndOfFileException
|
||||
{
|
||||
if ( isInlineFunction )
|
||||
skipOverCompoundStatement();
|
||||
|
@ -48,7 +49,7 @@ public class CompleteParser extends Parser {
|
|||
functionBody(scope);
|
||||
}
|
||||
|
||||
protected void catchBlockCompoundStatement(IASTScope scope) throws Backtrack, EndOfFile
|
||||
protected void catchBlockCompoundStatement(IASTScope scope) throws BacktrackException, EndOfFileException
|
||||
{
|
||||
compoundStatement(scope, true);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
/*
|
||||
* Created on Dec 4, 2003
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Generation - Code and Comments
|
||||
*/
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -11,9 +15,6 @@ import java.io.Reader;
|
|||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Generation - Code and Comments
|
||||
*/
|
||||
public class LimitedScannerContext
|
||||
extends ScannerContext
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -12,11 +12,12 @@ package org.eclipse.cdt.internal.core.parser;
|
|||
|
||||
import java.io.Reader;
|
||||
|
||||
import org.eclipse.cdt.core.parser.EndOfFile;
|
||||
import org.eclipse.cdt.core.parser.EndOfFileException;
|
||||
import org.eclipse.cdt.core.parser.IParserLogService;
|
||||
import org.eclipse.cdt.core.parser.IPreprocessor;
|
||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.OffsetLimitReachedException;
|
||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.core.parser.ScannerException;
|
||||
|
@ -49,7 +50,12 @@ public class Preprocessor extends Scanner implements IPreprocessor {
|
|||
// callback IProblem here
|
||||
log.errorLog("Preprocessor Exception "+ se.getProblem().getMessage()); //$NON-NLS-1$h
|
||||
}
|
||||
catch( EndOfFile eof )
|
||||
catch( OffsetLimitReachedException olre )
|
||||
{
|
||||
// callback IProblem here
|
||||
log.errorLog("Preprocessor Exception "+ olre.getMessage()); //$NON-NLS-1$h
|
||||
}
|
||||
catch( EndOfFileException eof )
|
||||
{
|
||||
// expected
|
||||
}
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
/*
|
||||
* Created on Dec 5, 2003
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Generation - Code and Comments
|
||||
*/
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser;
|
||||
|
||||
import org.eclipse.cdt.core.parser.Backtrack;
|
||||
import org.eclipse.cdt.core.parser.EndOfFile;
|
||||
import org.eclipse.cdt.core.parser.BacktrackException;
|
||||
import org.eclipse.cdt.core.parser.EndOfFileException;
|
||||
import org.eclipse.cdt.core.parser.IParserLogService;
|
||||
import org.eclipse.cdt.core.parser.IScanner;
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
|
@ -21,9 +25,6 @@ import org.eclipse.cdt.core.parser.ast.IASTScope;
|
|||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Generation - Code and Comments
|
||||
*/
|
||||
public class QuickParser extends Parser {
|
||||
|
||||
|
@ -40,12 +41,12 @@ public class QuickParser extends Parser {
|
|||
scanner.setASTFactory(astFactory);
|
||||
}
|
||||
|
||||
protected void handleFunctionBody(IASTScope scope, boolean isInlineFunction) throws Backtrack, EndOfFile
|
||||
protected void handleFunctionBody(IASTScope scope, boolean isInlineFunction) throws BacktrackException, EndOfFileException
|
||||
{
|
||||
skipOverCompoundStatement();
|
||||
}
|
||||
|
||||
protected void catchBlockCompoundStatement(IASTScope scope) throws Backtrack, EndOfFile
|
||||
protected void catchBlockCompoundStatement(IASTScope scope) throws BacktrackException, EndOfFileException
|
||||
{
|
||||
skipOverCompoundStatement();
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ import java.util.Map;
|
|||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.cdt.core.parser.Backtrack;
|
||||
import org.eclipse.cdt.core.parser.EndOfFile;
|
||||
import org.eclipse.cdt.core.parser.BacktrackException;
|
||||
import org.eclipse.cdt.core.parser.EndOfFileException;
|
||||
import org.eclipse.cdt.core.parser.ILineOffsetReconciler;
|
||||
import org.eclipse.cdt.core.parser.IMacroDescriptor;
|
||||
import org.eclipse.cdt.core.parser.IParser;
|
||||
|
@ -38,6 +38,7 @@ import org.eclipse.cdt.core.parser.IScannerInfo;
|
|||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.IToken;
|
||||
import org.eclipse.cdt.core.parser.NullSourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.OffsetLimitReachedException;
|
||||
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||
import org.eclipse.cdt.core.parser.ParserFactoryException;
|
||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
|
@ -64,6 +65,7 @@ public class Scanner implements IScanner {
|
|||
private boolean initialContextInitialized = false;
|
||||
private final String filename;
|
||||
private final Reader reader;
|
||||
protected IToken finalToken;
|
||||
|
||||
protected void handleProblem( int problemID, String argument, int beginningOffset, boolean warning, boolean error ) throws ScannerException
|
||||
{
|
||||
|
@ -128,7 +130,7 @@ public class Scanner implements IScanner {
|
|||
contextStack.push( context, requestor );
|
||||
} catch( ContextException ce )
|
||||
{
|
||||
// should never occur
|
||||
handleInternalError();
|
||||
}
|
||||
initialContextInitialized = true;
|
||||
}
|
||||
|
@ -179,7 +181,7 @@ public class Scanner implements IScanner {
|
|||
while ((c != NOCHAR) && ((c == ' ') || (c == '\t')))
|
||||
{
|
||||
c = getChar();
|
||||
result = true;
|
||||
result = true;
|
||||
}
|
||||
if (c != NOCHAR)
|
||||
ungetChar(c);
|
||||
|
@ -284,9 +286,10 @@ public class Scanner implements IScanner {
|
|||
private void setCurrentToken(IToken t) {
|
||||
if (currentToken != null)
|
||||
currentToken.setNext(t);
|
||||
finalToken = t;
|
||||
currentToken = t;
|
||||
}
|
||||
|
||||
|
||||
protected void resetStorageBuffer()
|
||||
{
|
||||
if( storageBuffer != null )
|
||||
|
@ -691,15 +694,15 @@ public class Scanner implements IScanner {
|
|||
getChar();
|
||||
}
|
||||
|
||||
public IToken nextToken() throws ScannerException, EndOfFile {
|
||||
public IToken nextToken() throws ScannerException, EndOfFileException, OffsetLimitReachedException {
|
||||
return nextToken( true, false );
|
||||
}
|
||||
|
||||
public IToken nextToken(boolean pasting) throws ScannerException, EndOfFile {
|
||||
public IToken nextToken(boolean pasting) throws ScannerException, EndOfFileException, OffsetLimitReachedException {
|
||||
return nextToken( pasting, false );
|
||||
}
|
||||
|
||||
public IToken nextToken( boolean pasting, boolean lookingForNextAlready ) throws ScannerException, EndOfFile
|
||||
public IToken nextToken( boolean pasting, boolean lookingForNextAlready ) throws ScannerException, EndOfFileException, OffsetLimitReachedException
|
||||
{
|
||||
if( ! initialContextInitialized )
|
||||
setupInitialContext();
|
||||
|
@ -793,7 +796,7 @@ public class Scanner implements IScanner {
|
|||
IToken next = null;
|
||||
try{
|
||||
next = nextToken( true, true );
|
||||
} catch( EndOfFile e ){
|
||||
} catch( EndOfFileException e ){
|
||||
next = null;
|
||||
}
|
||||
|
||||
|
@ -804,7 +807,7 @@ public class Scanner implements IScanner {
|
|||
currentToken = returnToken;
|
||||
try{
|
||||
next = nextToken( true, true );
|
||||
} catch( EndOfFile e ){
|
||||
} catch( EndOfFileException e ){
|
||||
next = null;
|
||||
}
|
||||
}
|
||||
|
@ -1598,11 +1601,11 @@ public class Scanner implements IScanner {
|
|||
}
|
||||
default :
|
||||
handleProblem( IProblem.SCANNER_BAD_CHARACTER, new Character( (char)c ).toString(), getCurrentOffset(), false, true, throwExceptionOnBadCharacterRead );
|
||||
c = ' ';
|
||||
c = getChar();
|
||||
continue;
|
||||
}
|
||||
|
||||
throw Parser.endOfFile;
|
||||
throwEOF();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1613,7 +1616,8 @@ public class Scanner implements IScanner {
|
|||
}
|
||||
|
||||
// we're done
|
||||
throw Parser.endOfFile;
|
||||
throwEOF();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1683,7 +1687,7 @@ public class Scanner implements IScanner {
|
|||
// the static instance we always use
|
||||
protected static endOfMacroTokenException endOfMacroToken = new endOfMacroTokenException();
|
||||
|
||||
public IToken nextTokenForStringizing() throws ScannerException, EndOfFile
|
||||
public IToken nextTokenForStringizing() throws ScannerException, EndOfFileException, OffsetLimitReachedException
|
||||
{
|
||||
int beginOffset = getCurrentOffset();
|
||||
int c = getChar();
|
||||
|
@ -1771,10 +1775,24 @@ public class Scanner implements IScanner {
|
|||
}
|
||||
|
||||
// we're done
|
||||
throw Parser.endOfFile;
|
||||
throwEOF();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected void throwEOF() throws EndOfFileException, OffsetLimitReachedException {
|
||||
if( offsetLimit == NO_OFFSET_LIMIT )
|
||||
throw new EndOfFileException();
|
||||
|
||||
if( finalToken.getEndOffset() == offsetLimit )
|
||||
throw new OffsetLimitReachedException(finalToken);
|
||||
throw new OffsetLimitReachedException( null );
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
cppKeywords.put("and", new Integer(IToken.t_and));
|
||||
cppKeywords.put("and_eq", new Integer(IToken.t_and_eq));
|
||||
|
@ -1956,20 +1974,21 @@ public class Scanner implements IScanner {
|
|||
parser = ParserFactory.createParser(trial, nullCallback, ParserMode.QUICK_PARSE, language, log );
|
||||
} catch( ParserFactoryException pfe )
|
||||
{
|
||||
// TODO - make INTERNAL IProblem
|
||||
// should never happen
|
||||
handleInternalError();
|
||||
}
|
||||
try {
|
||||
IASTExpression exp = parser.expression(null);
|
||||
if( exp.evaluateExpression() == 0 )
|
||||
return false;
|
||||
return true;
|
||||
} catch( Backtrack backtrack )
|
||||
} catch( BacktrackException backtrack )
|
||||
{
|
||||
handleProblem( IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR, expression, beginningOffset, false, true, true );
|
||||
}
|
||||
catch (ExpressionEvaluationException e) {
|
||||
handleProblem( IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR, expression, beginningOffset, false, true, true );
|
||||
} catch (EndOfFileException e) {
|
||||
handleProblem( IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR, expression, beginningOffset, false, true, true );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -2058,10 +2077,13 @@ public class Scanner implements IScanner {
|
|||
|
||||
try {
|
||||
t = helperScanner.nextToken(false);
|
||||
} catch (EndOfFile eof) {
|
||||
} catch (OffsetLimitReachedException e) {
|
||||
handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#include " + includeLine, beginningOffset, false, true, true );
|
||||
return;
|
||||
}
|
||||
} catch (EndOfFileException eof) {
|
||||
handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#include " + includeLine, beginningOffset, false, true, true );
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (t.getType() == IToken.tSTRING) {
|
||||
|
@ -2091,7 +2113,7 @@ public class Scanner implements IScanner {
|
|||
|
||||
endOffset = baseOffset + t.getEndOffset();
|
||||
|
||||
} catch (EndOfFile eof) {
|
||||
} catch (EndOfFileException eof) {
|
||||
handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#include " + includeLine, beginningOffset, false, true, true );
|
||||
return;
|
||||
}
|
||||
|
@ -2105,10 +2127,13 @@ public class Scanner implements IScanner {
|
|||
} else
|
||||
handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#include " + includeLine, beginningOffset, false, true, true );
|
||||
}
|
||||
catch( EndOfFile eof )
|
||||
catch (OffsetLimitReachedException e) {
|
||||
handleInternalError();
|
||||
}
|
||||
catch( EndOfFileException eof )
|
||||
{
|
||||
// good
|
||||
}
|
||||
}
|
||||
|
||||
} else
|
||||
handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#include " + includeLine, beginningOffset, false, true, true );
|
||||
|
@ -2172,7 +2197,7 @@ public class Scanner implements IScanner {
|
|||
forInclusion = b;
|
||||
}
|
||||
|
||||
protected void poundDefine(int beginning) throws ScannerException, EndOfFile {
|
||||
protected void poundDefine(int beginning) throws ScannerException, EndOfFileException {
|
||||
skipOverWhitespace();
|
||||
// definition
|
||||
String key = getNextIdentifier();
|
||||
|
@ -2245,8 +2270,12 @@ public class Scanner implements IScanner {
|
|||
} catch (ParserFactoryException e1) {
|
||||
}
|
||||
helperScanner.setTokenizingMacroReplacementList( true );
|
||||
IToken t = helperScanner.nextToken(false);
|
||||
|
||||
IToken t = null;
|
||||
try {
|
||||
t = helperScanner.nextToken(false);
|
||||
} catch (OffsetLimitReachedException e2) {
|
||||
handleInternalError();
|
||||
}
|
||||
try {
|
||||
while (true) {
|
||||
//each # preprocessing token in the replacement list shall be followed
|
||||
|
@ -2268,7 +2297,11 @@ public class Scanner implements IScanner {
|
|||
t = helperScanner.nextToken(false);
|
||||
}
|
||||
}
|
||||
catch( EndOfFile eof )
|
||||
catch( OffsetLimitReachedException olre )
|
||||
{
|
||||
handleInternalError();
|
||||
}
|
||||
catch( EndOfFileException eof )
|
||||
{
|
||||
// good
|
||||
}
|
||||
|
@ -2363,7 +2396,6 @@ public class Scanner implements IScanner {
|
|||
}
|
||||
else if( newDefinition instanceof String )
|
||||
{
|
||||
|
||||
if( previousDefinition instanceof String )
|
||||
{
|
||||
Scanner previous = new Scanner( new StringReader( (String)previousDefinition ), "redef-test", new ScannerInfo(), new NullSourceElementRequestor(),
|
||||
|
@ -2383,7 +2415,11 @@ public class Scanner implements IScanner {
|
|||
break;
|
||||
|
||||
}
|
||||
catch( EndOfFile eof )
|
||||
catch( OffsetLimitReachedException olre )
|
||||
{
|
||||
handleInternalError();
|
||||
}
|
||||
catch( EndOfFileException eof )
|
||||
{
|
||||
if( ( p != null ) && ( c == null ) )
|
||||
break;
|
||||
|
@ -2394,12 +2430,16 @@ public class Scanner implements IScanner {
|
|||
c = current.nextToken();
|
||||
break;
|
||||
}
|
||||
catch( EndOfFile eof2 )
|
||||
catch( OffsetLimitReachedException olre )
|
||||
{
|
||||
handleInternalError();
|
||||
}
|
||||
catch( EndOfFileException eof2 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2408,7 +2448,15 @@ public class Scanner implements IScanner {
|
|||
}
|
||||
}
|
||||
|
||||
protected Vector getMacroParameters (String params, boolean forStringizing) throws ScannerException {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected void handleInternalError() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
protected Vector getMacroParameters (String params, boolean forStringizing) throws ScannerException {
|
||||
|
||||
Scanner tokenizer = new Scanner(new StringReader(params), TEXT, new ScannerInfo( definitions, originalConfig.getIncludePaths() ), new NullSourceElementRequestor(), mode, language, log);
|
||||
tokenizer.setThrowExceptionOnBadCharacterRead(false);
|
||||
|
@ -2449,10 +2497,16 @@ public class Scanner implements IScanner {
|
|||
}
|
||||
space = true;
|
||||
}
|
||||
} catch (EndOfFile e) {
|
||||
}
|
||||
catch( OffsetLimitReachedException olre )
|
||||
{
|
||||
handleInternalError();
|
||||
}
|
||||
catch (EndOfFileException e) {
|
||||
// Good
|
||||
parameterValues.add(str);
|
||||
}
|
||||
|
||||
|
||||
return parameterValues;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
/*
|
||||
* Created on Dec 8, 2003
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Generation - Code and Comments
|
||||
*/
|
||||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser;
|
||||
|
||||
import org.eclipse.cdt.core.parser.Backtrack;
|
||||
import org.eclipse.cdt.core.parser.EndOfFile;
|
||||
import org.eclipse.cdt.core.parser.BacktrackException;
|
||||
import org.eclipse.cdt.core.parser.EndOfFileException;
|
||||
import org.eclipse.cdt.core.parser.IParser;
|
||||
import org.eclipse.cdt.core.parser.IParserLogService;
|
||||
import org.eclipse.cdt.core.parser.IScanner;
|
||||
|
@ -22,9 +26,6 @@ import org.eclipse.cdt.core.parser.ast.IASTScope;
|
|||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Generation - Code and Comments
|
||||
*/
|
||||
public class StructuralParser extends Parser implements IParser {
|
||||
|
||||
|
@ -46,7 +47,7 @@ public class StructuralParser extends Parser implements IParser {
|
|||
protected void handleFunctionBody(
|
||||
IASTScope scope,
|
||||
boolean isInlineFunction)
|
||||
throws Backtrack, EndOfFile {
|
||||
throws BacktrackException, EndOfFileException {
|
||||
skipOverCompoundStatement();
|
||||
}
|
||||
|
||||
|
@ -54,7 +55,7 @@ public class StructuralParser extends Parser implements IParser {
|
|||
* @see org.eclipse.cdt.internal.core.parser.Parser#catchBlockCompoundStatement(org.eclipse.cdt.core.parser.ast.IASTScope)
|
||||
*/
|
||||
protected void catchBlockCompoundStatement(IASTScope scope)
|
||||
throws Backtrack, EndOfFile {
|
||||
throws BacktrackException, EndOfFileException {
|
||||
skipOverCompoundStatement();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser.ast;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class ASTCompletionNode implements IASTCompletionNode {
|
||||
|
||||
private final String prefix;
|
||||
private final IASTNode context;
|
||||
private final IASTScope scope;
|
||||
private final CompletionKind kind;
|
||||
private final Set keywordSet;
|
||||
|
||||
public ASTCompletionNode( CompletionKind kind, IASTScope scope, IASTNode context, String prefix, Set keywords )
|
||||
{
|
||||
this.kind = kind;
|
||||
this.context = context;
|
||||
this.scope = scope;
|
||||
this.prefix = prefix;
|
||||
this.keywordSet = keywords;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTCompletionNode#getCompletionKind()
|
||||
*/
|
||||
public CompletionKind getCompletionKind() {
|
||||
return kind;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTCompletionNode#getCompletionScope()
|
||||
*/
|
||||
public IASTScope getCompletionScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTCompletionNode#getCompletionContext()
|
||||
*/
|
||||
public IASTNode getCompletionContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTCompletionNode#getCompletionPrefix()
|
||||
*/
|
||||
public String getCompletionPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTCompletionNode#getKeywords()
|
||||
*/
|
||||
public Iterator getKeywords() {
|
||||
if( keywordSet == null )
|
||||
return new EmptyIterator();
|
||||
return keywordSet.iterator();
|
||||
}
|
||||
|
||||
}
|
|
@ -32,7 +32,9 @@ public abstract class ASTSymbol extends ASTSymbolOwner implements ISymbolOwner,
|
|||
*/
|
||||
public IASTScope getOwnerScope()
|
||||
{
|
||||
return (IASTScope)symbol.getContainingSymbol().getASTExtension().getPrimaryDeclaration();
|
||||
if( symbol.getContainingSymbol() != null )
|
||||
return (IASTScope)symbol.getContainingSymbol().getASTExtension().getPrimaryDeclaration();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@ import java.util.List;
|
|||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNode.LookupKind;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNode.LookupResult;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
|
|
@ -18,9 +18,6 @@ import org.eclipse.cdt.core.parser.ast.IASTNode.LookupKind;
|
|||
|
||||
/**
|
||||
* @author aniefer
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Generation - Code and Comments
|
||||
*/
|
||||
public class TypeFilter {
|
||||
|
||||
|
|
|
@ -18,13 +18,14 @@ import java.io.StringReader;
|
|||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.eclipse.cdt.core.parser.EndOfFile;
|
||||
import org.eclipse.cdt.core.parser.EndOfFileException;
|
||||
import org.eclipse.cdt.core.parser.IParser;
|
||||
import org.eclipse.cdt.core.parser.IProblem;
|
||||
import org.eclipse.cdt.core.parser.IQuickParseCallback;
|
||||
import org.eclipse.cdt.core.parser.IScanner;
|
||||
import org.eclipse.cdt.core.parser.IToken;
|
||||
import org.eclipse.cdt.core.parser.NullSourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.OffsetLimitReachedException;
|
||||
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||
import org.eclipse.cdt.core.parser.ParserFactoryException;
|
||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
|
@ -362,7 +363,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
|
|||
|
||||
try {
|
||||
token = scanner.nextToken();
|
||||
} catch (EndOfFile e) {
|
||||
} catch (EndOfFileException e) {
|
||||
} catch (ScannerException e) {
|
||||
}
|
||||
|
||||
|
@ -581,7 +582,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (EndOfFile e) {
|
||||
} catch (EndOfFileException e) {
|
||||
list.addLast( name.toCharArray() );
|
||||
} catch (ScannerException e) {
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
2003-12-11 John Camelon
|
||||
Updated CompletionEngine to deal with new signatures/exceptions in parser.
|
||||
|
||||
2002-12-11 David Inglis
|
||||
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=48596
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTVariable;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNode.LookupException;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNode.LookupResult;
|
||||
import org.eclipse.cdt.internal.core.CharOperation;
|
||||
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
|
||||
|
@ -176,8 +177,6 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
try {
|
||||
result = parser.parse(completionOffset);
|
||||
} catch (ParserNotImplementedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
|
@ -275,8 +274,6 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
IASTNode node = (IASTNode) nodes.next();
|
||||
addNodeToCompletions(node, result.getPrefix());
|
||||
}
|
||||
Iterator keywords = result.getKeywords();
|
||||
addKeywordsToCompletions(keywords);
|
||||
return ;
|
||||
}
|
||||
|
||||
|
@ -297,15 +294,38 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
// Completing after a dot
|
||||
// 1. Get the search scope node
|
||||
IASTNode searchNode = completionNode.getCompletionScope();
|
||||
|
||||
LookupResult result = null;
|
||||
// 2. lookup fields & add to completion proposals
|
||||
LookupResult result = searchNode.lookup (completionNode.getCompletionPrefix(), IASTNode.LookupKind.FIELDS);
|
||||
addToCompletions (result);
|
||||
// 3. looup methods & add to completion proposals
|
||||
result = searchNode.lookup (completionNode.getCompletionPrefix(), IASTNode.LookupKind.METHODS);
|
||||
addToCompletions (result);
|
||||
// 4. lookup nested structures & add to completion proposals
|
||||
result = searchNode.lookup (completionNode.getCompletionPrefix(), IASTNode.LookupKind.STRUCTURES);
|
||||
addToCompletions (result);
|
||||
try
|
||||
{
|
||||
result = searchNode.lookup (completionNode.getCompletionPrefix(), IASTNode.LookupKind.FIELDS);
|
||||
addToCompletions (result);
|
||||
}
|
||||
catch( IASTNode.LookupException ilk )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// 3. looup methods & add to completion proposals
|
||||
result = searchNode.lookup (completionNode.getCompletionPrefix(), IASTNode.LookupKind.METHODS);
|
||||
addToCompletions (result);
|
||||
}
|
||||
catch( IASTNode.LookupException ilk )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
// 4. lookup nested structures & add to completion proposals
|
||||
result = searchNode.lookup (completionNode.getCompletionPrefix(), IASTNode.LookupKind.STRUCTURES);
|
||||
addToCompletions (result);
|
||||
} catch (LookupException e) {
|
||||
}
|
||||
|
||||
}
|
||||
private void completionOnTypeReference(IASTCompletionNode completionNode){
|
||||
// completing on a type
|
||||
|
@ -314,8 +334,13 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
// if the prefix is not empty
|
||||
if(completionNode.getCompletionPrefix().length() > 0 ) {
|
||||
// 2. Lookup all types that could be used here
|
||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.STRUCTURES);
|
||||
addToCompletions(result);
|
||||
LookupResult result;
|
||||
try {
|
||||
result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.STRUCTURES);
|
||||
addToCompletions(result);
|
||||
} catch (LookupException e) {
|
||||
}
|
||||
|
||||
// 3. Lookup keywords
|
||||
// basic types should be in the keyword list
|
||||
List keywords = lookupKeyword(completionNode.getCompletionPrefix(), BASIC_TYPES_KEYWORDS);
|
||||
|
@ -334,8 +359,15 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
// 3. lookup methods
|
||||
// we are at a field declaration place, the user could be trying to override a function.
|
||||
// We have to lookup functions that could be overridden here.
|
||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.METHODS);
|
||||
addToCompletions(result);
|
||||
LookupResult result;
|
||||
try {
|
||||
result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.METHODS);
|
||||
addToCompletions(result);
|
||||
} catch (LookupException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
private void completionOnVariableType(IASTCompletionNode completionNode){
|
||||
// 1. basic completion on all types
|
||||
|
@ -349,13 +381,28 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
if (completionNode.getCompletionPrefix().length() > 0){
|
||||
// here we have to look for anything that could be referenced within this scope
|
||||
// 1. lookup local variables, global variables, functions, methods, structures, enums, macros, and namespaces
|
||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.ALL);
|
||||
addToCompletions(result);
|
||||
try
|
||||
{
|
||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.ALL);
|
||||
addToCompletions(result);
|
||||
}
|
||||
catch( LookupException ilk )
|
||||
{
|
||||
|
||||
}
|
||||
} else // prefix is empty
|
||||
{
|
||||
// 1. look only for local variables
|
||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.LOCAL_VARIABLES);
|
||||
addToCompletions(result);
|
||||
// 1. look only for local variables
|
||||
try
|
||||
{
|
||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.LOCAL_VARIABLES);
|
||||
addToCompletions(result);
|
||||
}
|
||||
catch( LookupException ilk )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// 2. and what can be accessed through the "this" pointer
|
||||
// TODO : complete the lookup call
|
||||
}
|
||||
|
@ -366,23 +413,42 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
IASTNode 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, macros, and namespaces
|
||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.ALL);
|
||||
addToCompletions(result);
|
||||
try
|
||||
{
|
||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.ALL);
|
||||
addToCompletions(result);
|
||||
}
|
||||
catch( LookupException ilk )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void completionOnClassReference(IASTCompletionNode completionNode){
|
||||
// 1. Get the search scope node
|
||||
IASTNode searchNode = completionNode.getCompletionScope();
|
||||
// only look for classes
|
||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.CLASSES);
|
||||
addToCompletions(result);
|
||||
try
|
||||
{
|
||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.CLASSES);
|
||||
addToCompletions(result);
|
||||
}
|
||||
catch( LookupException ilk )
|
||||
{
|
||||
}
|
||||
}
|
||||
private void completionOnNamespaceReference(IASTCompletionNode completionNode){
|
||||
// 1. Get the search scope node
|
||||
IASTNode searchNode = completionNode.getCompletionScope();
|
||||
// only look for classes
|
||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.NAMESPACES);
|
||||
addToCompletions(result);
|
||||
try
|
||||
{
|
||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.NAMESPACES);
|
||||
addToCompletions(result);
|
||||
}
|
||||
catch( LookupException ilk )
|
||||
{
|
||||
}
|
||||
}
|
||||
private void completionOnExceptionReference(IASTCompletionNode completionNode){
|
||||
// here we have to look for all types
|
||||
|
@ -396,8 +462,14 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
// 1. Get the search scope node
|
||||
IASTNode searchNode = completionNode.getCompletionScope();
|
||||
// only look for macros
|
||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.MACROS);
|
||||
addToCompletions(result);
|
||||
try
|
||||
{
|
||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.MACROS);
|
||||
addToCompletions(result);
|
||||
}
|
||||
catch( LookupException ilk )
|
||||
{
|
||||
}
|
||||
}
|
||||
private void completionOnFunctionReference(IASTCompletionNode completionNode){
|
||||
// TODO: complete the lookups
|
||||
|
@ -406,7 +478,14 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
// 1. Get the search scope node
|
||||
IASTNode searchNode = completionNode.getCompletionScope();
|
||||
// only lookup constructors
|
||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.CONSTRUCTORS);
|
||||
try
|
||||
{
|
||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.CONSTRUCTORS);
|
||||
}
|
||||
catch( LookupException ilk )
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
private void completionOnKeyword(IASTCompletionNode completionNode){
|
||||
// lookup every type of keywords
|
||||
|
@ -485,6 +564,7 @@ public class CompletionEngine implements RelevanceConstants{
|
|||
completionOnKeyword(completionNode);
|
||||
}
|
||||
|
||||
addKeywordsToCompletions( completionNode.getKeywords());
|
||||
completionList.addAll(completions);
|
||||
return completionNode;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue