1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 09:45:39 +02:00
Further restructuring of Parser for ISourceElementRequestor. 
	Added interfaces/implementation for Simple Declarations.  
	Cleaned up DOM's representation of Constructor chains.  

TESTS
	Added DOMTests::testAssignmentExpression()
	Added PreprocessorConditionalTest to ParserTestSuite.
This commit is contained in:
John Camelon 2003-06-30 22:08:38 +00:00
parent f3ed140c9c
commit b2aacbd3c1
24 changed files with 1031 additions and 251 deletions

View file

@ -1,3 +1,7 @@
2003-06-30 John Camelon
Added DOMTests::testAssignmentExpression()
Added PreprocessorConditionalTest to ParserTestSuite.
2003-06-28 John Camelon
Completed Quickparse expression representation.
Updated ExpressionEvaluation and associated tests.

View file

@ -34,7 +34,7 @@ public class BaseScannerTest extends TestCase {
super(x);
}
public void initializeScanner(String input)
protected void initializeScanner(String input)
{
scanner= ParserFactory.createScanner( new StringReader(input),"TEXT", null, null, null );
}

View file

@ -1,6 +1,5 @@
package org.eclipse.cdt.core.parser.tests;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Iterator;
@ -15,7 +14,6 @@ import org.eclipse.cdt.internal.core.dom.ClassKey;
import org.eclipse.cdt.internal.core.dom.ClassSpecifier;
import org.eclipse.cdt.internal.core.dom.ConstructorChain;
import org.eclipse.cdt.internal.core.dom.ConstructorChainElement;
import org.eclipse.cdt.internal.core.dom.ConstructorChainElementExpression;
import org.eclipse.cdt.internal.core.dom.DeclSpecifier;
import org.eclipse.cdt.internal.core.dom.Declaration;
import org.eclipse.cdt.internal.core.dom.Declarator;
@ -914,59 +912,7 @@ public class DOMTests extends BaseDOMTest {
assertEquals( chainElements1.size(), 2 );
ConstructorChainElement element1_1 = (ConstructorChainElement) chainElements1.get(0);
assertEquals( element1_1.getName().toString(), "RTActor");
List expressions1_1 = element1_1.getExpressionList();
assertEquals( expressions1_1.size(), 2 );
ConstructorChainElementExpression expression1_1_1 = (ConstructorChainElementExpression)expressions1_1.get(0);
assertEquals( expression1_1_1.getExpression().elements().size(), 1 );
Name t1_1_1 = (Name)expression1_1_1.getExpression().elements().get(0);
ConstructorChainElementExpression expression1_1_2 = (ConstructorChainElementExpression)expressions1_1.get(1);
assertEquals( expression1_1_2.getExpression().elements().size(), 1 );
Name t1_1_2 = (Name)expression1_1_2.getExpression().elements().get(0);
assertEquals( t1_1_1.toString(), "rtg_rts");
assertEquals( t1_1_2.toString(), "rtg_ref");
ConstructorChainElement element1_2 = (ConstructorChainElement) chainElements1.get(1);
assertEquals( element1_2.getName().toString(), "myId" );
List expressions1_2 = element1_2.getExpressionList();
assertEquals( expressions1_2.size(), 1 );
ConstructorChainElementExpression expression = (ConstructorChainElementExpression) expressions1_2.get(0);
assertEquals( expression.getExpression().elements().size(), 1 );
Token t = (Token)expression.getExpression().elements().get(0);
assertEquals( t.getImage(), "0");
assertEquals( t.getType(), IToken.tINTEGER );
}
// public void testErrors()
// {
// validateWeEncounterAnError( "void myFunc( int hey, flo );");
// }
public void validateWeEncounterAnError( String codeText )
{
try
{
// Parse and get the translaton unit
Writer code = new StringWriter();
code.write(codeText);
try
{
TranslationUnit translationUnit = parse(code.toString());
fail( "We should not reach this line. Failure.");
} catch( ParserException pe )
{
}
catch( Exception e )
{
fail( "Unknown exception " + e.getMessage() );
}
}catch( IOException io )
{
fail( "IOException thrown");
}
}
public void testTemplateDeclarationOfMethod() throws Exception
@ -2239,6 +2185,11 @@ public class DOMTests extends BaseDOMTest {
assertEquals( ((ParameterDeclaration)clause2.getDeclarations().get(0)).getDeclSpecifier().getType(), DeclSpecifier.t_float );
}
public void testAssignmentExpressions() throws Exception
{
parse( "int x = y = z = 5;");
}
public void testBug39348() throws Exception
{
parse("unsigned char a[sizeof (struct sss)];");

View file

@ -34,6 +34,7 @@ public class ParserTestSuite extends TestCase {
suite.addTestSuite(CModelElementsTests.class);
suite.addTestSuite(MacroTests.class);
suite.addTestSuite( PreprocessorTest.class );
suite.addTestSuite( PreprocessorConditionalTest.class );
return suite;
}

View file

@ -0,0 +1,107 @@
/**********************************************************************
* 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.tests;
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.IToken;
import org.eclipse.cdt.core.parser.ParserFactory;
import org.eclipse.cdt.core.parser.ParserMode;
import org.eclipse.cdt.core.parser.ScannerException;
/**
* @author jcamelon
*
*/
public class PreprocessorConditionalTest extends BaseScannerTest
{
protected void initializeScanner(String input, Map definitions )
{
scanner= ParserFactory.createScanner( new StringReader(input),"TEXT", definitions, null, ParserMode.COMPLETE_PARSE );
}
protected void evaluateConditionalsPositive( String conditional, Map definitions )
{
StringBuffer buff = new StringBuffer();
buff.append( "#if " );
buff.append( conditional );
buff.append( "\n int x;\n#else\n#error NEVER\n#endif\n");
initializeScanner( buff.toString(), definitions );
evaluate();
}
protected void evaluateConditionalsNegative( String conditional, Map definitions )
{
StringBuffer buff = new StringBuffer();
buff.append( "#if " );
buff.append( conditional );
buff.append( "\n#error NEVER\n#else\n int x;\n#endif\n");
initializeScanner( buff.toString(), definitions );
evaluate();
}
/**
*
*/
private void evaluate()
{
try
{
validateToken( IToken.t_int );
validateIdentifier( "x");
validateToken( IToken.tSEMI );
scanner.nextToken();
fail( "Should have hit EOF by now");
}
catch( ScannerException se )
{
fail( "Got #error, should not have gotten that.");
}
catch( EndOfFile eof )
{
// expected
}
}
/**
* @param x
*/
public PreprocessorConditionalTest(String x)
{
super(x);
}
public void testConditionals()
{
Map definitions = new HashMap();
definitions.put( "DEFED", "" );
definitions.put( "VALUE", "30 ");
evaluateConditionalsPositive( "defined( DEFED )", definitions );
evaluateConditionalsNegative( "defined( NOTDEFED )", definitions );
evaluateConditionalsNegative( "! defined( DEFED )", definitions );
evaluateConditionalsPositive( "! defined( NOTDEFED )", definitions );
evaluateConditionalsPositive( "defined( VALUE ) && VALUE == 30", definitions );
evaluateConditionalsNegative( "defined( VALUE ) && VALUE == 40", definitions );
}
}

View file

@ -12,10 +12,6 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.dom;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.eclipse.cdt.internal.core.parser.Name;
@ -23,10 +19,9 @@ import org.eclipse.cdt.internal.core.parser.Name;
* @author jcamelon
*
*/
public class ConstructorChainElement {
public class ConstructorChainElement implements IExpressionOwner {
private Name name;
private List expressionList = new ArrayList();
private final ConstructorChain ownerChain;
ConstructorChainElement( ConstructorChain chain )
@ -49,17 +44,7 @@ public class ConstructorChainElement {
this.name = name;
}
/**
* @return List
*/
public List getExpressionList() {
return Collections.unmodifiableList( expressionList );
}
public void addExpression( ConstructorChainElementExpression expression )
{
expressionList.add( expression );
}
/**
* @return ConstructorChain
*/
@ -67,4 +52,22 @@ public class ConstructorChainElement {
return ownerChain;
}
private Expression exp = null;
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.IExpressionOwner#getExpression()
*/
public Expression getExpression()
{
return exp;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.IExpressionOwner#setExpression(org.eclipse.cdt.internal.core.dom.Expression)
*/
public void setExpression(Expression exp)
{
this.exp = exp;
}
}

View file

@ -1,51 +0,0 @@
/**********************************************************************
* Created on Mar 28, 2003
*
* 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:
* Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.dom;
/**
* @author jcamelon
*
*/
public class ConstructorChainElementExpression implements IExpressionOwner {
Expression exp;
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.IExpressionOwner#getExpression()
*/
public Expression getExpression() {
return exp;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.IExpressionOwner#setExpression(org.eclipse.cdt.internal.core.dom.Expression)
*/
public void setExpression(Expression exp) {
this.exp = exp;
}
ConstructorChainElementExpression( ConstructorChainElement element )
{
this.ownerElement = element;
}
private final ConstructorChainElement ownerElement;
/**
* @return ConstructorChainElement
*/
public ConstructorChainElement getOwnerElement() {
return ownerElement;
}
}

View file

@ -801,21 +801,6 @@ public class DOMBuilder implements IParserCallback, ISourceElementRequestor
ele.setName(currName);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#constructorChainElementExpressionListElementBegin(java.lang.Object)
*/
public Object constructorChainElementExpressionListElementBegin(Object element) {
return new ConstructorChainElementExpression( (ConstructorChainElement)element );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#constructorChainElementExpressionListElementEnd(java.lang.Object)
*/
public void constructorChainElementExpressionListElementEnd(Object expression) {
ConstructorChainElementExpression exp = (ConstructorChainElementExpression)expression;
exp.getOwnerElement().addExpression( exp );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitInstantiationBegin(java.lang.Object)
*/

View file

@ -335,6 +335,7 @@ public class DeclSpecifier {
type.append("short ");
if (isLong())
type.append("long ");
}
break;
default :

View file

@ -1,3 +1,8 @@
2003-06-30 John Camelon
Further restructuring of Parser for ISourceElementRequestor.
Added interfaces/implementation for Simple Declarations.
Cleaned up DOM's representation of Constructor chains.
2003-06-28 John Camelon
Completed Quickparse expression representation.
Updated ExpressionEvaluation and associated tests.

View file

@ -122,9 +122,6 @@ public interface IParserCallback {
public void constructorChainElementId( Object element );
public void constructorChainElementEnd( Object element );
public Object constructorChainElementExpressionListElementBegin( Object element );
public void constructorChainElementExpressionListElementEnd( Object expression );
public Object explicitInstantiationBegin( Object container);
public void explicitInstantiationEnd( Object instantiation );

View file

@ -0,0 +1,22 @@
/**********************************************************************
* 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.ast;
/**
* @author jcamelon
*
*/
public interface IASTConstructorMemberInitializer
{
public IASTExpression getExpressionList();
public String getName();
}

View file

@ -0,0 +1,22 @@
/**********************************************************************
* 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.ast;
import java.util.List;
/**
* @author jcamelon
*
*/
public interface IASTExceptionSpecification
{
public List getTypeIds();
}

View file

@ -16,6 +16,7 @@ import org.eclipse.cdt.core.parser.Backtrack;
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;
import org.eclipse.cdt.internal.core.parser.IASTArrayModifier;
/**
* @author jcamelon
@ -75,6 +76,22 @@ public interface IASTFactory {
public IASTExpression.IASTNewExpressionDescriptor createNewDescriptor();
public IASTInitializerClause createIASTInitializerClause(IASTInitializerClause.Kind kind, IASTExpression assignmentExpression, List initializerClauses);
public IASTInitializerClause createInitializerClause(IASTInitializerClause.Kind kind, IASTExpression assignmentExpression, List initializerClauses);
public IASTExceptionSpecification createExceptionSpecification( List typeIds );
/**
* @param exp
*/
public IASTArrayModifier createArrayModifier(IASTExpression exp);
/**
* @param duple
* @param expressionList
* @return
*/
public IASTConstructorMemberInitializer createConstructorMemberInitializer(ITokenDuple duple, IASTExpression expressionList );
public IASTSimpleTypeSpecifier createSimpleTypeSpecifier( IASTSimpleTypeSpecifier.SimpleType kind, ITokenDuple typeName, boolean isShort, boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename );
}

View file

@ -0,0 +1,52 @@
/**********************************************************************
* 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.ast;
import org.eclipse.cdt.core.parser.Enum;
/**
* @author jcamelon
*
*/
public interface IASTSimpleTypeSpecifier extends IASTTypeSpecifier
{
public static class SimpleType extends Enum
{
public static final SimpleType UNSPECIFIED = new SimpleType( 1 );
public static final SimpleType CHAR = new SimpleType( 1 );
public static final SimpleType WCHAR_T = new SimpleType( 2 );
public static final SimpleType BOOL = new SimpleType( 3 );
public static final SimpleType INT = new SimpleType( 4 );
public static final SimpleType FLOAT = new SimpleType( 5 );
public static final SimpleType DOUBLE = new SimpleType( 6 );
public static final SimpleType VOID = new SimpleType( 7 );
public static final SimpleType TYPENAME = new SimpleType( 8 );
public static final SimpleType TEMPLATE = new SimpleType( 9 );
/**
* @param enumValue
*/
protected SimpleType(int enumValue)
{
super(enumValue);
}
}
public SimpleType getType();
public String getTypename();
public boolean isLong();
public boolean isShort();
public boolean isSigned();
public boolean isUnsigned();
public boolean isTypename();
}

View file

@ -12,10 +12,16 @@ package org.eclipse.cdt.internal.core.parser;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTField;
import org.eclipse.cdt.core.parser.ast.IASTFunction;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTVariable;
/**
* @author jcamelon
@ -299,6 +305,73 @@ public class DeclarationWrapper
{
typeSpecifier = specifier;
}
/**
* @param requestor
*/
public List createAndCallbackASTNodes()
{
Iterator i = declarators.iterator();
List l = new ArrayList();
while( i.hasNext() )
l.add( createAndCallbackASTNode( (Declarator)i.next() ) );
return l;
}
/**
* @param declarator
*/
private Object createAndCallbackASTNode(Declarator declarator)
{
boolean isWithinClass = ( getScope() instanceof IASTClassSpecifier );
boolean isFunction = declarator.isFunction();
if( isWithinClass && isFunction )
return createMethodASTNode( declarator );
else if( isWithinClass )
return createFieldASTNode( declarator );
else if ( ( ! isWithinClass )&& isFunction )
return createFunctionASTNode( declarator );
else
return createVariableASTNode( declarator );
}
/**
* @param declarator
* @return
*/
private IASTMethod createMethodASTNode(Declarator declarator)
{
// TODO Auto-generated method stub
return null;
}
/**
* @param declarator
* @return
*/
private IASTFunction createFunctionASTNode(Declarator declarator)
{
// TODO Auto-generated method stub
return null;
}
/**
* @param declarator
* @return
*/
private IASTField createFieldASTNode(Declarator declarator)
{
// TODO Auto-generated method stub
return null;
}
/**
* @param declarator
* @return
*/
private IASTVariable createVariableASTNode(Declarator declarator)
{
// TODO Auto-generated method stub
return null;
}
}

View file

@ -14,6 +14,10 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.eclipse.cdt.core.parser.ITokenDuple;
import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
/**
@ -22,12 +26,25 @@ import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
*/
public class Declarator implements IParameterCollection
{
private final DeclarationWrapper owner1;
private boolean isFunction;
private boolean hasFunctionBody;
private IASTExpression constructorExpression;
private boolean pureVirtual = false;
private final DeclarationWrapper owner1;
private final Declarator owner2;
private String name;
private IASTInitializerClause initializerClause;
private Declarator ownedDeclarator = null;
private String name = "";
private IASTInitializerClause initializerClause = null;
private List ptrOps = new ArrayList();
private List parameters = new ArrayList();
private List parameters = new ArrayList();
private List arrayModifiers = new ArrayList();
private List constructorMemberInitializers = new ArrayList();
private IASTExceptionSpecification exceptionSpecification = null;
private IASTExpression bitFieldExpression = null;
private boolean isConst = false;
private boolean isVolatile = false;
private boolean isKandR = false;
private int nameStartOffset, nameEndOffset;
@ -146,4 +163,195 @@ public class Declarator implements IParameterCollection
initializerClause = expression;
}
/**
* @return
*/
public Declarator getOwnedDeclarator()
{
return ownedDeclarator;
}
/**
* @param declarator
*/
public void setOwnedDeclarator(Declarator declarator)
{
ownedDeclarator = declarator;
}
public void setName( ITokenDuple duple )
{
setName( duple.toString() );
setNameStartOffset( duple.getFirstToken().getOffset());
setNameEndOffset( duple.getLastToken().getEndOffset());
}
/**
* @return
*/
public IASTExceptionSpecification getExceptionSpecification()
{
return exceptionSpecification;
}
/**
* @return
*/
public boolean isConst()
{
return isConst;
}
/**
* @return
*/
public boolean isVolatile()
{
return isVolatile;
}
/**
* @param specification
*/
public void setExceptionSpecification(IASTExceptionSpecification specification)
{
exceptionSpecification = specification;
}
/**
* @param b
*/
public void setConst(boolean b)
{
isConst = b;
}
/**
* @param b
*/
public void setVolatile(boolean b)
{
isVolatile = b;
}
/**
* @return
*/
public boolean isKandR()
{
return isKandR;
}
/**
* @param b
*/
public void setKandR(boolean b)
{
isKandR = b;
}
/**
* @param b
*/
public void setPureVirtual(boolean b)
{
pureVirtual = b;
}
/**
* @return
*/
public boolean isPureVirtual()
{
return pureVirtual;
}
/**
* @param arrayMod
*/
public void addArrayModifier(IASTArrayModifier arrayMod)
{
arrayModifiers.add( arrayMod );
}
/**
* @return
*/
public List getArrayModifiers()
{
return arrayModifiers;
}
/**
* @return
*/
public IASTExpression getBitFieldExpression()
{
return bitFieldExpression;
}
/**
* @param expression
*/
public void setBitFieldExpression(IASTExpression expression)
{
bitFieldExpression = expression;
}
/**
* @param astExpression
*/
public void setConstructorExpression(IASTExpression astExpression)
{
constructorExpression = astExpression;
}
/**
* @return
*/
public IASTExpression getConstructorExpression()
{
return constructorExpression;
}
/**
* @param initializer
*/
public void addConstructorMemberInitializer(IASTConstructorMemberInitializer initializer)
{
constructorMemberInitializers.add( initializer );
}
/**
* @return
*/
public List getConstructorMemberInitializers()
{
return constructorMemberInitializers;
}
/**
* @param b
*/
public void hasFunctionBody(boolean b)
{
hasFunctionBody = true;
}
/**
* @return
*/
public boolean isFunction()
{
return isFunction;
}
/**
* @param b
*/
public void setIsFunction(boolean b)
{
isFunction = b;
}
}

View file

@ -0,0 +1,20 @@
/**********************************************************************
* 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;
/**
* @author jcamelon
*
*/
public interface IASTArrayModifier
{
}

View file

@ -960,16 +960,18 @@ public class Parser implements IParser
}
declSpecifierSeq(simpleDecl, false, tryConstructor, sdw);
Object declarator = null;
DeclaratorDuple d = null;
if (LT(1) != IToken.tSEMI)
try
{
declarator = initDeclarator(simpleDecl, sdw);
d = initDeclarator(simpleDecl, sdw);
declarator = d.getObject();
while (LT(1) == IToken.tCOMMA)
{
consume();
try
{
initDeclarator(simpleDecl, sdw);
d = initDeclarator(simpleDecl, sdw);
}
catch (Backtrack b)
{
@ -981,39 +983,56 @@ public class Parser implements IParser
{
// allowed to be empty
}
boolean done = false;
boolean hasFunctionBody = false;
switch (LT(1))
{
case IToken.tSEMI :
consume(IToken.tSEMI);
done = true;
break;
case IToken.tCOLON :
if (forKR)
throw backtrack;
ctorInitializer(declarator);
ctorInitializer(declarator, d.getDeclarator());
// Falling through on purpose
case IToken.tLBRACE :
if (forKR)
throw backtrack;
Object function = null;
try
{
function = callback.functionBodyBegin(simpleDecl);
}
catch (Exception e)
{
}
handleFunctionBody();
try
{
callback.functionBodyEnd(function);
}
catch (Exception e)
{
}
d.getDeclarator().hasFunctionBody( true );
hasFunctionBody = true;
break;
default :
throw backtrack;
}
List l = sdw.createAndCallbackASTNodes();
if( hasFunctionBody )
{
// if( l.size() != 1 )
// requestor.acceptProblem( ParserFactory.createProblem());
Object function = null;
try
{
function = callback.functionBodyBegin(simpleDecl);
}
catch (Exception e)
{
}
handleFunctionBody(d.getDeclarator());
try
{
callback.functionBodyEnd(function);
}
catch (Exception e)
{
}
}
try
{
callback.simpleDeclarationEnd(simpleDecl, (Token)lastToken);
@ -1023,7 +1042,7 @@ public class Parser implements IParser
}
}
protected void handleFunctionBody() throws Backtrack, EndOfFile {
protected void handleFunctionBody(Declarator d) throws Backtrack, EndOfFile {
if (mode == ParserMode.QUICK_PARSE)
{
// speed up the parser by skiping the body
@ -1059,7 +1078,7 @@ public class Parser implements IParser
* @param declarator IParserCallback object that represents the declarator (constructor) that owns this initializer
* @throws Backtrack request a backtrack
*/
protected void ctorInitializer(Object declarator) throws Backtrack
protected void ctorInitializer(Object declarator, Declarator d) throws Backtrack
{
consume(IToken.tCOLON);
Object constructorChain = null;
@ -1085,7 +1104,7 @@ public class Parser implements IParser
catch (Exception e)
{
}
name();
ITokenDuple duple = name();
try
{
callback.constructorChainElementId(constructorChainElement);
@ -1094,50 +1113,26 @@ public class Parser implements IParser
{
}
consume(IToken.tLPAREN);
while (LT(1) != IToken.tRPAREN)
IASTExpression expressionList = null;
Object expression = null;
try
{
//handle expression list here
Object item = null;
try
{
item =
callback
.constructorChainElementExpressionListElementBegin(
constructorChainElement);
}
catch (Exception e)
{
}
Object expression = null;
try
{
expression = callback.expressionBegin(item);
}
catch (Exception e)
{
}
IASTExpression assignmentExpression = assignmentExpression(expression);
try
{
callback.expressionEnd(item);
}
catch (Exception e)
{
}
try
{
callback
.constructorChainElementExpressionListElementEnd(
item);
}
catch (Exception e)
{
}
if (LT(1) == IToken.tRPAREN)
break;
consume(IToken.tCOMMA);
expression = callback.expressionBegin(constructorChainElement);
}
catch (Exception e)
{
}
expressionList = expression(expression);
try
{
callback.expressionEnd(expressionList);
}
catch (Exception e)
{
}
consume(IToken.tRPAREN);
try
{
callback.constructorChainElementEnd(
@ -1146,10 +1141,12 @@ public class Parser implements IParser
catch (Exception e)
{
}
d.addConstructorMemberInitializer( astFactory.createConstructorMemberInitializer( duple, expressionList ) );
if (LT(1) == IToken.tLBRACE)
break;
if (LT(1) == IToken.tCOMMA)
consume(IToken.tCOMMA);
consume(IToken.tCOMMA);
}
}
catch (Backtrack bt)
@ -1161,8 +1158,7 @@ public class Parser implements IParser
catch (Exception e)
{
}
if (mode != ParserMode.QUICK_PARSE)
throw backtrack;
throw backtrack;
}
try
{
@ -1201,7 +1197,8 @@ public class Parser implements IParser
if (LT(1) != IToken.tSEMI)
try
{
Object declarator = initDeclarator(parameterDecl, sdw );
DeclaratorDuple d = initDeclarator(parameterDecl, sdw );
Object declarator = d.getObject();
}
catch (Backtrack b)
{
@ -1922,7 +1919,7 @@ public class Parser implements IParser
* @return declarator that this parsing produced.
* @throws Backtrack request a backtrack
*/
protected Object initDeclarator(Object owner, DeclarationWrapper sdw)
protected DeclaratorDuple initDeclarator(Object owner, DeclarationWrapper sdw)
throws Backtrack
{
DeclaratorDuple duple = declarator(owner, sdw, null);
@ -1937,8 +1934,10 @@ public class Parser implements IParser
}
else if (LT(1) == IToken.tLPAREN)
{
// initializer in constructor
consume(IToken.tLPAREN); // EAT IT!
Object expression = null;
IASTExpression astExpression = null;
try
{
try
@ -1948,7 +1947,8 @@ public class Parser implements IParser
catch (Exception e)
{
}
expression(expression);
astExpression = expression(expression);
consume(IToken.tRPAREN);
try
{
callback.expressionEnd(expression);
@ -1956,10 +1956,12 @@ public class Parser implements IParser
catch (Exception e)
{
}
d.setConstructorExpression( astExpression );
}
catch (Backtrack b)
{
if (expression != null)
{
try
{
callback.expressionAbort(expression);
@ -1967,9 +1969,9 @@ public class Parser implements IParser
catch (Exception e)
{
}
throw b;
}
}
if (LT(1) == IToken.tRPAREN)
consume();
}
try
{
@ -1978,7 +1980,9 @@ public class Parser implements IParser
catch (Exception e)
{
}
return declarator;
sdw.addDeclarator(d);
return duple;
}
/**
@ -1993,7 +1997,7 @@ public class Parser implements IParser
if( LT(1) == (IToken.tRBRACE ) )
{
consume( IToken.tRBRACE );
return astFactory.createIASTInitializerClause( IASTInitializerClause.Kind.EMPTY, null, null );
return astFactory.createInitializerClause( IASTInitializerClause.Kind.EMPTY, null, null );
}
// otherwise it is a list of initializers
@ -2006,7 +2010,7 @@ public class Parser implements IParser
consume( IToken.tCOMMA );
}
consume( IToken.tRBRACE );
return astFactory.createIASTInitializerClause( IASTInitializerClause.Kind.INITIALIZER_LIST, null, initializerClauses );
return astFactory.createInitializerClause( IASTInitializerClause.Kind.INITIALIZER_LIST, null, initializerClauses );
}
// try this now instead
// assignmentExpression || { initializerList , } || { }
@ -2032,7 +2036,7 @@ public class Parser implements IParser
{
}
return astFactory.createIASTInitializerClause( IASTInitializerClause.Kind.ASSIGNMENT_EXPRESSION, assignmentExpression, null );
return astFactory.createInitializerClause( IASTInitializerClause.Kind.ASSIGNMENT_EXPRESSION, assignmentExpression, null );
}
catch (Backtrack b)
{
@ -2074,12 +2078,15 @@ public class Parser implements IParser
*/
protected DeclaratorDuple declarator(Object container, DeclarationWrapper sdw, Declarator owningDeclarator) throws Backtrack
{
boolean anonymous = false;
Object declarator = null;
Declarator d = null;
overallLoop:
do
{
Object declarator = null;
Declarator d = null;
{
declarator = null;
d = null;
if( sdw != null )
d = new Declarator( sdw );
else if( owningDeclarator != null )
@ -2122,7 +2129,8 @@ public class Parser implements IParser
{
try
{
name();
ITokenDuple duple = name();
d.setName( duple );
try
{
callback.declaratorId(declarator);
@ -2130,10 +2138,12 @@ public class Parser implements IParser
catch (Exception e)
{
}
}
catch (Backtrack bt)
{
IToken start = null;
IToken mark = mark();
if (LT(1) == IToken.tCOLONCOLON
|| LT(1) == IToken.tIDENTIFIER)
{
@ -2150,12 +2160,12 @@ public class Parser implements IParser
end = consumeTemplateParameters(end);
}
if (LT(1) == IToken.t_operator)
operatorId( declarator, d, start );
}
else
{
// anonymous is good
anonymous = true;
operatorId( declarator, d, start );
else
{
backup( mark );
throw backtrack;
}
}
}
}
@ -2168,6 +2178,7 @@ public class Parser implements IParser
if (!LA(2).looksLikeExpression())
{
// parameterDeclarationClause
d.setIsFunction( true );
Object clause = null;
try
{
@ -2208,8 +2219,7 @@ public class Parser implements IParser
}
if (LT(1) == IToken.tCOLON)
{
// this is most likely the definition of the constructor
return new DeclaratorDuple( declarator, d );
break overallLoop;
}
IToken beforeCVModifier = mark();
IToken cvModifier = null;
@ -2226,8 +2236,10 @@ public class Parser implements IParser
afterCVModifier = mark();
}
//check for throws clause here
List exceptionSpecIds = null;
if (LT(1) == IToken.t_throw)
{
exceptionSpecIds = new ArrayList();
try
{
callback.declaratorThrowsException(
@ -2239,6 +2251,7 @@ public class Parser implements IParser
consume(); // throw
consume(IToken.tLPAREN); // (
boolean done = false;
ITokenDuple duple = null;
while (!done)
{
switch (LT(1))
@ -2248,7 +2261,8 @@ public class Parser implements IParser
done = true;
break;
case IToken.tIDENTIFIER :
typeId();
duple = typeId();
exceptionSpecIds.add( duple );
try
{
callback
@ -2263,14 +2277,15 @@ public class Parser implements IParser
consume();
break;
default :
System.out.println(
"Unexpected Token ="
+ LA(1).getImage());
errorHandling();
Util.debugLog( "Unexpected Token =" + LA(1).getImage() );
failParse();
continue;
}
}
if( exceptionSpecIds != null )
d.setExceptionSpecification( astFactory.createExceptionSpecification( exceptionSpecIds ) );
}
// check for optional pure virtual
if (LT(1) == IToken.tASSIGN
&& LT(2) == IToken.tINTEGER
@ -2278,6 +2293,7 @@ public class Parser implements IParser
{
consume(IToken.tASSIGN);
consume(IToken.tINTEGER);
d.setPureVirtual( true );
try
{
callback.declaratorPureVirtual(declarator);
@ -2300,6 +2316,12 @@ public class Parser implements IParser
catch (Exception e)
{
}
if( cvModifier.getType() == IToken.t_const )
d.setConst( true );
if( cvModifier.getType() == IToken.t_volatile )
d.setVolatile( true );
// In this case (method) we can't expect K&R parameter declarations,
// but we'll check anyway, for errorhandling
}
@ -2308,6 +2330,7 @@ public class Parser implements IParser
// let's try this modifier as part of K&R parameter declaration
backup(beforeCVModifier);
}
if (LT(1) != IToken.tSEMI)
{
// try K&R-style parameter declarations
@ -2328,7 +2351,7 @@ public class Parser implements IParser
oldKRParameterDeclarationClause,
false,
true,
null);
sdw.getScope());
}
while (LT(1) != IToken.tLBRACE);
}
@ -2362,6 +2385,7 @@ public class Parser implements IParser
catch (Exception e)
{
}
IASTExpression exp = null;
if (LT(1) != IToken.tRBRACKET)
{
Object expression = null;
@ -2373,7 +2397,7 @@ public class Parser implements IParser
catch (Exception e)
{
}
constantExpression(expression);
exp = constantExpression(expression);
try
{
callback.expressionEnd(expression);
@ -2383,6 +2407,9 @@ public class Parser implements IParser
}
}
consume(IToken.tRBRACKET);
IASTArrayModifier arrayMod = astFactory.createArrayModifier( exp );
d.addArrayModifier( arrayMod );
try
{
callback.arrayDeclaratorEnd(array);
@ -2403,6 +2430,7 @@ public class Parser implements IParser
{
}
Object expression = null;
IASTExpression exp = null;
try
{
expression = callback.expressionBegin(bitfield);
@ -2410,7 +2438,7 @@ public class Parser implements IParser
catch (Exception e)
{
}
constantExpression(expression);
exp = constantExpression(expression);
try
{
callback.expressionEnd(expression);
@ -2425,6 +2453,7 @@ public class Parser implements IParser
catch (Exception e)
{
}
d.setBitFieldExpression( exp );
default :
break;
}
@ -2443,10 +2472,14 @@ public class Parser implements IParser
}
else
{
return new DeclaratorDuple( declarator, d );
break;
}
}
while (true);
if( sdw == null )
owningDeclarator.setOwnedDeclarator(d);
return new DeclaratorDuple( declarator, d );
}
protected void operatorId(Object declarator, Declarator d, IToken originalToken)
@ -2504,6 +2537,7 @@ public class Parser implements IParser
// In case we'll need better error recovery
// while( LT(1) != Token.tLPAREN ) { toSend = consume(); }
}
ITokenDuple duple = new TokenDuple( originalToken == null ? operatorToken : originalToken ,toSend );
try
{
callback.nameBegin(originalToken == null ? operatorToken : originalToken );
@ -2519,6 +2553,7 @@ public class Parser implements IParser
catch (Exception e)
{
}
d.setName( duple );
}
/**
* Parse a Pointer Operator.
@ -3285,9 +3320,9 @@ public class Parser implements IParser
* @param expression
* @throws Backtrack
*/
protected void constantExpression(Object expression) throws Backtrack
protected IASTExpression constantExpression(Object expression) throws Backtrack
{
conditionalExpression(expression);
return conditionalExpression(expression);
}
/* (non-Javadoc)

View file

@ -21,20 +21,25 @@ import org.eclipse.cdt.core.parser.ast.ClassKind;
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
import org.eclipse.cdt.core.parser.ast.IASTFactory;
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
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.IASTUsingDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType;
import org.eclipse.cdt.core.parser.ast.IASTExpression.Kind;
import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
import org.eclipse.cdt.core.parser.ast.IASTExpression.Kind;
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.SimpleType;
import org.eclipse.cdt.internal.core.parser.IASTArrayModifier;
import org.eclipse.cdt.internal.core.parser.ast.BaseASTFactory;
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
@ -219,9 +224,47 @@ public class FullParseASTFactory extends BaseASTFactory implements IASTFactory {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createIASTInitializerClause()
*/
public IASTInitializerClause createIASTInitializerClause(IASTInitializerClause.Kind kind, IASTExpression assignmentExpression, List initializerClauses) {
public IASTInitializerClause createInitializerClause(IASTInitializerClause.Kind kind, IASTExpression assignmentExpression, List initializerClauses) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExceptionSpecification(java.util.List)
*/
public IASTExceptionSpecification createExceptionSpecification(List typeIds)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createArrayModifier(org.eclipse.cdt.core.parser.ast.IASTExpression)
*/
public IASTArrayModifier createArrayModifier(IASTExpression exp)
{
// TODO
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createConstructorMemberInitializer(org.eclipse.cdt.core.parser.ITokenDuple, org.eclipse.cdt.core.parser.ast.IASTExpression)
*/
public IASTConstructorMemberInitializer createConstructorMemberInitializer(ITokenDuple duple, IASTExpression expressionList )
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createSimpleTypeSpecifier(org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.SimpleType, org.eclipse.cdt.core.parser.ITokenDuple, boolean, boolean, boolean, boolean)
*/
public IASTSimpleTypeSpecifier createSimpleTypeSpecifier(SimpleType kind, ITokenDuple typeName, boolean isShort, boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename)
{
// TODO Auto-generated method stub
return null;
}
}

View file

@ -0,0 +1,49 @@
/**********************************************************************
* 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.quick;
import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
/**
* @author jcamelon
*
*/
public class ASTConstructorMemberInitializer
implements IASTConstructorMemberInitializer
{
/**
* @param string
* @param expressionList
*/
public ASTConstructorMemberInitializer(String name, IASTExpression expressionList)
{
this.name = name;
this.expressionList = expressionList;
}
private final IASTExpression expressionList;
private final String name;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer#getExpressionList()
*/
public IASTExpression getExpressionList()
{
return expressionList;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer#getName()
*/
public String getName()
{
return name;
}
}

View file

@ -0,0 +1,45 @@
/**********************************************************************
* 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.quick;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.parser.ITokenDuple;
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
/**
* @author jcamelon
*
*/
public class ASTExceptionSpecification implements IASTExceptionSpecification
{
private final List typeIds;
/**
* @param typeIds
*/
public ASTExceptionSpecification(List typeIds)
{
Iterator i = typeIds.iterator();
this.typeIds = new ArrayList();
while( i.hasNext() )
this.typeIds.add( ((ITokenDuple)i.next()).toString() );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification#getTypeIds()
*/
public List getTypeIds()
{
return typeIds;
}
}

View file

@ -0,0 +1,153 @@
/**********************************************************************
* 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.quick;
import java.util.Hashtable;
import java.util.Map;
import org.eclipse.cdt.core.parser.ITokenDuple;
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
/**
* @author jcamelon
*
*/
public class ASTSimpleTypeSpecifier implements IASTSimpleTypeSpecifier
{
private final boolean isTypename;
private final SimpleType kind;
private final String typeName;
private final boolean isLong, isShort, isSigned, isUnsigned;
private static final Map nameMap;
static
{
nameMap = new Hashtable();
nameMap.put( SimpleType.BOOL, "bool");
nameMap.put( SimpleType.CHAR, "char");
nameMap.put( SimpleType.DOUBLE, "double");
nameMap.put( SimpleType.FLOAT, "float");
nameMap.put( SimpleType.INT, "int");
nameMap.put( SimpleType.VOID, "void" );
nameMap.put( SimpleType.WCHAR_T, "wchar_t" );
}
/**
* @param kind
* @param typeName
*/
public ASTSimpleTypeSpecifier(SimpleType kind, ITokenDuple typeName, boolean isShort, boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename)
{
this.kind = kind;
this.isLong = isLong;
this.isShort = isShort;
this.isSigned = isSigned;
this.isUnsigned = isUnsigned;
this.isTypename = isTypename;
StringBuffer type = new StringBuffer();
if( this.kind == IASTSimpleTypeSpecifier.SimpleType.CHAR || this.kind == IASTSimpleTypeSpecifier.SimpleType.WCHAR_T )
{
if (isUnsigned())
type.append("unsigned ");
type.append( (String)nameMap.get( this.kind ));
}
else if( this.kind == SimpleType.BOOL || this.kind == SimpleType.FLOAT || this.kind == SimpleType.VOID )
{
type.append( (String) nameMap.get( this.kind ));
}
else if( this.kind == SimpleType.INT )
{
if (isUnsigned())
type.append("unsigned ");
if (isShort())
type.append("short ");
if (isLong())
type.append("long ");
type.append( (String)nameMap.get( this.kind ));
}
else if( this.kind == SimpleType.DOUBLE )
{
if (isLong())
type.append("long ");
type.append( (String)nameMap.get( this.kind ));
}
else if( this.kind == SimpleType.TYPENAME || this.kind == SimpleType.TEMPLATE )
{
if (isTypename() )
type.append("typename ");
type.append(typeName.toString());
}
else if( this.kind == SimpleType.UNSPECIFIED )
{
if (isUnsigned())
type.append("unsigned ");
if (isShort())
type.append("short ");
if (isLong())
type.append("long ");
if (isSigned())
type.append("signed ");
}
this.typeName = typeName.toString();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#getType()
*/
public SimpleType getType()
{
return kind;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#getTypename()
*/
public String getTypename()
{
return typeName;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isLong()
*/
public boolean isLong()
{
return isLong;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isShort()
*/
public boolean isShort()
{
return isShort;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isSigned()
*/
public boolean isSigned()
{
return isSigned;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isUnsigned()
*/
public boolean isUnsigned()
{
return isUnsigned;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isTypename()
*/
public boolean isTypename()
{
return isTypename;
}
}

View file

@ -20,21 +20,26 @@ import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
import org.eclipse.cdt.core.parser.ast.IASTFactory;
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
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.IASTUsingDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType;
import org.eclipse.cdt.core.parser.ast.IASTExpression.Kind;
import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
import org.eclipse.cdt.core.parser.ast.IASTExpression.Kind;
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.SimpleType;
import org.eclipse.cdt.internal.core.parser.IASTArrayModifier;
import org.eclipse.cdt.internal.core.parser.ast.BaseASTFactory;
/**
@ -150,8 +155,41 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createIASTInitializerClause()
*/
public IASTInitializerClause createIASTInitializerClause(IASTInitializerClause.Kind kind, IASTExpression assignmentExpression, List initializerClauses) {
public IASTInitializerClause createInitializerClause(IASTInitializerClause.Kind kind, IASTExpression assignmentExpression, List initializerClauses) {
return new ASTInitializerClause( kind, assignmentExpression, initializerClauses );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExceptionSpecification(java.util.List)
*/
public IASTExceptionSpecification createExceptionSpecification(List typeIds)
{
return new ASTExceptionSpecification( typeIds );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createArrayModifier(org.eclipse.cdt.core.parser.ast.IASTExpression)
*/
public IASTArrayModifier createArrayModifier(IASTExpression exp)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createConstructorMemberInitializer(org.eclipse.cdt.core.parser.ITokenDuple, org.eclipse.cdt.core.parser.ast.IASTExpression)
*/
public IASTConstructorMemberInitializer createConstructorMemberInitializer(ITokenDuple duple, IASTExpression expressionList )
{
return new ASTConstructorMemberInitializer( duple.toString(), expressionList );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createSimpleTypeSpecifier(org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.SimpleType, org.eclipse.cdt.core.parser.ITokenDuple)
*/
public IASTSimpleTypeSpecifier createSimpleTypeSpecifier(SimpleType kind, ITokenDuple typeName, boolean isShort, boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename )
{
return new ASTSimpleTypeSpecifier( kind, typeName, isShort, isLong, isSigned, isUnsigned, isTypename );
}
}