mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-17 05:05:43 +02:00
Fixed unsigned short Simpledeclartions not showing up in the
outline view
This commit is contained in:
parent
1c8649d6fd
commit
aacea7223c
14 changed files with 305 additions and 84 deletions
|
@ -600,7 +600,7 @@ public class DOMBuilder implements IParserCallback
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierBegin(java.lang.Object)
|
||||
*/
|
||||
public Object enumSpecifierBegin(Object container) {
|
||||
public Object enumSpecifierBegin(Object container, Token enumKey) {
|
||||
SimpleDeclaration decl = (SimpleDeclaration)container;
|
||||
EnumerationSpecifier es = new EnumerationSpecifier( decl );
|
||||
decl.setTypeSpecifier(es);
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2003-03-31 John Camelon
|
||||
Fixed unsigned short SimpleDeclarations not showing up in the outline view.
|
||||
Fixed default visibilities for structs in outline view.
|
||||
Fixed bug35892.
|
||||
Added icon-less typedefs and enums to the outline view.
|
||||
Fixed NPEs relating to anonymous structs, unions, enums in outline view.
|
||||
|
||||
2003-03-31 Andrew Niefer
|
||||
Parser Symbol Table, better support for function resolution with pointers and
|
||||
references as parameters. Also support for typedefs as function parameters
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/**********************************************************************
|
||||
* Created on Apr 1, 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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.model.IParent;
|
||||
import org.eclipse.cdt.internal.core.parser.Token;
|
||||
import org.eclipse.cdt.internal.core.parser.util.Name;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class EnumerationWrapper {
|
||||
|
||||
private Name name;
|
||||
private List enumerators = new ArrayList();
|
||||
private final IParent parent;
|
||||
private final Token key;
|
||||
|
||||
public EnumerationWrapper( IParent incoming, Token enumKey )
|
||||
{
|
||||
this.parent= incoming;
|
||||
key = enumKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Name
|
||||
*/
|
||||
public Name getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
* @param name The name to set
|
||||
*/
|
||||
public void setName(Name name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return List
|
||||
*/
|
||||
public List getEnumerators() {
|
||||
return enumerators;
|
||||
}
|
||||
|
||||
public void addEnumerator( EnumeratorWrapper in )
|
||||
{
|
||||
enumerators.add( in );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ICElementWrapper
|
||||
*/
|
||||
public IParent getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Token
|
||||
*/
|
||||
public Token getClassKind() {
|
||||
return key;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/**********************************************************************
|
||||
* Created on Apr 1, 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;
|
||||
|
||||
import org.eclipse.cdt.internal.core.parser.util.Name;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class EnumeratorWrapper {
|
||||
|
||||
private final EnumerationWrapper parent;
|
||||
private Name name;
|
||||
|
||||
EnumeratorWrapper( EnumerationWrapper myParent )
|
||||
{
|
||||
this.parent = myParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Name
|
||||
*/
|
||||
public Name getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return EnumerationWrapper
|
||||
*/
|
||||
public EnumerationWrapper getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
* @param name The name to set
|
||||
*/
|
||||
public void setName(Name name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package org.eclipse.cdt.internal.core.model;
|
||||
|
||||
import org.eclipse.cdt.core.model.IParent;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
|
@ -10,6 +12,6 @@ package org.eclipse.cdt.internal.core.model;
|
|||
*/
|
||||
public interface ICElementWrapper {
|
||||
|
||||
public CElement getElement();
|
||||
public void setElement (CElement item);
|
||||
public IParent getElement();
|
||||
public void setElement (IParent item);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.model;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -44,20 +45,20 @@ public class NewModelBuilder implements IParserCallback {
|
|||
{
|
||||
SimpleDeclarationWrapper c = (SimpleDeclarationWrapper)container;
|
||||
|
||||
int kind;
|
||||
switch (classKey.getType()) {
|
||||
SimpleDeclarationWrapper wrapper = new SimpleDeclarationWrapper();
|
||||
wrapper.setClassKind( classKey );
|
||||
switch( classKey.getType() )
|
||||
{
|
||||
case Token.t_class:
|
||||
kind = ICElement.C_CLASS;
|
||||
wrapper.setCurrentVisibility( AccessSpecifier.v_private );
|
||||
break;
|
||||
case Token.t_struct:
|
||||
kind = ICElement.C_STRUCT;
|
||||
case Token.t_union:
|
||||
wrapper.setCurrentVisibility( AccessSpecifier.v_public );
|
||||
break;
|
||||
default:
|
||||
kind = ICElement.C_UNION;
|
||||
}
|
||||
|
||||
SimpleDeclarationWrapper wrapper = new SimpleDeclarationWrapper();
|
||||
wrapper.setKind( kind );
|
||||
|
||||
wrapper.setParent( c.getParent() );
|
||||
|
||||
return wrapper;
|
||||
|
@ -138,7 +139,7 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
|||
Object parent = wrapper.getElement();
|
||||
SimpleDeclarationWrapper result = new SimpleDeclarationWrapper();
|
||||
if( wrapper instanceof SimpleDeclarationWrapper ){
|
||||
result.setParent( (CElement)wrapper.getElement() );
|
||||
result.setParent( wrapper.getElement() );
|
||||
result.setCurrentVisibility(((SimpleDeclarationWrapper)wrapper).getCurrentVisibility());
|
||||
} else if ( wrapper instanceof TranslationUnitWrapper )
|
||||
result.setParent( (TranslationUnit)wrapper.getElement());
|
||||
|
@ -331,13 +332,36 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
|||
*/
|
||||
public void classSpecifierSafe(Object classSpecifier) {
|
||||
SimpleDeclarationWrapper wrapper = (SimpleDeclarationWrapper)classSpecifier;
|
||||
Structure elem = new Structure( wrapper.getParent(), wrapper.getKind(), null );
|
||||
int kind;
|
||||
|
||||
switch( wrapper.getClassKind().getType() )
|
||||
{
|
||||
case Token.t_class:
|
||||
kind = ICElement.C_CLASS;
|
||||
break;
|
||||
case Token.t_struct:
|
||||
kind = ICElement.C_STRUCT;
|
||||
break;
|
||||
default:
|
||||
kind = ICElement.C_UNION;
|
||||
break;
|
||||
}
|
||||
Structure elem = new Structure( (CElement)wrapper.getParent(), kind, null );
|
||||
wrapper.setElement( elem );
|
||||
wrapper.getParent().addChild(elem);
|
||||
String name = wrapper.getName().toString();
|
||||
elem.setElementName( name );
|
||||
elem.setIdPos(wrapper.getName().getStartOffset(), name.length());
|
||||
elem.setPos(wrapper.getName().getStartOffset(), name.length());
|
||||
((Parent)wrapper.getParent()).addChild(elem);
|
||||
|
||||
String elementName = ( wrapper.getName() == null ) ? "" : wrapper.getName().toString();
|
||||
elem.setElementName( elementName );
|
||||
if( wrapper.getName() != null )
|
||||
{
|
||||
elem.setIdPos(wrapper.getName().getStartOffset(), elementName.length());
|
||||
elem.setPos(wrapper.getName().getStartOffset(), elementName.length());
|
||||
}
|
||||
else
|
||||
{
|
||||
elem.setIdPos(wrapper.getClassKind().getOffset(), wrapper.getClassKind().getLength());
|
||||
elem.setPos(wrapper.getClassKind().getOffset(), wrapper.getClassKind().getLength());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#elaboratedTypeSpecifierBegin(java.lang.Object)
|
||||
|
@ -346,21 +370,9 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
|||
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.setClassKind( classKey );
|
||||
wrapper.setParent( c.getParent() );
|
||||
|
||||
return wrapper;
|
||||
|
@ -373,6 +385,7 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#elaboratedTypeSpecifierEnd(java.lang.Object)
|
||||
*/
|
||||
public void elaboratedTypeSpecifierEnd(Object elab) {
|
||||
SimpleDeclarationWrapper wrapper = (SimpleDeclarationWrapper)elab;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -640,14 +653,17 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierBegin(java.lang.Object)
|
||||
*/
|
||||
public Object enumSpecifierBegin(Object container) {
|
||||
return null;
|
||||
public Object enumSpecifierBegin(Object container, Token enumKey) {
|
||||
SimpleDeclarationWrapper c = (SimpleDeclarationWrapper)container;
|
||||
EnumerationWrapper wrapper = new EnumerationWrapper(c.getParent(), enumKey );
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierId(java.lang.Object)
|
||||
*/
|
||||
public void enumSpecifierId(Object enumSpec) {
|
||||
((EnumerationWrapper)enumSpec).setName( currName );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -661,25 +677,60 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierEnd(java.lang.Object)
|
||||
*/
|
||||
public void enumSpecifierEnd(Object enumSpec) {
|
||||
EnumerationWrapper wrapper = (EnumerationWrapper)enumSpec;
|
||||
|
||||
List enumerators = wrapper.getEnumerators();
|
||||
|
||||
Parent realParent = (Parent)wrapper.getParent();
|
||||
String enumName = ( wrapper.getName() == null ) ? "" : wrapper.getName().toString();
|
||||
Enumeration enumeration = new Enumeration( (ICElement)realParent, enumName );
|
||||
realParent.addChild( enumeration );
|
||||
|
||||
// create the list
|
||||
Iterator i = enumerators.iterator();
|
||||
while( i.hasNext())
|
||||
{
|
||||
EnumeratorWrapper subwrapper = (EnumeratorWrapper)i.next();
|
||||
Enumerator enumerator = new Enumerator( enumeration, subwrapper.getName().toString() );
|
||||
enumeration.addChild( enumerator );
|
||||
}
|
||||
|
||||
// do the offsets
|
||||
if( wrapper.getName() != null )
|
||||
{
|
||||
elem.setIdPos(wrapper.getName().getStartOffset(), enumName.length());
|
||||
elem.setPos(wrapper.getName().getStartOffset(), enumName.length());
|
||||
}
|
||||
else
|
||||
{
|
||||
elem.setIdPos(wrapper.getClassKind().getOffset(), wrapper.getClassKind().getLength());
|
||||
elem.setPos(wrapper.getClassKind().getOffset(), wrapper.getClassKind().getLength());
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionBegin(java.lang.Object)
|
||||
*/
|
||||
public Object enumDefinitionBegin(Object enumSpec) {
|
||||
return null;
|
||||
EnumerationWrapper wrapper = (EnumerationWrapper)enumSpec;
|
||||
EnumeratorWrapper result = new EnumeratorWrapper(wrapper);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionId(java.lang.Object)
|
||||
*/
|
||||
public void enumDefinitionId(Object enumDefn) {
|
||||
EnumeratorWrapper wrapper = (EnumeratorWrapper)enumDefn;
|
||||
wrapper.setName( currName );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionEnd(java.lang.Object)
|
||||
*/
|
||||
public void enumDefinitionEnd(Object enumDefn) {
|
||||
EnumeratorWrapper wrapper = (EnumeratorWrapper)enumDefn;
|
||||
wrapper.getParent().addEnumerator( wrapper );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -687,7 +738,6 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
|||
*/
|
||||
public void asmDefinition(Object container, String assemblyCode) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -3,8 +3,10 @@ package org.eclipse.cdt.internal.core.model;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.model.IParent;
|
||||
import org.eclipse.cdt.core.model.IStructure;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.internal.core.parser.Token;
|
||||
import org.eclipse.cdt.internal.core.parser.util.AccessSpecifier;
|
||||
import org.eclipse.cdt.internal.core.parser.util.DeclSpecifier;
|
||||
import org.eclipse.cdt.internal.core.parser.util.Name;
|
||||
|
@ -19,13 +21,13 @@ import org.eclipse.cdt.internal.core.parser.util.Name;
|
|||
*/
|
||||
public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpecifier.Container, ICElementWrapper {
|
||||
|
||||
private CElement element = null;
|
||||
private CElement parent = null;
|
||||
int kind;
|
||||
private IParent element = null;
|
||||
private IParent parent = null;
|
||||
|
||||
private Name name = null;
|
||||
private boolean functionDefinition = false;
|
||||
|
||||
public SimpleDeclarationWrapper( CElement item )
|
||||
public SimpleDeclarationWrapper( IParent item )
|
||||
{
|
||||
this.element = item;
|
||||
}
|
||||
|
@ -38,7 +40,7 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
* Returns the item.
|
||||
* @return CElement
|
||||
*/
|
||||
public CElement getElement() {
|
||||
public IParent getElement() {
|
||||
return element;
|
||||
}
|
||||
|
||||
|
@ -46,15 +48,15 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
* Sets the item.
|
||||
* @param item The item to set
|
||||
*/
|
||||
public void setElement (CElement item) {
|
||||
this.element = (CElement)item;
|
||||
public void setElement (IParent item) {
|
||||
this.element = (IParent)item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parent.
|
||||
* @return CElement
|
||||
*/
|
||||
public CElement getParent() {
|
||||
public IParent getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
@ -62,7 +64,7 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
* Sets the parent.
|
||||
* @param parent The parent to set
|
||||
*/
|
||||
public void setParent(CElement parent) {
|
||||
public void setParent(IParent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
@ -71,7 +73,7 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
// creates the appropriate C Elements
|
||||
List declaratorList = getDeclarators();
|
||||
Declarator [] declarators = (Declarator []) declaratorList.toArray( new Declarator[ declaratorList.size() ] );
|
||||
CElement parentElement = getParent();
|
||||
CElement parentElement = (CElement)getParent();
|
||||
|
||||
for( int i = 0; i < declarators.length; ++i )
|
||||
{
|
||||
|
@ -80,6 +82,7 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
|
||||
// instantiate the right element
|
||||
List clause =currentDeclarator.getParameterDeclarationClause();
|
||||
String declaratorName = ( currentDeclarator.getName() == null ) ? "" : currentDeclarator.getName().toString();
|
||||
if( clause == null && !isTypedef())
|
||||
{
|
||||
// TODO - this was to get rid of the NULL pointer we've been seeing
|
||||
|
@ -89,24 +92,23 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
// this is an attribute or a varaible
|
||||
if( parentElement instanceof IStructure )
|
||||
{
|
||||
declaration = createField( parentElement, currentDeclarator.getName().toString() );
|
||||
declaration = createField( parentElement, declaratorName );
|
||||
}
|
||||
else if( parentElement instanceof ITranslationUnit )
|
||||
{
|
||||
if(isExtern())
|
||||
{
|
||||
declaration = createVariableDeclaration( parentElement, currentDeclarator.getName().toString() );
|
||||
declaration = createVariableDeclaration( parentElement, declaratorName );
|
||||
}
|
||||
else
|
||||
{
|
||||
declaration = createVariable( parentElement, currentDeclarator.getName().toString() );
|
||||
declaration = createVariable( parentElement, declaratorName );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( isTypedef() )
|
||||
{
|
||||
// do nothing just yet
|
||||
//TODO : update this -- typedefs do not have a parameterdeclarationclause
|
||||
declaration = createTypedef( parentElement, declaratorName );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -114,7 +116,7 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
// this is a function or a method
|
||||
if( parentElement instanceof IStructure )
|
||||
{
|
||||
declaration = createMethodDeclaration( parentElement, currentDeclarator.getName().toString(), parameters );
|
||||
declaration = createMethodDeclaration( parentElement, declaratorName, parameters );
|
||||
|
||||
}
|
||||
else if( parentElement instanceof ITranslationUnit )
|
||||
|
@ -124,18 +126,27 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
// if it belongs to a class, then create a method
|
||||
// else create a function
|
||||
// this will not be known until we have cross reference information
|
||||
declaration = createFunction( parentElement, currentDeclarator.getName().toString(), parameters );
|
||||
declaration = createFunction( parentElement, declaratorName, parameters );
|
||||
}
|
||||
else
|
||||
{
|
||||
declaration = createFunctionDeclaration( parentElement, currentDeclarator.getName().toString(), parameters );
|
||||
declaration = createFunctionDeclaration( parentElement, declaratorName, parameters );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// hook up the offsets
|
||||
declaration.setIdPos( currentDeclarator.getName().getStartOffset(), currentDeclarator.getName().toString().length());
|
||||
declaration.setPos( currentDeclarator.getName().getStartOffset(), currentDeclarator.getName().toString().length() );
|
||||
|
||||
if( currentDeclarator.getName() != null )
|
||||
{
|
||||
// hook up the offsets
|
||||
declaration.setIdPos( currentDeclarator.getName().getStartOffset(), declaratorName.length());
|
||||
declaration.setPos( currentDeclarator.getName().getStartOffset(), declaratorName.length() );
|
||||
}
|
||||
else
|
||||
{
|
||||
declaration.setIdPos( classKind.getOffset(), classKind.getImage().toString().length());
|
||||
declaration.setPos( classKind.getOffset(), classKind.getImage().toString().length());
|
||||
}
|
||||
|
||||
// add to parent
|
||||
parentElement.addChild( declaration );
|
||||
|
@ -144,6 +155,7 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
}
|
||||
|
||||
List declarators = new LinkedList();
|
||||
String [] myString;
|
||||
|
||||
public void addDeclarator( Object in )
|
||||
{
|
||||
|
@ -197,21 +209,7 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the kind.
|
||||
* @return int
|
||||
*/
|
||||
public int getKind() {
|
||||
return kind;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the kind.
|
||||
* @param kind The kind to set
|
||||
*/
|
||||
public void setKind(int kind) {
|
||||
this.kind = kind;
|
||||
}
|
||||
private Token classKind;
|
||||
|
||||
/**
|
||||
* Returns the functionDefinition.
|
||||
|
@ -262,6 +260,12 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
return newElement;
|
||||
}
|
||||
|
||||
private CElement createTypedef(CElement parent, String name){
|
||||
CElement typedef = new TypeDef( parent, name );
|
||||
return typedef;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a Variable and fills its info
|
||||
* @param parent
|
||||
|
@ -387,4 +391,19 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
return newElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Token
|
||||
*/
|
||||
public Token getClassKind() {
|
||||
return classKind;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the classKind.
|
||||
* @param classKind The classKind to set
|
||||
*/
|
||||
public void setClassKind(Token classKind) {
|
||||
this.classKind = classKind;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.eclipse.cdt.internal.core.model;
|
||||
|
||||
import org.eclipse.cdt.core.model.IParent;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
|
@ -15,13 +17,13 @@ public class TranslationUnitWrapper implements ICElementWrapper {
|
|||
/**
|
||||
* @see org.eclipse.cdt.internal.core.model.IWrapper#getElement()
|
||||
*/
|
||||
public CElement getElement() {
|
||||
public IParent getElement() {
|
||||
return unit;
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.model.IWrapper#setElement(java.lang.Object)
|
||||
*/
|
||||
public void setElement(CElement item) {
|
||||
public void setElement(IParent item) {
|
||||
unit = (TranslationUnit)item;
|
||||
}
|
||||
|
||||
|
|
|
@ -513,7 +513,7 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierBegin(java.lang.Object)
|
||||
*/
|
||||
public Object enumSpecifierBegin(Object container) {
|
||||
public Object enumSpecifierBegin(Object container, Token enumKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ public interface IParserCallback {
|
|||
public void usingDeclarationAbort( Object declaration );
|
||||
public void usingDeclarationEnd( Object declaration );
|
||||
|
||||
public Object enumSpecifierBegin( Object container );
|
||||
public Object enumSpecifierBegin( Object container, Token enumKey );
|
||||
public void enumSpecifierId( Object enumSpec );
|
||||
public void enumSpecifierAbort( Object enumSpec );
|
||||
public void enumSpecifierEnd( Object enumSpec );
|
||||
|
|
|
@ -413,7 +413,7 @@ public class NullParserCallback implements IParserCallback {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierBegin(java.lang.Object)
|
||||
*/
|
||||
public Object enumSpecifierBegin(Object container) {
|
||||
public Object enumSpecifierBegin(Object container, Token enumKey) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -670,9 +670,9 @@ c, quick);
|
|||
case Token.t_volatile:
|
||||
case Token.t_signed:
|
||||
case Token.t_unsigned:
|
||||
case Token.t_short:
|
||||
try{ callback.simpleDeclSpecifier(decl, consume());} catch( Exception e ) {}
|
||||
break;
|
||||
case Token.t_short:
|
||||
case Token.t_char:
|
||||
case Token.t_wchar_t:
|
||||
case Token.t_bool:
|
||||
|
@ -1157,10 +1157,8 @@ c, quick);
|
|||
*/
|
||||
protected void enumSpecifier( Object owner ) throws Backtrack
|
||||
{
|
||||
consume( Token.t_enum );
|
||||
|
||||
Object enumSpecifier = null;
|
||||
try{ enumSpecifier = callback.enumSpecifierBegin( owner );} catch( Exception e ) {}
|
||||
try{ enumSpecifier = callback.enumSpecifierBegin( owner, consume( Token.t_enum ) );} catch( Exception e ) {}
|
||||
|
||||
if( LT(1) == Token.tIDENTIFIER )
|
||||
{
|
||||
|
|
|
@ -871,6 +871,14 @@ public class Scanner implements IScanner {
|
|||
}
|
||||
} else {
|
||||
switch (c) {
|
||||
case '\'' :
|
||||
c = getChar();
|
||||
int next = getChar();
|
||||
if( next == '\'' )
|
||||
return newToken( Token.tCHAR, new Character( (char)c ).toString(), currentContext );
|
||||
else
|
||||
if( throwExceptionOnBadCharacterRead )
|
||||
throw new ScannerException( "Invalid character '" + (char)c + "' read @ offset " + currentContext.getOffset() + " of file " + currentContext.getFilename() );
|
||||
case ':' :
|
||||
c = getChar();
|
||||
switch (c) {
|
||||
|
@ -1185,7 +1193,7 @@ public class Scanner implements IScanner {
|
|||
default :
|
||||
// Bad character
|
||||
if( throwExceptionOnBadCharacterRead )
|
||||
throw new ScannerException( "Invalid character read @ offset " + currentContext.getOffset() + " of file " + currentContext.getFilename() );
|
||||
throw new ScannerException( "Invalid character '" + (char)c + "' read @ offset " + currentContext.getOffset() + " of file " + currentContext.getFilename() );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -175,6 +175,6 @@ public class Token {
|
|||
static public final int tSTRING = 129;
|
||||
static public final int tFLOATINGPT = 130;
|
||||
static public final int tLSTRING = 131;
|
||||
|
||||
static public final int tLAST = tLSTRING;
|
||||
static public final int tCHAR = 132;
|
||||
static public final int tLAST = tCHAR;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue