mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 18:05:33 +02:00
Patch for John Camelon:
- Updated NewModelBuilder to work for ElaboratedTypeSpecifiers, PointerOperators, Const Methods. - Fixed bug35878.
This commit is contained in:
parent
c13b3fc240
commit
903e1c11d8
12 changed files with 258 additions and 45 deletions
|
@ -834,4 +834,11 @@ public class DOMBuilder implements IParserCallback
|
||||||
public void templateTypeParameterAbort(Object typeParm) {
|
public void templateTypeParameterAbort(Object typeParm) {
|
||||||
typeParm = null;
|
typeParm = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorAbort(java.lang.Object)
|
||||||
|
*/
|
||||||
|
public void pointerOperatorAbort(Object ptrOperator) {
|
||||||
|
ptrOperator = null;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.util.*;
|
||||||
import org.eclipse.cdt.internal.core.parser.util.DeclSpecifier;
|
import org.eclipse.cdt.internal.core.parser.util.DeclSpecifier;
|
||||||
import org.eclipse.cdt.internal.core.parser.util.Name;
|
import org.eclipse.cdt.internal.core.parser.util.Name;
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom;
|
package org.eclipse.cdt.internal.core.dom;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.parser.util.Name;
|
import org.eclipse.cdt.internal.core.parser.util.Name;
|
||||||
|
@ -29,7 +29,7 @@ public class EnumerationSpecifier extends TypeSpecifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Name name = null;
|
private Name name = null;
|
||||||
private List enumeratorDefinitions = new LinkedList();
|
private List enumeratorDefinitions = new ArrayList();
|
||||||
|
|
||||||
public void addEnumeratorDefinition( EnumeratorDefinition def )
|
public void addEnumeratorDefinition( EnumeratorDefinition def )
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
Parser Symbol Table, better support for function resolution with pointers and
|
Parser Symbol Table, better support for function resolution with pointers and
|
||||||
references as parameters. Also support for typedefs as function parameters
|
references as parameters. Also support for typedefs as function parameters
|
||||||
|
|
||||||
|
2003-03-31 John Camelon
|
||||||
|
Updated NewModelBuilder to work for ElaboratedTypeSpecifiers, PointerOperators, Const Methods.
|
||||||
|
Fixed bug35878.
|
||||||
|
|
||||||
2003-03-31 John Camelon
|
2003-03-31 John Camelon
|
||||||
Updated Scanner to work for Strings literals like L"this string"
|
Updated Scanner to work for Strings literals like L"this string"
|
||||||
Updated Scanner to work for floating points literals.
|
Updated Scanner to work for floating points literals.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.eclipse.cdt.internal.core.model;
|
package org.eclipse.cdt.internal.core.model;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.parser.util.Name;
|
import org.eclipse.cdt.internal.core.parser.util.Name;
|
||||||
|
@ -15,7 +16,8 @@ import org.eclipse.cdt.internal.core.parser.util.Name;
|
||||||
public class Declarator {
|
public class Declarator {
|
||||||
|
|
||||||
private Name name;
|
private Name name;
|
||||||
|
private boolean isConst = false;
|
||||||
|
private boolean isVolatile = false;
|
||||||
/**
|
/**
|
||||||
* Returns the name.
|
* Returns the name.
|
||||||
* @return Name
|
* @return Name
|
||||||
|
@ -49,4 +51,49 @@ public class Declarator {
|
||||||
public void setParameterDeclarationClause(List parameterDeclarationClause) {
|
public void setParameterDeclarationClause(List parameterDeclarationClause) {
|
||||||
this.parameterDeclarationClause = parameterDeclarationClause;
|
this.parameterDeclarationClause = parameterDeclarationClause;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List pointerOperators = new ArrayList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return List
|
||||||
|
*/
|
||||||
|
public List getPointerOperators() {
|
||||||
|
return pointerOperators;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addPointerOperator( PointerOperator po )
|
||||||
|
{
|
||||||
|
pointerOperators.add( po );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isConst() {
|
||||||
|
return isConst;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the isConst.
|
||||||
|
* @param isConst The isConst to set
|
||||||
|
*/
|
||||||
|
public void setConst(boolean isConst) {
|
||||||
|
this.isConst = isConst;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isVolatile() {
|
||||||
|
return isVolatile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the isVolatile.
|
||||||
|
* @param isVolatile The isVolatile to set
|
||||||
|
*/
|
||||||
|
public void setVolatile(boolean isVolatile) {
|
||||||
|
this.isVolatile = isVolatile;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -334,16 +334,39 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
||||||
Structure elem = new Structure( wrapper.getParent(), wrapper.getKind(), null );
|
Structure elem = new Structure( wrapper.getParent(), wrapper.getKind(), null );
|
||||||
wrapper.setElement( elem );
|
wrapper.setElement( elem );
|
||||||
wrapper.getParent().addChild(elem);
|
wrapper.getParent().addChild(elem);
|
||||||
String name = currName.toString();
|
String name = wrapper.getName().toString();
|
||||||
elem.setElementName( name );
|
elem.setElementName( name );
|
||||||
elem.setIdPos(currName.getStartOffset(), name.length());
|
elem.setIdPos(wrapper.getName().getStartOffset(), name.length());
|
||||||
elem.setPos(currName.getStartOffset(), name.length());
|
elem.setPos(wrapper.getName().getStartOffset(), name.length());
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#elaboratedTypeSpecifierBegin(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#elaboratedTypeSpecifierBegin(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public Object elaboratedTypeSpecifierBegin(Object container, Token classKey) {
|
public Object elaboratedTypeSpecifierBegin(Object container, Token classKey) {
|
||||||
return null;
|
if( container instanceof SimpleDeclarationWrapper )
|
||||||
|
{
|
||||||
|
SimpleDeclarationWrapper c = (SimpleDeclarationWrapper)container;
|
||||||
|
|
||||||
|
int kind;
|
||||||
|
switch (classKey.getType()) {
|
||||||
|
case Token.t_class:
|
||||||
|
kind = ICElement.C_CLASS;
|
||||||
|
break;
|
||||||
|
case Token.t_struct:
|
||||||
|
kind = ICElement.C_STRUCT;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
kind = ICElement.C_UNION;
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleDeclarationWrapper wrapper = new SimpleDeclarationWrapper();
|
||||||
|
wrapper.setKind( kind );
|
||||||
|
wrapper.setParent( c.getParent() );
|
||||||
|
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -356,6 +379,11 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#elaboratedTypeSpecifierName(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#elaboratedTypeSpecifierName(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void elaboratedTypeSpecifierName(Object elab) {
|
public void elaboratedTypeSpecifierName(Object elab) {
|
||||||
|
if( elab instanceof SimpleDeclarationWrapper )
|
||||||
|
{
|
||||||
|
SimpleDeclarationWrapper wrapper = (SimpleDeclarationWrapper)elab;
|
||||||
|
wrapper.setName( currName );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -399,8 +427,9 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorBegin(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorBegin(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||||
*/
|
*/
|
||||||
public Object pointerOperatorBegin(Object container) {
|
public Object pointerOperatorBegin(Object container) {
|
||||||
// TODO Auto-generated method stub
|
Declarator d = (Declarator)container;
|
||||||
return null;
|
PointerOperator po = new PointerOperator(d);
|
||||||
|
return po;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -408,7 +437,8 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorEnd(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorEnd(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void pointerOperatorEnd(Object ptrOperator) {
|
public void pointerOperatorEnd(Object ptrOperator) {
|
||||||
// TODO Auto-generated method stub
|
PointerOperator po = (PointerOperator)ptrOperator;
|
||||||
|
po.getOwnerDeclarator().addPointerOperator( po );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,31 +447,57 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
||||||
*/
|
*/
|
||||||
public void pointerOperatorName(Object ptrOperator) {
|
public void pointerOperatorName(Object ptrOperator) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorType(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
* @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) {
|
public void pointerOperatorType(Object ptrOperator, Token type) {
|
||||||
// TODO Auto-generated method stub
|
PointerOperator po=(PointerOperator)ptrOperator;
|
||||||
|
switch( type.getType() )
|
||||||
}
|
{
|
||||||
|
case Token.tSTAR:
|
||||||
|
po.setKind( PointerOperator.k_pointer );
|
||||||
|
break;
|
||||||
|
case Token.tAMPER:
|
||||||
|
po.setKind( PointerOperator.k_reference );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
} }
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorCVModifier(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
* @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) {
|
public void pointerOperatorCVModifier(Object ptrOperator, Token modifier) {
|
||||||
// TODO Auto-generated method stub
|
PointerOperator po=(PointerOperator)ptrOperator;
|
||||||
|
switch( modifier.getType() )
|
||||||
|
{
|
||||||
|
case Token.t_const:
|
||||||
|
po.setConst( true );
|
||||||
|
break;
|
||||||
|
case Token.t_volatile:
|
||||||
|
po.setVolatile( true );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorCVModifier(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
* @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) {
|
public void declaratorCVModifier(Object declarator, Token modifier) {
|
||||||
// TODO Auto-generated method stub
|
Declarator d = (Declarator)declarator;
|
||||||
|
switch( modifier.getType() )
|
||||||
|
{
|
||||||
|
case Token.t_const:
|
||||||
|
d.setConst( true );
|
||||||
|
break;
|
||||||
|
case Token.t_volatile:
|
||||||
|
d.setVolatile(true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -585,39 +641,32 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierBegin(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierBegin(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public Object enumSpecifierBegin(Object container) {
|
public Object enumSpecifierBegin(Object container) {
|
||||||
// TODO Auto-generated method stub
|
return null;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierId(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierId(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void enumSpecifierId(Object enumSpec) {
|
public void enumSpecifierId(Object enumSpec) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierAbort(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierAbort(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void enumSpecifierAbort(Object enumSpec) {
|
public void enumSpecifierAbort(Object enumSpec) {
|
||||||
// TODO Auto-generated method stub
|
enumSpec = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierEnd(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierEnd(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void enumSpecifierEnd(Object enumSpec) {
|
public void enumSpecifierEnd(Object enumSpec) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionBegin(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionBegin(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public Object enumDefinitionBegin(Object enumSpec) {
|
public Object enumDefinitionBegin(Object enumSpec) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -625,16 +674,12 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionId(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionId(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void enumDefinitionId(Object enumDefn) {
|
public void enumDefinitionId(Object enumDefn) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionEnd(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionEnd(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void enumDefinitionEnd(Object enumDefn) {
|
public void enumDefinitionEnd(Object enumDefn) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -713,32 +758,28 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitInstantiationBegin(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitInstantiationBegin(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public Object explicitInstantiationBegin(Object container) {
|
public Object explicitInstantiationBegin(Object container) {
|
||||||
// TODO Auto-generated method stub
|
// until explicit-instantiations are part of the code model just return the container object
|
||||||
return null;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitInstantiationEnd(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitInstantiationEnd(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void explicitInstantiationEnd(Object instantiation) {
|
public void explicitInstantiationEnd(Object instantiation) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitSpecializationBegin(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitSpecializationBegin(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public Object explicitSpecializationBegin(Object container) {
|
public Object explicitSpecializationBegin(Object container) {
|
||||||
// TODO Auto-generated method stub
|
// until explicit-specializations are part of the code model just return the container object
|
||||||
return null;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitSpecializationEnd(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitSpecializationEnd(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void explicitSpecializationEnd(Object instantiation) {
|
public void explicitSpecializationEnd(Object instantiation) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -753,8 +794,8 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#templateDeclarationBegin(java.lang.Object, boolean)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#templateDeclarationBegin(java.lang.Object, boolean)
|
||||||
*/
|
*/
|
||||||
public Object templateDeclarationBegin(Object container, boolean exported) {
|
public Object templateDeclarationBegin(Object container, boolean exported) {
|
||||||
// TODO Auto-generated method stub
|
// until linkageSpecs are part of the code model just return the container object
|
||||||
return null;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -810,7 +851,13 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
||||||
*/
|
*/
|
||||||
public void templateTypeParameterAbort(Object typeParm) {
|
public void templateTypeParameterAbort(Object typeParm) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorAbort(java.lang.Object)
|
||||||
|
*/
|
||||||
|
public void pointerOperatorAbort(Object ptrOperator) {
|
||||||
|
ptrOperator = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* Created on Mar 31, 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.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class PointerOperator {
|
||||||
|
|
||||||
|
private final Declarator ownerDeclarator;
|
||||||
|
|
||||||
|
public PointerOperator( Declarator decl )
|
||||||
|
{
|
||||||
|
ownerDeclarator = decl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Declarator
|
||||||
|
*/
|
||||||
|
public Declarator getOwnerDeclarator() {
|
||||||
|
return ownerDeclarator;
|
||||||
|
}
|
||||||
|
public static final int k_pointer = 1;
|
||||||
|
public static final int k_reference = 2;
|
||||||
|
|
||||||
|
private boolean isConst = false;
|
||||||
|
private boolean isVolatile = false;
|
||||||
|
private int kind;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isConst() {
|
||||||
|
return isConst;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isVolatile() {
|
||||||
|
return isVolatile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public int getKind() {
|
||||||
|
return kind;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the kind.
|
||||||
|
* @param kind The kind to set
|
||||||
|
*/
|
||||||
|
public void setKind(int kind) {
|
||||||
|
this.kind = kind;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -704,4 +704,10 @@ public class ExpressionEvaluator implements IParserCallback {
|
||||||
public void templateTypeParameterAbort(Object typeParm) {
|
public void templateTypeParameterAbort(Object typeParm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorAbort(java.lang.Object)
|
||||||
|
*/
|
||||||
|
public void pointerOperatorAbort(Object ptrOperator) {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ public interface IParserCallback {
|
||||||
public void pointerOperatorType( Object ptrOperator, Token type );
|
public void pointerOperatorType( Object ptrOperator, Token type );
|
||||||
public void pointerOperatorName( Object ptrOperator );
|
public void pointerOperatorName( Object ptrOperator );
|
||||||
public void pointerOperatorCVModifier( Object ptrOperator, Token modifier );
|
public void pointerOperatorCVModifier( Object ptrOperator, Token modifier );
|
||||||
|
public void pointerOperatorAbort( Object ptrOperator );
|
||||||
public void pointerOperatorEnd( Object ptrOperator );
|
public void pointerOperatorEnd( Object ptrOperator );
|
||||||
|
|
||||||
public Object argumentsBegin( Object declarator );
|
public Object argumentsBegin( Object declarator );
|
||||||
|
|
|
@ -605,4 +605,10 @@ public class NullParserCallback implements IParserCallback {
|
||||||
public void templateTypeParameterAbort(Object typeParm) {
|
public void templateTypeParameterAbort(Object typeParm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorAbort(java.lang.Object)
|
||||||
|
*/
|
||||||
|
public void pointerOperatorAbort(Object ptrOperator) {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1105,7 +1105,7 @@ c, quick);
|
||||||
try{ ptrOp = callback.pointerOperatorBegin( owner );} catch( Exception e ) {}
|
try{ ptrOp = callback.pointerOperatorBegin( owner );} catch( Exception e ) {}
|
||||||
|
|
||||||
if (t == Token.tAMPER) {
|
if (t == Token.tAMPER) {
|
||||||
try{ callback.pointerOperatorType( ptrOp, consume() ); } catch( Exception e ) {}
|
try{ callback.pointerOperatorType( ptrOp, consume(Token.tAMPER) ); } catch( Exception e ) {}
|
||||||
try{ callback.pointerOperatorEnd( ptrOp );} catch( Exception e ) {}
|
try{ callback.pointerOperatorEnd( ptrOp );} catch( Exception e ) {}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1139,6 +1139,7 @@ c, quick);
|
||||||
}
|
}
|
||||||
|
|
||||||
backup(mark);
|
backup(mark);
|
||||||
|
try{ callback.pointerOperatorAbort( ptrOp ); } catch( Exception e ) { }
|
||||||
throw backtrack;
|
throw backtrack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1977,7 +1978,8 @@ c, quick);
|
||||||
return scanner.nextToken();
|
return scanner.nextToken();
|
||||||
} catch (EndOfFile e) {
|
} catch (EndOfFile e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Exception e) {
|
} catch (ScannerException e) {
|
||||||
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -586,7 +586,12 @@ public class Scanner implements IScanner {
|
||||||
c = getChar();
|
c = getChar();
|
||||||
|
|
||||||
if (c == 'x') {
|
if (c == 'x') {
|
||||||
if( ! firstCharZero )
|
if( ! firstCharZero && floatingPoint )
|
||||||
|
{
|
||||||
|
ungetChar( c );
|
||||||
|
return newToken( Token.tDOT, ".", currentContext );
|
||||||
|
}
|
||||||
|
else if( ! firstCharZero )
|
||||||
throw new ScannerException( "Invalid Hexidecimal @ offset " + currentContext.getOffset() );
|
throw new ScannerException( "Invalid Hexidecimal @ offset " + currentContext.getOffset() );
|
||||||
|
|
||||||
hex = true;
|
hex = true;
|
||||||
|
@ -706,6 +711,7 @@ public class Scanner implements IScanner {
|
||||||
if (throwExceptionOnBadPreprocessorSyntax)
|
if (throwExceptionOnBadPreprocessorSyntax)
|
||||||
throw new ScannerException(
|
throw new ScannerException(
|
||||||
BAD_PP + currentContext.getOffset());
|
BAD_PP + currentContext.getOffset());
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
int type = ((Integer) directive).intValue();
|
int type = ((Integer) directive).intValue();
|
||||||
|
|
Loading…
Add table
Reference in a new issue