Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2003-03-03 10:54:13 -0500
committerDoug Schaefer2003-03-03 10:54:13 -0500
commita0b7aa2877549afd1fc9810acedcc8052416ead8 (patch)
tree5dbd52b408382ca458deea500e509ec445d11948
parent6ab46192aef41ee000cb9b211e84cd0fd79dd8be (diff)
downloadorg.eclipse.cdt-a0b7aa2877549afd1fc9810acedcc8052416ead8.tar.gz
org.eclipse.cdt-a0b7aa2877549afd1fc9810acedcc8052416ead8.tar.xz
org.eclipse.cdt-a0b7aa2877549afd1fc9810acedcc8052416ead8.zip
Patch for John Camelon:
- some of the outline view going with new parser
-rw-r--r--core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/ClassSpecifier.java1
-rw-r--r--core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/DOMBuilder.java84
-rw-r--r--core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/DeclarationSpecifier.java132
-rw-r--r--core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/Declarator.java4
-rw-r--r--core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/Name.java35
-rw-r--r--core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/ParameterDeclaration.java8
-rw-r--r--core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/SimpleDeclaration.java7
7 files changed, 23 insertions, 248 deletions
diff --git a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/ClassSpecifier.java b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/ClassSpecifier.java
index a6147063ed..da6cd430ec 100644
--- a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/ClassSpecifier.java
+++ b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/ClassSpecifier.java
@@ -4,6 +4,7 @@ import java.util.LinkedList;
import java.util.List;
import org.eclipse.cdt.core.dom.IScope;
+import org.eclipse.cdt.internal.core.newparser.util.Name;
public class ClassSpecifier extends TypeSpecifier implements IScope {
diff --git a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/DOMBuilder.java b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/DOMBuilder.java
index 91ace1620d..6aa799fcc8 100644
--- a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/DOMBuilder.java
+++ b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/DOMBuilder.java
@@ -4,6 +4,8 @@ package org.eclipse.cdt.internal.core.dom;
import org.eclipse.cdt.core.dom.IScope;
import org.eclipse.cdt.internal.core.newparser.IParserCallback;
import org.eclipse.cdt.internal.core.newparser.Token;
+import org.eclipse.cdt.internal.core.newparser.util.*;
+import org.eclipse.cdt.internal.core.newparser.util.Name;
/**
* This is the parser callback that creates objects in the DOM.
@@ -29,7 +31,7 @@ public class DOMBuilder implements IParserCallback
/**
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#argumentsEnd()
*/
- public void argumentsEnd() {
+ public void argumentsEnd(Object parameterDeclarationClause) {
}
/**
@@ -104,78 +106,8 @@ public class DOMBuilder implements IParserCallback
declSpec = new DeclarationSpecifier();
decl.setDeclSpecifier( declSpec );
}
-
- switch (specifier.getType()) {
- case Token.t_auto:
- declSpec.setAuto(true);
- break;
- case Token.t_register:
- declSpec.setRegister(true);
- break;
- case Token.t_static:
- declSpec.setStatic(true);
- break;
- case Token.t_extern:
- declSpec.setExtern(true);
- break;
- case Token.t_mutable:
- declSpec.setMutable(true);
- break;
- case Token.t_inline:
- declSpec.setInline(true);
- break;
- case Token.t_virtual:
- declSpec.setVirtual(true);
- break;
- case Token.t_explicit:
- declSpec.setExplicit(true);
- break;
- case Token.t_typedef:
- declSpec.setTypedef(true);
- break;
- case Token.t_friend:
- declSpec.setFriend(true);
- break;
- case Token.t_const:
- declSpec.setConst(true);
- break;
- case Token.t_volatile:
- declSpec.setVolatile(true);
- break;
- case Token.t_char:
- declSpec.setType(DeclarationSpecifier.t_char);
- break;
- case Token.t_wchar_t:
- declSpec.setType(DeclarationSpecifier.t_wchar_t);
- break;
- case Token.t_bool:
- declSpec.setType(DeclarationSpecifier.t_bool);
- break;
- case Token.t_short:
- declSpec.setShort(true);
- break;
- case Token.t_int:
- declSpec.setType(DeclarationSpecifier.t_int);
- break;
- case Token.t_long:
- declSpec.setLong(true);
- break;
- case Token.t_signed:
- declSpec.setUnsigned(false);
- break;
- case Token.t_unsigned:
- declSpec.setUnsigned(true);
- break;
- case Token.t_float:
- declSpec.setType(DeclarationSpecifier.t_float);
- break;
- case Token.t_double:
- declSpec.setType(DeclarationSpecifier.t_double);
- break;
- case Token.t_void:
- declSpec.setType(DeclarationSpecifier.t_void);
- break;
- }
+
+ declSpec.setType( specifier );
}
/**
@@ -223,7 +155,7 @@ public class DOMBuilder implements IParserCallback
/**
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#simpleDeclarationBegin(org.eclipse.cdt.internal.core.newparser.Token)
*/
- public Object simpleDeclarationBegin(Object container, Token firstToken) {
+ public Object simpleDeclarationBegin(Object container) {
SimpleDeclaration decl = new SimpleDeclaration();
((IScope)container).addDeclaration(decl);
return decl;
@@ -307,10 +239,10 @@ public class DOMBuilder implements IParserCallback
public void baseSpecifierName( Object baseSpecifier )
{
- ((BaseSpecifier)baseSpecifier).setName(currName.getName());
+ ((BaseSpecifier)baseSpecifier).setName(currName.toString());
}
- public Object parameterDeclarationBegin( Object container, Token firstToken )
+ public Object parameterDeclarationBegin( Object container )
{
ParameterDeclarationClause clause = (ParameterDeclarationClause)container;
ParameterDeclaration pd = new ParameterDeclaration();
diff --git a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/DeclarationSpecifier.java b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/DeclarationSpecifier.java
deleted file mode 100644
index 0b872dc017..0000000000
--- a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/DeclarationSpecifier.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package org.eclipse.cdt.internal.core.dom;
-
-import java.util.List;
-
-/**
- * @author jcamelon
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class DeclarationSpecifier {
- /**
- * @author jcamelon
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
- public interface Container {
-
- public DeclarationSpecifier getDeclSpecifier();
-
- public void setDeclSpecifier( DeclarationSpecifier in );
-
- public void addDeclarator(Declarator declarator);
- public List getDeclarators();
-
-
- };
-
- // SimpleDeclSpecifier layed out as bit array
- // leftmost 5 bits are type
- public static final int typeMask = 0x001f;
- public static final int isAuto = 0x0020;
- public static final int isRegister = 0x0040;
- public static final int isStatic = 0x0080;
- public static final int isExtern = 0x0100;
- public static final int isMutable = 0x0200;
- public static final int isInline = 0x0400;
- public static final int isVirtual = 0x0800;
- public static final int isExplicit = 0x1000;
- public static final int isTypedef = 0x2000;
- public static final int isFriend = 0x4000;
- public static final int isConst = 0x8000;
- public static final int isVolatile = 0x10000;
- public static final int isUnsigned = 0x20000;
- public static final int isShort = 0x40000;
- public static final int isLong = 0x80000;
-
- private int declSpecifierSeq = 0;
- public int getDeclSpecifierSeq() { return declSpecifierSeq; }
-
- // Convenience methods
- private void setBit(boolean b, int mask) {
- if (b)
- declSpecifierSeq = declSpecifierSeq | mask;
- else
- declSpecifierSeq = declSpecifierSeq & ~mask;
- }
-
- private boolean checkBit(int mask) {
- return (declSpecifierSeq & mask) == 1;
- }
-
- public void setAuto(boolean b) { setBit(b, isAuto); }
- public boolean isAuto() { return checkBit(isAuto); }
-
- public void setRegister(boolean b) { setBit(b, isRegister); }
- public boolean isRegister() { return checkBit(isRegister); }
-
- public void setStatic(boolean b) { setBit(b, isStatic); }
- public boolean isStatic() { return checkBit(isStatic); }
-
- public void setExtern(boolean b) { setBit(b, isExtern); }
- public boolean isExtern() { return checkBit(isExtern); }
-
- public void setMutable(boolean b) { setBit(b, isMutable); }
- public boolean isMutable() { return checkBit(isMutable); }
-
- public void setInline(boolean b) { setBit(b, isInline); }
- public boolean isInline() { return checkBit(isInline); }
-
- public void setVirtual(boolean b) { setBit(b, isVirtual); }
- public boolean isVirtual() { return checkBit(isVirtual); }
-
- public void setExplicit(boolean b) { setBit(b, isExplicit); }
- public boolean isExplicit() { return checkBit(isExplicit); }
-
- public void setTypedef(boolean b) { setBit(b, isTypedef); }
- public boolean isTypedef() { return checkBit(isTypedef); }
-
- public void setFriend(boolean b) { setBit(b, isFriend); }
- public boolean isFriend() { return checkBit(isFriend); }
-
- public void setConst(boolean b) { setBit(b, isConst); }
- public boolean isConst() { return checkBit(isConst); }
-
- public void setVolatile(boolean b) { setBit(b, isVolatile); }
- public boolean isVolatile() { return checkBit(isVolatile); }
-
- public void setUnsigned(boolean b) { setBit(b, isUnsigned); }
- public boolean isUnsigned() { return checkBit(isUnsigned); }
-
- public void setShort(boolean b) { setBit(b, isShort); }
- public boolean isShort() { return checkBit(isShort); }
-
- public void setLong(boolean b) { setBit(b, isLong); }
- public boolean isLong() { return checkBit(isLong); }
-
- // Simple Types
- public static final int t_type = 0; // Type Specifier
- public static final int t_char = 1;
- public static final int t_wchar_t = 2;
- public static final int t_bool = 3;
- public static final int t_int = 4;
- public static final int t_float = 5;
- public static final int t_double = 6;
- public static final int t_void = 7;
-
- public void setType(int t) {
- declSpecifierSeq = declSpecifierSeq & ~typeMask | t;
- }
-
- public int getType() {
- return declSpecifierSeq & typeMask;
- }
-
-
-}
diff --git a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/Declarator.java b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/Declarator.java
index 33d5ff46b5..f08d6ad5ca 100644
--- a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/Declarator.java
+++ b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/Declarator.java
@@ -1,5 +1,9 @@
package org.eclipse.cdt.internal.core.dom;
+import org.eclipse.cdt.internal.core.newparser.util.*;
+import org.eclipse.cdt.internal.core.newparser.util.Name;
+
+
public class Declarator {
public Declarator(DeclarationSpecifier.Container declaration) {
diff --git a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/Name.java b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/Name.java
deleted file mode 100644
index fd66b612bd..0000000000
--- a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/Name.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.cdt.internal.core.dom;
-
-import org.eclipse.cdt.internal.core.newparser.Token;
-
-/**
- * @author dschaefe
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class Name {
-
- private Token nameStart, nameEnd;
-
- public Name(Token nameStart) {
- this.nameStart = nameStart;
- }
-
- public void setEnd(Token nameEnd) {
- this.nameEnd = nameEnd;
- }
-
- public String getName() {
- String name = nameStart.getImage();
-
- for (Token t = nameStart; nameStart != nameEnd;) {
- t = nameStart.getNext();
- name += t.getImage();
- }
-
- return name;
- }
-}
diff --git a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/ParameterDeclaration.java b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/ParameterDeclaration.java
index 8c9c8eac7c..85e8e4241f 100644
--- a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/ParameterDeclaration.java
+++ b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/ParameterDeclaration.java
@@ -3,6 +3,8 @@ package org.eclipse.cdt.internal.core.dom;
import java.util.LinkedList;
import java.util.List;
+import org.eclipse.cdt.internal.core.newparser.util.*;
+
/**
* @author jcamelon
*
@@ -16,7 +18,7 @@ public class ParameterDeclaration extends Declaration implements DeclarationSpec
DeclarationSpecifier declSpec = null;
/**
- * @see org.eclipse.cdt.internal.core.dom.DeclarationSpecifier.Container#getDeclSpecifier()
+ * @see org.eclipse.cdt.internal.core.dom.DeclarationSpecifier.CElementWrapper#getDeclSpecifier()
*/
public DeclarationSpecifier getDeclSpecifier() {
if( declSpec == null )
@@ -26,14 +28,14 @@ public class ParameterDeclaration extends Declaration implements DeclarationSpec
}
/**
- * @see org.eclipse.cdt.internal.core.dom.DeclarationSpecifier.Container#setDeclSpecifier(org.eclipse.cdt.internal.core.dom.DeclarationSpecifier)
+ * @see org.eclipse.cdt.internal.core.dom.DeclarationSpecifier.CElementWrapper#setDeclSpecifier(org.eclipse.cdt.internal.core.dom.DeclarationSpecifier)
*/
public void setDeclSpecifier(DeclarationSpecifier in) {
declSpec = in;
}
private List declarators = new LinkedList();
- public void addDeclarator(Declarator declarator) {
+ public void addDeclarator(Object declarator) {
declarators.add(declarator);
}
diff --git a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/SimpleDeclaration.java b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/SimpleDeclaration.java
index 0b3447de6f..355bacd249 100644
--- a/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/SimpleDeclaration.java
+++ b/core/org.eclipse.cdt.core/newparser/org/eclipse/cdt/internal/core/dom/SimpleDeclaration.java
@@ -3,9 +3,12 @@ package org.eclipse.cdt.internal.core.dom;
import java.util.LinkedList;
import java.util.List;
+import org.eclipse.cdt.internal.core.newparser.util.*;
+
public class SimpleDeclaration extends Declaration implements DeclarationSpecifier.Container{
- private DeclarationSpecifier declSpec = null;
+ private DeclarationSpecifier declSpec = null;
+
public DeclarationSpecifier getDeclSpecifier()
{
if( declSpec == null )
@@ -43,7 +46,7 @@ public class SimpleDeclaration extends Declaration implements DeclarationSpecifi
private List declarators = new LinkedList();
- public void addDeclarator(Declarator declarator) {
+ public void addDeclarator(Object declarator) {
declarators.add(declarator);
}

Back to the top