mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +02:00
Patch for John Camelon:
- Added callback support for class member visibility. - Added callback support for pointer and reference operators on declarators. - Added callback support for throws clauses an const operations. - Added callback support for array declarators. - Updated parser tests to assist in this effort.
This commit is contained in:
parent
c27351afc0
commit
717cbc2041
15 changed files with 1190 additions and 227 deletions
|
@ -0,0 +1,52 @@
|
|||
/**********************************************************************
|
||||
* Created on Mar 23, 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
|
||||
*
|
||||
* To change this generated comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class ArrayQualifier implements IExpressionOwner {
|
||||
|
||||
private Expression constantExpression;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.dom.IExpressionOwner#getExpression()
|
||||
*/
|
||||
public Expression getExpression() {
|
||||
return constantExpression;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.dom.IExpressionOwner#setExpression(org.eclipse.cdt.internal.core.dom.Expression)
|
||||
*/
|
||||
public void setExpression(Expression exp) {
|
||||
constantExpression = exp;
|
||||
}
|
||||
|
||||
public ArrayQualifier( Declarator owner )
|
||||
{
|
||||
ownerDeclarator = owner;
|
||||
}
|
||||
|
||||
private Declarator ownerDeclarator;
|
||||
/**
|
||||
* @return Declarator
|
||||
*/
|
||||
public Declarator getOwnerDeclarator() {
|
||||
return ownerDeclarator;
|
||||
}
|
||||
|
||||
}
|
|
@ -11,6 +11,12 @@ public class ClassSpecifier extends TypeSpecifier implements IScope {
|
|||
public static final int t_struct = 1;
|
||||
public static final int t_union = 2;
|
||||
|
||||
public static final int v_public = 0;
|
||||
public static final int v_protected = 1;
|
||||
public static final int v_private = 3;
|
||||
|
||||
private int currentVisibility;
|
||||
|
||||
private final int classKey;
|
||||
public int getClassKey() { return classKey; }
|
||||
|
||||
|
@ -38,4 +44,19 @@ public class ClassSpecifier extends TypeSpecifier implements IScope {
|
|||
public List getDeclarations() {
|
||||
return declarations;
|
||||
}
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public int getCurrentVisibility() {
|
||||
return currentVisibility;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the currentVisiblity.
|
||||
* @param currentVisiblity The currentVisiblity to set
|
||||
*/
|
||||
public void setCurrentVisibility(int currentVisiblity) {
|
||||
this.currentVisibility = currentVisiblity;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package org.eclipse.cdt.internal.core.dom;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.internal.core.parser.IParserCallback;
|
||||
import org.eclipse.cdt.internal.core.parser.Token;
|
||||
import org.eclipse.cdt.internal.core.parser.util.DeclSpecifier;
|
||||
|
@ -40,10 +43,12 @@ public class DOMBuilder implements IParserCallback
|
|||
SimpleDeclaration decl = (SimpleDeclaration)container;
|
||||
|
||||
int kind = ClassSpecifier.t_struct;
|
||||
int visibility = ClassSpecifier.v_public;
|
||||
|
||||
switch (classKey.getType()) {
|
||||
case Token.t_class:
|
||||
kind = ClassSpecifier.t_class;
|
||||
visibility = ClassSpecifier.v_private;
|
||||
break;
|
||||
case Token.t_struct:
|
||||
kind = ClassSpecifier.t_struct;
|
||||
|
@ -54,6 +59,7 @@ public class DOMBuilder implements IParserCallback
|
|||
}
|
||||
|
||||
ClassSpecifier classSpecifier = new ClassSpecifier(kind, decl);
|
||||
classSpecifier.setCurrentVisibility( visibility );
|
||||
decl.setTypeSpecifier(classSpecifier);
|
||||
return classSpecifier;
|
||||
}
|
||||
|
@ -130,13 +136,14 @@ public class DOMBuilder implements IParserCallback
|
|||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#functionBodyBegin()
|
||||
*/
|
||||
public void functionBodyBegin(Object declaration) {
|
||||
public Object functionBodyBegin(Object declaration) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#functionBodyEnd()
|
||||
*/
|
||||
public void functionBodyEnd() {
|
||||
public void functionBodyEnd(Object functionBody) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -342,4 +349,137 @@ public class DOMBuilder implements IParserCallback
|
|||
public void expressionAbort(Object expression) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classMemberVisibility(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void classMemberVisibility(Object classSpecifier, Token visibility) {
|
||||
ClassSpecifier spec = (ClassSpecifier)classSpecifier;
|
||||
switch( visibility.getType() )
|
||||
{
|
||||
case Token.t_public:
|
||||
spec.setCurrentVisibility( ClassSpecifier.v_public );
|
||||
break;
|
||||
case Token.t_protected:
|
||||
spec.setCurrentVisibility( ClassSpecifier.v_protected );
|
||||
break;
|
||||
case Token.t_private:
|
||||
spec.setCurrentVisibility( ClassSpecifier.v_private );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorBegin(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public Object pointerOperatorBegin(Object container) {
|
||||
Declarator declarator = (Declarator)container;
|
||||
PointerOperator ptrOp = new PointerOperator(declarator);
|
||||
return ptrOp;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorEnd(java.lang.Object)
|
||||
*/
|
||||
public void pointerOperatorEnd(Object ptrOperator) {
|
||||
PointerOperator ptrOp = (PointerOperator)ptrOperator;
|
||||
Declarator owner = ptrOp.getOwnerDeclarator();
|
||||
owner.addPointerOperator( ptrOp );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorName(java.lang.Object)
|
||||
*/
|
||||
public void pointerOperatorName(Object ptrOperator) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorType(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void pointerOperatorType(Object ptrOperator, Token type) {
|
||||
PointerOperator ptrOp = (PointerOperator)ptrOperator;
|
||||
switch( type.getType() )
|
||||
{
|
||||
case Token.tSTAR:
|
||||
ptrOp.setType( PointerOperator.t_pointer );
|
||||
break;
|
||||
case Token.tAMPER:
|
||||
ptrOp.setType( PointerOperator.t_reference );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorCVModifier(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void pointerOperatorCVModifier(Object ptrOperator, Token modifier) {
|
||||
PointerOperator ptrOp = (PointerOperator)ptrOperator;
|
||||
switch( modifier.getType() )
|
||||
{
|
||||
case Token.t_const:
|
||||
ptrOp.setConst(true);
|
||||
break;
|
||||
case Token.t_volatile:
|
||||
ptrOp.setVolatile( true );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorCVModifier(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void declaratorCVModifier(Object declarator, Token modifier) {
|
||||
Declarator decl = (Declarator)declarator;
|
||||
switch( modifier.getType() )
|
||||
{
|
||||
case Token.t_const:
|
||||
decl.setConst(true);
|
||||
break;
|
||||
case Token.t_volatile:
|
||||
decl.setVolatile( true );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#arrayBegin(java.lang.Object)
|
||||
*/
|
||||
public Object arrayDeclaratorBegin(Object declarator) {
|
||||
Declarator decl = (Declarator)declarator;
|
||||
ArrayQualifier qual = new ArrayQualifier( decl );
|
||||
return qual;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#arrayEnd(java.lang.Object)
|
||||
*/
|
||||
public void arrayDeclaratorEnd(Object arrayQualifier ) {
|
||||
ArrayQualifier qual = (ArrayQualifier)arrayQualifier;
|
||||
Declarator parent = qual.getOwnerDeclarator();
|
||||
parent.addArrayQualifier(qual);
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#exceptionSpecificationTypename(java.lang.Object)
|
||||
*/
|
||||
public void declaratorThrowExceptionName(Object declarator ) {
|
||||
Declarator decl = (Declarator)declarator;
|
||||
decl.addExceptionSpecifierTypeName( currName );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorThrowsException(java.lang.Object)
|
||||
*/
|
||||
public void declaratorThrowsException(Object declarator) {
|
||||
Declarator decl = (Declarator)declarator;
|
||||
decl.throwsExceptions();
|
||||
}
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
package org.eclipse.cdt.internal.core.dom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.internal.core.parser.util.DeclSpecifier;
|
||||
import org.eclipse.cdt.internal.core.parser.util.Name;
|
||||
|
||||
|
@ -61,20 +64,107 @@ public class Declarator implements IExpressionOwner {
|
|||
return parms;
|
||||
}
|
||||
|
||||
private Expression expression = null;
|
||||
private Expression initialExpression = null;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.dom.IExpressionOwner#getExpression()
|
||||
*/
|
||||
public Expression getExpression() {
|
||||
return expression;
|
||||
return initialExpression;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.dom.IExpressionOwner#setExpression(org.eclipse.cdt.internal.core.dom.Expression)
|
||||
*/
|
||||
public void setExpression(Expression exp) {
|
||||
expression = exp;
|
||||
initialExpression = exp;
|
||||
}
|
||||
|
||||
List pointerOperators = null;
|
||||
List arrayQualifiers = null;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return List
|
||||
*/
|
||||
public List getPointerOperators() {
|
||||
return pointerOperators;
|
||||
}
|
||||
|
||||
public void addPointerOperator( PointerOperator po )
|
||||
{
|
||||
if( pointerOperators == null )
|
||||
{
|
||||
pointerOperators = new ArrayList();
|
||||
}
|
||||
pointerOperators.add(po);
|
||||
}
|
||||
|
||||
List exceptionSpecifier = null;
|
||||
|
||||
public List getExceptionSpecifier()
|
||||
{
|
||||
return exceptionSpecifier;
|
||||
}
|
||||
|
||||
public void throwsExceptions()
|
||||
{
|
||||
if( exceptionSpecifier == null )
|
||||
exceptionSpecifier = new ArrayList();
|
||||
}
|
||||
|
||||
public void addExceptionSpecifierTypeName( Name name )
|
||||
{
|
||||
exceptionSpecifier.add( name );
|
||||
}
|
||||
|
||||
boolean isConst = false;
|
||||
boolean isVolatile = false;
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isConst() {
|
||||
return isConst;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isVolatile() {
|
||||
return isVolatile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the isConst.
|
||||
* @param isConst The isConst to set
|
||||
*/
|
||||
public void setConst(boolean isConst) {
|
||||
this.isConst = isConst;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the isVolatile.
|
||||
* @param isVolatile The isVolatile to set
|
||||
*/
|
||||
public void setVolatile(boolean isVolatile) {
|
||||
this.isVolatile = isVolatile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return List
|
||||
*/
|
||||
public List getArrayQualifiers() {
|
||||
return arrayQualifiers;
|
||||
}
|
||||
|
||||
public void addArrayQualifier( ArrayQualifier q )
|
||||
{
|
||||
if( arrayQualifiers == null )
|
||||
{
|
||||
arrayQualifiers = new ArrayList();
|
||||
}
|
||||
arrayQualifiers.add(q);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
/**********************************************************************
|
||||
* Created on Mar 23, 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
|
||||
*
|
||||
* To change this generated comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class PointerOperator {
|
||||
|
||||
public final static int t_undefined = 0;
|
||||
public final static int t_pointer = 1;
|
||||
public final static int t_reference = 2;
|
||||
|
||||
private int type = t_undefined;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type.
|
||||
* @param type The type to set
|
||||
*/
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
private boolean isConst = false;
|
||||
private boolean isVolatile = false;
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isConst() {
|
||||
return isConst;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isVolatile() {
|
||||
return isVolatile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the isConst.
|
||||
* @param isConst The isConst to set
|
||||
*/
|
||||
public void setConst(boolean isConst) {
|
||||
this.isConst = isConst;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the isVolatile.
|
||||
* @param isVolatile The isVolatile to set
|
||||
*/
|
||||
public void setVolatile(boolean isVolatile) {
|
||||
this.isVolatile = isVolatile;
|
||||
}
|
||||
|
||||
public PointerOperator( Declarator decl )
|
||||
{
|
||||
ownerDeclarator = decl;
|
||||
}
|
||||
|
||||
private Declarator ownerDeclarator = null;
|
||||
/**
|
||||
* @return Declarator
|
||||
*/
|
||||
public Declarator getOwnerDeclarator() {
|
||||
return ownerDeclarator;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,3 +1,9 @@
|
|||
2003-03-23 John Camelon
|
||||
Added callback support for class member visibility.
|
||||
Added callback support for pointer and reference operators on declarators.
|
||||
Added callback support for throws clauses an const operations.
|
||||
Added callback support for array declarators.
|
||||
|
||||
2003-03-20 Andrew Niefer
|
||||
Parser Symbol Table updates for:
|
||||
* friends
|
||||
|
|
|
@ -102,9 +102,10 @@ public class NewModelBuilder implements IParserCallback {
|
|||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#beginFunctionBody()
|
||||
*/
|
||||
public void functionBodyBegin(Object declaration) {
|
||||
public Object functionBodyBegin(Object declaration) {
|
||||
SimpleDeclarationWrapper wrapper = (SimpleDeclarationWrapper)declaration;
|
||||
wrapper.setFunctionDefinition(true);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -254,7 +255,7 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
|||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#functionBodyEnd()
|
||||
*/
|
||||
public void functionBodyEnd() {
|
||||
public void functionBodyEnd(Object functionBody) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -366,4 +367,103 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
|||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classMemberVisibility(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void classMemberVisibility(Object classSpecifier, Token visibility) {
|
||||
SimpleDeclarationWrapper spec = (SimpleDeclarationWrapper)classSpecifier;
|
||||
switch( visibility.getType() )
|
||||
{
|
||||
case Token.t_public:
|
||||
spec.setCurrentVisibility( SimpleDeclarationWrapper.v_public );
|
||||
break;
|
||||
case Token.t_protected:
|
||||
spec.setCurrentVisibility( SimpleDeclarationWrapper.v_protected );
|
||||
break;
|
||||
case Token.t_private:
|
||||
spec.setCurrentVisibility( SimpleDeclarationWrapper.v_private );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorBegin(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public Object pointerOperatorBegin(Object container) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorEnd(java.lang.Object)
|
||||
*/
|
||||
public void pointerOperatorEnd(Object ptrOperator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorName(java.lang.Object)
|
||||
*/
|
||||
public void pointerOperatorName(Object ptrOperator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorType(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void pointerOperatorType(Object ptrOperator, Token type) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorCVModifier(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void pointerOperatorCVModifier(Object ptrOperator, Token modifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorCVModifier(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void declaratorCVModifier(Object declarator, Token modifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#arrayBegin(java.lang.Object)
|
||||
*/
|
||||
public Object arrayDeclaratorBegin(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#arrayEnd(java.lang.Object)
|
||||
*/
|
||||
public void arrayDeclaratorEnd(Object arrayQualifier ) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#exceptionSpecificationTypename(java.lang.Object)
|
||||
*/
|
||||
public void declaratorThrowExceptionName(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorThrowsException(java.lang.Object)
|
||||
*/
|
||||
public void declaratorThrowsException(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -214,4 +214,24 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
this.functionDefinition = functionDefinition;
|
||||
}
|
||||
|
||||
public static final int v_public = 0;
|
||||
public static final int v_protected = 1;
|
||||
public static final int v_private = 3;
|
||||
|
||||
private int currentVisibility;
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public int getCurrentVisibility() {
|
||||
return currentVisibility;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the currentVisibility.
|
||||
* @param currentVisibility The currentVisibility to set
|
||||
*/
|
||||
public void setCurrentVisibility(int currentVisibility) {
|
||||
this.currentVisibility = currentVisibility;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -206,12 +206,13 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
/**
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#functionBodyBegin()
|
||||
*/
|
||||
public void functionBodyBegin(Object declaration) {
|
||||
public Object functionBodyBegin(Object declaration) {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#functionBodyEnd()
|
||||
*/
|
||||
public void functionBodyEnd() {
|
||||
public void functionBodyEnd(Object functionBody) {
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classSpecifierBegin(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
|
@ -314,4 +315,91 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classMemberVisibility(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void classMemberVisibility(Object classSpecifier, Token visibility) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorBegin(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public Object pointerOperatorBegin(Object container) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorEnd(java.lang.Object)
|
||||
*/
|
||||
public void pointerOperatorEnd(Object ptrOperator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorName(java.lang.Object)
|
||||
*/
|
||||
public void pointerOperatorName(Object ptrOperator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorType(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void pointerOperatorType(Object ptrOperator, Token type) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorCVModifier(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void pointerOperatorCVModifier(Object ptrOperator, Token modifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorCVModifier(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void declaratorCVModifier(Object declarator, Token modifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#arrayBegin(java.lang.Object)
|
||||
*/
|
||||
public Object arrayDeclaratorBegin(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#arrayEnd(java.lang.Object)
|
||||
*/
|
||||
public void arrayDeclaratorEnd(Object arrayQualifier ) {
|
||||
// TODO Auto-generated method stub;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#exceptionSpecificationTypename(java.lang.Object)
|
||||
*/
|
||||
public void declaratorThrowExceptionName(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorThrowsException(java.lang.Object)
|
||||
*/
|
||||
public void declaratorThrowsException(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,18 +33,31 @@ public interface IParserCallback {
|
|||
public Object declaratorBegin(Object container);
|
||||
public void declaratorId(Object declarator);
|
||||
public void declaratorAbort( Object container, Object declarator );
|
||||
public void declaratorCVModifier( Object declarator, Token modifier );
|
||||
public void declaratorThrowsException( Object declarator );
|
||||
public void declaratorThrowExceptionName( Object declarator );
|
||||
public void declaratorEnd(Object declarator);
|
||||
|
||||
public Object arrayDeclaratorBegin( Object declarator );
|
||||
public void arrayDeclaratorEnd( Object arrayQualifier );
|
||||
|
||||
public Object pointerOperatorBegin( Object container );
|
||||
public void pointerOperatorType( Object ptrOperator, Token type );
|
||||
public void pointerOperatorName( Object ptrOperator );
|
||||
public void pointerOperatorCVModifier( Object ptrOperator, Token modifier );
|
||||
public void pointerOperatorEnd( Object ptrOperator );
|
||||
|
||||
public Object argumentsBegin( Object declarator );
|
||||
public void argumentsEnd(Object parameterDeclarationClause);
|
||||
|
||||
public void functionBodyBegin(Object declaration);
|
||||
public void functionBodyEnd();
|
||||
public Object functionBodyBegin(Object declaration);
|
||||
public void functionBodyEnd(Object functionBody);
|
||||
|
||||
public Object classSpecifierBegin(Object container, Token classKey);
|
||||
public void classSpecifierName(Object classSpecifier);
|
||||
public void classSpecifierAbort( Object classSpecifier );
|
||||
public void classSpecifierSafe( Object classSpecifier );
|
||||
public void classMemberVisibility( Object classSpecifier, Token visibility );
|
||||
public void classSpecifierEnd(Object classSpecifier);
|
||||
|
||||
public Object baseSpecifierBegin( Object containingClassSpec );
|
||||
|
|
|
@ -1,225 +1,356 @@
|
|||
package org.eclipse.cdt.internal.core.parser;
|
||||
|
||||
public class NullParserCallback implements IParserCallback {
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#beginArguments()
|
||||
*/
|
||||
public Object argumentsBegin( Object container ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#beginClass(String, Token)
|
||||
*/
|
||||
public Object classSpecifierBegin(Object container, Token classKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#beginDeclarator()
|
||||
*/
|
||||
public Object declaratorBegin(Object container) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#beginFunctionBody()
|
||||
*/
|
||||
public void functionBodyBegin(Object declaration) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#beginInclusion(String)
|
||||
*/
|
||||
public void inclusionBegin(String includeFile, int offset) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(Token)
|
||||
*/
|
||||
public Object simpleDeclarationBegin(Object Container) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#beginTranslationUnit()
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#translationUnitBegin()
|
||||
*/
|
||||
public Object translationUnitBegin() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#declaratorId(Token)
|
||||
*/
|
||||
public void declaratorId(Object declarator) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#declSpecifier(Token)
|
||||
*/
|
||||
public void simpleDeclSpecifier(Object Container, Token specifier) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#endArguments()
|
||||
*/
|
||||
public void argumentsEnd(Object parameterDeclarationClause) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#endClass()
|
||||
*/
|
||||
public void classSpecifierEnd(Object classSpecifier) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#endDeclarator()
|
||||
*/
|
||||
public void declaratorEnd(Object declarator) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#endFunctionBody()
|
||||
*/
|
||||
public void functionBodyEnd() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#endInclusion()
|
||||
*/
|
||||
public void inclusionEnd() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#endSimpleDeclaration(Token)
|
||||
*/
|
||||
public void simpleDeclarationEnd(Object declaration) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#endTranslationUnit()
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#translationUnitEnd(java.lang.Object)
|
||||
*/
|
||||
public void translationUnitEnd(Object unit) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#expressionOperator(Token)
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#inclusionBegin(java.lang.String, int)
|
||||
*/
|
||||
public void expressionOperator(Object expression, Token operator) throws Exception {
|
||||
public void inclusionBegin(String includeFile, int offset) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#expressionTerminal(Token)
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#inclusionEnd()
|
||||
*/
|
||||
public void expressionTerminal(Object expression, Token terminal) throws Exception {
|
||||
public void inclusionEnd() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#macro(String)
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#macro(java.lang.String, int)
|
||||
*/
|
||||
public void macro(String macroName, int offset) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#nameBegin(org.eclipse.cdt.internal.core.newparser.Token)
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#simpleDeclarationBegin(java.lang.Object)
|
||||
*/
|
||||
public void nameBegin(Token firstToken) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#nameEnd(org.eclipse.cdt.internal.core.newparser.Token)
|
||||
*/
|
||||
public void nameEnd(Token lastToken) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#classSpecifierName()
|
||||
*/
|
||||
public void classSpecifierName(Object classSpecifier) {
|
||||
}
|
||||
|
||||
public Object baseSpecifierBegin( Object classSpecifier )
|
||||
{
|
||||
public Object simpleDeclarationBegin(Object Container) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public void baseSpecifierEnd( Object x )
|
||||
{
|
||||
}
|
||||
|
||||
public void baseSpecifierName( Object baseSpecifier )
|
||||
{
|
||||
}
|
||||
|
||||
public void baseSpecifierVisibility( Object baseSpecifier, Token visibility )
|
||||
{
|
||||
}
|
||||
|
||||
public void baseSpecifierVirtual( Object baseSpecifier, boolean virtual )
|
||||
{
|
||||
}
|
||||
|
||||
public Object parameterDeclarationBegin( Object container )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void parameterDeclarationEnd( Object declaration ){
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#declaratorAbort(java.lang.Object, java.lang.Object)
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#simpleDeclSpecifier(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void declaratorAbort(Object container, Object declarator) {
|
||||
public void simpleDeclSpecifier(Object Container, Token specifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#expressionBegin(java.lang.Object)
|
||||
*/
|
||||
public Object expressionBegin(Object container) {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#expressionEnd(java.lang.Object)
|
||||
*/
|
||||
public void expressionEnd(Object expression) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classSpecifierAbort(java.lang.Object)
|
||||
*/
|
||||
public void classSpecifierAbort(Object classSpecifier) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classSpecifierSafe(java.lang.Object)
|
||||
*/
|
||||
public void classSpecifierSafe(Object classSpecifier) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#elaboratedTypeSpecifierBegin(java.lang.Object)
|
||||
*/
|
||||
public Object elaboratedTypeSpecifierBegin(Object container, Token classKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#elaboratedTypeSpecifierEnd(java.lang.Object)
|
||||
*/
|
||||
public void elaboratedTypeSpecifierEnd(Object elab) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#elaboratedTypeSpecifierName(java.lang.Object)
|
||||
*/
|
||||
public void elaboratedTypeSpecifierName(Object elab) {
|
||||
}
|
||||
|
||||
/**
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#simpleDeclSpecifierName(java.lang.Object)
|
||||
*/
|
||||
public void simpleDeclSpecifierName(Object declaration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#simpleDeclarationEnd(java.lang.Object)
|
||||
*/
|
||||
public void simpleDeclarationEnd(Object declaration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#parameterDeclarationBegin(java.lang.Object)
|
||||
*/
|
||||
public Object parameterDeclarationBegin(Object Container) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#parameterDeclarationEnd(java.lang.Object)
|
||||
*/
|
||||
public void parameterDeclarationEnd(Object declaration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#nameBegin(org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void nameBegin(Token firstToken) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#nameEnd(org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void nameEnd(Token lastToken) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorBegin(java.lang.Object)
|
||||
*/
|
||||
public Object declaratorBegin(Object container) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorId(java.lang.Object)
|
||||
*/
|
||||
public void declaratorId(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorAbort(java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
public void declaratorAbort(Object container, Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorCVModifier(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void declaratorCVModifier(Object declarator, Token modifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorThrowExceptionName(java.lang.Object)
|
||||
*/
|
||||
public void declaratorThrowExceptionName(Object exceptionSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorEnd(java.lang.Object)
|
||||
*/
|
||||
public void declaratorEnd(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#arrayDeclaratorBegin(java.lang.Object)
|
||||
*/
|
||||
public Object arrayDeclaratorBegin(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#arrayDeclaratorEnd(java.lang.Object)
|
||||
*/
|
||||
public void arrayDeclaratorEnd(Object arrayQualifier) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorBegin(java.lang.Object)
|
||||
*/
|
||||
public Object pointerOperatorBegin(Object container) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorType(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void pointerOperatorType(Object ptrOperator, Token type) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorName(java.lang.Object)
|
||||
*/
|
||||
public void pointerOperatorName(Object ptrOperator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorCVModifier(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void pointerOperatorCVModifier(Object ptrOperator, Token modifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorEnd(java.lang.Object)
|
||||
*/
|
||||
public void pointerOperatorEnd(Object ptrOperator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#argumentsBegin(java.lang.Object)
|
||||
*/
|
||||
public Object argumentsBegin(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#argumentsEnd(java.lang.Object)
|
||||
*/
|
||||
public void argumentsEnd(Object parameterDeclarationClause) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#functionBodyBegin(java.lang.Object)
|
||||
*/
|
||||
public Object functionBodyBegin(Object declaration) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#functionBodyEnd(java.lang.Object)
|
||||
*/
|
||||
public void functionBodyEnd(Object functionBody) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classSpecifierBegin(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public Object classSpecifierBegin(Object container, Token classKey) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classSpecifierName(java.lang.Object)
|
||||
*/
|
||||
public void classSpecifierName(Object classSpecifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classSpecifierAbort(java.lang.Object)
|
||||
*/
|
||||
public void classSpecifierAbort(Object classSpecifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classSpecifierSafe(java.lang.Object)
|
||||
*/
|
||||
public void classSpecifierSafe(Object classSpecifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classMemberVisibility(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void classMemberVisibility(Object classSpecifier, Token visibility) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classSpecifierEnd(java.lang.Object)
|
||||
*/
|
||||
public void classSpecifierEnd(Object classSpecifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#baseSpecifierBegin(java.lang.Object)
|
||||
*/
|
||||
public Object baseSpecifierBegin(Object containingClassSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#baseSpecifierName(java.lang.Object)
|
||||
*/
|
||||
public void baseSpecifierName(Object baseSpecifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#baseSpecifierVisibility(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void baseSpecifierVisibility(Object baseSpecifier, Token visibility) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#baseSpecifierVirtual(java.lang.Object, boolean)
|
||||
*/
|
||||
public void baseSpecifierVirtual(Object baseSpecifier, boolean virtual) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#baseSpecifierEnd(java.lang.Object)
|
||||
*/
|
||||
public void baseSpecifierEnd(Object baseSpecifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#expressionBegin(java.lang.Object)
|
||||
*/
|
||||
public Object expressionBegin(Object container) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#expressionOperator(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void expressionOperator(Object expression, Token operator) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#expressionTerminal(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void expressionTerminal(Object expression, Token terminal) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -230,4 +361,44 @@ public class NullParserCallback implements IParserCallback {
|
|||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#expressionEnd(java.lang.Object)
|
||||
*/
|
||||
public void expressionEnd(Object expression) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#elaboratedTypeSpecifierBegin(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public Object elaboratedTypeSpecifierBegin(Object container, Token classKey) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#elaboratedTypeSpecifierName(java.lang.Object)
|
||||
*/
|
||||
public void elaboratedTypeSpecifierName(Object elab) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#elaboratedTypeSpecifierEnd(java.lang.Object)
|
||||
*/
|
||||
public void elaboratedTypeSpecifierEnd(Object elab) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorThrowsException(java.lang.Object)
|
||||
*/
|
||||
public void declaratorThrowsException(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -105,6 +105,7 @@ c, quick);
|
|||
}
|
||||
|
||||
protected void consumeToNextSemicolon() throws EndOfFile {
|
||||
parsePassed = false;
|
||||
consume();
|
||||
// TODO - we should really check for matching braces too
|
||||
while (LT(1) != Token.tSEMI) {
|
||||
|
@ -210,7 +211,7 @@ c, quick);
|
|||
}
|
||||
// Falling through on purpose
|
||||
case Token.tLBRACE:
|
||||
callback.functionBodyBegin(simpleDecl );
|
||||
Object function = callback.functionBodyBegin(simpleDecl );
|
||||
if (quickParse) {
|
||||
// speed up the parser by skiping the body
|
||||
// simply look for matching brace and return
|
||||
|
@ -229,7 +230,7 @@ c, quick);
|
|||
} else {
|
||||
functionBody();
|
||||
}
|
||||
callback.functionBodyEnd();
|
||||
callback.functionBodyEnd(function);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -408,12 +409,12 @@ c, quick);
|
|||
* cvQualifier
|
||||
* : "const" | "volatile"
|
||||
*/
|
||||
protected Object cvQualifier() throws Exception {
|
||||
protected void cvQualifier( Object ptrOp ) throws Exception {
|
||||
switch (LT(1)) {
|
||||
case Token.t_const:
|
||||
case Token.t_volatile:
|
||||
consume();
|
||||
return null;
|
||||
callback.pointerOperatorCVModifier( ptrOp, consume() );
|
||||
return;
|
||||
default:
|
||||
throw backtrack;
|
||||
}
|
||||
|
@ -510,7 +511,7 @@ c, quick);
|
|||
|
||||
for (;;) {
|
||||
try {
|
||||
ptrOperator();
|
||||
ptrOperator(declarator);
|
||||
} catch (Backtrack b) {
|
||||
break;
|
||||
}
|
||||
|
@ -557,12 +558,59 @@ c, quick);
|
|||
}
|
||||
}
|
||||
callback.argumentsEnd(clause);
|
||||
|
||||
// const-volatile marker on the method
|
||||
if( LT(1) == Token.t_const || LT(1) == Token.t_volatile )
|
||||
{
|
||||
callback.declaratorCVModifier( declarator, consume() );
|
||||
}
|
||||
|
||||
//check for throws clause here
|
||||
if( LT(1) == Token.t_throw )
|
||||
{
|
||||
callback.declaratorThrowsException( declarator );
|
||||
consume(); // throw
|
||||
consume( Token.tLPAREN );// (
|
||||
boolean done = false;
|
||||
while( ! done )
|
||||
{
|
||||
switch( LT(1) )
|
||||
{
|
||||
case Token.tRPAREN:
|
||||
consume();
|
||||
done = true;
|
||||
break;
|
||||
case Token.tIDENTIFIER:
|
||||
//TODO this is not exactly right - should be type-id rather than just a name
|
||||
name();
|
||||
callback.declaratorThrowExceptionName( declarator );
|
||||
break;
|
||||
case Token.tCOMMA:
|
||||
consume();
|
||||
break;
|
||||
default:
|
||||
System.out.println( "Unexpected Token =" + LA(1).getImage() );
|
||||
consumeToNextSemicolon();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Token.tLBRACKET:
|
||||
consume();
|
||||
// constantExpression();
|
||||
consume(Token.tRBRACKET);
|
||||
while( LT(1) == Token.tLBRACKET )
|
||||
{
|
||||
consume(); // eat the '['
|
||||
Object array = callback.arrayDeclaratorBegin( declarator );
|
||||
if( LT(1) != Token.tRBRACKET )
|
||||
{
|
||||
Object expression = callback.expressionBegin( array );
|
||||
constantExpression(expression);
|
||||
callback.expressionEnd( expression );
|
||||
}
|
||||
consume(Token.tRBRACKET);
|
||||
callback.arrayDeclaratorEnd( array );
|
||||
}
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
@ -584,30 +632,37 @@ c, quick);
|
|||
* | "&"
|
||||
* | name "*" (cvQualifier)*
|
||||
*/
|
||||
protected Object ptrOperator() throws Exception {
|
||||
protected void ptrOperator(Object owner) throws Exception {
|
||||
int t = LT(1);
|
||||
Object ptrOp = callback.pointerOperatorBegin( owner );
|
||||
|
||||
if (t == Token.tAMPER) {
|
||||
consume();
|
||||
return null;
|
||||
callback.pointerOperatorType( ptrOp, consume() );
|
||||
callback.pointerOperatorEnd( ptrOp );
|
||||
return;
|
||||
}
|
||||
|
||||
Token mark = mark();
|
||||
if (t == Token.tIDENTIFIER || t == Token.tCOLONCOLON)
|
||||
{
|
||||
name();
|
||||
callback.pointerOperatorName( ptrOp );
|
||||
}
|
||||
|
||||
if (t == Token.tSTAR) {
|
||||
consume();
|
||||
callback.pointerOperatorType( ptrOp, consume());
|
||||
|
||||
for (;;) {
|
||||
try {
|
||||
cvQualifier();
|
||||
cvQualifier( ptrOp );
|
||||
} catch (Backtrack b) {
|
||||
// expected at some point
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
callback.pointerOperatorEnd( ptrOp );
|
||||
return;
|
||||
}
|
||||
|
||||
backup(mark);
|
||||
|
@ -705,15 +760,9 @@ c, quick);
|
|||
|
||||
switch (LT(1)) {
|
||||
case Token.t_public:
|
||||
consume();
|
||||
consume(Token.tCOLON);
|
||||
break;
|
||||
case Token.t_protected:
|
||||
consume();
|
||||
consume(Token.tCOLON);
|
||||
break;
|
||||
case Token.t_private:
|
||||
consume();
|
||||
callback.classMemberVisibility( classSpec, consume() );
|
||||
consume(Token.tCOLON);
|
||||
break;
|
||||
case Token.tRBRACE:
|
||||
|
|
|
@ -1264,7 +1264,7 @@ public class Scanner implements IScanner {
|
|||
EXPRESSION,
|
||||
definitions);
|
||||
Parser parser = new Parser(trial, evaluator);
|
||||
parser.expression(null); //TODO should this be null?
|
||||
parser.expression(null);
|
||||
|
||||
expressionEvalResult = evaluator.getResult();
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2003-03-23 John Camelon
|
||||
Added ptrOperator() test to DOMTests.
|
||||
Added testFunctionModifiers() test to DOMTests.
|
||||
Added testArrays() test to DOMTests.
|
||||
|
||||
2003-03-20 Alain Magloire
|
||||
|
||||
Patch from Amer Hoda, tests for the CElement deltas for Translation Units.
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.internal.core.dom.ArrayQualifier;
|
||||
import org.eclipse.cdt.internal.core.dom.BaseSpecifier;
|
||||
import org.eclipse.cdt.internal.core.dom.ClassSpecifier;
|
||||
import org.eclipse.cdt.internal.core.dom.DOMBuilder;
|
||||
|
@ -14,6 +15,7 @@ import org.eclipse.cdt.internal.core.dom.Declarator;
|
|||
import org.eclipse.cdt.internal.core.dom.Expression;
|
||||
import org.eclipse.cdt.internal.core.dom.ParameterDeclaration;
|
||||
import org.eclipse.cdt.internal.core.dom.ParameterDeclarationClause;
|
||||
import org.eclipse.cdt.internal.core.dom.PointerOperator;
|
||||
import org.eclipse.cdt.internal.core.dom.SimpleDeclaration;
|
||||
import org.eclipse.cdt.internal.core.dom.TranslationUnit;
|
||||
import org.eclipse.cdt.internal.core.parser.Parser;
|
||||
|
@ -341,6 +343,123 @@ public class DOMTests extends TestCase {
|
|||
assertNull( integerDeclarator.getParms() );
|
||||
}
|
||||
|
||||
public void testFunctionModifiers() throws Exception
|
||||
{
|
||||
Writer code = new StringWriter();
|
||||
code.write( "void foo( void ) const throw ( yay, nay, we::dont::care );");
|
||||
TranslationUnit translationUnit = parse( code.toString() );
|
||||
List tudeclarations = translationUnit.getDeclarations();
|
||||
assertEquals( 1, tudeclarations.size() );
|
||||
SimpleDeclaration decl1 = (SimpleDeclaration)tudeclarations.get(0);
|
||||
assertEquals( decl1.getDeclSpecifier().getType(), DeclSpecifier.t_void);
|
||||
assertEquals( decl1.getDeclarators().size(), 1 );
|
||||
Declarator declarator = (Declarator)decl1.getDeclarators().get(0);
|
||||
assertEquals( declarator.getName().toString(), "foo");
|
||||
assertTrue( declarator.isConst() );
|
||||
assertFalse( declarator.isVolatile() );
|
||||
List exceptions = declarator.getExceptionSpecifier();
|
||||
assertEquals( exceptions.size(), 3 );
|
||||
Name n = (Name)exceptions.get(0);
|
||||
assertEquals( n.toString(), "yay");
|
||||
n = (Name)exceptions.get(1);
|
||||
assertEquals( n.toString(), "nay");
|
||||
n = (Name)exceptions.get(2);
|
||||
assertEquals( n.toString(), "we::dont::care");
|
||||
}
|
||||
|
||||
|
||||
public void testArrays() throws Exception
|
||||
{
|
||||
// Parse and get the translaton unit
|
||||
Writer code = new StringWriter();
|
||||
code.write("int x [5][];");
|
||||
TranslationUnit translationUnit = parse( code.toString() );
|
||||
List tudeclarations = translationUnit.getDeclarations();
|
||||
assertEquals( 1, tudeclarations.size() );
|
||||
SimpleDeclaration decl1 = (SimpleDeclaration)tudeclarations.get(0);
|
||||
assertEquals( decl1.getDeclSpecifier().getType(), DeclSpecifier.t_int);
|
||||
assertEquals( decl1.getDeclarators().size(), 1 );
|
||||
Declarator declarator = (Declarator)decl1.getDeclarators().get(0);
|
||||
assertEquals( declarator.getName().toString(), "x");
|
||||
List arrayQualifiers = declarator.getArrayQualifiers();
|
||||
assertEquals( 2, arrayQualifiers.size() );
|
||||
ArrayQualifier q1 =(ArrayQualifier)arrayQualifiers.get(0);
|
||||
assertNotNull( q1.getExpression() );
|
||||
List tokens = q1.getExpression().tokens();
|
||||
assertEquals( tokens.size(), 1 );
|
||||
ArrayQualifier q2 =(ArrayQualifier)arrayQualifiers.get(1);
|
||||
assertNull( q2.getExpression() );
|
||||
}
|
||||
|
||||
public void testPointerOperators() throws Exception
|
||||
{
|
||||
// Parse and get the translaton unit
|
||||
Writer code = new StringWriter();
|
||||
code.write("int * x = 0, & y, * const * const volatile * z;");
|
||||
TranslationUnit translationUnit = parse(code.toString());
|
||||
|
||||
List tudeclarations = translationUnit.getDeclarations();
|
||||
assertEquals( 1, tudeclarations.size() );
|
||||
SimpleDeclaration decl1 = (SimpleDeclaration)tudeclarations.get(0);
|
||||
assertEquals( decl1.getDeclSpecifier().getType(), DeclSpecifier.t_int);
|
||||
|
||||
assertEquals( 3, decl1.getDeclarators().size() );
|
||||
|
||||
Declarator declarator1 = (Declarator)decl1.getDeclarators().get( 0 );
|
||||
assertEquals( declarator1.getName().toString(), "x" );
|
||||
Expression initValue1 = declarator1.getExpression();
|
||||
assertEquals( initValue1.tokens().size(), 1 );
|
||||
List ptrOps1 = declarator1.getPointerOperators();
|
||||
assertNotNull( ptrOps1 );
|
||||
assertEquals( 1, ptrOps1.size() );
|
||||
PointerOperator po1 = (PointerOperator)ptrOps1.get(0);
|
||||
assertNotNull( po1 );
|
||||
assertFalse( po1.isConst() );
|
||||
assertFalse( po1.isVolatile() );
|
||||
assertEquals( po1.getType(), PointerOperator.t_pointer );
|
||||
Token t1 = (Token)initValue1.tokens().get(0);
|
||||
assertEquals( t1.getType(), Token.tINTEGER );
|
||||
assertEquals( t1.getImage(), "0");
|
||||
|
||||
Declarator declarator2 = (Declarator)decl1.getDeclarators().get( 1 );
|
||||
assertEquals( declarator2.getName().toString(), "y" );
|
||||
assertNull( declarator2.getExpression() );
|
||||
List ptrOps2 = declarator2.getPointerOperators();
|
||||
assertNotNull( ptrOps2 );
|
||||
assertEquals( 1, ptrOps2.size() );
|
||||
PointerOperator po2 = (PointerOperator)ptrOps2.get(0);
|
||||
assertNotNull( po2 );
|
||||
assertFalse( po2.isConst() );
|
||||
assertFalse( po2.isVolatile() );
|
||||
assertEquals( po2.getType(), PointerOperator.t_reference );
|
||||
|
||||
Declarator declarator3 = (Declarator)decl1.getDeclarators().get( 2 );
|
||||
assertEquals( "z", declarator3.getName().toString() );
|
||||
List ptrOps3 = declarator3.getPointerOperators();
|
||||
assertNotNull( ptrOps3 );
|
||||
assertEquals( 3, ptrOps3.size() );
|
||||
|
||||
//* const
|
||||
PointerOperator po3 = (PointerOperator)ptrOps3.get(0);
|
||||
assertNotNull( po3 );
|
||||
assertTrue( po3.isConst() );
|
||||
assertFalse( po3.isVolatile() );
|
||||
assertEquals( po3.getType(), PointerOperator.t_pointer );
|
||||
// * const volatile
|
||||
PointerOperator po4 = (PointerOperator)ptrOps3.get(1);
|
||||
assertNotNull( po4 );
|
||||
assertEquals( po4.getType(), PointerOperator.t_pointer );
|
||||
assertTrue( po4.isConst() );
|
||||
assertTrue( po4.isVolatile() );
|
||||
// *
|
||||
PointerOperator po5 = (PointerOperator)ptrOps3.get(2);
|
||||
assertNotNull( po5 );
|
||||
assertFalse( po5.isConst() );
|
||||
assertFalse( po5.isVolatile() );
|
||||
assertEquals( po5.getType(), PointerOperator.t_pointer );
|
||||
}
|
||||
|
||||
|
||||
// public void testErrors()
|
||||
// {
|
||||
// validateWeEncounterAnError( "void myFunc( int hey, flo );");
|
||||
|
@ -368,7 +487,6 @@ public class DOMTests extends TestCase {
|
|||
{
|
||||
fail( "IOException thrown");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue