mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Modified the IASTFactory to take three expression lists for the createNewDescriptor() instead of just one.
They are : newPlacementExpressions, typeIdExpressions, and newInitializerExpressions.
This commit is contained in:
parent
4f65c461c3
commit
c64fbade9d
8 changed files with 68 additions and 25 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2003-08-25 Hoda Amer
|
||||||
|
Modified the IASTFactory to take three expression lists
|
||||||
|
for the createNewDescriptor() instead of just one.
|
||||||
|
They are : newPlacementExpressions, typeIdExpressions, and
|
||||||
|
newInitializerExpressions.
|
||||||
|
|
||||||
2003-08-25 John Camelon
|
2003-08-25 John Camelon
|
||||||
Updated Structure.java to keep JDK 1.3 compliance.
|
Updated Structure.java to keep JDK 1.3 compliance.
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.ast;
|
package org.eclipse.cdt.core.parser.ast;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.Enum;
|
import org.eclipse.cdt.core.parser.Enum;
|
||||||
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
|
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
|
||||||
|
@ -124,7 +124,9 @@ public interface IASTExpression extends ISourceElementCallbackDelegate
|
||||||
|
|
||||||
public interface IASTNewExpressionDescriptor
|
public interface IASTNewExpressionDescriptor
|
||||||
{
|
{
|
||||||
public List getExpressions();
|
public Iterator getNewPlacementExpressions();
|
||||||
|
public Iterator getNewTypeIdExpressions();
|
||||||
|
public Iterator getNewInitializerExpressions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ public interface IASTFactory
|
||||||
IToken id,
|
IToken id,
|
||||||
ITokenDuple typeId,
|
ITokenDuple typeId,
|
||||||
String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException;
|
String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException;
|
||||||
public IASTExpression.IASTNewExpressionDescriptor createNewDescriptor(List expressions);
|
public IASTExpression.IASTNewExpressionDescriptor createNewDescriptor(List newPlacementExpressions,List newTypeIdExpressions,List newInitializerExpressions);
|
||||||
public IASTInitializerClause createInitializerClause(
|
public IASTInitializerClause createInitializerClause(
|
||||||
IASTInitializerClause.Kind kind,
|
IASTInitializerClause.Kind kind,
|
||||||
IASTExpression assignmentExpression,
|
IASTExpression assignmentExpression,
|
||||||
|
|
|
@ -3540,7 +3540,9 @@ public class Parser implements IParser
|
||||||
IToken beforeSecondParen = null;
|
IToken beforeSecondParen = null;
|
||||||
IToken backtrackMarker = null;
|
IToken backtrackMarker = null;
|
||||||
ITokenDuple typeId = null;
|
ITokenDuple typeId = null;
|
||||||
ArrayList expressions = new ArrayList();
|
ArrayList newPlacementExpressions = new ArrayList();
|
||||||
|
ArrayList newTypeIdExpressions = new ArrayList();
|
||||||
|
ArrayList newInitializerExpressions = new ArrayList();
|
||||||
|
|
||||||
if (LT(1) == IToken.tLPAREN)
|
if (LT(1) == IToken.tLPAREN)
|
||||||
{
|
{
|
||||||
|
@ -3550,7 +3552,7 @@ public class Parser implements IParser
|
||||||
// Try to consume placement list
|
// Try to consume placement list
|
||||||
// Note: since expressionList and expression are the same...
|
// Note: since expressionList and expression are the same...
|
||||||
backtrackMarker = mark();
|
backtrackMarker = mark();
|
||||||
expressions.add(expression(scope));
|
newPlacementExpressions.add(expression(scope));
|
||||||
consume(IToken.tRPAREN);
|
consume(IToken.tRPAREN);
|
||||||
placementParseFailure = false;
|
placementParseFailure = false;
|
||||||
if (LT(1) == IToken.tLPAREN)
|
if (LT(1) == IToken.tLPAREN)
|
||||||
|
@ -3634,7 +3636,7 @@ public class Parser implements IParser
|
||||||
return astFactory.createExpression(
|
return astFactory.createExpression(
|
||||||
scope, IASTExpression.Kind.NEW_TYPEID,
|
scope, IASTExpression.Kind.NEW_TYPEID,
|
||||||
null, null, null, null, typeId, "",
|
null, null, null, null, typeId, "",
|
||||||
astFactory.createNewDescriptor(expressions));
|
astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions));
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -3663,7 +3665,7 @@ public class Parser implements IParser
|
||||||
{
|
{
|
||||||
// array new
|
// array new
|
||||||
consume();
|
consume();
|
||||||
expressions.add(assignmentExpression(scope));
|
newTypeIdExpressions.add(assignmentExpression(scope));
|
||||||
consume(IToken.tRBRACKET);
|
consume(IToken.tRBRACKET);
|
||||||
}
|
}
|
||||||
// newinitializer
|
// newinitializer
|
||||||
|
@ -3671,7 +3673,7 @@ public class Parser implements IParser
|
||||||
{
|
{
|
||||||
consume(IToken.tLPAREN);
|
consume(IToken.tLPAREN);
|
||||||
if (LT(1) != IToken.tRPAREN)
|
if (LT(1) != IToken.tRPAREN)
|
||||||
expressions.add(expression(scope));
|
newInitializerExpressions.add(expression(scope));
|
||||||
consume(IToken.tRPAREN);
|
consume(IToken.tRPAREN);
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
|
@ -3679,7 +3681,7 @@ public class Parser implements IParser
|
||||||
return astFactory.createExpression(
|
return astFactory.createExpression(
|
||||||
scope, IASTExpression.Kind.NEW_TYPEID,
|
scope, IASTExpression.Kind.NEW_TYPEID,
|
||||||
null, null, null, null, typeId, "",
|
null, null, null, null, typeId, "",
|
||||||
astFactory.createNewDescriptor(expressions));
|
astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions));
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.parser.ast.complete;
|
package org.eclipse.cdt.internal.core.parser.ast.complete;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
|
import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
|
||||||
|
@ -22,19 +23,28 @@ import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescripto
|
||||||
*/
|
*/
|
||||||
public class ASTNewDescriptor implements IASTNewExpressionDescriptor {
|
public class ASTNewDescriptor implements IASTNewExpressionDescriptor {
|
||||||
|
|
||||||
List expressions;
|
List newPlacementExpressions;
|
||||||
|
List newTypeIdExpressions;
|
||||||
public ASTNewDescriptor(List expressions) {
|
List newInitializerExpressions;
|
||||||
|
public ASTNewDescriptor(List newPlacementExpressions, List newTypeIdExpressions, List newInitializerExpressions) {
|
||||||
super();
|
super();
|
||||||
this.expressions = expressions;
|
this.newPlacementExpressions = newPlacementExpressions;
|
||||||
|
this.newTypeIdExpressions = newTypeIdExpressions;
|
||||||
|
this.newInitializerExpressions = newInitializerExpressions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor#getExpressions()
|
* @see org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor#getExpressions()
|
||||||
*/
|
*/
|
||||||
public List getExpressions() {
|
public Iterator getNewPlacementExpressions() {
|
||||||
return expressions;
|
return newPlacementExpressions.iterator();
|
||||||
|
}
|
||||||
|
public Iterator getNewTypeIdExpressions() {
|
||||||
|
return newTypeIdExpressions.iterator();
|
||||||
|
}
|
||||||
|
public Iterator getNewInitializerExpressions() {
|
||||||
|
return newInitializerExpressions.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -641,12 +641,21 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
getExpressionReferences(rhs, references);
|
getExpressionReferences(rhs, references);
|
||||||
getExpressionReferences(thirdExpression,references);
|
getExpressionReferences(thirdExpression,references);
|
||||||
|
|
||||||
|
// add newDescriptor's references & add to references
|
||||||
// if there is a newDescriptor, check related expressions
|
// if there is a newDescriptor, check related expressions
|
||||||
if(newDescriptor != null){
|
if(newDescriptor != null){
|
||||||
Iterator i = newDescriptor.getExpressions().iterator();
|
Iterator i = newDescriptor.getNewPlacementExpressions();
|
||||||
while (i.hasNext()){
|
while (i.hasNext()){
|
||||||
getExpressionReferences((IASTExpression)i.next(), references);
|
getExpressionReferences((IASTExpression)i.next(), references);
|
||||||
}
|
}
|
||||||
|
i = newDescriptor.getNewTypeIdExpressions();
|
||||||
|
while (i.hasNext()){
|
||||||
|
getExpressionReferences((IASTExpression)i.next(), references);
|
||||||
|
}
|
||||||
|
i = newDescriptor.getNewInitializerExpressions();
|
||||||
|
while (i.hasNext()){
|
||||||
|
getExpressionReferences((IASTExpression)i.next(), references);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//look up id & add to references
|
//look up id & add to references
|
||||||
|
@ -672,7 +681,6 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
if( typeId != null )
|
if( typeId != null )
|
||||||
lookupQualifiedName( startingScope, typeId, references, false );
|
lookupQualifiedName( startingScope, typeId, references, false );
|
||||||
|
|
||||||
//TODO add newDescriptor's references & add to references
|
|
||||||
return new ASTExpression( kind, lhs, rhs, thirdExpression,
|
return new ASTExpression( kind, lhs, rhs, thirdExpression,
|
||||||
id == null ? "" : id.getImage(),
|
id == null ? "" : id.getImage(),
|
||||||
typeId == null ? "" : typeId.toString(),
|
typeId == null ? "" : typeId.toString(),
|
||||||
|
@ -690,11 +698,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNewDescriptor()
|
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNewDescriptor()
|
||||||
*/
|
*/
|
||||||
public IASTNewExpressionDescriptor createNewDescriptor(List expressions)
|
public IASTNewExpressionDescriptor createNewDescriptor(List newPlacementExpressions,List newTypeIdExpressions,List newInitializerExpressions)
|
||||||
{
|
{
|
||||||
// TODO FIX THIS
|
return new ASTNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions);
|
||||||
// return null;
|
|
||||||
return new ASTNewDescriptor(expressions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.parser.ast.quick;
|
package org.eclipse.cdt.internal.core.parser.ast.quick;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
|
import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
|
||||||
|
|
||||||
|
@ -19,10 +19,27 @@ import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescripto
|
||||||
*/
|
*/
|
||||||
public class ASTNewDescriptor implements IASTNewExpressionDescriptor {
|
public class ASTNewDescriptor implements IASTNewExpressionDescriptor {
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor#getExpressions()
|
* @see org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor#getNewInitializerExpressions()
|
||||||
*/
|
*/
|
||||||
public List getExpressions() {
|
public Iterator getNewInitializerExpressions() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor#getNewPlacementExpressions()
|
||||||
|
*/
|
||||||
|
public Iterator getNewPlacementExpressions() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor#getTypeIdExpressions()
|
||||||
|
*/
|
||||||
|
public Iterator getNewTypeIdExpressions() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNewDescriptor()
|
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNewDescriptor()
|
||||||
*/
|
*/
|
||||||
public IASTNewExpressionDescriptor createNewDescriptor(List expressions) {
|
public IASTNewExpressionDescriptor createNewDescriptor(List newPlacementEpressions, List newTypeIdExpressions, List newInitializerExpressions) {
|
||||||
return new ASTNewDescriptor();
|
return new ASTNewDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue