mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
SimpleDecl support for migration towards ISourceElementRequestor.
This commit is contained in:
parent
cf576425cb
commit
65fb06058c
6 changed files with 4604 additions and 3051 deletions
|
@ -1,3 +1,6 @@
|
|||
2003-06-23 John Camelon
|
||||
Updating SimpleDeclarations to move towards new Callback structure.
|
||||
|
||||
2003-06-23 John Camelon
|
||||
Updated Factory infrastructure, constructors, etc.
|
||||
Introduced Preprocessor class for transitive closure calc. client.
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
import org.eclipse.cdt.internal.core.parser.Token;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
|
|
@ -0,0 +1,286 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class DeclarationWrapper
|
||||
{
|
||||
private final IASTScope scope;
|
||||
private List declarators = new ArrayList();
|
||||
private boolean typeNamed = false;
|
||||
private String name = null;
|
||||
private boolean volatil = false;
|
||||
private boolean virtual = false;
|
||||
private boolean typedef = false;
|
||||
private boolean staticc = false;
|
||||
private boolean register = false;
|
||||
private boolean extern = false;
|
||||
private boolean explicit = false;
|
||||
private boolean constt = false;
|
||||
private int startingOffset = 0;
|
||||
private boolean auto = false,
|
||||
mutable = false,
|
||||
friend = false,
|
||||
inline = false;
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setAuto(boolean b)
|
||||
{
|
||||
auto = b;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public IASTScope getScope()
|
||||
{
|
||||
return scope;
|
||||
}
|
||||
/**
|
||||
* @param scope
|
||||
*/
|
||||
public DeclarationWrapper(IASTScope scope)
|
||||
{
|
||||
this.scope = scope;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setTypenamed(boolean b)
|
||||
{
|
||||
typeNamed = b;
|
||||
}
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public void setTypeName(String string)
|
||||
{
|
||||
name = string;
|
||||
}
|
||||
private int type = -1;
|
||||
/**
|
||||
* @param i
|
||||
*/
|
||||
public void setType(int i)
|
||||
{
|
||||
type = i;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setMutable(boolean b)
|
||||
{
|
||||
mutable = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setFriend(boolean b)
|
||||
{
|
||||
friend = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setInline(boolean b)
|
||||
{
|
||||
inline = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setRegister(boolean b)
|
||||
{
|
||||
register = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setStatic(boolean b)
|
||||
{
|
||||
staticc = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setTypedef(boolean b)
|
||||
{
|
||||
typedef = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setVirtual(boolean b)
|
||||
{
|
||||
virtual = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setVolatile(boolean b)
|
||||
{
|
||||
volatil = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setExtern(boolean b)
|
||||
{
|
||||
extern = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setExplicit(boolean b)
|
||||
{
|
||||
explicit = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setConst(boolean b)
|
||||
{
|
||||
constt = b;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isAuto()
|
||||
{
|
||||
return auto;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isConst()
|
||||
{
|
||||
return constt;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isExplicit()
|
||||
{
|
||||
return explicit;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isExtern()
|
||||
{
|
||||
return extern;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isFriend()
|
||||
{
|
||||
return friend;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isInline()
|
||||
{
|
||||
return inline;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isMutable()
|
||||
{
|
||||
return mutable;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isRegister()
|
||||
{
|
||||
return register;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public int getStartingOffset()
|
||||
{
|
||||
return startingOffset;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isStatic()
|
||||
{
|
||||
return staticc;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public int getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isTypedef()
|
||||
{
|
||||
return typedef;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isTypeNamed()
|
||||
{
|
||||
return typeNamed;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isVirtual()
|
||||
{
|
||||
return virtual;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isVolatile()
|
||||
{
|
||||
return volatil;
|
||||
}
|
||||
|
||||
public void addDeclarator( Declarator d )
|
||||
{
|
||||
declarators.add( d );
|
||||
}
|
||||
|
||||
public List getDeclarators()
|
||||
{
|
||||
return Collections.unmodifiableList( declarators );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class Declarator
|
||||
{
|
||||
private final DeclarationWrapper owner1;
|
||||
private final Declarator owner2;
|
||||
private String name;
|
||||
private List ptrOps = new ArrayList();
|
||||
|
||||
private int nameStartOffset, nameEndOffset;
|
||||
|
||||
public Declarator( DeclarationWrapper owner )
|
||||
{
|
||||
this.owner1 = owner;
|
||||
owner2 = null;
|
||||
}
|
||||
|
||||
public Declarator( Declarator owner )
|
||||
{
|
||||
owner2 = owner;
|
||||
owner1 = null;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public int getNameEndOffset()
|
||||
{
|
||||
return nameEndOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public int getNameStartOffset()
|
||||
{
|
||||
return nameStartOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public DeclarationWrapper getOwner()
|
||||
{
|
||||
return owner1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public void setName(String string)
|
||||
{
|
||||
name = string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param i
|
||||
*/
|
||||
public void setNameEndOffset(int i)
|
||||
{
|
||||
nameEndOffset = i;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param i
|
||||
*/
|
||||
public void setNameStartOffset(int i)
|
||||
{
|
||||
nameStartOffset = i;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public Declarator getOwnerDeclarator()
|
||||
{
|
||||
return owner2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public List getPtrOps()
|
||||
{
|
||||
return Collections.unmodifiableList( ptrOps );
|
||||
}
|
||||
|
||||
public void addPtrOp( PointerOperator ptrOp )
|
||||
{
|
||||
ptrOps.add( ptrOp );
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,97 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class PointerOperator
|
||||
{
|
||||
private String name;
|
||||
private boolean isConst = false;
|
||||
private boolean isVolatile = false;
|
||||
|
||||
public static class Type
|
||||
{
|
||||
private final int type;
|
||||
public static final Type REFERENCE = new Type( 1 );
|
||||
public static final Type POINTER = new Type( 2 );
|
||||
public static final Type NAMED = new Type( 3 );
|
||||
|
||||
private Type( int type )
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
private Type type;
|
||||
|
||||
public PointerOperator( Type t )
|
||||
{
|
||||
this.type = t;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public Type getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isConst()
|
||||
{
|
||||
return isConst;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isVolatile()
|
||||
{
|
||||
return isVolatile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setConst(boolean b)
|
||||
{
|
||||
isConst = b;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setVolatile(boolean b)
|
||||
{
|
||||
isVolatile = b;
|
||||
}
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public void setName(String string)
|
||||
{
|
||||
name = string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue