mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
CORE/UI
First pass of parsing function bodies with X-Reference information. Updated IASTFactory/ISourceElementRequestor to include IASTCodeScope constructs, clients should keep this in mind and update their implementations. TESTS Updated ASTFailedTests::testBug39702() to fail more accurately. Added testSimpleFunctionBody(), testSimpleForLoop() to CompleteParseASTTest.java.
This commit is contained in:
parent
55efa70a8a
commit
619b617056
18 changed files with 566 additions and 177 deletions
|
@ -1,3 +1,7 @@
|
|||
2003-09-04 John Camelon
|
||||
Updated ASTFailedTests::testBug39702() to fail more accurately.
|
||||
Added testSimpleFunctionBody(), testSimpleForLoop() to CompleteParseASTTest.java.
|
||||
|
||||
2003-09-04 Hoda Amer
|
||||
Call to ASTExpression getTypeId() changed to getTypeIdString().
|
||||
|
||||
|
|
|
@ -272,9 +272,7 @@ public class ASTFailedTests extends BaseASTTest
|
|||
catch (IOException ioe)
|
||||
{
|
||||
}
|
||||
Iterator declarations = parse(code.toString()).getDeclarations();
|
||||
IASTDeclaration d = (IASTDeclaration)declarations.next();
|
||||
assertFalse( "Should be 1 declaration, not 2", !declarations.hasNext() );
|
||||
assertCodeFailsFullParse(code.toString());
|
||||
}
|
||||
public void testBug39703() throws Exception
|
||||
{
|
||||
|
|
|
@ -506,7 +506,7 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
|||
|
||||
public void testBug41520() throws Exception
|
||||
{
|
||||
Iterator i = parse( "const int x = 666, y( x );").getDeclarations();
|
||||
Iterator i = parse( "const int x = 666; const int y( x );").getDeclarations();
|
||||
IASTVariable variableX = (IASTVariable)i.next();
|
||||
IASTVariable variableY = (IASTVariable)i.next();
|
||||
assertFalse( i.hasNext() );
|
||||
|
@ -552,7 +552,7 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
|||
|
||||
public void testIsDestructor() throws Exception
|
||||
{
|
||||
Iterator i = parse( "class A{ public: A(); }; \n A::~A() {}; \n" ).getDeclarations();
|
||||
Iterator i = parse( "class A{ public: ~A(); }; \n A::~A() {}; \n" ).getDeclarations();
|
||||
IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
IASTMethod method = (IASTMethod)i.next();
|
||||
assertTrue (method.isDestructor());
|
||||
|
@ -567,4 +567,34 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
|||
IASTClassSpecifier classB = (IASTClassSpecifier) ((IASTAbstractTypeSpecifierDeclaration)sub.next()).getTypeSpecifier();
|
||||
IASTClassSpecifier structA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)( getDeclarations( classB ).next())).getTypeSpecifier();
|
||||
}
|
||||
|
||||
public void testSimpleFunctionBody() throws Exception
|
||||
{
|
||||
Iterator i = parse( "class A { int f1(); }; const int x = 4; int f() { return x; } int A::f1() { return x; }").getDeclarations();
|
||||
IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
IASTMethod method_prototype = (IASTMethod)getDeclarations(classA).next();
|
||||
IASTVariable x = (IASTVariable) i.next();
|
||||
IASTFunction function_f = (IASTFunction) i.next();
|
||||
IASTMethod method_f = (IASTMethod)i.next();
|
||||
assertEquals( method_f.getName(), method_prototype.getName() );
|
||||
assertFalse( i.hasNext() );
|
||||
assertEquals( callback.getReferences().size(), 3 );
|
||||
IASTVariableReference referenceX = (IASTVariableReference) callback.getReferences().get(0);
|
||||
assertEquals( referenceX.getReferencedElement(), x );
|
||||
IASTClassReference referenceA = (IASTClassReference) callback.getReferences().get(1);
|
||||
assertEquals( referenceA.getReferencedElement(), classA );
|
||||
referenceX = (IASTVariableReference) callback.getReferences().get(2);
|
||||
assertEquals( referenceX.getReferencedElement(), x );
|
||||
}
|
||||
|
||||
|
||||
public void testSimpleForLoop() throws Exception
|
||||
{
|
||||
Iterator i = parse( "const int FIVE = 5; void f() { int x = 0; for( int i = 0; i < FIVE; ++i ) { x += i; } }").getDeclarations();
|
||||
IASTVariable five = (IASTVariable) i.next();
|
||||
IASTFunction f = (IASTFunction) i.next();
|
||||
assertFalse( i.hasNext() );
|
||||
assertEquals( callback.getReferences().size(), 5 );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -523,6 +523,22 @@ public class CompleteParseBaseTest extends TestCase
|
|||
{
|
||||
return forewardDecls;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope)
|
||||
*/
|
||||
public void enterCodeBlock(IASTScope scope) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope)
|
||||
*/
|
||||
public void exitCodeBlock(IASTScope scope) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
protected Iterator getDeclarations(IASTScope scope)
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
|
||||
|
@ -959,4 +960,18 @@ public class DOMBuilder implements ISourceElementRequestor
|
|||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope)
|
||||
*/
|
||||
public void enterCodeBlock(IASTScope scope) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope)
|
||||
*/
|
||||
public void exitCodeBlock(IASTScope scope) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
|
@ -36,6 +36,7 @@ import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
|
||||
|
@ -416,4 +417,18 @@ public class SourceIndexerRequestor implements ISourceElementRequestor, IIndexCo
|
|||
public void acceptElaboratedForewardDeclaration(IASTElaboratedTypeSpecifier elaboratedType){
|
||||
indexer.addElaboratedForwardDeclaration(elaboratedType);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope)
|
||||
*/
|
||||
public void enterCodeBlock(IASTScope scope) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope)
|
||||
*/
|
||||
public void exitCodeBlock(IASTScope scope) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2003-09-04 John Camelon
|
||||
First pass of parsing function bodies with X-Reference information.
|
||||
Updated IASTFactory/ISourceElementRequestor to include IASTCodeScope
|
||||
constructs, clients should keep this in mind and update their implementations.
|
||||
|
||||
2003-09-03 Andrew Niefer
|
||||
fix bug in PST that prevents > 2 constructors
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
|
||||
|
@ -60,6 +61,8 @@ public interface ISourceElementRequestor {
|
|||
|
||||
public void enterFunctionBody( IASTFunction function );
|
||||
public void exitFunctionBody( IASTFunction function );
|
||||
public void enterCodeBlock( IASTScope scope );
|
||||
public void exitCodeBlock( IASTScope scope );
|
||||
|
||||
public void enterCompilationUnit( IASTCompilationUnit compilationUnit );
|
||||
public void enterInclusion( IASTInclusion inclusion );
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Created on Sep 2, 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.ast;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public interface IASTCodeScope extends IASTScope, ISourceElementCallbackDelegate{
|
||||
|
||||
}
|
|
@ -11,7 +11,6 @@
|
|||
package org.eclipse.cdt.core.parser.ast;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.IToken;
|
||||
import org.eclipse.cdt.core.parser.ITokenDuple;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
|
||||
|
@ -191,8 +190,15 @@ public interface IASTFactory
|
|||
public IASTTypedefDeclaration createTypedef( IASTScope scope, String name, IASTAbstractDeclaration mapping, int startingOffset, int nameOffset ) throws ASTSemanticException;
|
||||
|
||||
public IASTAbstractTypeSpecifierDeclaration createTypeSpecDeclaration( IASTScope scope, IASTTypeSpecifier typeSpecifier, IASTTemplate template, int startingOffset, int endingOffset);
|
||||
|
||||
public boolean queryIsTypeName( IASTScope scope, ITokenDuple nameInQuestion );
|
||||
|
||||
static final String DOUBLE_COLON = "::";
|
||||
static final String TELTA = "~";
|
||||
/**
|
||||
* @param scope
|
||||
* @return
|
||||
*/
|
||||
public IASTCodeScope createNewCodeBlock(IASTScope scope);
|
||||
|
||||
}
|
|
@ -21,6 +21,7 @@ import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
|
||||
|
@ -405,5 +406,21 @@ public class NullSourceElementRequestor implements ISourceElementRequestor
|
|||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope)
|
||||
*/
|
||||
public void enterCodeBlock(IASTScope scope) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope)
|
||||
*/
|
||||
public void exitCodeBlock(IASTScope scope) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.eclipse.cdt.core.parser.ast.ASTSemanticException;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTArrayModifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCodeScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
|
||||
|
@ -704,11 +705,19 @@ public class Parser implements IParser
|
|||
{
|
||||
backup( mark );
|
||||
|
||||
simpleDeclaration(
|
||||
SimpleDeclarationStrategy.TRY_VARIABLE,
|
||||
false,
|
||||
scope,
|
||||
ownerTemplate);
|
||||
try
|
||||
{
|
||||
simpleDeclaration(
|
||||
SimpleDeclarationStrategy.TRY_VARIABLE,
|
||||
false,
|
||||
scope,
|
||||
ownerTemplate);
|
||||
}
|
||||
catch( Backtrack b3 )
|
||||
{
|
||||
backup( mark );
|
||||
throw b3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -853,7 +862,6 @@ public class Parser implements IParser
|
|||
sdw.isUnsigned(), sdw.isTypeNamed()));
|
||||
} catch( ASTSemanticException se )
|
||||
{
|
||||
failParse();
|
||||
throw backtrack;
|
||||
}
|
||||
|
||||
|
@ -902,13 +910,11 @@ public class Parser implements IParser
|
|||
}
|
||||
catch (ASTSemanticException e)
|
||||
{
|
||||
failParse();
|
||||
throw backtrack;
|
||||
}
|
||||
Iterator i = l.iterator();
|
||||
if (hasFunctionBody && l.size() != 1)
|
||||
{
|
||||
failParse();
|
||||
throw backtrack; //TODO Should be an IProblem
|
||||
}
|
||||
if (i.hasNext()) // no need to do this unless we have a declarator
|
||||
|
@ -928,7 +934,7 @@ public class Parser implements IParser
|
|||
IASTDeclaration declaration = (IASTDeclaration)i.next();
|
||||
declaration.enterScope( requestor );
|
||||
|
||||
handleFunctionBody(declarator);
|
||||
handleFunctionBody((IASTScope)declaration);
|
||||
((IASTOffsetableElement)declaration).setEndingOffset(
|
||||
lastToken.getEndOffset());
|
||||
|
||||
|
@ -948,7 +954,7 @@ public class Parser implements IParser
|
|||
}
|
||||
|
||||
}
|
||||
protected void handleFunctionBody(Declarator d) throws Backtrack, EndOfFile
|
||||
protected void handleFunctionBody(IASTScope scope) throws Backtrack, EndOfFile
|
||||
{
|
||||
if ( mode == ParserMode.QUICK_PARSE ) // TODO - Enable parsing within function bodies i.e. mode == ParserMode.QUICK_PARSE)
|
||||
{
|
||||
|
@ -971,7 +977,7 @@ public class Parser implements IParser
|
|||
}
|
||||
else
|
||||
{
|
||||
functionBody();
|
||||
functionBody(scope);
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -1668,15 +1674,22 @@ public class Parser implements IParser
|
|||
IToken mark = mark();
|
||||
|
||||
if (LT(1) == IToken.tCOLONCOLON)
|
||||
last = consume();
|
||||
last = consume( IToken.tCOLONCOLON );
|
||||
// TODO - whacky way to deal with destructors, please revisit
|
||||
if (LT(1) == IToken.tCOMPL)
|
||||
consume();
|
||||
switch (LT(1))
|
||||
{
|
||||
case IToken.tIDENTIFIER :
|
||||
last = consume();
|
||||
last = consumeTemplateParameters(last);
|
||||
last = consume(IToken.tIDENTIFIER);
|
||||
IToken secondMark = mark();
|
||||
try
|
||||
{
|
||||
last = consumeTemplateParameters(last);
|
||||
} catch( Backtrack bt )
|
||||
{
|
||||
backup( secondMark );
|
||||
}
|
||||
break;
|
||||
default :
|
||||
backup(mark);
|
||||
|
@ -1753,12 +1766,20 @@ public class Parser implements IParser
|
|||
}
|
||||
else if (LT(1) == IToken.tLPAREN)
|
||||
{
|
||||
IToken mark = mark();
|
||||
// initializer in constructor
|
||||
consume(IToken.tLPAREN); // EAT IT!
|
||||
IASTExpression astExpression = null;
|
||||
astExpression = expression(sdw.getScope());
|
||||
consume(IToken.tRPAREN);
|
||||
d.setConstructorExpression(astExpression);
|
||||
try
|
||||
{
|
||||
consume(IToken.tLPAREN); // EAT IT!
|
||||
IASTExpression astExpression = null;
|
||||
astExpression = expression(sdw.getScope());
|
||||
consume(IToken.tRPAREN);
|
||||
d.setConstructorExpression(astExpression);
|
||||
} catch( Backtrack bt )
|
||||
{
|
||||
backup( mark );
|
||||
throw bt;
|
||||
}
|
||||
}
|
||||
sdw.addDeclarator(d);
|
||||
return d;
|
||||
|
@ -1902,35 +1923,57 @@ public class Parser implements IParser
|
|||
if( forKR )
|
||||
throw backtrack;
|
||||
|
||||
|
||||
|
||||
// temporary fix for initializer/function declaration ambiguity
|
||||
if (!LA(2).looksLikeExpression() && strategy != SimpleDeclarationStrategy.TRY_VARIABLE )
|
||||
{
|
||||
// parameterDeclarationClause
|
||||
d.setIsFunction(true);
|
||||
// TODO need to create a temporary scope object here
|
||||
consume();
|
||||
boolean seenParameter = false;
|
||||
parameterDeclarationLoop : for (;;)
|
||||
{
|
||||
switch (LT(1))
|
||||
{
|
||||
case IToken.tRPAREN :
|
||||
consume();
|
||||
break parameterDeclarationLoop;
|
||||
case IToken.tELIPSE :
|
||||
consume();
|
||||
break;
|
||||
case IToken.tCOMMA :
|
||||
consume();
|
||||
seenParameter = false;
|
||||
break;
|
||||
default :
|
||||
if (seenParameter)
|
||||
throw backtrack;
|
||||
parameterDeclaration(d, scope);
|
||||
seenParameter = true;
|
||||
}
|
||||
}
|
||||
boolean failed = false;
|
||||
if( LT(2) == IToken.tIDENTIFIER )
|
||||
{
|
||||
IToken newMark = mark();
|
||||
consume( IToken.tLPAREN );
|
||||
|
||||
try
|
||||
{
|
||||
if( ! astFactory.queryIsTypeName( scope, name() ) )
|
||||
failed = true;
|
||||
} catch( Backtrack b )
|
||||
{
|
||||
failed = true;
|
||||
}
|
||||
|
||||
backup( newMark );
|
||||
}
|
||||
if( !failed )
|
||||
{
|
||||
// parameterDeclarationClause
|
||||
d.setIsFunction(true);
|
||||
// TODO need to create a temporary scope object here
|
||||
consume(IToken.tLPAREN);
|
||||
boolean seenParameter = false;
|
||||
parameterDeclarationLoop : for (;;)
|
||||
{
|
||||
switch (LT(1))
|
||||
{
|
||||
case IToken.tRPAREN :
|
||||
consume();
|
||||
break parameterDeclarationLoop;
|
||||
case IToken.tELIPSE :
|
||||
consume();
|
||||
break;
|
||||
case IToken.tCOMMA :
|
||||
consume();
|
||||
seenParameter = false;
|
||||
break;
|
||||
default :
|
||||
if (seenParameter)
|
||||
throw backtrack;
|
||||
parameterDeclaration(d, scope);
|
||||
seenParameter = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (LT(1) == IToken.tCOLON)
|
||||
{
|
||||
|
@ -2550,9 +2593,9 @@ public class Parser implements IParser
|
|||
*
|
||||
* @throws Backtrack request a backtrack
|
||||
*/
|
||||
protected void functionBody() throws Backtrack
|
||||
protected void functionBody( IASTScope scope ) throws Backtrack
|
||||
{
|
||||
compoundStatement();
|
||||
compoundStatement( scope, false );
|
||||
}
|
||||
/**
|
||||
* Parses a statement.
|
||||
|
@ -2565,67 +2608,80 @@ public class Parser implements IParser
|
|||
switch (LT(1))
|
||||
{
|
||||
case IToken.t_case :
|
||||
consume();
|
||||
constantExpression(scope);
|
||||
consume(IToken.t_case);
|
||||
IASTExpression constant_expression = constantExpression(scope);
|
||||
constant_expression.acceptElement(requestor);
|
||||
consume(IToken.tCOLON);
|
||||
statement(null);
|
||||
statement(scope);
|
||||
return;
|
||||
case IToken.t_default :
|
||||
consume();
|
||||
consume(IToken.t_default);
|
||||
consume(IToken.tCOLON);
|
||||
statement(null);
|
||||
statement(scope);
|
||||
return;
|
||||
case IToken.tLBRACE :
|
||||
compoundStatement();
|
||||
compoundStatement(scope, true);
|
||||
return;
|
||||
case IToken.t_if :
|
||||
consume();
|
||||
consume( IToken.t_if );
|
||||
consume(IToken.tLPAREN);
|
||||
condition();
|
||||
condition( scope );
|
||||
consume(IToken.tRPAREN);
|
||||
statement(null);
|
||||
if( LT(1) != IToken.tLBRACE )
|
||||
statement( astFactory.createNewCodeBlock( scope ) );
|
||||
else
|
||||
statement(scope);
|
||||
if (LT(1) == IToken.t_else)
|
||||
{
|
||||
consume();
|
||||
statement(null);
|
||||
consume( IToken.t_else );
|
||||
if( LT(1) != IToken.tLBRACE )
|
||||
statement( astFactory.createNewCodeBlock( scope ) );
|
||||
else
|
||||
statement( scope );
|
||||
}
|
||||
return;
|
||||
case IToken.t_switch :
|
||||
consume();
|
||||
consume(IToken.tLPAREN);
|
||||
condition();
|
||||
condition(scope);
|
||||
consume(IToken.tRPAREN);
|
||||
statement(null);
|
||||
statement(scope);
|
||||
return;
|
||||
case IToken.t_while :
|
||||
consume();
|
||||
consume(IToken.tLPAREN);
|
||||
condition();
|
||||
consume(IToken.tRPAREN);
|
||||
statement(null);
|
||||
return;
|
||||
case IToken.t_do :
|
||||
consume();
|
||||
statement(null);
|
||||
consume(IToken.t_while);
|
||||
consume(IToken.tLPAREN);
|
||||
condition();
|
||||
condition(scope);
|
||||
consume(IToken.tRPAREN);
|
||||
if( LT(1) != IToken.tLBRACE )
|
||||
statement(astFactory.createNewCodeBlock(scope));
|
||||
else
|
||||
statement(scope);
|
||||
return;
|
||||
case IToken.t_do :
|
||||
consume(IToken.t_do);
|
||||
if( LT(1) != IToken.tLBRACE )
|
||||
statement(astFactory.createNewCodeBlock(scope));
|
||||
else
|
||||
statement(scope);
|
||||
consume(IToken.t_while);
|
||||
consume(IToken.tLPAREN);
|
||||
condition(scope);
|
||||
consume(IToken.tRPAREN);
|
||||
return;
|
||||
case IToken.t_for :
|
||||
consume();
|
||||
consume(IToken.tLPAREN);
|
||||
forInitStatement();
|
||||
forInitStatement(scope);
|
||||
if (LT(1) != IToken.tSEMI)
|
||||
condition();
|
||||
condition(scope);
|
||||
consume(IToken.tSEMI);
|
||||
if (LT(1) != IToken.tRPAREN)
|
||||
{
|
||||
//TODO get rid of NULL
|
||||
expression(scope);
|
||||
{
|
||||
IASTExpression finalExpression = expression(scope);
|
||||
finalExpression.acceptElement(requestor);
|
||||
}
|
||||
consume(IToken.tRPAREN);
|
||||
statement(null);
|
||||
statement(scope);
|
||||
return;
|
||||
case IToken.t_break :
|
||||
consume();
|
||||
|
@ -2639,8 +2695,8 @@ public class Parser implements IParser
|
|||
consume();
|
||||
if (LT(1) != IToken.tSEMI)
|
||||
{
|
||||
//TODO get rid of NULL
|
||||
expression(scope);
|
||||
IASTExpression retVal = expression(scope);
|
||||
retVal.acceptElement(requestor);
|
||||
}
|
||||
consume(IToken.tSEMI);
|
||||
return;
|
||||
|
@ -2651,14 +2707,14 @@ public class Parser implements IParser
|
|||
return;
|
||||
case IToken.t_try :
|
||||
consume();
|
||||
compoundStatement();
|
||||
compoundStatement(scope,true);
|
||||
while (LT(1) == IToken.t_catch)
|
||||
{
|
||||
consume();
|
||||
consume(IToken.tLPAREN);
|
||||
declaration(null, null); // was exceptionDeclaration
|
||||
declaration(scope, null); // was exceptionDeclaration
|
||||
consume(IToken.tRPAREN);
|
||||
compoundStatement();
|
||||
compoundStatement(scope, true);
|
||||
}
|
||||
return;
|
||||
case IToken.tSEMI :
|
||||
|
@ -2669,50 +2725,97 @@ public class Parser implements IParser
|
|||
// label
|
||||
if (LT(1) == IToken.tIDENTIFIER && LT(2) == IToken.tCOLON)
|
||||
{
|
||||
consume();
|
||||
consume();
|
||||
statement(null);
|
||||
consume(IToken.tIDENTIFIER);
|
||||
consume(IToken.tCOLON);
|
||||
statement(scope);
|
||||
return;
|
||||
}
|
||||
// expressionStatement
|
||||
// Note: the function style cast ambiguity is handled in expression
|
||||
// Since it only happens when we are in a statement
|
||||
IToken mark = mark();
|
||||
try
|
||||
{
|
||||
expression(scope);
|
||||
IASTExpression thisExpression = expression(scope);
|
||||
consume(IToken.tSEMI);
|
||||
thisExpression.acceptElement( requestor );
|
||||
return;
|
||||
}
|
||||
catch (Backtrack b)
|
||||
{
|
||||
backup( mark );
|
||||
}
|
||||
// declarationStatement
|
||||
declaration(null, null);
|
||||
declaration(scope, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Backtrack
|
||||
*/
|
||||
protected void condition() throws Backtrack
|
||||
protected void condition( IASTScope scope ) throws Backtrack
|
||||
{
|
||||
// TO DO
|
||||
IASTExpression someExpression = expression( scope );
|
||||
someExpression.acceptElement(requestor);
|
||||
//TODO type-specifier-seq declarator = assignment expression
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Backtrack
|
||||
*/
|
||||
protected void forInitStatement( IASTScope scope ) throws Backtrack
|
||||
{
|
||||
try
|
||||
{
|
||||
simpleDeclarationStrategyUnion(scope,null);
|
||||
}
|
||||
catch( Backtrack bt )
|
||||
{
|
||||
try
|
||||
{
|
||||
IASTExpression e = expression( scope );
|
||||
e.acceptElement(requestor);
|
||||
}
|
||||
catch( Backtrack b )
|
||||
{
|
||||
failParse();
|
||||
throw b;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @throws Backtrack
|
||||
*/
|
||||
protected void forInitStatement() throws Backtrack
|
||||
{
|
||||
// TO DO
|
||||
}
|
||||
/**
|
||||
* @throws Backtrack
|
||||
*/
|
||||
protected void compoundStatement() throws Backtrack
|
||||
protected void compoundStatement( IASTScope scope, boolean createNewScope ) throws Backtrack
|
||||
{
|
||||
consume(IToken.tLBRACE);
|
||||
|
||||
IASTCodeScope newScope = null;
|
||||
if( createNewScope )
|
||||
{
|
||||
newScope = astFactory.createNewCodeBlock(scope);
|
||||
newScope.enterScope( requestor );
|
||||
}
|
||||
IToken checkToken = null;
|
||||
while (LT(1) != IToken.tRBRACE)
|
||||
statement(null);
|
||||
consume();
|
||||
{
|
||||
checkToken = LA(1);
|
||||
try
|
||||
{
|
||||
statement(createNewScope ? newScope : scope );
|
||||
}
|
||||
catch( Backtrack b )
|
||||
{
|
||||
failParse();
|
||||
if( LA(1) == checkToken )
|
||||
errorHandling();
|
||||
}
|
||||
}
|
||||
|
||||
consume(IToken.tRBRACE);
|
||||
if( createNewScope )
|
||||
newScope.exitScope( requestor );
|
||||
}
|
||||
/**
|
||||
* @param expression
|
||||
|
@ -2757,61 +2860,79 @@ public class Parser implements IParser
|
|||
* @param expression
|
||||
* @throws Backtrack
|
||||
*/
|
||||
protected IASTExpression assignmentExpression( IASTScope scope )
|
||||
throws Backtrack
|
||||
{
|
||||
if (LT(1) == IToken.t_throw)
|
||||
{
|
||||
return throwExpression(scope);
|
||||
}
|
||||
IASTExpression conditionalExpression =
|
||||
conditionalExpression(scope);
|
||||
// if the condition not taken, try assignment operators
|
||||
if (conditionalExpression != null
|
||||
&& conditionalExpression.getExpressionKind()
|
||||
== IASTExpression.Kind.CONDITIONALEXPRESSION_HARD)
|
||||
return conditionalExpression;
|
||||
switch (LT(1))
|
||||
{
|
||||
case IToken.tASSIGN :
|
||||
return assignmentOperatorExpression( scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_NORMAL);
|
||||
case IToken.tSTARASSIGN :
|
||||
return assignmentOperatorExpression(scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_MULT);
|
||||
case IToken.tDIVASSIGN :
|
||||
return assignmentOperatorExpression(scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_DIV);
|
||||
case IToken.tMODASSIGN :
|
||||
return assignmentOperatorExpression(scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_MOD);
|
||||
case IToken.tPLUSASSIGN :
|
||||
return assignmentOperatorExpression(scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_PLUS);
|
||||
case IToken.tMINUSASSIGN :
|
||||
return assignmentOperatorExpression(scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_MINUS);
|
||||
case IToken.tSHIFTRASSIGN :
|
||||
return assignmentOperatorExpression(scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_RSHIFT);
|
||||
case IToken.tSHIFTLASSIGN :
|
||||
return assignmentOperatorExpression(scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_LSHIFT);
|
||||
case IToken.tAMPERASSIGN :
|
||||
return assignmentOperatorExpression(scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_AND);
|
||||
case IToken.tXORASSIGN :
|
||||
return assignmentOperatorExpression(scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_XOR);
|
||||
case IToken.tBITORASSIGN :
|
||||
return assignmentOperatorExpression(scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_OR);
|
||||
}
|
||||
return conditionalExpression;
|
||||
}
|
||||
protected IASTExpression assignmentExpression(IASTScope scope)
|
||||
throws Backtrack {
|
||||
if (LT(1) == IToken.t_throw) {
|
||||
return throwExpression(scope);
|
||||
}
|
||||
IASTExpression conditionalExpression = conditionalExpression(scope);
|
||||
// if the condition not taken, try assignment operators
|
||||
if (conditionalExpression != null
|
||||
&& conditionalExpression.getExpressionKind()
|
||||
== IASTExpression.Kind.CONDITIONALEXPRESSION_HARD)
|
||||
return conditionalExpression;
|
||||
switch (LT(1)) {
|
||||
case IToken.tASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_NORMAL,
|
||||
conditionalExpression);
|
||||
case IToken.tSTARASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_MULT,
|
||||
conditionalExpression);
|
||||
case IToken.tDIVASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_DIV,
|
||||
conditionalExpression);
|
||||
case IToken.tMODASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_MOD,
|
||||
conditionalExpression);
|
||||
case IToken.tPLUSASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_PLUS,
|
||||
conditionalExpression);
|
||||
case IToken.tMINUSASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_MINUS,
|
||||
conditionalExpression);
|
||||
case IToken.tSHIFTRASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_RSHIFT,
|
||||
conditionalExpression);
|
||||
case IToken.tSHIFTLASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_LSHIFT,
|
||||
conditionalExpression);
|
||||
case IToken.tAMPERASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_AND,
|
||||
conditionalExpression);
|
||||
case IToken.tXORASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_XOR,
|
||||
conditionalExpression);
|
||||
case IToken.tBITORASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_OR,
|
||||
conditionalExpression);
|
||||
}
|
||||
return conditionalExpression;
|
||||
}
|
||||
protected IASTExpression assignmentOperatorExpression(
|
||||
IASTScope scope,
|
||||
IASTExpression.Kind kind)
|
||||
IASTExpression.Kind kind, IASTExpression lhs )
|
||||
throws EndOfFile, Backtrack
|
||||
{
|
||||
IToken t = consume();
|
||||
|
@ -2822,8 +2943,8 @@ public class Parser implements IParser
|
|||
return astFactory.createExpression(
|
||||
scope,
|
||||
kind,
|
||||
assignmentExpression,
|
||||
null,
|
||||
lhs,
|
||||
assignmentExpression,
|
||||
null,
|
||||
null,
|
||||
"", null);
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Created on Sep 2, 2003
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.parser.ast.complete;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCodeScope;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class ASTCodeScope extends ASTScope implements IASTCodeScope {
|
||||
|
||||
/**
|
||||
* @param newScope
|
||||
*/
|
||||
public ASTCodeScope(IContainerSymbol newScope) {
|
||||
super( newScope );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||
*/
|
||||
public void acceptElement(ISourceElementRequestor requestor) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||
*/
|
||||
public void enterScope(ISourceElementRequestor requestor) {
|
||||
requestor.enterCodeBlock( this );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||
*/
|
||||
public void exitScope(ISourceElementRequestor requestor) {
|
||||
requestor.exitCodeBlock( this );
|
||||
}
|
||||
|
||||
}
|
|
@ -27,6 +27,7 @@ import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTArrayModifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCodeScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
|
||||
|
@ -102,7 +103,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
// looking for a function
|
||||
result = startingScope.qualifiedFunctionLookup(name, new LinkedList(parameters));
|
||||
}else{
|
||||
// looking for a class
|
||||
// looking for something else
|
||||
result = startingScope.qualifiedLookup(name, type);
|
||||
}
|
||||
if( result != null )
|
||||
|
@ -1008,7 +1009,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
(IParameterizedSymbol) lookupQualifiedName(parentScope, functionName, TypeInfo.t_function, parameters, 0, functionReferences, false);
|
||||
if(methodDeclaration != null){
|
||||
ASTMethodReference reference = (ASTMethodReference) functionReferences.iterator().next();
|
||||
visibility = ((IASTMethod)reference.getReferencedElement()).getVisiblity();
|
||||
visibility = ((IASTMethod)reference.getReferencedElement()).getVisiblity();
|
||||
}
|
||||
return createMethod(scope, functionName, parameters, returnType,
|
||||
exception, isInline, isFriend, isStatic, startOffset, offset,
|
||||
|
@ -1246,27 +1247,34 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
if( returnType.getTypeSpecifier() != null )
|
||||
setParameter( symbol, returnType, false, references );
|
||||
setParameters( symbol, references, parameters.iterator() );
|
||||
|
||||
try
|
||||
{
|
||||
ownerScope.addSymbol( symbol );
|
||||
}
|
||||
catch (ParserSymbolTableException e)
|
||||
{
|
||||
throw new ASTSemanticException();
|
||||
}
|
||||
|
||||
|
||||
// check constructor / destructor if no return type
|
||||
if ( returnType.getTypeSpecifier() == null ){
|
||||
if(parentName.indexOf(DOUBLE_COLON) != -1){
|
||||
parentName = parentName.substring(parentName.lastIndexOf(DOUBLE_COLON) + DOUBLE_COLON.length());
|
||||
}
|
||||
if( parentName.equals(name) ){
|
||||
if( parentName.equals(name) ){
|
||||
isConstructor = true;
|
||||
} else if(name.startsWith(TELTA) && parentName.equals(name.substring(1))){
|
||||
isDestructor = true;
|
||||
}
|
||||
} else if(name.startsWith(TELTA) && parentName.equals(name.substring(1))){
|
||||
isDestructor = true;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if( !isConstructor )
|
||||
ownerScope.addSymbol( symbol );
|
||||
else
|
||||
{
|
||||
symbol.setType( TypeInfo.t_constructor );
|
||||
((IDerivableContainerSymbol)ownerScope).addConstructor( symbol );
|
||||
}
|
||||
}
|
||||
catch (ParserSymbolTableException e)
|
||||
{
|
||||
throw new ASTSemanticException();
|
||||
}
|
||||
|
||||
|
||||
ASTMethod method = new ASTMethod( symbol, parameters, returnType, exception, startOffset, nameOffset, ownerTemplate, references, isConstructor, isDestructor, isPureVirtual, visibility, constructorChain );
|
||||
try
|
||||
|
@ -1642,4 +1650,36 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
}
|
||||
return astAlias;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNewCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope)
|
||||
*/
|
||||
public IASTCodeScope createNewCodeBlock(IASTScope scope) {
|
||||
IContainerSymbol symbol = scopeToSymbol( scope );
|
||||
|
||||
IContainerSymbol newScope = pst.newContainerSymbol("");
|
||||
newScope.setContainingSymbol(symbol);
|
||||
|
||||
return new ASTCodeScope( newScope );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#queryIsTypeName(org.eclipse.cdt.core.parser.ITokenDuple)
|
||||
*/
|
||||
public boolean queryIsTypeName(IASTScope scope, ITokenDuple nameInQuestion) {
|
||||
ISymbol lookupSymbol = null;
|
||||
try {
|
||||
lookupSymbol =
|
||||
lookupQualifiedName(
|
||||
scopeToSymbol(scope),
|
||||
nameInQuestion,
|
||||
new ArrayList(),
|
||||
false);
|
||||
} catch (ASTSemanticException e) {
|
||||
// won't get thrown
|
||||
}
|
||||
if( lookupSymbol == null ) return false;
|
||||
if( lookupSymbol.isType( TypeInfo.t_type, TypeInfo.t_enumeration ) ) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ package org.eclipse.cdt.internal.core.parser.ast.quick;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.IToken;
|
||||
import org.eclipse.cdt.core.parser.ITokenDuple;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTClassKind;
|
||||
|
@ -22,6 +21,7 @@ import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCodeScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
|
||||
|
@ -276,4 +276,18 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
|||
{
|
||||
return new ASTNamespaceAlias( scope, identifier, alias.toString(), startingOffset, nameOffset, endOffset );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNewCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope)
|
||||
*/
|
||||
public IASTCodeScope createNewCodeBlock(IASTScope scope) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#queryIsTypeName(org.eclipse.cdt.core.parser.ITokenDuple)
|
||||
*/
|
||||
public boolean queryIsTypeName(IASTScope scope, ITokenDuple nameInQuestion) {
|
||||
return true; // we have no information to say that it is not
|
||||
}
|
||||
}
|
||||
|
|
|
@ -453,4 +453,20 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
|
|||
System.out.println("(" + Thread.currentThread() + ") " + log);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope)
|
||||
*/
|
||||
public void enterCodeBlock(IASTScope scope) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope)
|
||||
*/
|
||||
public void exitCodeBlock(IASTScope scope) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2003-09-04 John Camelon
|
||||
First pass of parsing function bodies with X-Reference information.
|
||||
Updated IASTFactory/ISourceElementRequestor to include IASTCodeScope
|
||||
constructs, clients should keep this in mind and update their implementations.
|
||||
|
||||
2003-09-04 Alain Magloire
|
||||
|
||||
Faulty logic when checking the build console preferences.
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
|
||||
|
@ -292,4 +293,20 @@ public class SourceElementRequestorAdapter implements ISourceElementRequestor {
|
|||
public void exitTemplateSpecialization(IASTTemplateSpecialization specialization) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope)
|
||||
*/
|
||||
public void enterCodeBlock(IASTScope scope) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope)
|
||||
*/
|
||||
public void exitCodeBlock(IASTScope scope) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue