Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Camelon2004-11-12 10:42:52 -0500
committerJohn Camelon2004-11-12 10:42:52 -0500
commitc89fe958ea2bfb7a6218630391420ed31fa0fd4a (patch)
tree006f3831127673da281a53b53695f1cf9b319cc4
parent87e783b7726f9f884a9bcd339da4b5db1f892e8f (diff)
downloadorg.eclipse.cdt-c89fe958ea2bfb7a6218630391420ed31fa0fd4a.tar.gz
org.eclipse.cdt-c89fe958ea2bfb7a6218630391420ed31fa0fd4a.tar.xz
org.eclipse.cdt-c89fe958ea2bfb7a6218630391420ed31fa0fd4a.zip
Fixed Enumerations up in AST2.
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICASTEnumerationSpecifier.java20
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/CASTEnumerationSpecifier.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/GNUCSourceParser.java53
3 files changed, 55 insertions, 22 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICASTEnumerationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICASTEnumerationSpecifier.java
new file mode 100644
index 0000000000..72ce2c4ee9
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICASTEnumerationSpecifier.java
@@ -0,0 +1,20 @@
+/**********************************************************************
+ * Copyright (c) 2002-2004 IBM Canada 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.core.dom.ast.c;
+
+import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
+
+/**
+ * @author jcamelon
+ */
+public interface ICASTEnumerationSpecifier extends ICASTDeclSpecifier,
+ IASTEnumerationSpecifier {
+
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/CASTEnumerationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/CASTEnumerationSpecifier.java
index db5e5debaa..578ec3ec8f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/CASTEnumerationSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/CASTEnumerationSpecifier.java
@@ -13,14 +13,14 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.eclipse.cdt.core.dom.ast.c.ICASTEnumerationSpecifier;
/**
* @author jcamelon
*/
public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier implements
- IASTEnumerationSpecifier {
+ ICASTEnumerationSpecifier {
private IASTName name;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/GNUCSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/GNUCSourceParser.java
index 5ae2c85c7a..50d8d73bf0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/GNUCSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/GNUCSourceParser.java
@@ -71,6 +71,7 @@ import org.eclipse.cdt.core.dom.ast.c.ICASTArrayDesignator;
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
+import org.eclipse.cdt.core.dom.ast.c.ICASTEnumerationSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator;
import org.eclipse.cdt.core.dom.ast.c.ICASTPointer;
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
@@ -1572,7 +1573,8 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
IToken identifier = null;
ICASTCompositeTypeSpecifier structSpec = null;
ICASTElaboratedTypeSpecifier elabSpec = null;
-
+ ICASTEnumerationSpecifier enumSpec = null;
+
declSpecifiers: for (;;) {
switch (LT(1)) {
//Storage Class Specifiers
@@ -1696,22 +1698,22 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
case IToken.t_struct:
case IToken.t_union:
try {
- structSpec = structOrUnionSpecifier( isConst, isVolatile, isRestrict, isInline, storageClass );
+ structSpec = structOrUnionSpecifier( );
flags.setEncounteredTypename(true);
break;
} catch (BacktrackException bt) {
- elabSpec = elaboratedTypeSpecifier( isConst, isVolatile, isRestrict, isInline, storageClass );
+ elabSpec = elaboratedTypeSpecifier( );
flags.setEncounteredTypename(true);
break;
}
case IToken.t_enum:
try {
- enumSpecifier(null);
+ enumSpec = (ICASTEnumerationSpecifier) enumSpecifier(null);
flags.setEncounteredTypename(true);
break;
} catch (BacktrackException bt) {
// this is an elaborated class specifier
- elabSpec = elaboratedTypeSpecifier(isConst, isVolatile, isRestrict, isInline, storageClass );
+ elabSpec = elaboratedTypeSpecifier( );
flags.setEncounteredTypename(true);
break;
}
@@ -1729,11 +1731,35 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
if( structSpec != null )
{
structSpec.setOffset( startingOffset );
+ structSpec.setConst(isConst);
+ structSpec.setRestrict(isRestrict);
+ structSpec.setVolatile(isVolatile);
+ structSpec.setInline(isInline);
+ structSpec.setStorageClass(storageClass);
+
return structSpec;
}
+
+ if( enumSpec != null )
+ {
+ enumSpec.setOffset( startingOffset );
+ enumSpec.setConst(isConst);
+ enumSpec.setRestrict(isRestrict);
+ enumSpec.setVolatile(isVolatile);
+ enumSpec.setInline(isInline);
+ enumSpec.setStorageClass(storageClass);
+ return enumSpec;
+
+ }
if( elabSpec != null )
{
elabSpec.setOffset( startingOffset );
+ elabSpec.setConst(isConst);
+ elabSpec.setRestrict(isRestrict);
+ elabSpec.setVolatile(isVolatile);
+ elabSpec.setInline(isInline);
+ elabSpec.setStorageClass(storageClass);
+
return elabSpec;
}
if (isIdentifier) {
@@ -1791,7 +1817,6 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
*
* classSpecifier : classKey name (baseClause)? "{" (memberSpecification)*
* "}"
- *
* @param owner
* IParserCallback object that represents the declaration that
* owns this classSpecifier
@@ -1800,7 +1825,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
* @throws BacktrackException
* request a backtrack
*/
- protected ICASTCompositeTypeSpecifier structOrUnionSpecifier( boolean isConst, boolean isVolatile, boolean isRestrict, boolean isInline, int storageClass )
+ protected ICASTCompositeTypeSpecifier structOrUnionSpecifier( )
throws BacktrackException, EndOfFileException {
int classKind = 0;
@@ -1846,13 +1871,6 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
ICASTCompositeTypeSpecifier result = createCompositeTypeSpecifier();
- result.setConst( isConst );
- result.setInline( isInline );
- result.setVolatile( isVolatile );
- result.setRestrict( isRestrict );
- result.setStorageClass( storageClass );
-
-
result.setKey( classKind );
result.setOffset( classKey.getOffset() );
@@ -1902,7 +1920,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
return new CASTCompositeTypeSpecifier();
}
- protected ICASTElaboratedTypeSpecifier elaboratedTypeSpecifier(boolean isConst, boolean isVolatile, boolean isRestrict, boolean isInline, int storageClass)
+ protected ICASTElaboratedTypeSpecifier elaboratedTypeSpecifier()
throws BacktrackException, EndOfFileException {
// this is an elaborated class specifier
IToken t = consume();
@@ -1930,11 +1948,6 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
result.setName( name );
name.setParent( result );
name.setPropertyInParent( IASTElaboratedTypeSpecifier.TYPE_NAME );
- result.setConst( isConst );
- result.setInline( isInline );
- result.setVolatile( isVolatile );
- result.setRestrict( isRestrict );
- result.setStorageClass( storageClass );
result.setKind( eck );
return result;
}

Back to the top