Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/BaseProblemFactory.java65
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/BranchTracker.java166
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/CompleteParser.java71
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ContextException.java37
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ContextStack.java193
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ContextualParser.java194
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java809
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Declarator.java451
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IDeclarator.java44
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IDeclaratorOwner.java23
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IParameterCollection.java23
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IProblemFactory.java26
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IScannerContext.java81
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/KeywordSets.java167
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/LimitedScannerContext.java47
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/LineOffsetReconciler.java104
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/MacroDescriptor.java126
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/OffsetDuple.java45
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParameterCollection.java37
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java5420
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParserException.java20
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Preprocessor.java63
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Problem.java118
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/QuickParseCallback.java197
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/QuickParser.java69
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Scanner.java2749
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ScannerContext.java178
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ScannerProblemFactory.java228
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/SimpleDeclarationStrategy.java32
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/StructuralParseCallback.java247
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/StructuralParser.java77
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Token.java178
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/TokenDuple.java176
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/TypeId.java79
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTAbstractDeclaration.java124
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTArrayModifier.java62
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTCompletionNode.java77
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTDesignator.java88
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTInclusion.java156
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTMacro.java118
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTQualifiedNamedElement.java69
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java67
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/EmptyIterator.java44
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/NamedOffsets.java47
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/Offsets.java39
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTASMDefinition.java98
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTAbstractTypeSpecifierDeclaration.java120
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTAnonymousDeclaration.java39
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTBaseSpecifier.java115
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassReference.java78
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java271
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCodeScope.java91
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCompilationUnit.java82
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTConstructorMemberInitializer.java99
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTElaboratedTypeSpecifier.java171
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerationReference.java71
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerationSpecifier.java158
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerator.java141
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumeratorReference.java70
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTExceptionSpecification.java68
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTExpression.java260
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTField.java70
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFieldReference.java71
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java341
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunctionReference.java72
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTInitializerClause.java130
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTLinkageSpecification.java115
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTMethod.java195
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTMethodReference.java69
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceAlias.java150
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java177
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceReference.java72
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNewDescriptor.java90
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNode.java148
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterDeclaration.java197
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterReference.java72
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTReference.java59
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTReferenceStore.java43
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTScope.java51
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSimpleTypeSpecifier.java150
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbol.java40
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbolOwner.java43
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateDeclaration.java124
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateInstantiation.java106
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateSpecialization.java106
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypeId.java229
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedef.java170
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedefReference.java69
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTUsingDeclaration.java130
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTUsingDirective.java125
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariable.java246
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariableReference.java72
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java2812
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ExpressionResult.java59
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ExpressionResultList.java57
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTASMDefinition.java99
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTAbstractTypeSpecifierDeclaration.java117
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTBaseSpecifier.java106
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTClassSpecifier.java218
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTCompilationUnit.java76
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTConstructorMemberInitializer.java68
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTDeclaration.java37
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTElaboratedTypeSpecifier.java158
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerationSpecifier.java151
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerator.java145
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTExceptionSpecification.java67
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTExpression.java222
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTField.java85
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java291
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTInitializerClause.java112
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTLinkageSpecification.java128
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java213
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceAlias.java148
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java162
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNewDescriptor.java69
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNode.java31
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTParameterDeclaration.java121
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTScopedTypeSpecifier.java50
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTSimpleTypeSpecifier.java195
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateDeclaration.java139
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateInstantiation.java122
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateParameter.java79
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateSpecialization.java116
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypeId.java169
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypedefDeclaration.java150
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDeclaration.java115
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDirective.java107
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java231
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/IASTQClassSpecifier.java23
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/IASTQScope.java23
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java328
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/AbstractSymbolExtension.java45
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/BasicSymbol.java189
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ContainerSymbol.java793
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/DerivableContainerSymbol.java388
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ForewardDeclaredSymbolExtension.java109
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IContainerSymbol.java58
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IDerivableContainerSymbol.java58
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IParameterizedSymbol.java54
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISpecializedSymbol.java27
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbol.java64
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbolASTExtension.java32
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbolOwner.java20
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/NamespaceSymbolExtension.java99
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParameterizedSymbol.java290
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java2481
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTableException.java50
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/SpecializedSymbol.java30
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/StandardSymbolExtension.java94
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateInstance.java134
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeFilter.java114
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeInfo.java527
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/util/ASTUtil.java238
153 files changed, 0 insertions, 32588 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/BaseProblemFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/BaseProblemFactory.java
deleted file mode 100644
index 54f8e8c912f..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/BaseProblemFactory.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**********************************************************************
- * 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.Map;
-
-import org.eclipse.cdt.core.parser.IProblem;
-
-
-/**
- * @author jcamelon
- */
-public abstract class BaseProblemFactory {
-
- protected final static String PROBLEM = "IProblem : ";
- protected final static String IN_FILE = " in file: ";
- protected final static String ON_LINE = " on line: ";
-
- public abstract String createMessage(int id, Map arguments, int lineNumber, char[] fileName );
-
- public IProblem createProblem(int id, int start, int end, int line, char[] file, String message, Map arguments, boolean warn, boolean error) {
- return new Problem( id, start, end, line, file, message, arguments, warn, error);
- }
-
- public boolean checkBitmask( int id, int bitmask )
- {
- return ( id & bitmask ) != 0;
- }
-
- protected IProblem createInternalProblem( int id, int start, int end, int line, char [] file, Map arguments, boolean warn, boolean error )
- {
- return createProblem( id, start, end, line, file, createInternalMessage( id, arguments, line, file), arguments, warn, error );
- }
-
- /**
- * @param id
- * @param arguments
- * @param line
- * @param file
- * @return
- */
- private String createInternalMessage(int id, Map arguments, int line, char[] file)
- {
- if( checkBitmask( id, IProblem.INTERNAL_RELATED ))
- {
- StringBuffer buffer = new StringBuffer();
-
- switch( id )
- {
- }
-
- return buffer.toString();
- }
- return null;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/BranchTracker.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/BranchTracker.java
deleted file mode 100644
index 1a49b4ef6c1..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/BranchTracker.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package org.eclipse.cdt.internal.core.parser;
-
-import java.util.EmptyStackException;
-import java.util.Stack;
-
-/**
- * @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 BranchTracker {
-
- private static final int IGNORE_SENTINEL = -1;
-
- /**
- * Default constructor.
- *
- * @see java.lang.Object#Object()
- */
- public BranchTracker()
- {
- }
-
- private Stack branches = new Stack();
-
- private int ignore = IGNORE_SENTINEL;
- private static final Boolean FALSE = new Boolean( false );
- private static final Boolean TRUE = new Boolean( true );
-
- /**
- * Method poundif.
- *
- * This method is called whenever one encounters a #if, #ifndef
- * or #ifdef preprocessor directive.
- *
- * @param taken - boolean indicates whether or not the condition
- * evaluates to true or false
- * @return boolean - are we set to continue scanning or not?
- */
- public boolean poundif( boolean taken )
- {
- if( ignore == IGNORE_SENTINEL )
- {
- // we are entering an if
- // push the taken value onto the stack
- branches.push( new Boolean( taken ) );
-
- if( taken == false )
- {
- ignore = branches.size();
- }
-
- return taken;
- }
- else
- {
- branches.push( FALSE );
- return false;
- }
- }
-
- public boolean poundelif( boolean taken ) throws EmptyStackException
- {
- if( ignore != IGNORE_SENTINEL && ignore < branches.size() )
- {
- branches.pop();
- branches.push( FALSE );
- return false;
- }
-
- // so at this point we are either
- // --> ignore == IGNORE_SENTINEL
- // --> ignore >= branches.size()
- // check the branch queue to see whether or not the branch has already been taken
- Boolean branchAlreadyTaken;
- branchAlreadyTaken = (Boolean) branches.peek();
-
- if( ignore == IGNORE_SENTINEL )
- {
- if( ! branchAlreadyTaken.booleanValue() )
- {
- branches.pop();
- branches.push( new Boolean( taken ) );
- if( ! taken )
- ignore = branches.size();
-
- return taken;
- }
-
- // otherwise this section is to be ignored as well
- ignore = branches.size();
- return false;
- }
-
- // if we have gotten this far then ignore == branches.size()
- if( ! branchAlreadyTaken.booleanValue() )
- {
- branches.pop();
- branches.push( new Boolean( taken ) );
- if( taken )
- ignore = IGNORE_SENTINEL;
-
- return taken;
- }
- ignore = branches.size();
- return false;
- }
-
- public boolean poundelse() throws EmptyStackException
- {
- if( ignore != IGNORE_SENTINEL && ignore < branches.size() )
- {
- branches.pop();
- branches.push( FALSE );
- return false;
- }
-
- Boolean branchAlreadyTaken;
- branchAlreadyTaken = (Boolean) branches.peek();
-
- if( ignore == IGNORE_SENTINEL )
- {
- if( branchAlreadyTaken.booleanValue() )
- {
- ignore = branches.size();
- return false;
- }
-
- branches.pop();
- branches.push( TRUE );
- return true;
-
- }
-
- // now ignore >= branches.size()
- if( branchAlreadyTaken.booleanValue() )
- {
- ignore = branches.size();
- return false;
- }
-
- branches.pop();
- branches.push( TRUE );
- ignore = IGNORE_SENTINEL;
- return true;
-
- }
-
- // taken only on an #endif
- public boolean poundendif( )
- {
- if( ignore == branches.size() )
- ignore = IGNORE_SENTINEL;
- branches.pop();
- return ( ignore == IGNORE_SENTINEL );
- }
-
- public int getDepth()
- {
- return branches.size();
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/CompleteParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/CompleteParser.java
deleted file mode 100644
index e618bee5b28..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/CompleteParser.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**********************************************************************
- * 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 org.eclipse.cdt.core.parser.BacktrackException;
-import org.eclipse.cdt.core.parser.EndOfFileException;
-import org.eclipse.cdt.core.parser.IParserLogService;
-import org.eclipse.cdt.core.parser.IScanner;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ParserFactory;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.core.parser.ParserMode;
-import org.eclipse.cdt.core.parser.ParserNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTCompletionNode;
-import org.eclipse.cdt.core.parser.ast.IASTNode;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-
-/**
- * @author jcamelon
- */
-public class CompleteParser extends Parser {
-
- /**
- * @param scanner
- * @param callback
- * @param mode
- * @param language
- * @param log
- */
- public CompleteParser(IScanner scanner, ISourceElementRequestor callback, ParserLanguage language, IParserLogService log) {
- super(scanner, callback, language, log);
- astFactory = ParserFactory.createASTFactory( ParserMode.COMPLETE_PARSE, language);
- scanner.setASTFactory(astFactory);
- }
-
- protected void handleFunctionBody(IASTScope scope, boolean isInlineFunction) throws BacktrackException, EndOfFileException
- {
- if ( isInlineFunction )
- skipOverCompoundStatement();
- else
- functionBody(scope);
- }
-
- protected void catchBlockCompoundStatement(IASTScope scope) throws BacktrackException, EndOfFileException
- {
- compoundStatement(scope, true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IParser#parse(int)
- */
- public IASTCompletionNode parse(int offset) throws ParserNotImplementedException {
- throw new ParserNotImplementedException();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IParser#parse(int, int)
- */
- public IASTNode parse(int startingOffset, int endingOffset) throws ParserNotImplementedException {
- throw new ParserNotImplementedException();
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ContextException.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ContextException.java
deleted file mode 100644
index 1fa5bbbeb5d..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ContextException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**********************************************************************
- * 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 ContextException extends Exception
-{
- private final int id;
-
- /**
- * @param i
- */
- public ContextException(int i)
- {
- id = i;
- }
-
- /**
- * @return
- */
- public int getId()
- {
- return id;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ContextStack.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ContextStack.java
deleted file mode 100644
index 110166b3579..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ContextStack.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 IBM 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 Corp. - Rational Software - initial implementation
- ******************************************************************************/
-
-package org.eclipse.cdt.internal.core.parser;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.Set;
-import java.util.Stack;
-
-import org.eclipse.cdt.core.parser.IParserLogService;
-import org.eclipse.cdt.core.parser.IProblem;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTInclusion;
-import org.eclipse.cdt.internal.core.parser.IScannerContext.ContextKind;
-
-/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class ContextStack {
-
- private final IParserLogService log;
-
- public ContextStack( IParserLogService l ) {
- log = l;
- }
-
- public void updateContext(Reader reader, String filename, ContextKind type, IASTInclusion inclusion, ISourceElementRequestor requestor) throws ContextException {
- updateContext(reader, filename, type, inclusion, requestor, -1, -1);
- }
-
- public void updateContext(Reader reader, String filename, ContextKind type, IASTInclusion inclusion, ISourceElementRequestor requestor, int macroOffset, int macroLength) throws ContextException
- {
- int startLine = 1;
-
- // If we expand a macro within a macro, then keep offsets of the top-level one,
- // as only the top level macro identifier is properly positioned
- if (type == IScannerContext.ContextKind.MACROEXPANSION) {
- if (currentContext.getKind() == IScannerContext.ContextKind.MACROEXPANSION) {
- macroOffset = currentContext.getMacroOffset();
- macroLength = currentContext.getMacroLength();
- }
-
- startLine = currentContext.getLine();
- }
-
- undoStack.clear();
- IScannerContext context = new ScannerContext( reader, filename, type, null, macroOffset, macroLength, startLine );
- context.setExtension(inclusion);
- push( context, requestor );
- }
-
- protected void push( IScannerContext context, ISourceElementRequestor requestor ) throws ContextException
- {
- if( context.getKind() == IScannerContext.ContextKind.INCLUSION )
- {
- if( !inclusions.add( context.getFilename() ) )
- throw new ContextException( IProblem.PREPROCESSOR_CIRCULAR_INCLUSION );
- context.getExtension().enterScope( requestor );
-
- } else if( context.getKind() == IScannerContext.ContextKind.MACROEXPANSION )
- {
- if( !defines.add( context.getFilename() ) )
- throw new ContextException( IProblem.PREPROCESSOR_INVALID_MACRO_DEFN );
- }
- if( currentContext != null )
- contextStack.push(currentContext);
-
- currentContext = context;
- if( context.getKind() == IScannerContext.ContextKind.TOP )
- topContext = context;
- }
-
- public boolean rollbackContext(ISourceElementRequestor requestor) {
- try {
- currentContext.getReader().close();
- } catch (IOException ie) {
- log.traceLog("ContextStack : Error closing reader ");
- }
-
- if( currentContext.getKind() == IScannerContext.ContextKind.INCLUSION )
- {
- inclusions.remove( currentContext.getFilename() );
- currentContext.getExtension().exitScope( requestor );
- } else if( currentContext.getKind() == IScannerContext.ContextKind.MACROEXPANSION )
- {
- defines.remove( currentContext.getFilename() );
- }
-
- undoStack.addFirst( currentContext );
-
- if (contextStack.isEmpty()) {
- currentContext = null;
- return false;
- }
-
- currentContext = (ScannerContext) contextStack.pop();
- return true;
- }
-
- public void undoRollback( IScannerContext undoTo, ISourceElementRequestor requestor ) throws ContextException {
- if( currentContext == undoTo ){
- return;
- }
-
- int size = undoStack.size();
- if( size > 0 )
- {
- for( int i = size; i > 0; i-- )
- {
- push( (IScannerContext) undoStack.removeFirst(), requestor );
-
- if( currentContext == undoTo )
- break;
- }
- }
- }
-
- /**
- *
- * @param symbol
- * @return boolean, whether or not we should expand this definition
- *
- * 16.3.4-2 If the name of the macro being replaced is found during
- * this scan of the replacement list it is not replaced. Further, if
- * any nested replacements encounter the name of the macro being replaced,
- * it is not replaced.
- */
- protected boolean shouldExpandDefinition( String symbol )
- {
- return !defines.contains( symbol );
- }
-
- public IScannerContext getCurrentContext(){
- return currentContext;
- }
-
- private IScannerContext currentContext, topContext;
- private Stack contextStack = new Stack();
- private LinkedList undoStack = new LinkedList();
- private Set inclusions = new HashSet();
- private Set defines = new HashSet();
-
- /**
- * @return
- */
- public IScannerContext getTopContext() {
- return topContext;
- }
-
- public IScannerContext getMostRelevantFileContext()
- {
- if( currentContext != null )
- {
- if( currentContext.getKind() == IScannerContext.ContextKind.TOP ) return currentContext;
- if( currentContext.getKind() == IScannerContext.ContextKind.INCLUSION ) return currentContext;
- }
-
- IScannerContext context = null;
- for( int i = contextStack.size() - 1; i >= 0; --i )
- {
- context = (IScannerContext)contextStack.get(i);
- if( context.getKind() == IScannerContext.ContextKind.INCLUSION || context.getKind() == IScannerContext.ContextKind.TOP )
- break;
- if( i == 0 ) context = null;
- }
-
- return context;
- }
-
- public int getCurrentLineNumber()
- {
- return getMostRelevantFileContext() != null ? getMostRelevantFileContext().getLine() : -1;
- }
-
- public int getTopFileLineNumber()
- {
- return topContext.getLine();
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ContextualParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ContextualParser.java
deleted file mode 100644
index cb32036f5a0..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ContextualParser.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/**********************************************************************
- * 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.Iterator;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.eclipse.cdt.core.parser.BacktrackException;
-import org.eclipse.cdt.core.parser.EndOfFileException;
-import org.eclipse.cdt.core.parser.IParser;
-import org.eclipse.cdt.core.parser.IParserLogService;
-import org.eclipse.cdt.core.parser.IScanner;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.IToken;
-import org.eclipse.cdt.core.parser.OffsetLimitReachedException;
-import org.eclipse.cdt.core.parser.ParserFactory;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.core.parser.ParserMode;
-import org.eclipse.cdt.core.parser.ParserNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTCompletionNode;
-import org.eclipse.cdt.core.parser.ast.IASTNode;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
-import org.eclipse.cdt.internal.core.parser.ast.ASTCompletionNode;
-
-/**
- * @author jcamelon
- */
-public class ContextualParser extends Parser implements IParser {
-
- protected CompletionKind kind;
- protected IASTScope scope;
- protected IASTNode context;
- protected IToken finalToken;
- private Set keywordSet;
- private int boundaryOffset;
-
- /**
- * @param scanner
- * @param callback
- * @param language
- * @param log
- */
- public ContextualParser(IScanner scanner, ISourceElementRequestor callback, ParserLanguage language, IParserLogService log) {
- super(scanner, callback, language, log);
- astFactory = ParserFactory.createASTFactory( ParserMode.COMPLETE_PARSE, language);
- scanner.setASTFactory(astFactory);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IParser#parse(int)
- */
- public IASTCompletionNode parse(int offset) throws ParserNotImplementedException {
- scanner.setOffsetBoundary(offset);
- boundaryOffset = offset;
- translationUnit();
- return new ASTCompletionNode( getCompletionKind(), getCompletionScope(), getCompletionContext(), getCompletionPrefix(), reconcileKeywords( getKeywordSet(), getCompletionPrefix() ) );
- }
-
- /**
- * @param set
- * @param string
- * @return
- */
- private Set reconcileKeywords(Set keywords, String prefix) {
- Set resultSet = new TreeSet();
- Iterator i = keywords.iterator();
- while( i.hasNext() )
- {
- String value = (String) i.next();
- if( value.startsWith( prefix ) )
- resultSet.add( value );
- else if( value.compareTo( prefix ) > 0 )
- break;
- }
- return resultSet;
- }
-
- /**
- * @return
- */
- private Set getKeywordSet() {
- return keywordSet;
- }
-
- /**
- * @return
- */
- private String getCompletionPrefix() {
- return ( finalToken == null ? "" : finalToken.getImage() );
- }
-
- /**
- * @return
- */
- private IASTNode getCompletionContext() {
- return context;
- }
-
- /**
- * @return
- */
- private IASTScope getCompletionScope() {
- return scope;
- }
-
- /**
- * @return
- */
- protected IASTCompletionNode.CompletionKind getCompletionKind() {
- return kind;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IParser#parse(int, int)
- */
- public IASTNode parse(int startingOffset, int endingOffset) throws ParserNotImplementedException {
- scanner.setOffsetBoundary(endingOffset);
- translationUnit();
- return getCompletionContext();
- }
-
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.Parser#setCurrentScope(org.eclipse.cdt.core.parser.ast.IASTScope)
- */
- protected void setCurrentScope(IASTScope scope) {
- this.scope = scope;
- }
-
- protected void setCompletionContext( IASTNode node )
- {
- this.context = node;
- }
-
- protected void setCompletionKind( IASTCompletionNode.CompletionKind kind )
- {
- this.kind = kind;
- }
-
-
- protected void handleFunctionBody(IASTScope scope, boolean isInlineFunction) throws BacktrackException, EndOfFileException
- {
- if ( isInlineFunction )
- skipOverCompoundStatement();
- else
- functionBody(scope);
- }
-
- protected void catchBlockCompoundStatement(IASTScope scope) throws BacktrackException, EndOfFileException
- {
- compoundStatement(scope, true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.Parser#handleOffsetLimitException()
- */
- protected void handleOffsetLimitException(OffsetLimitReachedException exception) throws EndOfFileException, OffsetLimitReachedException {
- setCompletionToken( exception.getFinalToken() );
- if( (finalToken!= null )&& (finalToken.getEndOffset() != boundaryOffset ))
- setCompletionToken(null);
- throw exception;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.Parser#setCompletionKeywords(java.lang.String[])
- */
- protected void setCompletionKeywords(KeywordSets.Key key) {
- this.keywordSet = KeywordSets.getKeywords( key, language );
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.Parser#setCompletionToken(org.eclipse.cdt.core.parser.IToken)
- */
- protected void setCompletionToken(IToken token) {
- finalToken = token;
- }
-
- protected IToken getCompletionToken()
- {
- return finalToken;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java
deleted file mode 100644
index 0d8ccdcdfd3..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java
+++ /dev/null
@@ -1,809 +0,0 @@
-/**********************************************************************
- * 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.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ITokenDuple;
-import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
-import org.eclipse.cdt.core.parser.ast.ASTSemanticException;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTFactory;
-import org.eclipse.cdt.core.parser.ast.IASTField;
-import org.eclipse.cdt.core.parser.ast.IASTFunction;
-import org.eclipse.cdt.core.parser.ast.IASTMethod;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTTemplate;
-import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTVariable;
-import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type;
-/**
- * @author jcamelon
- *
- */
-public class DeclarationWrapper implements IDeclaratorOwner
-{
- private boolean imaginary, complex;
- private boolean restrict;
- private int endOffset;
- private ITokenDuple name;
- private Type simpleType =
- IASTSimpleTypeSpecifier.Type.UNSPECIFIED;
- private boolean isSigned;
- private boolean isLong;
- private boolean isShort;
- private boolean isUnsigned;
- private final IASTTemplate templateDeclaration;
- private final IASTScope scope;
- private IASTTypeSpecifier typeSpecifier;
- private List declarators = new ArrayList();
- private boolean typeNamed = false;
- 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,
- int startingOffset,
- IASTTemplate templateDeclaration)
- {
- this.scope = scope;
- this.startingOffset = startingOffset;
- this.templateDeclaration = templateDeclaration;
- }
- /**
- * @param b
- */
- public void setTypenamed(boolean b)
- {
- typeNamed = b;
- }
- /**
- * @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 boolean isRegister()
- {
- return register;
- }
- /**
- * @return
- */
- public int getStartingOffset()
- {
- return startingOffset;
- }
- /**
- * @return
- */
- public boolean isStatic()
- {
- return staticc;
- }
- /**
- * @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 Iterator getDeclarators()
- {
- return Collections.unmodifiableList(declarators).iterator();
- }
- /**
- * @return
- */
- public IASTTypeSpecifier getTypeSpecifier()
- {
- return typeSpecifier;
- }
- /**
- * @param specifier
- */
- public void setTypeSpecifier(IASTTypeSpecifier specifier)
- {
- typeSpecifier = specifier;
- }
- private IASTFactory astFactory = null;
- /**
- * @param requestor
- */
- public List createASTNodes(IASTFactory astFactory) throws ASTSemanticException
- {
- this.astFactory = astFactory;
- Iterator i = declarators.iterator();
- List l = new ArrayList();
- while (i.hasNext())
- l.add(createASTNode((Declarator)i.next()));
- return l;
- }
- /**
- * @param declarator
- */
- private IASTDeclaration createASTNode(Declarator declarator) throws ASTSemanticException
- {
- boolean isWithinClass = (getScope() instanceof IASTClassSpecifier); //TODO fix this for COMPLETE_PARSE
- boolean isFunction = declarator.isFunction();
- boolean hasInnerDeclarator = ( declarator.getOwnedDeclarator() != null );
-
- if( hasInnerDeclarator )
- return createIndirectDeclaration( declarator );
-
- if (isTypedef())
- return createTypedef(declarator, false);
-
- if (isWithinClass )
- {
- if( isFunction)
- return createMethodASTNode(declarator, false);
- else
- return createFieldASTNode(declarator, false );
- }
- else
- {
- if (isFunction)
- return createFunctionASTNode(declarator, false);
- else
- return createVariableASTNode(declarator, false);
- }
- }
- /**
- * @param declarator
- * @return
- */
- private IASTDeclaration createIndirectDeclaration(Declarator declarator) throws ASTSemanticException
- {
- if( declarator.getOwnedDeclarator().getOwnedDeclarator() == null )
- {
-
- Declarator d = declarator.getOwnedDeclarator();
- Iterator i = d.getPointerOperators().iterator();
- if( !i.hasNext() )
- {
- boolean isWithinClass = scope instanceof IASTClassSpecifier;
- boolean isFunction = (declarator.getParameters().size() != 0);
- if (isTypedef())
- return createTypedef(declarator, true);
-
- if (isWithinClass )
- {
- if( isFunction)
- return createMethodASTNode(declarator, true);
- else
- return createFieldASTNode(declarator, true );
- }
- else
- {
- if (isFunction)
- return createFunctionASTNode(declarator, true);
- else
- return createVariableASTNode(declarator, true);
- }
-
- }
-
- List convertedParms = createParameterList( declarator.getParameters() );
- IASTAbstractDeclaration abs = null;
- try
- {
- abs =
- astFactory.createAbstractDeclaration(
- constt,
- volatil,
- getTypeSpecifier(),
- declarator.getPointerOperators(),
- declarator.getArrayModifiers(),
- convertedParms,
- (ASTPointerOperator)i.next());
- }
- catch (Exception e)
- {
- throw new ASTSemanticException();
- }
- String name = ( d.getPointerOperatorNameDuple() != null ) ? d.getPointerOperatorNameDuple().toString() + d.getName() : d.getName();
- if( typedef )
- try
- {
- return astFactory.createTypedef(
- scope,
- name,
- abs, getStartingOffset(), d.getNameStartOffset(), d.getNameEndOffset() );
- }
- catch (ASTSemanticException e1)
- {
- throw e1;
- }
- catch (Exception e1)
- {
- throw new ASTSemanticException();
- }
- else
- try
- {
- return astFactory.createVariable( scope, name, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), d.getNameStartOffset(), d.getNameEndOffset(), d.getConstructorExpression() );
- }
- catch (Exception e2)
- {
- throw new ASTSemanticException();
- }
-
- }
- else
- {
- throw new ASTSemanticException();
- }
-
- }
-
- /**
- * @param declarator
- * @return
- */
- private IASTTypedefDeclaration createTypedef(Declarator declarator, boolean nested ) throws ASTSemanticException
- {
- try
- {
- return astFactory.createTypedef(
- scope,
- nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
- astFactory.createAbstractDeclaration(
- constt,
- volatil,
- getTypeSpecifier(),
- declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null), startingOffset, declarator.getNameStartOffset(), declarator.getNameEndOffset());
- }
- catch (ASTSemanticException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new ASTSemanticException();
- }
- }
- /**
- * @param declarator
- * @return
- */
- private IASTMethod createMethodASTNode(Declarator declarator, boolean nested) throws ASTSemanticException
- {
- try
- {
- return astFactory
- .createMethod(
- scope,
- nested ? declarator.getOwnedDeclarator().getNameDuple() : declarator.getNameDuple(),
- createParameterList(declarator.getParameters()),
- astFactory.createAbstractDeclaration(
- constt,
- volatil,
- getTypeSpecifier(),
- declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
- declarator.getExceptionSpecification(),
- inline,
- friend,
- staticc,
- startingOffset,
- declarator.getNameStartOffset(),
- declarator.getNameEndOffset(),
- templateDeclaration,
- declarator.isConst(),
- declarator.isVolatile(),
- virtual,
- explicit,
- declarator.isPureVirtual(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode(),
- declarator.getConstructorMemberInitializers(), declarator.hasFunctionBody(), declarator.hasFunctionTryBlock(), declarator.isVarArgs());
- }
- catch (ASTSemanticException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new ASTSemanticException();
- }
- }
- /**
- * @param declarator
- * @return
- */
- private IASTFunction createFunctionASTNode(Declarator declarator, boolean nested) throws ASTSemanticException
- {
- try
- {
- return astFactory.createFunction(
- scope,
- nested ? declarator.getOwnedDeclarator().getNameDuple() : declarator.getNameDuple(),
- createParameterList(declarator.getParameters()),
- astFactory.createAbstractDeclaration(
- constt,
- volatil,
- getTypeSpecifier(),
- declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
- declarator.getExceptionSpecification(),
- inline,
- friend,
- staticc,
- startingOffset,
- declarator.getNameStartOffset(),
- declarator.getNameEndOffset(),
- templateDeclaration,
- declarator.isConst(),
- declarator.isVolatile(),
- virtual,
- explicit,
- declarator.isPureVirtual(),
- declarator.getConstructorMemberInitializers(), declarator.hasFunctionBody(), declarator.hasFunctionTryBlock(),
- declarator.isVarArgs() );
- }
- catch (ASTSemanticException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new ASTSemanticException();
- }
- }
- /**
- * @param declarator
- * @return
- */
- private IASTField createFieldASTNode(Declarator declarator, boolean nested) throws ASTSemanticException
- {
- try
- {
- return astFactory.createField(
- scope,
- nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
- auto,
- declarator.getInitializerClause(),
- declarator.getBitFieldExpression(),
- astFactory.createAbstractDeclaration(
- constt,
- volatil,
- getTypeSpecifier(),
- declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
- mutable,
- extern,
- register,
- staticc,
- startingOffset,
- declarator.getNameStartOffset(),
- declarator.getNameEndOffset(), declarator.getConstructorExpression(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode());
- }
- catch (ASTSemanticException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new ASTSemanticException();
- }
- }
- private List createParameterList(List currentParameters) throws ASTSemanticException
- {
- List result = new ArrayList();
- Iterator i = currentParameters.iterator();
- while (i.hasNext())
- {
- DeclarationWrapper wrapper = (DeclarationWrapper)i.next();
- Iterator j = wrapper.getDeclarators();
- while (j.hasNext())
- {
- Declarator declarator = (Declarator)j.next();
- try
- {
- result.add(
- astFactory.createParameterDeclaration(
- wrapper.isConst(),
- wrapper.isVolatile(),
- wrapper.getTypeSpecifier(),
- declarator.getPointerOperators(),
- declarator.getArrayModifiers(),
- null, null, declarator.getName() == null
- ? ""
- : declarator.getName(), declarator.getInitializerClause(), wrapper.getStartingOffset(), declarator.getNameStartOffset(), declarator.getNameEndOffset(), wrapper.getEndOffset()));
- }
- catch (Exception e)
- {
- throw new ASTSemanticException();
- }
- }
- }
- return result;
- }
- /**
- * @param declarator
- * @return
- */
- private IASTVariable createVariableASTNode(Declarator declarator, boolean nested ) throws ASTSemanticException
- {
- try
- {
- return astFactory.createVariable(
- scope,
- nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
- isAuto(),
- declarator.getInitializerClause(),
- declarator.getBitFieldExpression(),
- astFactory.createAbstractDeclaration(
- constt,
- volatil,
- getTypeSpecifier(),
- declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
- mutable,
- extern,
- register,
- staticc,
- getStartingOffset(),
- declarator.getNameStartOffset(), declarator.getNameEndOffset(), declarator.getConstructorExpression());
- }
- catch (ASTSemanticException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new ASTSemanticException();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IDeclaratorOwner#getDeclarationWrapper()
- */
- public DeclarationWrapper getDeclarationWrapper()
- {
- return this;
- }
- /**
- * @return
- */
- public boolean isUnsigned()
- {
- return isUnsigned;
- }
- /**
- * @return
- */
- public boolean isSigned()
- {
- return isSigned;
- }
- /**
- * @return
- */
- public boolean isShort()
- {
- return isShort;
- }
- /**
- * @return
- */
- public boolean isLong()
- {
- return isLong;
- }
- /**
- * @param b
- */
- public void setLong(boolean b)
- {
- isLong = b;
- }
- /**
- * @param b
- */
- public void setShort(boolean b)
- {
- isShort = b;
- }
- /**
- * @param b
- */
- public void setSigned(boolean b)
- {
- isSigned = b;
- }
- /**
- * @param b
- */
- public void setUnsigned(boolean b)
- {
- isUnsigned = b;
- }
- /**
- * @return
- */
- public Type getSimpleType()
- {
- return simpleType;
- }
- /**
- * @param type
- */
- public void setSimpleType(Type type)
- {
- simpleType = type;
- }
- /**
- * @param duple
- */
- public void setTypeName(ITokenDuple duple)
- {
- name = duple;
- }
- /**
- * @return
- */
- public ITokenDuple getName()
- {
- return name;
- }
- /**
- * @param duple
- */
- public void setName(ITokenDuple duple)
- {
- name = duple;
- }
- /**
- * @return
- */
- public IASTTemplate getOwnerTemplate()
- {
- return templateDeclaration;
- }
- /**
- * @param i
- */
- public void setEndingOffset(int i)
- {
- endOffset = i;
- }
- /**
- * @return
- */
- public int getEndOffset()
- {
- return endOffset;
- }
- /**
- * @param b
- */
- public void setRestrict(boolean b)
- {
- restrict = b;
- }
-
-
- /**
- * @return
- */
- public boolean isRestrict()
- {
- return restrict;
- }
- /**
- * @param b
- */
- public void setImaginary(boolean b)
- {
- imaginary = b;
- }
-
- /**
- * @return
- */
- public boolean isComplex()
- {
- return complex;
- }
-
- /**
- * @return
- */
- public boolean isImaginary()
- {
- return imaginary;
- }
-
- /**
- * @param b
- */
- public void setComplex(boolean b)
- {
- complex = b;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Declarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Declarator.java
deleted file mode 100644
index 1d4d0f120c8..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Declarator.java
+++ /dev/null
@@ -1,451 +0,0 @@
-/**********************************************************************
- * 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.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ITokenDuple;
-import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
-import org.eclipse.cdt.core.parser.ast.IASTArrayModifier;
-import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
-import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
-
-/**
- * @author jcamelon
- *
- */
-public class Declarator implements IParameterCollection, IDeclaratorOwner, IDeclarator
-{
- private boolean hasFunctionTryBlock;
- private ITokenDuple pointerOperatorNameDuple;
- private ITokenDuple namedDuple;
- private boolean isFunction;
- private boolean hasFunctionBody;
- private IASTExpression constructorExpression;
- private boolean pureVirtual = false;
- private final IDeclaratorOwner owner;
- private Declarator ownedDeclarator = null;
- private String name = "";
- private IASTInitializerClause initializerClause = null;
- private List ptrOps = new ArrayList();
- private List parameters = new ArrayList();
- private List arrayModifiers = new ArrayList();
- private List constructorMemberInitializers = new ArrayList();
- private IASTExceptionSpecification exceptionSpecification = null;
- private IASTExpression bitFieldExpression = null;
- private boolean isConst = false;
- private boolean isVolatile = false;
- private boolean isKandR = false;
-
-
- private int nameStartOffset, nameEndOffset;
- private boolean varArgs;
-
- public Declarator( IDeclaratorOwner owner )
- {
- this.owner = owner;
- }
-
- /**
- * @return
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * @return
- */
- public int getNameEndOffset()
- {
- return nameEndOffset;
- }
-
- /**
- * @return
- */
- public int getNameStartOffset()
- {
- return nameStartOffset;
- }
-
- /**
- * @return
- */
- public IDeclaratorOwner getOwner()
- {
- return owner;
- }
-
- /**
- * @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 List getPointerOperators()
- {
- return Collections.unmodifiableList( ptrOps );
- }
-
- public void addPointerOperator( ASTPointerOperator ptrOp )
- {
- ptrOps.add( ptrOp );
- }
- /**
- * @return
- */
- public List getParameters()
- {
- return parameters;
- }
-
- public void addParameter( DeclarationWrapper param )
- {
- parameters.add( param );
- }
- /**
- * @return
- */
- public IASTInitializerClause getInitializerClause()
- {
- return initializerClause;
- }
-
- /**
- * @param expression
- */
- public void setInitializerClause(IASTInitializerClause expression)
- {
- initializerClause = expression;
- }
-
- /**
- * @return
- */
- public Declarator getOwnedDeclarator()
- {
- return ownedDeclarator;
- }
-
- /**
- * @param declarator
- */
- public void setOwnedDeclarator(Declarator declarator)
- {
- ownedDeclarator = declarator;
- }
-
- public void setName( ITokenDuple duple )
- {
- setName( duple.toString() );
- setNameStartOffset( duple.getFirstToken().getOffset());
- setNameEndOffset( duple.getLastToken().getEndOffset());
- namedDuple = duple;
- }
-
- /**
- * @return
- */
- public IASTExceptionSpecification getExceptionSpecification()
- {
- return exceptionSpecification;
- }
-
- /**
- * @return
- */
- public boolean isConst()
- {
- return isConst;
- }
-
- /**
- * @return
- */
- public boolean isVolatile()
- {
- return isVolatile;
- }
-
- /**
- * @param specification
- */
- public void setExceptionSpecification(IASTExceptionSpecification specification)
- {
- exceptionSpecification = specification;
- }
-
- /**
- * @param b
- */
- public void setConst(boolean b)
- {
- isConst = b;
- }
-
- /**
- * @param b
- */
- public void setVolatile(boolean b)
- {
- isVolatile = b;
- }
-
- /**
- * @return
- */
- public boolean isKandR()
- {
- return isKandR;
- }
-
- /**
- * @param b
- */
- public void setKandR(boolean b)
- {
- isKandR = b;
- }
-
- /**
- * @param b
- */
- public void setPureVirtual(boolean b)
- {
- pureVirtual = b;
- }
-
- /**
- * @return
- */
- public boolean isPureVirtual()
- {
- return pureVirtual;
- }
-
- /**
- * @param arrayMod
- */
- public void addArrayModifier(IASTArrayModifier arrayMod)
- {
- arrayModifiers.add( arrayMod );
- }
-
- /**
- * @return
- */
- public List getArrayModifiers()
- {
- return arrayModifiers;
- }
-
- /**
- * @return
- */
- public IASTExpression getBitFieldExpression()
- {
- return bitFieldExpression;
- }
-
- /**
- * @param expression
- */
- public void setBitFieldExpression(IASTExpression expression)
- {
- bitFieldExpression = expression;
- }
-
- /**
- * @param astExpression
- */
- public void setConstructorExpression(IASTExpression astExpression)
- {
- constructorExpression = astExpression;
- }
-
- /**
- * @return
- */
- public IASTExpression getConstructorExpression()
- {
- return constructorExpression;
- }
-
- /**
- * @param initializer
- */
- public void addConstructorMemberInitializer(IASTConstructorMemberInitializer initializer)
- {
- constructorMemberInitializers.add( initializer );
- }
-
- /**
- * @return
- */
- public List getConstructorMemberInitializers()
- {
- return constructorMemberInitializers;
- }
-
- /**
- * @param b
- */
- public void hasFunctionBody(boolean b)
- {
- hasFunctionBody = b;
- }
-
- /**
- * @return
- */
- public boolean isFunction()
- {
- return isFunction;
- }
-
- /**
- * @param b
- */
- public void setIsFunction(boolean b)
- {
- isFunction = b;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IDeclaratorOwner#getDeclarators()
- */
- public Iterator getDeclarators()
- {
- List l = new ArrayList();
- if( ownedDeclarator != null )
- l.add( ownedDeclarator );
- return l.iterator();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IDeclaratorOwner#getDeclarationWrapper()
- */
- public DeclarationWrapper getDeclarationWrapper()
- {
- Declarator d = this;
- while( d.getOwner() instanceof IDeclarator )
- d = (Declarator)d.getOwner();
- return (DeclarationWrapper)d.getOwner();
- }
-
-
- /**
- * @return
- */
- public ITokenDuple getNameDuple()
- {
- return namedDuple;
- }
-
- /**
- * @param nameDuple
- */
- public void setPointerOperatorName(ITokenDuple nameDuple)
- {
- pointerOperatorNameDuple = nameDuple;
- }
-
- /**
- * @return
- */
- public ITokenDuple getPointerOperatorNameDuple()
- {
- return pointerOperatorNameDuple;
- }
-
- /**
- * @return
- */
- public boolean hasFunctionBody()
- {
- return hasFunctionBody;
- }
-
- /**
- * @param b
- */
- public void setHasFunctionBody(boolean b)
- {
- hasFunctionBody = b;
- }
-
- /**
- * @param b
- */
- public void setFunctionTryBlock(boolean b)
- {
- hasFunctionTryBlock = true;
- }
-
- /**
- * @return
- */
- public boolean hasFunctionTryBlock()
- {
- return hasFunctionTryBlock;
- }
-
- /**
- * @param b
- */
- public void setHasFunctionTryBlock(boolean b)
- {
- hasFunctionTryBlock = b;
- }
-
- /**
- * @param b
- */
- public void setIsVarArgs(boolean b) {
- varArgs = b;
- }
-
- /**
- * @return Returns the varArgs.
- */
- public boolean isVarArgs() {
- return varArgs;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IDeclarator.java
deleted file mode 100644
index 36a1a0aa324..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IDeclarator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**********************************************************************
- * 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.List;
-
-import org.eclipse.cdt.core.parser.ITokenDuple;
-import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
-import org.eclipse.cdt.core.parser.ast.IASTArrayModifier;
-/**
- * @author jcamelon
- *
- */
-public interface IDeclarator
-{
- /**
- * @return
- */
- public abstract List getPointerOperators();
- public abstract void addPointerOperator(ASTPointerOperator ptrOp);
- /**
- * @param arrayMod
- */
- public abstract void addArrayModifier(IASTArrayModifier arrayMod);
- /**
- * @return
- */
- public abstract List getArrayModifiers();
-
- /**
- * @param nameDuple
- */
- public void setPointerOperatorName(ITokenDuple nameDuple);
-
- public ITokenDuple getPointerOperatorNameDuple();
-
-} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IDeclaratorOwner.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IDeclaratorOwner.java
deleted file mode 100644
index 2904f0b2231..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IDeclaratorOwner.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**********************************************************************
- * 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.Iterator;
-
-/**
- * @author jcamelon
- *
- */
-public interface IDeclaratorOwner
-{
- public Iterator getDeclarators();
- public DeclarationWrapper getDeclarationWrapper();
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IParameterCollection.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IParameterCollection.java
deleted file mode 100644
index 2733b26e180..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IParameterCollection.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**********************************************************************
- * 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.List;
-
-/**
- * @author jcamelon
- *
- */
-public interface IParameterCollection
-{
- public List getParameters();
- public void addParameter( DeclarationWrapper param );
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IProblemFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IProblemFactory.java
deleted file mode 100644
index 7702e8f52ed..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IProblemFactory.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**********************************************************************
- * 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.Map;
-
-import org.eclipse.cdt.core.parser.IProblem;
-
-/**
- * @author jcamelon
- *
- */
-public interface IProblemFactory {
-
- public IProblem createProblem( int id, int start, int end, int line, char [] file, Map arguments, boolean warn, boolean error );
- public String [] getRequiredAttributesForId( int id );
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IScannerContext.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IScannerContext.java
deleted file mode 100644
index 29433ee2c36..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IScannerContext.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.cdt.internal.core.parser;
-import java.io.IOException;
-import java.io.Reader;
-
-import org.eclipse.cdt.core.parser.Enum;
-import org.eclipse.cdt.core.parser.ast.IASTInclusion;
-/**
- * @author jcamelon
- *
- */
-public interface IScannerContext {
-
-
- public static class ContextKind extends Enum
- {
- public static ContextKind SENTINEL = new ContextKind( 0 );
- public static ContextKind TOP = new ContextKind( 1 );
- public static ContextKind INCLUSION = new ContextKind( 2 );
- public static ContextKind MACROEXPANSION = new ContextKind( 3 );
-
- /**
- * @param enumValue
- */
- protected ContextKind(int enumValue) {
- super(enumValue);
- //
- }
- }
-
- /**
- * This initializer is used for scanner contexts which are macro expansions.
- *
- * @param macroOffset Offset of the expanding macro
- * @param macroLength Length of the macro identifier
- * @return
- */
- public int read() throws IOException;
- public String getFilename();
-
- /**
- * Returns macro offset (the offset of the top expanded macro).
- * @return int
- */
- public int getMacroOffset();
-
- /**
- * Returns macro length (the length of the top expanded macro identifier).
- * @return int
- */
- public int getMacroLength();
-
- /**
- * Returns the offset.
- * @return int
- */
- public int getOffset();
-
- /**
- * Returns relative offset (relative to the beginning of the ScannerContext).
- * @return int
- */
- public int getRelativeOffset();
-
- public Reader getReader();
-
- public int undoStackSize();
- public int popUndo();
- public void pushUndo(int undo);
-
- public ContextKind getKind();
- public void setKind( ContextKind kind );
-
- public IASTInclusion getExtension();
- public void setExtension( IASTInclusion ext );
-
- /**
- * @return
- */
- public int getLine();
-
-} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/KeywordSets.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/KeywordSets.java
deleted file mode 100644
index a86cc5a10fc..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/KeywordSets.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/**********************************************************************
- * 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.HashSet;
-import java.util.Hashtable;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.eclipse.cdt.core.parser.Enum;
-import org.eclipse.cdt.core.parser.Keywords;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-
-/**
- * @author jcamelon
- */
-public class KeywordSets {
-
-
- public static class Key extends Enum
- {
- public static final Key EMPTY = new Key( 0 );
- public static final Key DECL_SPECIFIER_SEQUENCE = new Key( 1 );
- public static final Key DECLARATION = new Key( 2 );
- public static final Key STATEMENT = new Key(3);
- /**
- * @param enumValue
- */
- protected Key(int enumValue) {
- super(enumValue);
- }
-
- }
-
- public static Set getKeywords( Key kind, ParserLanguage language )
- {
- if( kind == Key.EMPTY )
- return EMPTY;
- if( kind == Key.DECL_SPECIFIER_SEQUENCE )
- return (Set) DECL_SPECIFIER_SEQUENCE.get( language );
- if( kind == Key.DECLARATION )
- return (Set) DECLARATION.get( language );
- if( kind == Key.STATEMENT )
- return (Set) STATEMENT.get( language );
-
- //TODO finish this
- return null;
- }
-
- private static final Set EMPTY = new HashSet();
-
- private static final Set DECL_SPECIFIER_SEQUENCE_C;
- static
- {
- DECL_SPECIFIER_SEQUENCE_C = new TreeSet();
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.INLINE );
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.AUTO);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.REGISTER);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.STATIC);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.EXTERN);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.MUTABLE);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.TYPEDEF);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.CONST);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.VOLATILE);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.SIGNED);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.UNSIGNED);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.SHORT);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.LONG);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords._COMPLEX);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords._IMAGINARY);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.CHAR);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.WCHAR_T);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords._BOOL);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.INT);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.FLOAT);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.DOUBLE);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.VOID);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.STRUCT);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.UNION);
- DECL_SPECIFIER_SEQUENCE_C.add( Keywords.ENUM);
- }
-
- private static final Set DECL_SPECIFIER_SEQUENCE_CPP;
- static
- {
- DECL_SPECIFIER_SEQUENCE_CPP = new TreeSet();
- // add all of C then remove the ones we don't need
- DECL_SPECIFIER_SEQUENCE_CPP.addAll( DECL_SPECIFIER_SEQUENCE_C );
- DECL_SPECIFIER_SEQUENCE_CPP.remove( Keywords._COMPLEX);
- DECL_SPECIFIER_SEQUENCE_CPP.remove( Keywords._IMAGINARY);
- DECL_SPECIFIER_SEQUENCE_CPP.remove( Keywords._BOOL);
- // CPP specific stuff
- DECL_SPECIFIER_SEQUENCE_CPP.add( Keywords.VIRTUAL);
- DECL_SPECIFIER_SEQUENCE_CPP.add( Keywords.MUTABLE);
- DECL_SPECIFIER_SEQUENCE_CPP.add( Keywords.EXPLICIT);
- DECL_SPECIFIER_SEQUENCE_CPP.add( Keywords.FRIEND);
- DECL_SPECIFIER_SEQUENCE_CPP.add( Keywords.BOOL);
- DECL_SPECIFIER_SEQUENCE_CPP.add( Keywords.TYPENAME);
- DECL_SPECIFIER_SEQUENCE_CPP.add( Keywords.CLASS);
- }
-
- private static final Hashtable DECL_SPECIFIER_SEQUENCE;
- static
- {
- DECL_SPECIFIER_SEQUENCE = new Hashtable();
- DECL_SPECIFIER_SEQUENCE.put( ParserLanguage.CPP, DECL_SPECIFIER_SEQUENCE_CPP );
- DECL_SPECIFIER_SEQUENCE.put( ParserLanguage.C, DECL_SPECIFIER_SEQUENCE_C );
- }
-
- private static final Set DECLARATION_CPP;
- static
- {
- DECLARATION_CPP = new TreeSet();
- DECLARATION_CPP.addAll( DECL_SPECIFIER_SEQUENCE_CPP );
- DECLARATION_CPP.add( Keywords.ASM );
- // more to come
- }
-
- private static final Set DECLARATION_C;
- static
- {
- DECLARATION_C = new TreeSet();
- DECLARATION_C.addAll(DECL_SPECIFIER_SEQUENCE_C );
- DECLARATION_C.add(Keywords.ASM );
- // more to come
- }
-
- private static final Hashtable DECLARATION;
- static
- {
- DECLARATION = new Hashtable();
- DECLARATION.put( ParserLanguage.CPP, DECLARATION_CPP );
- DECLARATION.put( ParserLanguage.C, DECLARATION_C );
- }
-
- private static final Set STATEMENT_C;
- static
- {
- STATEMENT_C= new TreeSet();
- STATEMENT_C.addAll( DECLARATION_C );
- STATEMENT_C.add( Keywords.FOR );
- // more to come
- }
-
- private static final Set STATEMENT_CPP;
- static
- {
- STATEMENT_CPP = new TreeSet( STATEMENT_C );
- STATEMENT_CPP.add( Keywords.TRY );
- }
-
- private static final Hashtable STATEMENT;
- static
- {
- STATEMENT = new Hashtable();
- STATEMENT.put( ParserLanguage.CPP, STATEMENT_CPP);
- STATEMENT.put( ParserLanguage.C, STATEMENT_C );
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/LimitedScannerContext.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/LimitedScannerContext.java
deleted file mode 100644
index f01443529d0..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/LimitedScannerContext.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**********************************************************************
- * 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.io.IOException;
-import java.io.Reader;
-
-/**
- * @author jcamelon
- */
-public class LimitedScannerContext
- extends ScannerContext
- implements IScannerContext {
-
- private final int limit;
-
- /**
- * @param reader
- * @param string
- * @param i
- * @param object
- * @param offsetLimit
- */
- public LimitedScannerContext(Reader reader, String string, ContextKind kind, int offsetLimit) {
- super( reader, string, kind, null );
- limit = offsetLimit;
- }
-
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IScannerContext#read()
- */
- public int read() throws IOException {
- if( getOffset() == limit ) throw new IOException();
- return super.read();
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/LineOffsetReconciler.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/LineOffsetReconciler.java
deleted file mode 100644
index ca114da655c..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/LineOffsetReconciler.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/**********************************************************************
- * 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.io.IOException;
-import java.io.Reader;
-
-import org.eclipse.cdt.core.parser.ILineOffsetReconciler;
-import org.eclipse.cdt.core.parser.IOffsetDuple;
-
-/**
- * @author jcamelon
- *
- */
-public class LineOffsetReconciler implements ILineOffsetReconciler
-{
- private Reader ourReader;
- int currentOffset = 0;
- /**
- * @param input
- */
- public LineOffsetReconciler(Reader input)
- {
- ourReader = input;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ILineOffsetReconciler#getLineNumberForOffset(int)
- */
- public int getLineNumberForOffset(int offset)
- {
- if( offset < currentOffset )
- resetReader();
- int lineNumber = 1;
- for( int i = currentOffset; i < offset; ++i )
- {
- int c = getChar();
- if( c == -1 )
- return -1;
- if( c == '\n' )
- ++lineNumber;
- }
- return lineNumber;
- }
-
- private int getChar()
- {
- int c;
- try
- {
- c = ourReader.read();
- ++currentOffset;
- }
- catch (IOException e)
- {
- return -1;
- }
- return c;
- }
- private void resetReader()
- {
- try
- {
- ourReader.reset();
- currentOffset = 0;
- }
- catch (IOException e)
- {
- throw new Error( "Could not reset Reader" );
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ILineOffsetReconciler#getOffsetRangeForLineNumber(int)
- */
- public IOffsetDuple getOffsetRangeForLineNumber(int LineNumber)
- {
- int lineNumber = 1;
- int floor= -1, ceiling = -1;
- int offset = 0;
- while( lineNumber != LineNumber )
- {
- int c = getChar();
- ++offset;
- if( c == '\n' ) ++lineNumber;
- }
- floor = offset;
- while( lineNumber == LineNumber )
- {
- int c = getChar();
- ++offset;
- if( c == '\n' ) ++lineNumber;
- }
- ceiling = offset;
- return new OffsetDuple( floor, ceiling );
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/MacroDescriptor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/MacroDescriptor.java
deleted file mode 100644
index 7a2e0f37016..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/MacroDescriptor.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001 Rational Software Corp. 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 implementation
- ******************************************************************************/
-package org.eclipse.cdt.internal.core.parser;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.IMacroDescriptor;
-import org.eclipse.cdt.core.parser.IToken;
-
-public class MacroDescriptor implements IMacroDescriptor {
-
- public MacroDescriptor()
- {
- }
-
- /**
- * Method initialize.
- * @param name The name or label that the Macro can be identified by.
- * @param identifiers An ordered list of parameters in the macro
- * definition.
- * @param tokens An ordered list of tokens that describe the
- * RHS expansion in the macro definition.
- * @param sig The complete signature of the macro, as a string.
- */
- public void initialize( String name, List identifiers, List tokens, String sig )
- {
- this.name = name;
- identifierParameters = identifiers;
- tokenizedExpansion = tokens;
- signature = sig;
- }
-
- private String name;
- private List identifierParameters;
- private List tokenizedExpansion;
- private String signature;
- /**
- * Returns the identifiers.
- * @return List
- */
- public final List getParameters() {
- return identifierParameters;
- }
-
- /**
- * Returns the tokens.
- * @return List
- */
- public final List getTokenizedExpansion() {
- return tokenizedExpansion;
- }
-
- /**
- * Returns the name.
- * @return String
- */
- public final String getName()
- {
- return name;
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString()
- {
- StringBuffer buffer = new StringBuffer( 128 );
- int count = getParameters().size();
-
- buffer.append( "MacroDescriptor with name=" + getName() + "\n" );
- buffer.append( "Number of parameters = " + count + "\n" );
- Iterator iter = getParameters().iterator();
- int current = 0;
- while( iter.hasNext() )
- {
- buffer.append( "Parameter #" + current++ + " with name=" + (String) iter.next() + "\n" );
- }
-
- count = getTokenizedExpansion().size();
- iter = getTokenizedExpansion().iterator();
-
- buffer.append( "Number of tokens = " + count + "\n" );
- current = 0;
- while( iter.hasNext() )
- {
- buffer.append( "Token #" + current++ + " is " + ((IToken)iter.next()).toString() + "\n" );
- }
-
- return buffer.toString();
- }
-
- /**
- * Returns the signature.
- * @return String
- */
- public final String getSignature()
- {
- return signature;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IMacroDescriptor#compatible(org.eclipse.cdt.core.parser.IMacroDescriptor)
- */
- public boolean compatible(IMacroDescriptor descriptor) {
- if( descriptor.getName() == null ) return false;
- if( descriptor.getTokenizedExpansion() == null ) return false;
- if( descriptor.getParameters() == null ) return false;
- if( ! name.equals( descriptor.getName() )) return false;
- if( descriptor.getParameters().size() != identifierParameters.size() ) return false;
- if( descriptor.getTokenizedExpansion().size() != tokenizedExpansion.size() ) return false;
-
- if( ! (descriptor.getParameters().containsAll( identifierParameters ) )) return false;
- if( ! (descriptor.getTokenizedExpansion().containsAll( tokenizedExpansion ))) return false;
- return true;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/OffsetDuple.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/OffsetDuple.java
deleted file mode 100644
index a04166cdb0f..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/OffsetDuple.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**********************************************************************
- * 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 org.eclipse.cdt.core.parser.IOffsetDuple;
-
-/**
- * @author jcamelon
- *
- */
-public class OffsetDuple implements IOffsetDuple
-{
- private final int lineFloor, lineCeiling;
- /**
- * @param floor
- * @param ceiling
- */
- public OffsetDuple(int floor, int ceiling)
- {
- lineFloor = floor;
- lineCeiling = ceiling;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IOffsetDuple#getCeilingOffset()
- */
- public int getCeilingOffset()
- {
- return lineCeiling;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IOffsetDuple#getFloorOffset()
- */
- public int getFloorOffset()
- {
- return lineFloor;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParameterCollection.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParameterCollection.java
deleted file mode 100644
index 9c34ad8a44f..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParameterCollection.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**********************************************************************
- * 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.List;
-
-/**
- * @author jcamelon
- *
- */
-public class ParameterCollection implements IParameterCollection
-{
- private List list = new ArrayList();
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IParameterCollection#getParameters()
- */
- public List getParameters()
- {
- return list;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IParameterCollection#addParameter(org.eclipse.cdt.internal.core.parser.DeclarationWrapper)
- */
- public void addParameter(DeclarationWrapper param)
- {
- list.add( param );
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java
deleted file mode 100644
index 45e842e31a9..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java
+++ /dev/null
@@ -1,5420 +0,0 @@
-/**********************************************************************
- * 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.parser;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Stack;
-
-import org.eclipse.cdt.core.parser.BacktrackException;
-import org.eclipse.cdt.core.parser.EndOfFileException;
-import org.eclipse.cdt.core.parser.IParser;
-import org.eclipse.cdt.core.parser.IParserLogService;
-import org.eclipse.cdt.core.parser.IScanner;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.IToken;
-import org.eclipse.cdt.core.parser.ITokenDuple;
-import org.eclipse.cdt.core.parser.OffsetLimitReachedException;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.core.parser.ScannerException;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.core.parser.ast.ASTClassKind;
-import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
-import org.eclipse.cdt.core.parser.ast.ASTSemanticException;
-import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
-import org.eclipse.cdt.core.parser.ast.IASTArrayModifier;
-import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTCodeScope;
-import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
-import org.eclipse.cdt.core.parser.ast.IASTCompletionNode;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTDesignator;
-import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.core.parser.ast.IASTFactory;
-import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
-import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
-import org.eclipse.cdt.core.parser.ast.IASTNode;
-import org.eclipse.cdt.core.parser.ast.IASTOffsetableElement;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTTemplate;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateParameter;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
-import org.eclipse.cdt.core.parser.ast.IASTTypeId;
-import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
-import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType;
-import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
-import org.eclipse.cdt.core.parser.ast.IASTExpression.Kind;
-import org.eclipse.cdt.internal.core.parser.KeywordSets.Key;
-
-/**
- * This is our first implementation of the IParser interface, serving as a parser for
- * ANSI C and C++.
- *
- * From time to time we will make reference to the ANSI ISO specifications.
- *
- * @author jcamelon
- */
-public abstract class Parser implements IParser
-{
- protected final IParserLogService log;
- private static final List EMPTY_LIST = new ArrayList();
- private static int FIRST_ERROR_OFFSET_UNSET = -1;
- // sentinel initial value for offsets
- protected int firstErrorOffset = FIRST_ERROR_OFFSET_UNSET;
- // offset where the first parse error occurred
-
- // are we doing the high-level parse, or an in depth parse?
- protected boolean parsePassed = true; // did the parse pass?
- protected ParserLanguage language = ParserLanguage.CPP; // C or CPP
- protected ISourceElementRequestor requestor = null;
- // new callback mechanism
- protected IASTFactory astFactory = null; // ast factory
- /**
- * This is the single entry point for setting parsePassed to
- * false, and also making note what token offset we failed upon.
- *
- * @throws EndOfFileException
- */
- protected void failParse()
- {
- try
- {
- if (firstErrorOffset == FIRST_ERROR_OFFSET_UNSET )
- firstErrorOffset = LA(1).getOffset();
- } catch( EndOfFileException eof )
- {
- // do nothing
- }
- finally
- {
- parsePassed = false;
- }
- }
- /**
- * This is the standard cosntructor that we expect the Parser to be instantiated
- * with.
- *
- * @param s IScanner instance that has been initialized to the code input
- * @param c IParserCallback instance that will receive callbacks as we parse
- * @param quick Are we asking for a high level parse or not?
- */
- public Parser(
- IScanner scanner,
- ISourceElementRequestor callback,
- ParserLanguage language,
- IParserLogService log )
- {
- this.scanner = scanner;
- this.requestor = callback;
- this.language = language;
- this.log = log;
- }
-
- // counter that keeps track of the number of times Parser.parse() is called
- private static int parseCount = 0;
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IParser#parse()
- */
- public boolean parse()
- {
- long startTime = System.currentTimeMillis();
- translationUnit();
- // For the debuglog to take place, you have to call
- // Util.setDebugging(true);
- // Or set debug to true in the core plugin preference
- log.traceLog(
- "Parse "
- + (++parseCount)
- + ": "
- + (System.currentTimeMillis() - startTime)
- + "ms"
- + (parsePassed ? "" : " - parse failure") );
- return parsePassed;
- }
-
-
- /**
- * This is the top-level entry point into the ANSI C++ grammar.
- *
- * translationUnit : (declaration)*
- */
- protected void translationUnit()
- {
- IASTCompilationUnit compilationUnit;
- try
- {
- compilationUnit = astFactory.createCompilationUnit();
- }
- catch (Exception e2)
- {
- return;
- }
-
- compilationUnit.enterScope( requestor );
- IToken lastBacktrack = null;
- IToken checkToken = null;
- while (true)
- {
- try
- {
- checkToken = LA(1);
- declaration(compilationUnit, null);
- if (LA(1) == checkToken)
- errorHandling();
- }
- catch (EndOfFileException e)
- {
- // Good
- break;
- }
- catch (BacktrackException b)
- {
- try
- {
- // Mark as failure and try to reach a recovery point
- failParse();
- if (lastBacktrack != null && lastBacktrack == LA(1))
- {
- // we haven't progressed from the last backtrack
- // try and find tne next definition
- errorHandling();
- }
- else
- {
- // start again from here
- lastBacktrack = LA(1);
- }
- }
- catch (EndOfFileException e)
- {
- break;
- }
- }
- catch (Exception e)
- {
- failParse();
- break;
- }
- }
- compilationUnit.exitScope( requestor );
- }
- /**
- * This function is called whenever we encounter and error that we cannot backtrack out of and we
- * still wish to try and continue on with the parse to do a best-effort parse for our client.
- *
- * @throws EndOfFileException We can potentially hit EndOfFile here as we are skipping ahead.
- */
- protected void errorHandling() throws EndOfFileException
- {
- failParse();
- consume();
- int depth = 0;
- while (!((LT(1) == IToken.tSEMI && depth == 0)
- || (LT(1) == IToken.tRBRACE && depth == 1)))
- {
- switch (LT(1))
- {
- case IToken.tLBRACE :
- ++depth;
- break;
- case IToken.tRBRACE :
- --depth;
- break;
- }
- consume();
- }
- // eat the SEMI/RBRACE as well
- consume();
- }
- /**
- * The merger of using-declaration and using-directive in ANSI C++ grammar.
- *
- * using-declaration:
- * using typename? ::? nested-name-specifier unqualified-id ;
- * using :: unqualified-id ;
- * using-directive:
- * using namespace ::? nested-name-specifier? namespace-name ;
- *
- * @param container Callback object representing the scope these definitions fall into.
- * @throws BacktrackException request for a backtrack
- */
- protected void usingClause(IASTScope scope)
- throws EndOfFileException, BacktrackException
- {
- IToken firstToken = consume(IToken.t_using);
- if (LT(1) == IToken.t_namespace)
- {
- // using-directive
- consume(IToken.t_namespace);
- // optional :: and nested classes handled in name
- TokenDuple duple = null;
- if (LT(1) == IToken.tIDENTIFIER || LT(1) == IToken.tCOLONCOLON)
- duple = name();
- else
- throw backtrack;
- if (LT(1) == IToken.tSEMI)
- {
- IToken last = consume(IToken.tSEMI);
- IASTUsingDirective astUD = null;
-
- try
- {
- astUD = astFactory.createUsingDirective(scope, duple, firstToken.getOffset(), last.getEndOffset());
- }
- catch (Exception e1)
- {
- throw backtrack;
- }
- astUD.acceptElement(requestor);
- return;
- }
- else
- {
- throw backtrack;
- }
- }
- else
- {
- boolean typeName = false;
- if (LT(1) == IToken.t_typename)
- {
- typeName = true;
- consume(IToken.t_typename);
- }
- TokenDuple name = null;
- if (LT(1) == IToken.tIDENTIFIER || LT(1) == IToken.tCOLONCOLON)
- {
- // optional :: and nested classes handled in name
- name = name();
- }
- else
- {
- throw backtrack;
- }
- if (LT(1) == IToken.tSEMI)
- {
- IToken last = consume(IToken.tSEMI);
- IASTUsingDeclaration declaration = null;
- try
- {
- declaration =
- astFactory.createUsingDeclaration(
- scope,
- typeName,
- name,
- firstToken.getOffset(),
- last.getEndOffset());
- }
- catch (Exception e1)
- {
- throw backtrack;
- }
- declaration.acceptElement( requestor );
- }
- else
- {
- throw backtrack;
- }
- }
- }
- /**
- * Implements Linkage specification in the ANSI C++ grammar.
- *
- * linkageSpecification
- * : extern "string literal" declaration
- * | extern "string literal" { declaration-seq }
- *
- * @param container Callback object representing the scope these definitions fall into.
- * @throws BacktrackException request for a backtrack
- */
- protected void linkageSpecification(IASTScope scope)
- throws EndOfFileException, BacktrackException
- {
- IToken firstToken = consume(IToken.t_extern);
- if (LT(1) != IToken.tSTRING)
- throw backtrack;
- IToken spec = consume(IToken.tSTRING);
-
- if (LT(1) == IToken.tLBRACE)
- {
- consume(IToken.tLBRACE);
- IASTLinkageSpecification linkage;
- try
- {
- linkage =
- astFactory.createLinkageSpecification(
- scope,
- spec.getImage(),
- firstToken.getOffset());
- }
- catch (Exception e)
- {
- throw backtrack;
- }
-
- linkage.enterScope( requestor );
- linkageDeclarationLoop : while (LT(1) != IToken.tRBRACE)
- {
- IToken checkToken = LA(1);
- switch (LT(1))
- {
- case IToken.tRBRACE :
- consume(IToken.tRBRACE);
- break linkageDeclarationLoop;
- default :
- try
- {
- declaration(linkage, null);
- }
- catch (BacktrackException bt)
- {
- failParse();
- if (checkToken == LA(1))
- errorHandling();
- }
- }
- if (checkToken == LA(1))
- errorHandling();
- }
- // consume the }
- IToken lastToken = consume();
- linkage.setEndingOffset(lastToken.getEndOffset());
- linkage.exitScope( requestor );
- }
- else // single declaration
- {
- IASTLinkageSpecification linkage;
- try
- {
- linkage =
- astFactory.createLinkageSpecification(
- scope,
- spec.getImage(),
- firstToken.getOffset());
- }
- catch (Exception e)
- {
- throw backtrack;
- }
- linkage.enterScope( requestor );
- declaration(linkage, null);
- linkage.exitScope( requestor );
- }
- }
- /**
- *
- * Represents the emalgamation of template declarations, template instantiations and
- * specializations in the ANSI C++ grammar.
- *
- * template-declaration: export? template < template-parameter-list > declaration
- * explicit-instantiation: template declaration
- * explicit-specialization: template <> declaration
- *
- * @param container Callback object representing the scope these definitions fall into.
- * @throws BacktrackException request for a backtrack
- */
- protected void templateDeclaration(IASTScope scope)
- throws EndOfFileException, BacktrackException
- {
- IToken firstToken = null;
- boolean exported = false;
- if (LT(1) == IToken.t_export)
- {
- exported = true;
- firstToken = consume(IToken.t_export);
- consume(IToken.t_template);
- }
- else
- firstToken = consume(IToken.t_template);
- if (LT(1) != IToken.tLT)
- {
- // explicit-instantiation
- IASTTemplateInstantiation templateInstantiation;
- try
- {
- templateInstantiation =
- astFactory.createTemplateInstantiation(
- scope,
- firstToken.getOffset());
- }
- catch (Exception e)
- {
- throw backtrack;
- }
- templateInstantiation.enterScope( requestor );
- declaration(scope, templateInstantiation);
- templateInstantiation.setEndingOffset(lastToken.getEndOffset());
- templateInstantiation.exitScope( requestor );
-
- return;
- }
- else
- {
- consume(IToken.tLT);
- if (LT(1) == IToken.tGT)
- {
- consume(IToken.tGT);
- // explicit-specialization
-
- IASTTemplateSpecialization templateSpecialization;
- try
- {
- templateSpecialization =
- astFactory.createTemplateSpecialization(
- scope,
- firstToken.getOffset());
- }
- catch (Exception e)
- {
- throw backtrack;
- }
- templateSpecialization.enterScope(requestor);
- declaration(scope, templateSpecialization);
- templateSpecialization.setEndingOffset(
- lastToken.getEndOffset());
- templateSpecialization.exitScope(requestor);
- return;
- }
- }
-
- try
- {
- List parms = templateParameterList(scope);
- consume(IToken.tGT);
- IASTTemplateDeclaration templateDecl;
- try
- {
- templateDecl =
- astFactory.createTemplateDeclaration(
- scope,
- parms,
- exported,
- firstToken.getOffset());
- }
- catch (Exception e)
- {
- throw backtrack;
- }
- templateDecl.enterScope( requestor );
- declaration(scope, templateDecl );
- templateDecl.setEndingOffset(
- lastToken.getEndOffset() );
- templateDecl.exitScope( requestor );
-
- }
- catch (BacktrackException bt)
- {
- throw bt;
- }
- }
- /**
- *
- *
- *
- * template-parameter-list: template-parameter
- * template-parameter-list , template-parameter
- * template-parameter: type-parameter
- * parameter-declaration
- * type-parameter: class identifier?
- * class identifier? = type-id
- * typename identifier?
- * typename identifier? = type-id
- * template < template-parameter-list > class identifier?
- * template < template-parameter-list > class identifier? = id-expression
- * template-id: template-name < template-argument-list?>
- * template-name: identifier
- * template-argument-list: template-argument
- * template-argument-list , template-argument
- * template-argument: assignment-expression
- * type-id
- * id-expression
- *
- * @param templateDeclaration Callback's templateDeclaration which serves as a scope to this list.
- * @throws BacktrackException request for a backtrack
- */
- protected List templateParameterList(IASTScope scope)
- throws BacktrackException, EndOfFileException
- {
- // if we have gotten this far then we have a true template-declaration
- // iterate through the template parameter list
- List returnValue = new ArrayList();
-
- for (;;)
- {
- if (LT(1) == IToken.tGT)
- return returnValue;
- if (LT(1) == IToken.t_class || LT(1) == IToken.t_typename)
- {
- IASTTemplateParameter.ParamKind kind =
- (consume().getType() == IToken.t_class)
- ? IASTTemplateParameter.ParamKind.CLASS
- : IASTTemplateParameter.ParamKind.TYPENAME;
-
- IToken id = null;
- IASTTypeId typeId = null;
- try
- {
- if (LT(1) == IToken.tIDENTIFIER) // optional identifier
- {
- id = identifier();
-
- if (LT(1) == IToken.tASSIGN) // optional = type-id
- {
- consume(IToken.tASSIGN);
- typeId = typeId(scope, false); // type-id
- }
- }
-
- }
- catch (BacktrackException bt)
- {
- throw bt;
- }
- try
- {
- returnValue.add(
- astFactory.createTemplateParameter(
- kind,
- ( id == null )? "" : id.getImage(),
- (typeId == null) ? null : typeId.getTypeOrClassName(),
- null,
- null));
- }
- catch (Exception e)
- {
- throw backtrack;
- }
-
- }
- else if (LT(1) == IToken.t_template)
- {
- consume(IToken.t_template);
- consume(IToken.tLT);
-
- List subResult = templateParameterList(scope);
- consume(IToken.tGT);
- consume(IToken.t_class);
- IToken optionalId = null;
- IASTTypeId optionalTypeId = null;
- if (LT(1) == IToken.tIDENTIFIER) // optional identifier
- {
- optionalId = identifier();
-
- if (LT(1) == IToken.tASSIGN) // optional = type-id
- {
- consume(IToken.tASSIGN);
- optionalTypeId = typeId(scope, false);
-
- }
- }
-
- try
- {
- returnValue.add(
- astFactory.createTemplateParameter(
- IASTTemplateParameter.ParamKind.TEMPLATE_LIST,
- ( optionalId == null )? "" : optionalId.getImage(),
- ( optionalTypeId == null ) ? "" : optionalTypeId.toString(),
- null,
- subResult));
- }
- catch (Exception e)
- {
- throw backtrack;
- }
- }
- else if (LT(1) == IToken.tCOMMA)
- {
- consume(IToken.tCOMMA);
- continue;
- }
- else
- {
- ParameterCollection c = new ParameterCollection();
- parameterDeclaration(c, scope);
- DeclarationWrapper wrapper =
- (DeclarationWrapper)c.getParameters().get(0);
- Declarator declarator =
- (Declarator)wrapper.getDeclarators().next();
- try
- {
- returnValue.add(
- astFactory.createTemplateParameter(
- IASTTemplateParameter.ParamKind.PARAMETER,
- null,
- null,
- astFactory.createParameterDeclaration(
- wrapper.isConst(),
- wrapper.isVolatile(),
- wrapper.getTypeSpecifier(),
- declarator.getPointerOperators(),
- declarator.getArrayModifiers(),
- null, null, declarator.getName() == null
- ? ""
- : declarator.getName(), declarator.getInitializerClause(), wrapper.getStartingOffset(), declarator.getNameStartOffset(), declarator.getNameEndOffset(), wrapper.getEndOffset()),
- null));
- }
- catch (Exception e)
- {
- throw backtrack;
- }
- }
- }
- }
- /**
- * The most abstract construct within a translationUnit : a declaration.
- *
- * declaration
- * : {"asm"} asmDefinition
- * | {"namespace"} namespaceDefinition
- * | {"using"} usingDeclaration
- * | {"export"|"template"} templateDeclaration
- * | {"extern"} linkageSpecification
- * | simpleDeclaration
- *
- * Notes:
- * - folded in blockDeclaration
- * - merged alternatives that required same LA
- * - functionDefinition into simpleDeclaration
- * - namespaceAliasDefinition into namespaceDefinition
- * - usingDirective into usingDeclaration
- * - explicitInstantiation and explicitSpecialization into
- * templateDeclaration
- *
- * @param container IParserCallback object which serves as the owner scope for this declaration.
- * @throws BacktrackException request a backtrack
- */
- protected void declaration(
- IASTScope scope,
- IASTTemplate ownerTemplate)
- throws EndOfFileException, BacktrackException
- {
- setCurrentScope(scope);
- setCompletionKeywords( Key.DECLARATION );
- switch (LT(1))
- {
- case IToken.t_asm :
- IToken first = consume(IToken.t_asm);
- setCompletionKind( CompletionKind.NO_SUCH_KIND );
- consume(IToken.tLPAREN);
- String assembly = consume(IToken.tSTRING).getImage();
- consume(IToken.tRPAREN);
- IToken last = consume(IToken.tSEMI);
- IASTASMDefinition asmDefinition;
- try
- {
- asmDefinition =
- astFactory.createASMDefinition(
- scope,
- assembly,
- first.getOffset(),
- last.getEndOffset());
- }
- catch (Exception e)
- {
- throw backtrack;
- }
- // if we made it this far, then we have all we need
- // do the callback
- asmDefinition.acceptElement(requestor);
- return;
- case IToken.t_namespace :
- namespaceDefinition(scope);
- return;
- case IToken.t_using :
- usingClause(scope);
- return;
- case IToken.t_export :
- case IToken.t_template :
- templateDeclaration(scope);
- return;
- case IToken.t_extern :
- if (LT(2) == IToken.tSTRING)
- {
- linkageSpecification(scope);
- return;
- }
- default :
- simpleDeclarationStrategyUnion(scope, ownerTemplate);
- }
- setCurrentScope(scope);
- setCompletionKeywords( Key.DECLARATION );
-
- }
- protected void simpleDeclarationStrategyUnion(
- IASTScope scope,
- IASTTemplate ownerTemplate)
- throws EndOfFileException, BacktrackException
- {
- IToken mark = mark();
-
- if( scope instanceof IASTClassSpecifier )
- setCompletionKind( CompletionKind.FIELD_TYPE );
- else if (scope instanceof IASTCodeScope)
- setCompletionKind( CompletionKind.SINGLE_NAME_REFERENCE);
- else
- setCompletionKind( CompletionKind.VARIABLE_TYPE );
- try
- {
- simpleDeclaration(
- SimpleDeclarationStrategy.TRY_CONSTRUCTOR,
- scope,
- ownerTemplate);
- // try it first with the original strategy
- }
- catch (BacktrackException bt)
- {
- // did not work
- backup(mark);
-
- try
- {
- simpleDeclaration(
- SimpleDeclarationStrategy.TRY_FUNCTION,
- scope,
- ownerTemplate);
- }
- catch( BacktrackException bt2 )
- {
- backup( mark );
-
- try
- {
- simpleDeclaration(
- SimpleDeclarationStrategy.TRY_VARIABLE,
- scope,
- ownerTemplate);
- }
- catch( BacktrackException b3 )
- {
- backup( mark );
- throw b3;
- }
- }
- }
- }
- /**
- * Serves as the namespace declaration portion of the ANSI C++ grammar.
- *
- * namespace-definition:
- * namespace identifier { namespace-body } | namespace { namespace-body }
- * namespace-body:
- * declaration-seq?
- * @param container IParserCallback object which serves as the owner scope for this declaration.
- * @throws BacktrackException request a backtrack
-
- */
- protected void namespaceDefinition(IASTScope scope)
- throws BacktrackException, EndOfFileException
- {
- IToken first = consume(IToken.t_namespace);
-
- IToken identifier = null;
- // optional name
- if (LT(1) == IToken.tIDENTIFIER)
- identifier = identifier();
-
- if (LT(1) == IToken.tLBRACE)
- {
- consume();
- IASTNamespaceDefinition namespaceDefinition = null;
- try
- {
- namespaceDefinition =
- astFactory.createNamespaceDefinition(
- scope,
- (identifier == null ? "" : identifier.getImage()),
- first.getOffset(),
- (identifier == null ? first.getOffset() : identifier.getOffset()),
- (identifier == null ? first.getEndOffset() : identifier.getEndOffset() ));
- }
- catch (Exception e1)
- {
- throw backtrack;
- }
- namespaceDefinition.enterScope( requestor );
- namepsaceDeclarationLoop : while (LT(1) != IToken.tRBRACE)
- {
- IToken checkToken = LA(1);
- switch (LT(1))
- {
- case IToken.tRBRACE :
- //consume(Token.tRBRACE);
- break namepsaceDeclarationLoop;
- default :
- try
- {
- declaration(namespaceDefinition, null);
- }
- catch (BacktrackException bt)
- {
- failParse();
- if (checkToken == LA(1))
- errorHandling();
- }
- }
- if (checkToken == LA(1))
- errorHandling();
- }
- // consume the }
- IToken last = consume(IToken.tRBRACE);
-
- namespaceDefinition.setEndingOffset(
- last.getOffset() + last.getLength());
- namespaceDefinition.exitScope( requestor );
- }
- else if( LT(1) == IToken.tASSIGN )
- {
- consume( IToken.tASSIGN );
-
- if( identifier == null )
- throw backtrack;
-
- ITokenDuple duple = name();
- consume( IToken.tSEMI );
- try
- {
- astFactory.createNamespaceAlias(
- scope, identifier.getImage(), duple, first.getOffset(),
- identifier.getOffset(), identifier.getEndOffset(), duple.getLastToken().getEndOffset() );
- }
- catch (Exception e1)
- {
- throw backtrack;
- }
- }
- else
- {
- throw backtrack;
- }
- }
- /**
- * Serves as the catch-all for all complicated declarations, including function-definitions.
- *
- * simpleDeclaration
- * : (declSpecifier)* (initDeclarator ("," initDeclarator)*)?
- * (";" | { functionBody }
- *
- * Notes:
- * - append functionDefinition stuff to end of this rule
- *
- * To do:
- * - work in functionTryBlock
- *
- * @param container IParserCallback object which serves as the owner scope for this declaration.
- * @param tryConstructor true == take strategy1 (constructor ) : false == take strategy 2 ( pointer to function)
- * @throws BacktrackException request a backtrack
- */
- protected void simpleDeclaration(
- SimpleDeclarationStrategy strategy,
- IASTScope scope,
- IASTTemplate ownerTemplate)
- throws BacktrackException, EndOfFileException
- {
- IToken firstToken = LA(1);
- DeclarationWrapper sdw =
- new DeclarationWrapper(scope, firstToken.getOffset(), ownerTemplate);
-
- setCompletionKeywords( Key.DECL_SPECIFIER_SEQUENCE );
- declSpecifierSeq(sdw, false, strategy == SimpleDeclarationStrategy.TRY_CONSTRUCTOR );
- if (sdw.getTypeSpecifier() == null && sdw.getSimpleType() != IASTSimpleTypeSpecifier.Type.UNSPECIFIED )
- try
- {
- sdw.setTypeSpecifier(
- astFactory.createSimpleTypeSpecifier(
- scope,
- sdw.getSimpleType(),
- sdw.getName(),
- sdw.isShort(),
- sdw.isLong(),
- sdw.isSigned(),
- sdw.isUnsigned(), sdw.isTypeNamed(), sdw.isComplex(), sdw.isImaginary()));
- }
- catch (Exception e1)
- {
- throw backtrack;
- }
-
- Declarator declarator = null;
- if (LT(1) != IToken.tSEMI)
- {
- declarator = initDeclarator(sdw, strategy);
-
- while (LT(1) == IToken.tCOMMA)
- {
- consume();
- initDeclarator(sdw, strategy);
- }
- }
-
- boolean hasFunctionBody = false;
- boolean hasFunctionTryBlock = false;
- boolean consumedSemi = false;
-
- switch (LT(1))
- {
- case IToken.tSEMI :
- consume(IToken.tSEMI);
- consumedSemi = true;
- break;
- case IToken.t_try :
- consume( IToken.t_try );
- if( LT(1) == IToken.tCOLON )
- ctorInitializer( declarator );
- hasFunctionTryBlock = true;
- declarator.setFunctionTryBlock( true );
- break;
- case IToken.tCOLON :
- ctorInitializer(declarator);
- break;
- case IToken.tLBRACE:
- break;
- default:
- throw backtrack;
- }
-
- if( ! consumedSemi )
- {
- if( LT(1) == IToken.tLBRACE )
- {
- if( firstToken == LA(1) )
- throw backtrack;
- declarator.setHasFunctionBody(true);
- hasFunctionBody = true;
- }
-
- if( hasFunctionTryBlock && ! hasFunctionBody )
- throw backtrack;
- }
-
- List l = null;
- try
- {
- l = sdw.createASTNodes(astFactory);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- }
- Iterator i = l.iterator();
- if (hasFunctionBody && l.size() != 1)
- {
- throw backtrack; //TODO Should be an IProblem
- }
- if (i.hasNext()) // no need to do this unless we have a declarator
- {
- if (!hasFunctionBody)
- {
- while (i.hasNext())
- {
- IASTDeclaration declaration = (IASTDeclaration)i.next();
- ((IASTOffsetableElement)declaration).setEndingOffset(
- lastToken.getEndOffset());
- declaration.acceptElement( requestor );
- }
- }
- else
- {
- IASTDeclaration declaration = (IASTDeclaration)i.next();
- declaration.enterScope( requestor );
-
- if ( !( declaration instanceof IASTScope ) )
- throw backtrack;
-
- handleFunctionBody((IASTScope)declaration,
- sdw.isInline() );
- ((IASTOffsetableElement)declaration).setEndingOffset(
- lastToken.getEndOffset());
-
- declaration.exitScope( requestor );
-
- if( hasFunctionTryBlock )
- catchHandlerSequence( scope );
-
- }
- }
- else
- {
- try
- {
- astFactory
- .createTypeSpecDeclaration(
- sdw.getScope(),
- sdw.getTypeSpecifier(),
- ownerTemplate,
- sdw.getStartingOffset(),
- lastToken.getEndOffset())
- .acceptElement(requestor);
- }
- catch (Exception e1)
- {
- throw backtrack;
- }
- }
-
- }
- protected abstract void handleFunctionBody(IASTScope scope, boolean isInlineFunction) throws BacktrackException, EndOfFileException;
-
- protected void skipOverCompoundStatement() throws BacktrackException, EndOfFileException
- {
- // speed up the parser by skiping the body
- // simply look for matching brace and return
- consume(IToken.tLBRACE);
- int depth = 1;
- while (depth > 0)
- {
- switch (consume().getType())
- {
- case IToken.tRBRACE :
- --depth;
- break;
- case IToken.tLBRACE :
- ++depth;
- break;
- }
- }
- }
- /**
- * This method parses a constructor chain
- * ctorinitializer: : meminitializerlist
- * meminitializerlist: meminitializer | meminitializer , meminitializerlist
- * meminitializer: meminitializerid | ( expressionlist? )
- * meminitializerid: ::? nestednamespecifier?
- * classname
- * identifier
- * @param declarator IParserCallback object that represents the declarator (constructor) that owns this initializer
- * @throws BacktrackException request a backtrack
- */
- protected void ctorInitializer(Declarator d )
- throws EndOfFileException, BacktrackException
- {
- consume(IToken.tCOLON);
-
- try
- {
- for (;;)
- {
- if (LT(1) == IToken.tLBRACE)
- break;
-
-
- ITokenDuple duple = name();
-
- consume(IToken.tLPAREN);
- IASTExpression expressionList = null;
-
- expressionList = expression(d.getDeclarationWrapper().getScope());
-
- consume(IToken.tRPAREN);
-
- try
- {
- d.addConstructorMemberInitializer(
- astFactory.createConstructorMemberInitializer(
- d.getDeclarationWrapper().getScope(),
- duple, expressionList));
- }
- catch (Exception e1)
- {
- throw backtrack;
- }
- if (LT(1) == IToken.tLBRACE)
- break;
- consume(IToken.tCOMMA);
- }
- }
- catch (BacktrackException bt)
- {
-
- throw backtrack;
- }
-
- }
- /**
- * This routine parses a parameter declaration
- *
- * @param containerObject The IParserCallback object representing the parameterDeclarationClause owning the parm.
- * @throws BacktrackException request a backtrack
- */
- protected void parameterDeclaration(
- IParameterCollection collection, IASTScope scope)
- throws BacktrackException, EndOfFileException
- {
- IToken current = LA(1);
-
- DeclarationWrapper sdw =
- new DeclarationWrapper(scope, current.getOffset(), null);
- declSpecifierSeq(sdw, true, false);
- if (sdw.getTypeSpecifier() == null
- && sdw.getSimpleType()
- != IASTSimpleTypeSpecifier.Type.UNSPECIFIED)
- try
- {
- sdw.setTypeSpecifier(
- astFactory.createSimpleTypeSpecifier(
- scope,
- sdw.getSimpleType(),
- sdw.getName(),
- sdw.isShort(),
- sdw.isLong(),
- sdw.isSigned(),
- sdw.isUnsigned(), sdw.isTypeNamed(), sdw.isComplex(), sdw.isImaginary()));
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- }
- catch (Exception e)
- {
- throw backtrack;
- }
-
- if (LT(1) != IToken.tSEMI)
- initDeclarator(sdw, SimpleDeclarationStrategy.TRY_FUNCTION );
-
- if( lastToken != null )
- sdw.setEndingOffset( lastToken.getEndOffset() );
-
- if (current == LA(1))
- throw backtrack;
- collection.addParameter(sdw);
- }
- /**
- * This class represents the state and strategy for parsing declarationSpecifierSequences
- */
- private class Flags
- {
- private boolean encounteredTypename = false;
- // have we encountered a typeName yet?
- private boolean encounteredRawType = false;
- // have we encountered a raw type yet?
- private final boolean parm;
- // is this for a simpleDeclaration or parameterDeclaration?
- private final boolean constructor;
- // are we attempting the constructor strategy?
- public Flags(boolean parm, boolean c)
- {
- this.parm = parm;
- constructor = c;
- }
- /**
- * @return true if we have encountered a simple type up to this point, false otherwise
- */
- public boolean haveEncounteredRawType()
- {
- return encounteredRawType;
- }
- /**
- * @return true if we have encountered a typename up to this point, false otherwise
- */
- public boolean haveEncounteredTypename()
- {
- return encounteredTypename;
- }
- /**
- * @param b - set to true if we encounter a raw type (int, short, etc.)
- */
- public void setEncounteredRawType(boolean b)
- {
- encounteredRawType = b;
- }
- /**
- * @param b - set to true if we encounter a typename
- */
- public void setEncounteredTypename(boolean b)
- {
- encounteredTypename = b;
- }
- /**
- * @return true if we are parsing for a ParameterDeclaration
- */
- public boolean isForParameterDeclaration()
- {
- return parm;
- }
- /**
- * @return whether or not we are attempting the constructor strategy or not
- */
- public boolean isForConstructor()
- {
- return constructor;
- }
- }
- /**
- * @param flags input flags that are used to make our decision
- * @return whether or not this looks like a constructor (true or false)
- * @throws EndOfFileException we could encounter EOF while looking ahead
- */
- private boolean lookAheadForConstructorOrConversion(Flags flags, DeclarationWrapper sdw )
- throws EndOfFileException
- {
- if (flags.isForParameterDeclaration())
- return false;
- if (LT(2) == IToken.tLPAREN && flags.isForConstructor())
- return true;
-
- IToken mark = mark();
- Declarator d = new Declarator( sdw );
- try
- {
- consumeTemplatedOperatorName( d );
- }
- catch (BacktrackException e)
- {
- backup( mark );
- return false;
- }
-
- ITokenDuple duple = d.getNameDuple();
- if( duple == null )
- {
- backup( mark );
- return false;
- }
-
- int lastColon = duple.findLastTokenType(IToken.tCOLON);
- if( lastColon == -1 )
- {
- int lt1 = LT(1);
- backup( mark );
- return flags.isForConstructor() && (lt1 == IToken.tLPAREN);
- }
-
- IToken className = null;
- int index = lastColon - 1;
- if( duple.getToken( index ).getType() == IToken.tGT )
- {
- int depth = -1;
- while( depth == -1 )
- {
- if( duple.getToken( --index ).getType() == IToken.tLT )
- ++depth;
- }
- className = duple.getToken( index );
- }
-
- boolean result = className.getImage().equals( duple.getLastToken());
- backup( mark );
- return result;
- }
- /**
- * @param flags input flags that are used to make our decision
- * @return whether or not this looks like a a declarator follows
- * @throws EndOfFileException we could encounter EOF while looking ahead
- */
- private boolean lookAheadForDeclarator(Flags flags) throws EndOfFileException
- {
- return flags.haveEncounteredTypename()
- && ((LT(2) != IToken.tIDENTIFIER
- || (LT(3) != IToken.tLPAREN && LT(3) != IToken.tASSIGN))
- && !LA(2).isPointer());
- }
- private void callbackSimpleDeclToken(Flags flags) throws BacktrackException, EndOfFileException
- {
- flags.setEncounteredRawType(true);
- consume();
- }
- /**
- * This function parses a declaration specifier sequence, as according to the ANSI C++ spec.
- *
- * declSpecifier
- * : "auto" | "register" | "static" | "extern" | "mutable"
- * | "inline" | "virtual" | "explicit"
- * | "char" | "wchar_t" | "bool" | "short" | "int" | "long"
- * | "signed" | "unsigned" | "float" | "double" | "void"
- * | "const" | "volatile"
- * | "friend" | "typedef"
- * | ("typename")? name
- * | {"class"|"struct"|"union"} classSpecifier
- * | {"enum"} enumSpecifier
- *
- * Notes:
- * - folded in storageClassSpecifier, typeSpecifier, functionSpecifier
- * - folded elaboratedTypeSpecifier into classSpecifier and enumSpecifier
- * - find template names in name
- *
- * @param decl IParserCallback object representing the declaration that owns this specifier sequence
- * @param parm Is this for a parameter declaration (true) or simple declaration (false)
- * @param tryConstructor true for constructor, false for pointer to function strategy
- * @throws BacktrackException request a backtrack
- */
- protected void declSpecifierSeq(
- DeclarationWrapper sdw,
- boolean parm,
- boolean tryConstructor )
- throws BacktrackException, EndOfFileException
- {
- Flags flags = new Flags(parm, tryConstructor);
- IToken typeNameBegin = null;
- IToken typeNameEnd = null;
- declSpecifiers : for (;;)
- {
- switch (LT(1))
- {
- case IToken.t_inline :
- consume();
- sdw.setInline(true);
- break;
- case IToken.t_auto :
- consume();
- sdw.setAuto(true);
- break;
- case IToken.t_register :
- sdw.setRegister(true);
- consume();
- break;
- case IToken.t_static :
- sdw.setStatic(true);
- consume();
- break;
- case IToken.t_extern :
- sdw.setExtern(true);
- consume();
- break;
- case IToken.t_mutable :
- sdw.setMutable(true);
- consume();
- break;
- case IToken.t_virtual :
- sdw.setVirtual(true);
- consume();
- break;
- case IToken.t_explicit :
- sdw.setExplicit(true);
- consume();
- break;
- case IToken.t_typedef :
- sdw.setTypedef(true);
- consume();
- break;
- case IToken.t_friend :
- sdw.setFriend(true);
- consume();
- break;
- case IToken.t_const :
- sdw.setConst(true);
- consume();
- break;
- case IToken.t_volatile :
- sdw.setVolatile(true);
- consume();
- break;
- case IToken.t_signed :
- sdw.setSigned(true);
- if (typeNameBegin == null)
- typeNameBegin = LA(1);
- typeNameEnd = LA(1);
- callbackSimpleDeclToken(flags);
- sdw.setSimpleType(IASTSimpleTypeSpecifier.Type.INT);
- break;
- case IToken.t_unsigned :
- sdw.setUnsigned(true);
- if (typeNameBegin == null)
- typeNameBegin = LA(1);
- typeNameEnd = LA(1);
- callbackSimpleDeclToken(flags);
- sdw.setSimpleType(IASTSimpleTypeSpecifier.Type.INT);
- break;
- case IToken.t_short :
- sdw.setShort(true);
- if (typeNameBegin == null)
- typeNameBegin = LA(1);
- typeNameEnd = LA(1);
- callbackSimpleDeclToken(flags);
- sdw.setSimpleType(IASTSimpleTypeSpecifier.Type.INT);
- break;
- case IToken.t_long :
- if (typeNameBegin == null)
- typeNameBegin = LA(1);
- typeNameEnd = LA(1);
- callbackSimpleDeclToken(flags);
- sdw.setSimpleType(IASTSimpleTypeSpecifier.Type.INT);
- sdw.setLong(true);
- break;
- case IToken.t__Complex :
- consume( IToken.t__Complex );
- if (typeNameBegin == null)
- typeNameBegin = LA(1);
- typeNameEnd = LA(1);
- sdw.setComplex( true );
- break;
- case IToken.t__Imaginary :
- consume( IToken.t__Imaginary );
- if (typeNameBegin == null)
- typeNameBegin = LA(1);
- typeNameEnd = LA(1);
- sdw.setImaginary( true );
- break;
- case IToken.t_char :
- if (typeNameBegin == null)
- typeNameBegin = LA(1);
- typeNameEnd = LA(1);
- callbackSimpleDeclToken(flags);
- sdw.setSimpleType(IASTSimpleTypeSpecifier.Type.CHAR);
- break;
- case IToken.t_wchar_t :
- if (typeNameBegin == null)
- typeNameBegin = LA(1);
- typeNameEnd = LA(1);
- callbackSimpleDeclToken(flags);
- sdw.setSimpleType(
- IASTSimpleTypeSpecifier.Type.WCHAR_T);
- break;
- case IToken.t_bool :
- if (typeNameBegin == null)
- typeNameBegin = LA(1);
- typeNameEnd = LA(1);
- callbackSimpleDeclToken(flags);
- sdw.setSimpleType(IASTSimpleTypeSpecifier.Type.BOOL);
- break;
- case IToken.t__Bool:
- if (typeNameBegin == null)
- typeNameBegin = LA(1);
- typeNameEnd = LA(1);
- callbackSimpleDeclToken(flags);
- sdw.setSimpleType(IASTSimpleTypeSpecifier.Type._BOOL);
- break;
- case IToken.t_int :
- if (typeNameBegin == null)
- typeNameBegin = LA(1);
- typeNameEnd = LA(1);
- callbackSimpleDeclToken(flags);
- sdw.setSimpleType(IASTSimpleTypeSpecifier.Type.INT);
- break;
- case IToken.t_float :
- if (typeNameBegin == null)
- typeNameBegin = LA(1);
- typeNameEnd = LA(1);
- callbackSimpleDeclToken(flags);
- sdw.setSimpleType(IASTSimpleTypeSpecifier.Type.FLOAT);
- break;
- case IToken.t_double :
- if (typeNameBegin == null)
- typeNameBegin = LA(1);
- typeNameEnd = LA(1);
- callbackSimpleDeclToken(flags);
- sdw.setSimpleType(
- IASTSimpleTypeSpecifier.Type.DOUBLE);
- break;
- case IToken.t_void :
- if (typeNameBegin == null)
- typeNameBegin = LA(1);
- typeNameEnd = LA(1);
- callbackSimpleDeclToken(flags);
- sdw.setSimpleType(IASTSimpleTypeSpecifier.Type.VOID);
- break;
- case IToken.t_typename :
- sdw.setTypenamed(true);
- consume(IToken.t_typename );
- IToken first = LA(1);
- IToken last = null;
- last = name().getLastToken();
- if (LT(1) == IToken.t_template)
- {
- consume(IToken.t_template);
- last = templateId();
- }
- ITokenDuple duple = new TokenDuple(first, last);
- sdw.setTypeName(duple);
-
- break;
- case IToken.tCOLONCOLON :
- consume(IToken.tCOLONCOLON);
- case IToken.tIDENTIFIER :
- // TODO - Kludgy way to handle constructors/destructors
- if (flags.haveEncounteredRawType())
- {
- if (typeNameBegin != null)
- sdw.setTypeName(
- new TokenDuple(typeNameBegin, typeNameEnd));
- return;
- }
- if (parm && flags.haveEncounteredTypename())
- {
- if (typeNameBegin != null)
- sdw.setTypeName(
- new TokenDuple(typeNameBegin, typeNameEnd));
- return;
- }
- if (lookAheadForConstructorOrConversion(flags, sdw))
- {
- if (typeNameBegin != null)
- sdw.setTypeName(
- new TokenDuple(typeNameBegin, typeNameEnd));
- return;
- }
- if (lookAheadForDeclarator(flags))
- {
- if (typeNameBegin != null)
- sdw.setTypeName(
- new TokenDuple(typeNameBegin, typeNameEnd));
-
- return;
- }
-
- ITokenDuple d = name();
- sdw.setTypeName(d);
- sdw.setSimpleType( IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME );
- flags.setEncounteredTypename(true);
- break;
- case IToken.t_class :
- case IToken.t_struct :
- case IToken.t_union :
- try
- {
- classSpecifier(sdw);
- flags.setEncounteredTypename(true);
- break;
- }
- catch (BacktrackException bt)
- {
- elaboratedTypeSpecifier(sdw);
- flags.setEncounteredTypename(true);
- break;
- }
- case IToken.t_enum :
- try
- {
- enumSpecifier(sdw);
- flags.setEncounteredTypename(true);
- break;
- }
- catch (BacktrackException bt)
- {
- // this is an elaborated class specifier
- elaboratedTypeSpecifier(sdw);
- flags.setEncounteredTypename(true);
- break;
- }
- default :
- break declSpecifiers;
- }
- }
- if (typeNameBegin != null)
- sdw.setTypeName(new TokenDuple(typeNameBegin, typeNameEnd));
- }
- /**
- * Parse an elaborated type specifier.
- *
- * @param decl Declaration which owns the elaborated type
- * @throws BacktrackException request a backtrack
- */
- protected void elaboratedTypeSpecifier(DeclarationWrapper sdw)
- throws BacktrackException, EndOfFileException
- {
- // this is an elaborated class specifier
- IToken t = consume();
- ASTClassKind eck = null;
- switch (t.getType())
- {
- case Token.t_class :
- eck = ASTClassKind.CLASS;
- break;
- case Token.t_struct :
- eck = ASTClassKind.STRUCT;
- break;
- case Token.t_union :
- eck = ASTClassKind.UNION;
- break;
- case Token.t_enum :
- eck = ASTClassKind.ENUM;
- break;
- default :
- break;
- }
-
- ITokenDuple d = name();
- IASTTypeSpecifier elaboratedTypeSpec = null;
- final boolean isForewardDecl = ( LT(1) == IToken.tSEMI );
-
- try
- {
- elaboratedTypeSpec =
- astFactory.createElaboratedTypeSpecifier(
- sdw.getScope(),
- eck,
- d,
- t.getOffset(),
- d.getLastToken().getEndOffset(),
- isForewardDecl, sdw.isFriend() );
- }
- catch (ASTSemanticException e)
- {
- failParse();
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- sdw.setTypeSpecifier(elaboratedTypeSpec);
-
- if( isForewardDecl )
- ((IASTElaboratedTypeSpecifier)elaboratedTypeSpec).acceptElement( requestor );
- }
- /**
- * Consumes template parameters.
- *
- * @param previousLast Previous "last" token (returned if nothing was consumed)
- * @return Last consumed token, or <code>previousLast</code> if nothing was consumed
- * @throws BacktrackException request a backtrack
- */
- protected IToken consumeTemplateParameters(IToken previousLast)
- throws EndOfFileException, BacktrackException
- {
- IToken last = previousLast;
- if (LT(1) == IToken.tLT)
- {
- last = consume(IToken.tLT);
- // until we get all the names sorted out
- Stack scopes = new Stack();
- scopes.push(new Integer(IToken.tLT));
-
- while (!scopes.empty())
- {
- int top;
- last = consume();
-
- switch (last.getType()) {
- case IToken.tGT :
- if (((Integer)scopes.peek()).intValue() == IToken.tLT) {
- scopes.pop();
- }
- break;
- case IToken.tRBRACKET :
- do {
- top = ((Integer)scopes.pop()).intValue();
- } while (!scopes.empty() && (top == IToken.tGT || top == IToken.tLT));
- if (top != IToken.tLBRACKET) throw backtrack;
-
- break;
- case IToken.tRPAREN :
- do {
- top = ((Integer)scopes.pop()).intValue();
- } while (!scopes.empty() && (top == IToken.tGT || top == IToken.tLT));
- if (top != IToken.tLPAREN) throw backtrack;
-
- break;
- case IToken.tLT :
- case IToken.tLBRACKET:
- case IToken.tLPAREN:
- scopes.push(new Integer(last.getType()));
- break;
- }
- }
- }
- return last;
- }
- /**
- * Parse an identifier.
- *
- * @throws BacktrackException request a backtrack
- */
- protected IToken identifier() throws EndOfFileException, BacktrackException
- {
- IToken first = consume(IToken.tIDENTIFIER); // throws backtrack if its not that
- return first;
- }
- /**
- * Parses a className.
- *
- * class-name: identifier | template-id
- *
- * @throws BacktrackException
- */
- protected ITokenDuple className() throws EndOfFileException, BacktrackException
- {
- ITokenDuple duple = name();
- IToken last = duple.getLastToken();
- if (LT(1) == IToken.tLT) {
- last = consumeTemplateParameters(duple.getLastToken());
- }
-
- return new TokenDuple(duple.getFirstToken(), last);
- }
-
- /**
- * Parse a template-id, according to the ANSI C++ spec.
- *
- * template-id: template-name < template-argument-list opt >
- * template-name : identifier
- *
- * @return the last token that we consumed in a successful parse
- *
- * @throws BacktrackException request a backtrack
- */
- protected IToken templateId() throws EndOfFileException, BacktrackException
- {
- ITokenDuple duple = name();
- IToken last = consumeTemplateParameters(duple.getLastToken());
- return last;
- }
- /**
- * Parse a name.
- *
- * name
- * : ("::")? name2 ("::" name2)*
- *
- * name2
- * : IDENTIFER
- *
- * @throws BacktrackException request a backtrack
- */
- protected TokenDuple name() throws BacktrackException, EndOfFileException
- {
- IToken first = LA(1);
- IToken last = null;
- IToken mark = mark();
-
- try
- {
- if (LT(1) == IToken.tCOLONCOLON)
- last = consume( IToken.tCOLONCOLON );
- // TODO - whacky way to deal with destructors, please revisit
- if (LT(1) == IToken.tCOMPL)
- consume();
- switch (LT(1))
- {
- case IToken.tIDENTIFIER :
- last = consume(IToken.tIDENTIFIER);
- IToken secondMark = null;
- try
- {
- secondMark = mark();
- }
- catch( OffsetLimitReachedException olre )
- {
- return new TokenDuple(last, last);
- }
- try
- {
- last = consumeTemplateParameters(last);
- } catch( BacktrackException bt )
- {
- backup( secondMark );
- }
- break;
- default :
- backup(mark);
- throw backtrack;
- }
- while (LT(1) == IToken.tCOLONCOLON)
- {
- last = consume();
- if (LT(1) == IToken.t_template)
- consume();
- if (LT(1) == IToken.tCOMPL)
- consume();
- switch (LT(1))
- {
- case IToken.t_operator :
- backup(mark);
- throw backtrack;
- case IToken.tIDENTIFIER :
- last = consume();
- last = consumeTemplateParameters(last);
- }
- }
-
- return new TokenDuple(first, last);
- } catch( OffsetLimitReachedException olre )
- {
- backup(mark);
- throw backtrack;
- }
- }
- /**
- * Parse a const-volatile qualifier.
- *
- * cvQualifier
- * : "const" | "volatile"
- *
- * TODO: fix this
- * @param ptrOp Pointer Operator that const-volatile applies to.
- * @return Returns the same object sent in.
- * @throws BacktrackException
- */
- protected IToken cvQualifier(
- IDeclarator declarator)
- throws EndOfFileException, BacktrackException
- {
- IToken result = null;
- switch (LT(1))
- {
- case IToken.t_const :
- result = consume( IToken.t_const );
- declarator.addPointerOperator(ASTPointerOperator.CONST_POINTER);
- break;
- case IToken.t_volatile :
- result = consume( IToken.t_volatile );
- declarator.addPointerOperator(ASTPointerOperator.VOLATILE_POINTER);
- break;
- case IToken.t_restrict :
- if( language == ParserLanguage.C )
- {
- result = consume( IToken.t_restrict );
- declarator.addPointerOperator(ASTPointerOperator.RESTRICT_POINTER);
- break;
- }
- else
- throw backtrack;
- default :
-
- }
- return result;
- }
- /**
- * Parses the initDeclarator construct of the ANSI C++ spec.
- *
- * initDeclarator
- * : declarator ("=" initializerClause | "(" expressionList ")")?
- * @param owner IParserCallback object that represents the owner declaration object.
- * @return declarator that this parsing produced.
- * @throws BacktrackException request a backtrack
- */
- protected Declarator initDeclarator(
- DeclarationWrapper sdw, SimpleDeclarationStrategy strategy )
- throws EndOfFileException, BacktrackException
- {
- Declarator d = declarator(sdw, sdw.getScope(), strategy );
- if( language == ParserLanguage.CPP )
- optionalCPPInitializer(d);
- else if( language == ParserLanguage.C )
- optionalCInitializer(d);
- sdw.addDeclarator(d);
- return d;
- }
-
- protected void optionalCPPInitializer(Declarator d)
- throws EndOfFileException, BacktrackException
- {
- // handle initializer
- if (LT(1) == IToken.tASSIGN)
- {
- consume(IToken.tASSIGN);
- d.setInitializerClause(initializerClause(d.getDeclarationWrapper().getScope()));
- }
- else if (LT(1) == IToken.tLPAREN )
- {
- IToken mark = mark();
- // initializer in constructor
- try
- {
- consume(IToken.tLPAREN); // EAT IT!
- IASTExpression astExpression = null;
- astExpression = expression(d.getDeclarationWrapper().getScope());
- consume(IToken.tRPAREN);
- d.setConstructorExpression(astExpression);
- } catch( BacktrackException bt )
- {
- backup( mark );
- throw bt;
- }
- }
- }
-
- protected void optionalCInitializer( Declarator d ) throws EndOfFileException, BacktrackException
- {
- if( LT(1) == IToken.tASSIGN )
- {
- consume( IToken.tASSIGN );
- d.setInitializerClause( cInitializerClause(d.getDeclarationWrapper().getScope(), EMPTY_LIST ) );
- }
- }
- /**
- * @param scope
- * @return
- */
- protected IASTInitializerClause cInitializerClause(
- IASTScope scope,
- List designators)
- throws EndOfFileException, BacktrackException
- {
- if (LT(1) == IToken.tLBRACE)
- {
- consume(IToken.tLBRACE);
- List initializerList = new ArrayList();
- for (;;)
- {
- // required at least one initializer list
- // get designator list
- List newDesignators = designatorList(scope);
- if( newDesignators.size() != 0 )
- consume( IToken.tASSIGN );
- IASTInitializerClause initializer =
- cInitializerClause(scope, newDesignators );
- initializerList.add(initializer);
- // can end with just a '}'
- if (LT(1) == IToken.tRBRACE)
- break;
- // can end with ", }"
- if (LT(1) == IToken.tCOMMA)
- consume(IToken.tCOMMA);
- if (LT(1) == IToken.tRBRACE)
- break;
- // otherwise, its another initializer in the list
- }
- // consume the closing brace
- consume(IToken.tRBRACE);
- return astFactory.createInitializerClause(
- scope,
- (
- ( designators.size() == 0 ) ?
- IASTInitializerClause.Kind.INITIALIZER_LIST :
- IASTInitializerClause.Kind.DESIGNATED_INITIALIZER_LIST ),
- null, initializerList, designators );
- }
- // if we get this far, it means that we have not yet succeeded
- // try this now instead
- // assignmentExpression
- try
- {
- IASTExpression assignmentExpression = assignmentExpression(scope);
- try
- {
- return astFactory.createInitializerClause(
- scope,
- (
- ( designators.size() == 0 ) ?
- IASTInitializerClause.Kind.ASSIGNMENT_EXPRESSION :
- IASTInitializerClause.Kind.DESIGNATED_ASSIGNMENT_EXPRESSION ),
- assignmentExpression, null, designators );
- }
- catch (Exception e)
- {
- throw backtrack;
- }
- }
- catch (BacktrackException b)
- {
- // do nothing
- }
- throw backtrack;
- }
- /**
- *
- */
- protected IASTInitializerClause initializerClause(IASTScope scope)
- throws EndOfFileException, BacktrackException
- {
- if (LT(1) == IToken.tLBRACE)
- {
- consume(IToken.tLBRACE);
- if (LT(1) == (IToken.tRBRACE))
- {
- consume(IToken.tRBRACE);
- try
- {
- return astFactory.createInitializerClause(
- scope,
- IASTInitializerClause.Kind.EMPTY,
- null, null, EMPTY_LIST );
- }
- catch (Exception e)
- {
- throw backtrack;
- }
- }
-
- // otherwise it is a list of initializer clauses
- List initializerClauses = new ArrayList();
- for (;;)
- {
- IASTInitializerClause clause = initializerClause(scope);
- initializerClauses.add(clause);
- if (LT(1) == IToken.tRBRACE)
- break;
- consume(IToken.tCOMMA);
- }
- consume(IToken.tRBRACE);
- try
- {
- return astFactory.createInitializerClause(
- scope,
- IASTInitializerClause.Kind.INITIALIZER_LIST,
- null, initializerClauses, EMPTY_LIST );
- }
- catch (Exception e)
- {
- throw backtrack;
- }
- }
-
- // if we get this far, it means that we did not
- // try this now instead
- // assignmentExpression
- try
- {
- IASTExpression assignmentExpression =
- assignmentExpression(scope);
-
- try
- {
- return astFactory.createInitializerClause(
- scope,
- IASTInitializerClause.Kind.ASSIGNMENT_EXPRESSION,
- assignmentExpression, null, EMPTY_LIST );
- }
- catch (Exception e)
- {
- throw backtrack;
- }
- }
- catch (BacktrackException b)
- {
- // do nothing
- }
- catch ( EndOfFileException eof )
- {
-
- }
- throw backtrack;
- }
-
- protected List designatorList(IASTScope scope) throws EndOfFileException, BacktrackException
- {
- List designatorList = new ArrayList();
- // designated initializers for C
-
- if( LT(1) == IToken.tDOT || LT(1) == IToken.tLBRACKET )
- {
-
- while( LT(1) == IToken.tDOT || LT(1) == IToken.tLBRACKET )
- {
- IToken id = null;
- IASTExpression constantExpression = null;
- IASTDesignator.DesignatorKind kind = null;
-
- if( LT(1) == IToken.tDOT )
- {
- consume( IToken.tDOT );
- id = identifier();
- kind = IASTDesignator.DesignatorKind.FIELD;
- }
- else if( LT(1) == IToken.tLBRACKET )
- {
- consume( IToken.tLBRACKET );
- constantExpression = expression( scope );
- consume( IToken.tRBRACKET );
- kind = IASTDesignator.DesignatorKind.SUBSCRIPT;
- }
-
- IASTDesignator d =
- astFactory.createDesignator( kind, constantExpression, id );
- designatorList.add( d );
-
- }
- }
- return designatorList;
- }
- /**
- * Parse a declarator, as according to the ANSI C++ specification.
- *
- * declarator
- * : (ptrOperator)* directDeclarator
- *
- * directDeclarator
- * : declaratorId
- * | directDeclarator "(" parameterDeclarationClause ")" (cvQualifier)*
- * (exceptionSpecification)*
- * | directDeclarator "[" (constantExpression)? "]"
- * | "(" declarator")"
- * | directDeclarator "(" parameterDeclarationClause ")" (oldKRParameterDeclaration)*
- *
- * declaratorId
- * : name
- *
- * @param container IParserCallback object that represents the owner declaration.
- * @return declarator that this parsing produced.
- * @throws BacktrackException request a backtrack
- */
- protected Declarator declarator(
- IDeclaratorOwner owner, IASTScope scope, SimpleDeclarationStrategy strategy )
- throws EndOfFileException, BacktrackException
- {
- Declarator d = null;
- DeclarationWrapper sdw = owner.getDeclarationWrapper();
- overallLoop : do
- {
- d = new Declarator(owner);
-
- consumePointerOperators(d);
-
- if (LT(1) == IToken.tLPAREN)
- {
- consume();
- declarator(d, scope, strategy );
- consume(IToken.tRPAREN);
- }
- else
- consumeTemplatedOperatorName(d);
-
- for (;;)
- {
- switch (LT(1))
- {
- case IToken.tLPAREN :
-
- // temporary fix for initializer/function declaration ambiguity
- if (!LA(2).looksLikeExpression() && strategy != SimpleDeclarationStrategy.TRY_VARIABLE )
- {
- boolean failed = false;
- if( LT(2) == IToken.tIDENTIFIER )
- {
- IToken newMark = mark();
- consume( IToken.tLPAREN );
-
- try
- {
- try
- {
- if( ! astFactory.queryIsTypeName( scope, name() ) )
- failed = true;
- }
- catch (Exception e)
- {
- throw backtrack;
- }
- } catch( BacktrackException b )
- {
- failed = true;
- }
-
- backup( newMark );
- }
- if( !failed )
- {
- // parameterDeclarationClause
- d.setIsFunction(true);
- // TODO need to create a temporary scope object here
- consume(IToken.tLPAREN);
- boolean seenParameter = false;
- parameterDeclarationLoop : for (;;)
- {
- switch (LT(1))
- {
- case IToken.tRPAREN :
- consume();
- break parameterDeclarationLoop;
- case IToken.tELLIPSIS :
- consume();
- d.setIsVarArgs( true );
- break;
- case IToken.tCOMMA :
- consume();
- seenParameter = false;
- break;
- default :
- if (seenParameter)
- throw backtrack;
- parameterDeclaration(d, scope);
- seenParameter = true;
- }
- }
- }
-
- if (LT(1) == IToken.tCOLON || LT(1) == IToken.t_try )
- break overallLoop;
-
- IToken beforeCVModifier = mark();
- IToken cvModifier = null;
- IToken afterCVModifier = beforeCVModifier;
- // const-volatile
- // 2 options: either this is a marker for the method,
- // or it might be the beginning of old K&R style parameter declaration, see
- // void getenv(name) const char * name; {}
- // This will be determined further below
- if (LT(1) == IToken.t_const
- || LT(1) == IToken.t_volatile)
- {
- cvModifier = consume();
- afterCVModifier = mark();
- }
- //check for throws clause here
- List exceptionSpecIds = null;
- if (LT(1) == IToken.t_throw)
- {
- exceptionSpecIds = new ArrayList();
- consume(); // throw
- consume(IToken.tLPAREN); // (
- boolean done = false;
- IASTTypeId duple = null;
- while (!done)
- {
- switch (LT(1))
- {
- case IToken.tRPAREN :
- consume();
- done = true;
- break;
- case IToken.tCOMMA :
- consume();
- break;
- default :
- String image = LA(1).getImage();
- try
- {
- duple = typeId(scope, false);
- exceptionSpecIds.add(duple);
- }
- catch (BacktrackException e)
- {
- failParse();
- log.traceLog(
- "Unexpected Token ="
- + image );
- consume();
- // eat this token anyway
- continue;
- }
- break;
- }
- }
- if (exceptionSpecIds != null)
- try
- {
- d.setExceptionSpecification(
- astFactory
- .createExceptionSpecification(
- d.getDeclarationWrapper().getScope(), exceptionSpecIds));
- }
- catch (ASTSemanticException e)
- {
- failParse();
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- // check for optional pure virtual
- if (LT(1) == IToken.tASSIGN
- && LT(2) == IToken.tINTEGER
- && LA(2).getImage().equals("0"))
- {
- consume(IToken.tASSIGN);
- consume(IToken.tINTEGER);
- d.setPureVirtual(true);
- }
- if (afterCVModifier != LA(1)
- || LT(1) == IToken.tSEMI)
- {
- // There were C++-specific clauses after const/volatile modifier
- // Then it is a marker for the method
- if (cvModifier != null)
- {
-
- if (cvModifier.getType() == IToken.t_const)
- d.setConst(true);
- if (cvModifier.getType()
- == IToken.t_volatile)
- d.setVolatile(true);
- }
- afterCVModifier = mark();
- // In this case (method) we can't expect K&R parameter declarations,
- // but we'll check anyway, for errorhandling
- }
- }
- break;
- case IToken.tLBRACKET :
- consumeArrayModifiers(d, sdw.getScope());
- continue;
- case IToken.tCOLON :
- consume(IToken.tCOLON);
- IASTExpression exp = null;
- exp = constantExpression(scope);
- d.setBitFieldExpression(exp);
- default :
- break;
- }
- break;
- }
- if (LA(1).getType() != IToken.tIDENTIFIER)
- break;
-
- }
- while (true);
- if (d.getOwner() instanceof IDeclarator)
- ((Declarator)d.getOwner()).setOwnedDeclarator(d);
- return d;
- }
- protected void consumeTemplatedOperatorName(Declarator d)
- throws EndOfFileException, BacktrackException
- {
- if (LT(1) == IToken.t_operator)
- operatorId(d, null);
- else
- {
- try
- {
- ITokenDuple duple = name();
- d.setName(duple);
-
- }
- catch (BacktrackException bt)
- {
- Declarator d1 = d;
- Declarator d11 = d1;
- IToken start = null;
- IToken mark = mark();
- if (LT(1) == IToken.tCOLONCOLON
- || LT(1) == IToken.tIDENTIFIER)
- {
- start = consume();
- IToken end = null;
- if (start.getType() == IToken.tIDENTIFIER)
- end = consumeTemplateParameters(end);
- while (LT(1) == IToken.tCOLONCOLON
- || LT(1) == IToken.tIDENTIFIER)
- {
- end = consume();
- if (end.getType() == IToken.tIDENTIFIER)
- end = consumeTemplateParameters(end);
- }
- if (LT(1) == IToken.t_operator)
- operatorId(d11, start);
- else
- {
- backup(mark);
- throw backtrack;
- }
- }
- }
- }
- }
- protected void consumeArrayModifiers( IDeclarator d, IASTScope scope )
- throws EndOfFileException, BacktrackException
- {
- while (LT(1) == IToken.tLBRACKET)
- {
- consume( IToken.tLBRACKET ); // eat the '['
-
- IASTExpression exp = null;
- if (LT(1) != IToken.tRBRACKET)
- {
- exp = constantExpression(scope);
- }
- consume(IToken.tRBRACKET);
- IASTArrayModifier arrayMod;
- try
- {
- arrayMod = astFactory.createArrayModifier(exp);
- }
- catch (Exception e)
- {
- throw backtrack;
- }
- d.addArrayModifier(arrayMod);
- }
- }
-
- protected void operatorId(
- Declarator d,
- IToken originalToken)
- throws BacktrackException, EndOfFileException
- {
- // we know this is an operator
- IToken operatorToken = consume(IToken.t_operator);
- IToken toSend = null;
- if (LA(1).isOperator()
- || LT(1) == IToken.tLPAREN
- || LT(1) == IToken.tLBRACKET)
- {
- if ((LT(1) == IToken.t_new || LT(1) == IToken.t_delete)
- && LT(2) == IToken.tLBRACKET
- && LT(3) == IToken.tRBRACKET)
- {
- consume();
- consume(IToken.tLBRACKET);
- toSend = consume(IToken.tRBRACKET);
- // vector new and delete operators
- }
- else if (LT(1) == IToken.tLPAREN && LT(2) == IToken.tRPAREN)
- {
- // operator ()
- consume(IToken.tLPAREN);
- toSend = consume(IToken.tRPAREN);
- }
- else if (LT(1) == IToken.tLBRACKET && LT(2) == IToken.tRBRACKET)
- {
- consume(IToken.tLBRACKET);
- toSend = consume(IToken.tRBRACKET);
- }
- else if (LA(1).isOperator())
- toSend = consume();
- else
- throw backtrack;
- }
- else
- {
- // must be a conversion function
- typeId(d.getDeclarationWrapper().getScope(), true );
- toSend = lastToken;
- }
- ITokenDuple duple =
- new TokenDuple(
- originalToken == null ? operatorToken : originalToken,
- toSend);
-
- d.setName(duple);
- }
- /**
- * Parse a Pointer Operator.
- *
- * ptrOperator
- * : "*" (cvQualifier)*
- * | "&"
- * | ::? nestedNameSpecifier "*" (cvQualifier)*
- *
- * @param owner Declarator that this pointer operator corresponds to.
- * @throws BacktrackException request a backtrack
- */
- protected IToken consumePointerOperators(IDeclarator d) throws EndOfFileException, BacktrackException
- {
- IToken result = null;
- for( ; ; )
- {
- if (LT(1) == IToken.tAMPER)
- {
- result = consume( IToken.tAMPER );
- d.addPointerOperator(ASTPointerOperator.REFERENCE);
- return result;
-
- }
- IToken mark = mark();
-
- ITokenDuple nameDuple = null;
- if (LT(1) == IToken.tIDENTIFIER || LT(1) == IToken.tCOLONCOLON)
- {
- try
- {
- nameDuple = name();
- }
- catch( BacktrackException bt )
- {
- backup( mark );
- return null;
- }
- }
- if ( LT(1) == IToken.tSTAR)
- {
- result = consume(Token.tSTAR); // tokenType = "*"
-
- d.setPointerOperatorName(nameDuple);
-
- IToken successful = null;
- for (;;)
- {
- IToken newSuccess = cvQualifier(d);
- if( newSuccess != null ) successful = newSuccess;
- else break;
-
- }
-
- if( successful == null )
- {
- d.addPointerOperator( ASTPointerOperator.POINTER );
- }
- continue;
- }
- backup(mark);
- return result;
- }
- }
- /**
- * Parse an enumeration specifier, as according to the ANSI specs in C & C++.
- *
- * enumSpecifier:
- * "enum" (name)? "{" (enumerator-list) "}"
- * enumerator-list:
- * enumerator-definition
- * enumerator-list , enumerator-definition
- * enumerator-definition:
- * enumerator
- * enumerator = constant-expression
- * enumerator: identifier
- *
- * @param owner IParserCallback object that represents the declaration that owns this type specifier.
- * @throws BacktrackException request a backtrack
- */
- protected void enumSpecifier(DeclarationWrapper sdw)
- throws BacktrackException, EndOfFileException
- {
- IToken mark = mark();
- IToken identifier = null;
- consume( IToken.t_enum );
- if (LT(1) == IToken.tIDENTIFIER)
- {
- identifier = identifier();
- }
- if (LT(1) == IToken.tLBRACE)
- {
- IASTEnumerationSpecifier enumeration = null;
- try
- {
- enumeration = astFactory.createEnumerationSpecifier(
- sdw.getScope(),
- ((identifier == null) ? "" : identifier.getImage()),
- mark.getOffset(),
- ((identifier == null)
- ? mark.getOffset()
- : identifier.getOffset()),
- ((identifier == null)? mark.getEndOffset()
- : identifier.getEndOffset()));
- }
- catch (ASTSemanticException e)
- {
- failParse();
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- consume(IToken.tLBRACE);
- while (LT(1) != IToken.tRBRACE)
- {
- IToken enumeratorIdentifier = null;
- if (LT(1) == IToken.tIDENTIFIER)
- {
- enumeratorIdentifier = identifier();
- }
- else
- {
- throw backtrack;
- }
- IASTExpression initialValue = null;
- if (LT(1) == IToken.tASSIGN)
- {
- consume(IToken.tASSIGN);
- initialValue = constantExpression(sdw.getScope());
- }
-
- if (LT(1) == IToken.tRBRACE)
- {
- try
- {
- astFactory.addEnumerator(
- enumeration,
- enumeratorIdentifier.getImage(),
- enumeratorIdentifier.getOffset(),
- enumeratorIdentifier.getOffset(),
- enumeratorIdentifier.getEndOffset(), enumeratorIdentifier.getEndOffset(), initialValue);
- }
- catch (ASTSemanticException e1)
- {
- failParse();
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- break;
- }
- if (LT(1) != IToken.tCOMMA)
- {
- throw backtrack;
- }
- try
- {
- astFactory.addEnumerator(
- enumeration,
- enumeratorIdentifier.getImage(),
- enumeratorIdentifier.getOffset(),
- enumeratorIdentifier.getOffset(),
- enumeratorIdentifier.getEndOffset(), enumeratorIdentifier.getEndOffset(), initialValue);
- }
- catch (ASTSemanticException e1)
- {
- failParse();
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- consume(IToken.tCOMMA);
- }
- IToken t = consume(IToken.tRBRACE);
- enumeration.setEndingOffset(t.getEndOffset());
- enumeration.acceptElement( requestor );
- sdw.setTypeSpecifier(enumeration);
- }
- else
- {
- // enumSpecifierAbort
- backup(mark);
- throw backtrack;
- }
- }
- /**
- * Parse a class/struct/union definition.
- *
- * classSpecifier
- * : classKey name (baseClause)? "{" (memberSpecification)* "}"
- *
- * @param owner IParserCallback object that represents the declaration that owns this classSpecifier
- * @throws BacktrackException request a backtrack
- */
- protected void classSpecifier(DeclarationWrapper sdw)
- throws BacktrackException, EndOfFileException
- {
- ClassNameType nameType = ClassNameType.IDENTIFIER;
- ASTClassKind classKind = null;
- ASTAccessVisibility access = ASTAccessVisibility.PUBLIC;
- IToken classKey = null;
- IToken mark = mark();
-
- // class key
- switch (LT(1))
- {
- case IToken.t_class :
- classKey = consume();
- classKind = ASTClassKind.CLASS;
- access = ASTAccessVisibility.PRIVATE;
- break;
- case IToken.t_struct :
- classKey = consume();
- classKind = ASTClassKind.STRUCT;
- break;
- case IToken.t_union :
- classKey = consume();
- classKind = ASTClassKind.UNION;
- break;
- default :
- throw backtrack;
- }
-
-
- ITokenDuple duple = null;
-
- setCompletionKind( CompletionKind.USER_SPECIFIED_NAME );
- setCompletionKeywords( Key.EMPTY );
- // class name
- if (LT(1) == IToken.tIDENTIFIER)
- duple = className();
- if (duple != null && !duple.isIdentifier())
- nameType = ClassNameType.TEMPLATE;
- if (LT(1) != IToken.tCOLON && LT(1) != IToken.tLBRACE)
- {
- backup(mark);
- throw backtrack;
- }
- IASTClassSpecifier astClassSpecifier = null;
-
- try
- {
- astClassSpecifier =
- astFactory
- .createClassSpecifier(
- sdw.getScope(),
- duple,
- classKind,
- nameType,
- access,
- classKey.getOffset(),
- duple == null ? classKey.getOffset() : duple.getFirstToken().getOffset(),
- duple == null ? classKey.getEndOffset() : duple.getFirstToken().getEndOffset() );
- }
- catch (ASTSemanticException e)
- {
- failParse();
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- sdw.setTypeSpecifier(astClassSpecifier);
- // base clause
- if (LT(1) == IToken.tCOLON)
- {
- baseSpecifier(astClassSpecifier);
- }
- if (LT(1) == IToken.tLBRACE)
- {
- consume(IToken.tLBRACE);
- astClassSpecifier.enterScope( requestor );
- memberDeclarationLoop : while (LT(1) != IToken.tRBRACE)
- {
- IToken checkToken = LA(1);
- switch (LT(1))
- {
- case IToken.t_public :
- consume();
- consume(IToken.tCOLON);
- astClassSpecifier.setCurrentVisibility( ASTAccessVisibility.PUBLIC );
- break;
- case IToken.t_protected :
- consume();
- consume(IToken.tCOLON);
- astClassSpecifier.setCurrentVisibility( ASTAccessVisibility.PROTECTED);
- break;
-
- case IToken.t_private :
- consume();
- consume(IToken.tCOLON);
- astClassSpecifier.setCurrentVisibility( ASTAccessVisibility.PRIVATE);
- break;
- case IToken.tRBRACE :
- consume(IToken.tRBRACE);
- break memberDeclarationLoop;
- default :
- try
- {
- declaration(astClassSpecifier, null);
- }
- catch (BacktrackException bt)
- {
- failParse();
- if (checkToken == LA(1))
- errorHandling();
- }
- }
- if (checkToken == LA(1))
- errorHandling();
- }
- // consume the }
- IToken lt = consume(IToken.tRBRACE);
- astClassSpecifier.setEndingOffset(lt.getEndOffset());
-
- try
- {
- astFactory.signalEndOfClassSpecifier( astClassSpecifier );
- }
- catch (Exception e1)
- {
- throw backtrack;
- }
-
- astClassSpecifier.exitScope( requestor );
-
- }
- }
- /**
- * Parse the subclass-baseclauses for a class specification.
- *
- * baseclause: : basespecifierlist
- * basespecifierlist: basespecifier
- * basespecifierlist, basespecifier
- * basespecifier: ::? nestednamespecifier? classname
- * virtual accessspecifier? ::? nestednamespecifier? classname
- * accessspecifier virtual? ::? nestednamespecifier? classname
- * accessspecifier: private | protected | public
- * @param classSpecOwner
- * @throws BacktrackException
- */
- protected void baseSpecifier(
- IASTClassSpecifier astClassSpec)
- throws EndOfFileException, BacktrackException
- {
- consume(IToken.tCOLON);
- boolean isVirtual = false;
- ASTAccessVisibility visibility = ASTAccessVisibility.PUBLIC;
- ITokenDuple nameDuple = null;
- baseSpecifierLoop : for (;;)
- {
- switch (LT(1))
- {
- case IToken.t_virtual :
- consume(IToken.t_virtual);
- isVirtual = true;
- break;
- case IToken.t_public :
- consume();
- break;
- case IToken.t_protected :
- consume();
- visibility = ASTAccessVisibility.PROTECTED;
- break;
- case IToken.t_private :
- visibility = ASTAccessVisibility.PRIVATE;
- consume();
- break;
- case IToken.tCOLONCOLON :
- case IToken.tIDENTIFIER :
- nameDuple = name();
- break;
- case IToken.tCOMMA :
- try
- {
- astFactory.addBaseSpecifier(
- astClassSpec,
- isVirtual,
- visibility,
- nameDuple );
- }
- catch (ASTSemanticException e)
- {
- failParse();
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- isVirtual = false;
- visibility = ASTAccessVisibility.PUBLIC;
- nameDuple = null;
- consume();
- continue baseSpecifierLoop;
- default :
- break baseSpecifierLoop;
- }
- }
-
- try
- {
- astFactory.addBaseSpecifier(
- astClassSpec,
- isVirtual,
- visibility,
- nameDuple );
- }
- catch (ASTSemanticException e)
- {
- failParse();
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- /**
- * Parses a function body.
- *
- * @throws BacktrackException request a backtrack
- */
- protected void functionBody( IASTScope scope ) throws EndOfFileException, BacktrackException
- {
- compoundStatement( scope, false );
- }
- /**
- * Parses a statement.
- *
- * @throws BacktrackException request a backtrack
- */
- protected void statement(IASTScope scope) throws EndOfFileException, BacktrackException
- {
- setCurrentScope(scope);
-
- setCompletionKind( CompletionKind.STATEMENT_START );
- setCompletionKeywords( Key.STATEMENT );
-
- switch (LT(1))
- {
- case IToken.t_case :
- consume(IToken.t_case);
- IASTExpression constant_expression = constantExpression(scope);
- constant_expression.acceptElement(requestor);
- consume(IToken.tCOLON);
- statement(scope);
- return;
- case IToken.t_default :
- consume(IToken.t_default);
- consume(IToken.tCOLON);
- statement(scope);
- return;
- case IToken.tLBRACE :
- compoundStatement(scope, true);
- return;
- case IToken.t_if :
- consume( IToken.t_if );
- consume(IToken.tLPAREN);
- condition( scope );
- consume(IToken.tRPAREN);
- if( LT(1) != IToken.tLBRACE )
- singleStatementScope(scope);
- else
- statement( scope );
- if (LT(1) == IToken.t_else)
- {
- consume( IToken.t_else );
- if( LT(1) != IToken.tLBRACE )
- singleStatementScope(scope);
- else
- statement( scope );
- }
- return;
- case IToken.t_switch :
- consume();
- consume(IToken.tLPAREN);
- condition(scope);
- consume(IToken.tRPAREN);
- statement(scope);
- return;
- case IToken.t_while :
- consume(IToken.t_while);
- consume(IToken.tLPAREN);
- condition(scope);
- consume(IToken.tRPAREN);
- if( LT(1) != IToken.tLBRACE )
- singleStatementScope(scope);
- else
- statement(scope);
- return;
- case IToken.t_do :
- consume(IToken.t_do);
- if( LT(1) != IToken.tLBRACE )
- singleStatementScope(scope);
- else
- statement(scope);
- consume(IToken.t_while);
- consume(IToken.tLPAREN);
- condition(scope);
- consume(IToken.tRPAREN);
- return;
- case IToken.t_for :
- consume();
- consume(IToken.tLPAREN);
- forInitStatement(scope);
- if (LT(1) != IToken.tSEMI)
- condition(scope);
- consume(IToken.tSEMI);
- if (LT(1) != IToken.tRPAREN)
- {
- IASTExpression finalExpression = expression(scope);
- finalExpression.acceptElement(requestor);
- }
- consume(IToken.tRPAREN);
- statement(scope);
- return;
- case IToken.t_break :
- consume();
- consume(IToken.tSEMI);
- return;
- case IToken.t_continue :
- consume();
- consume(IToken.tSEMI);
- return;
- case IToken.t_return :
- consume();
- if (LT(1) != IToken.tSEMI)
- {
- IASTExpression retVal = expression(scope);
- retVal.acceptElement(requestor);
- }
- consume(IToken.tSEMI);
- return;
- case IToken.t_goto :
- consume();
- consume(IToken.tIDENTIFIER);
- consume(IToken.tSEMI);
- return;
- case IToken.t_try :
- consume();
- compoundStatement(scope,true);
- catchHandlerSequence(scope);
- return;
- case IToken.tSEMI :
- consume();
- return;
- default :
- // can be many things:
- // label
-
- try
- {
- if (LT(1) == IToken.tIDENTIFIER && LT(2) == IToken.tCOLON)
- {
- consume(IToken.tIDENTIFIER);
- consume(IToken.tCOLON);
- statement(scope);
- return;
- }
- }catch( OffsetLimitReachedException olre )
- {
- // ok
- }
- // expressionStatement
- // Note: the function style cast ambiguity is handled in expression
- // Since it only happens when we are in a statement
- IToken mark = mark();
- try
- {
- IASTExpression thisExpression = expression(scope);
- if( queryLookaheadCapability() )
- consume(IToken.tSEMI);
- else
- throw new EndOfFileException();
- thisExpression.acceptElement( requestor );
- return;
- }
- catch (BacktrackException b)
- {
- backup( mark );
- }
- catch( OffsetLimitReachedException olre )
- {
- backup(mark);
- }
-
- // declarationStatement
- declaration(scope, null);
- }
-
- }
- protected void catchHandlerSequence(IASTScope scope)
- throws EndOfFileException, BacktrackException
- {
- if( LT(1) != IToken.t_catch )
- throw backtrack; // error, need at least one of these
- while (LT(1) == IToken.t_catch)
- {
- consume(IToken.t_catch);
- consume(IToken.tLPAREN);
- if( LT(1) == IToken.tELLIPSIS )
- consume( IToken.tELLIPSIS );
- else
- declaration(scope, null); // was exceptionDeclaration
- consume(IToken.tRPAREN);
-
- catchBlockCompoundStatement(scope);
- }
- }
-
- protected abstract void catchBlockCompoundStatement(IASTScope scope) throws BacktrackException, EndOfFileException;
-
- protected void singleStatementScope(IASTScope scope) throws EndOfFileException, BacktrackException
- {
- IASTCodeScope newScope;
- try
- {
- newScope = astFactory.createNewCodeBlock(scope);
- }
- catch (Exception e)
- {
- throw backtrack;
- }
- newScope.enterScope( requestor );
- try
- {
- statement( newScope );
- }
- finally
- {
- newScope.exitScope( requestor );
- }
- }
-
- /**
- * @throws BacktrackException
- */
- protected void condition( IASTScope scope ) throws BacktrackException, EndOfFileException
- {
- IASTExpression someExpression = expression( scope );
- someExpression.acceptElement(requestor);
- //TODO type-specifier-seq declarator = assignment expression
- }
-
- /**
- * @throws BacktrackException
- */
- protected void forInitStatement( IASTScope scope ) throws BacktrackException, EndOfFileException
- {
- try
- {
- simpleDeclarationStrategyUnion(scope,null);
- }
- catch( BacktrackException bt )
- {
- try
- {
- IASTExpression e = expression( scope );
- e.acceptElement(requestor);
- }
- catch( BacktrackException b )
- {
- failParse();
- throw b;
- }
- }
-
- }
- /**
- * @throws BacktrackException
- */
- protected void compoundStatement( IASTScope scope, boolean createNewScope ) throws EndOfFileException, BacktrackException
- {
- consume(IToken.tLBRACE);
-
- IASTCodeScope newScope = null;
- if( createNewScope )
- {
- try
- {
- newScope = astFactory.createNewCodeBlock(scope);
- }
- catch (Exception e)
- {
- throw backtrack;
- }
- newScope.enterScope( requestor );
- }
- IToken checkToken = null;
- setCurrentScope(createNewScope ? newScope : scope);
- setCompletionKind( CompletionKind.STATEMENT_START );
- while (queryLookaheadCapability() && LT(1) != IToken.tRBRACE)
- {
- checkToken = LA(1);
- setCurrentScope(createNewScope ? newScope : scope);
- try
- {
- statement(createNewScope ? newScope : scope );
- }
- catch( BacktrackException b )
- {
- failParse();
- if( LA(1) == checkToken )
- errorHandling();
- }
- setCurrentScope(createNewScope ? newScope : scope);
-
- setCompletionKind( CompletionKind.STATEMENT_START );
- setCompletionKeywords( Key.STATEMENT );
- }
-
- if( queryLookaheadCapability() ) consume(IToken.tRBRACE);
- else throw new EndOfFileException();
- if( createNewScope )
- newScope.exitScope( requestor );
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression constantExpression( IASTScope scope )
- throws BacktrackException, EndOfFileException
- {
- return conditionalExpression(scope);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IParser#expression(java.lang.Object)
- */
- public IASTExpression expression(IASTScope scope) throws BacktrackException, EndOfFileException
- {
- IASTExpression assignmentExpression = assignmentExpression(scope);
- if( !queryLookaheadCapability() ) return assignmentExpression;
- while (LT(1) == IToken.tCOMMA)
- {
- consume();
- IASTExpression secondExpression = assignmentExpression(scope);
- try
- {
- assignmentExpression =
- astFactory.createExpression(
- scope,
- IASTExpression.Kind.EXPRESSIONLIST,
- assignmentExpression,
- secondExpression,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- return assignmentExpression;
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression assignmentExpression(IASTScope scope)
- throws EndOfFileException, BacktrackException {
- if (LT(1) == IToken.t_throw) {
- return throwExpression(scope);
- }
- IASTExpression conditionalExpression = conditionalExpression(scope);
- // if the condition not taken, try assignment operators
- if (conditionalExpression != null
- && conditionalExpression.getExpressionKind()
- == IASTExpression.Kind.CONDITIONALEXPRESSION)
- return conditionalExpression;
- if( !queryLookaheadCapability() ) return conditionalExpression;
- switch (LT(1)) {
- case IToken.tASSIGN :
- return assignmentOperatorExpression(
- scope,
- IASTExpression.Kind.ASSIGNMENTEXPRESSION_NORMAL,
- conditionalExpression);
- case IToken.tSTARASSIGN :
- return assignmentOperatorExpression(
- scope,
- IASTExpression.Kind.ASSIGNMENTEXPRESSION_MULT,
- conditionalExpression);
- case IToken.tDIVASSIGN :
- return assignmentOperatorExpression(
- scope,
- IASTExpression.Kind.ASSIGNMENTEXPRESSION_DIV,
- conditionalExpression);
- case IToken.tMODASSIGN :
- return assignmentOperatorExpression(
- scope,
- IASTExpression.Kind.ASSIGNMENTEXPRESSION_MOD,
- conditionalExpression);
- case IToken.tPLUSASSIGN :
- return assignmentOperatorExpression(
- scope,
- IASTExpression.Kind.ASSIGNMENTEXPRESSION_PLUS,
- conditionalExpression);
- case IToken.tMINUSASSIGN :
- return assignmentOperatorExpression(
- scope,
- IASTExpression.Kind.ASSIGNMENTEXPRESSION_MINUS,
- conditionalExpression);
- case IToken.tSHIFTRASSIGN :
- return assignmentOperatorExpression(
- scope,
- IASTExpression.Kind.ASSIGNMENTEXPRESSION_RSHIFT,
- conditionalExpression);
- case IToken.tSHIFTLASSIGN :
- return assignmentOperatorExpression(
- scope,
- IASTExpression.Kind.ASSIGNMENTEXPRESSION_LSHIFT,
- conditionalExpression);
- case IToken.tAMPERASSIGN :
- return assignmentOperatorExpression(
- scope,
- IASTExpression.Kind.ASSIGNMENTEXPRESSION_AND,
- conditionalExpression);
- case IToken.tXORASSIGN :
- return assignmentOperatorExpression(
- scope,
- IASTExpression.Kind.ASSIGNMENTEXPRESSION_XOR,
- conditionalExpression);
- case IToken.tBITORASSIGN :
- return assignmentOperatorExpression(
- scope,
- IASTExpression.Kind.ASSIGNMENTEXPRESSION_OR,
- conditionalExpression);
- }
- return conditionalExpression;
- }
- protected IASTExpression assignmentOperatorExpression(
- IASTScope scope,
- IASTExpression.Kind kind, IASTExpression lhs )
- throws EndOfFileException, BacktrackException
- {
- consume();
- IASTExpression assignmentExpression = assignmentExpression(scope);
-
- try
- {
- return astFactory.createExpression(
- scope,
- kind,
- lhs,
- assignmentExpression,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression throwExpression( IASTScope scope )
- throws EndOfFileException, BacktrackException
- {
- consume(IToken.t_throw);
- IASTExpression throwExpression = null;
- try
- {
- throwExpression = expression(scope);
- }
- catch (BacktrackException b)
- {
- }
- try
- {
- return astFactory.createExpression(
- scope,
- IASTExpression.Kind.THROWEXPRESSION,
- throwExpression,
- null,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- /**
- * @param expression
- * @return
- * @throws BacktrackException
- */
- protected IASTExpression conditionalExpression( IASTScope scope )
- throws BacktrackException, EndOfFileException
- {
- IASTExpression firstExpression = logicalOrExpression(scope);
- if( !queryLookaheadCapability() ) return firstExpression;
- if (LT(1) == IToken.tQUESTION)
- {
- consume();
- IASTExpression secondExpression = expression(scope);
- consume(IToken.tCOLON);
- IASTExpression thirdExpression = assignmentExpression(scope);
- try
- {
- return astFactory.createExpression(
- scope,
- IASTExpression.Kind.CONDITIONALEXPRESSION,
- firstExpression,
- secondExpression,
- thirdExpression,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- else
- return firstExpression;
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression logicalOrExpression(IASTScope scope)
- throws BacktrackException, EndOfFileException
- {
- IASTExpression firstExpression = logicalAndExpression(scope);
- if( !queryLookaheadCapability() ) return firstExpression;
- while (LT(1) == IToken.tOR)
- {
- consume();
- IASTExpression secondExpression = logicalAndExpression(scope);
-
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- IASTExpression.Kind.LOGICALOREXPRESSION,
- firstExpression,
- secondExpression,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- return firstExpression;
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression logicalAndExpression( IASTScope scope )
- throws BacktrackException, EndOfFileException
- {
- IASTExpression firstExpression = inclusiveOrExpression( scope );
- if( !queryLookaheadCapability() ) return firstExpression;
- while (LT(1) == IToken.tAND)
- {
- consume();
- IASTExpression secondExpression = inclusiveOrExpression( scope );
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- IASTExpression.Kind.LOGICALANDEXPRESSION,
- firstExpression,
- secondExpression,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- return firstExpression;
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression inclusiveOrExpression( IASTScope scope )
- throws BacktrackException, EndOfFileException
- {
- IASTExpression firstExpression = exclusiveOrExpression(scope);
- if( !queryLookaheadCapability() ) return firstExpression;
- while (LT(1) == IToken.tBITOR)
- {
- consume();
- IASTExpression secondExpression = exclusiveOrExpression(scope);
-
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- IASTExpression.Kind.INCLUSIVEOREXPRESSION,
- firstExpression,
- secondExpression,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- return firstExpression;
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression exclusiveOrExpression( IASTScope scope )
- throws BacktrackException, EndOfFileException
- {
- IASTExpression firstExpression = andExpression( scope );
- if( !queryLookaheadCapability() ) return firstExpression;
- while (LT(1) == IToken.tXOR)
- {
- consume();
-
- IASTExpression secondExpression = andExpression( scope );
-
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- IASTExpression.Kind.EXCLUSIVEOREXPRESSION,
- firstExpression,
- secondExpression,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- return firstExpression;
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression andExpression(IASTScope scope) throws EndOfFileException, BacktrackException
- {
- IASTExpression firstExpression = equalityExpression(scope);
- if( !queryLookaheadCapability() ) return firstExpression;
- while (LT(1) == IToken.tAMPER)
- {
- consume();
- IASTExpression secondExpression = equalityExpression(scope);
-
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- IASTExpression.Kind.ANDEXPRESSION,
- firstExpression,
- secondExpression,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- return firstExpression;
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression equalityExpression( IASTScope scope )
- throws EndOfFileException, BacktrackException
- {
- IASTExpression firstExpression = relationalExpression(scope);
- for (;;)
- {
- if( !queryLookaheadCapability() ) return firstExpression;
- switch (LT(1))
- {
- case IToken.tEQUAL :
- case IToken.tNOTEQUAL :
- IToken t = consume();
- IASTExpression secondExpression =
- relationalExpression(scope);
-
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- (t.getType() == IToken.tEQUAL)
- ? IASTExpression.Kind.EQUALITY_EQUALS
- : IASTExpression.Kind.EQUALITY_NOTEQUALS,
- firstExpression,
- secondExpression,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- break;
- default :
- return firstExpression;
- }
- }
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression relationalExpression(IASTScope scope)
- throws BacktrackException, EndOfFileException
- {
- IASTExpression firstExpression = shiftExpression(scope);
- for (;;)
- {
- if( !queryLookaheadCapability() ) return firstExpression;
- switch (LT(1))
- {
- case IToken.tGT :
- case IToken.tLT :
- case IToken.tLTEQUAL :
- case IToken.tGTEQUAL :
- IToken mark = mark();
- IToken t = consume();
- IToken next = LA(1);
- IASTExpression secondExpression =
- shiftExpression(scope);
- if (next == LA(1))
- {
- // we did not consume anything
- // this is most likely an error
- backup(mark);
- return firstExpression;
- }
- else
- {
- IASTExpression.Kind kind = null;
- switch (t.getType())
- {
- case IToken.tGT :
- kind =
- IASTExpression.Kind.RELATIONAL_GREATERTHAN;
- break;
- case IToken.tLT :
- kind = IASTExpression.Kind.RELATIONAL_LESSTHAN;
- break;
- case IToken.tLTEQUAL :
- kind =
- IASTExpression
- .Kind
- .RELATIONAL_LESSTHANEQUALTO;
- break;
- case IToken.tGTEQUAL :
- kind =
- IASTExpression
- .Kind
- .RELATIONAL_GREATERTHANEQUALTO;
- break;
- }
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- kind,
- firstExpression,
- secondExpression,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- break;
- default :
- return firstExpression;
- }
- }
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression shiftExpression(IASTScope scope)
- throws BacktrackException, EndOfFileException
- {
- IASTExpression firstExpression = additiveExpression(scope);
- for (;;)
- {
- if( !queryLookaheadCapability() ) return firstExpression;
- switch (LT(1))
- {
- case IToken.tSHIFTL :
- case IToken.tSHIFTR :
- IToken t = consume();
- IASTExpression secondExpression =
- additiveExpression(scope);
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- ((t.getType() == IToken.tSHIFTL)
- ? IASTExpression.Kind.SHIFT_LEFT
- : IASTExpression.Kind.SHIFT_RIGHT),
- firstExpression,
- secondExpression,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- break;
- default :
- return firstExpression;
- }
- }
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression additiveExpression( IASTScope scope )
- throws BacktrackException, EndOfFileException
- {
- IASTExpression firstExpression = multiplicativeExpression( scope );
- for (;;)
- {
- if( !queryLookaheadCapability() ) return firstExpression;
- switch (LT(1))
- {
- case IToken.tPLUS :
- case IToken.tMINUS :
- IToken t = consume();
- IASTExpression secondExpression =
- multiplicativeExpression(scope);
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- ((t.getType() == IToken.tPLUS)
- ? IASTExpression.Kind.ADDITIVE_PLUS
- : IASTExpression.Kind.ADDITIVE_MINUS),
- firstExpression,
- secondExpression,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- break;
- default :
- return firstExpression;
- }
- }
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression multiplicativeExpression( IASTScope scope )
- throws BacktrackException, EndOfFileException
- {
- IASTExpression firstExpression = pmExpression(scope);
- for (;;)
- {
- if( !queryLookaheadCapability() ) return firstExpression;
- switch (LT(1))
- {
- case IToken.tSTAR :
- case IToken.tDIV :
- case IToken.tMOD :
- IToken t = consume();
- IASTExpression secondExpression = pmExpression(scope);
- IASTExpression.Kind kind = null;
- switch (t.getType())
- {
- case IToken.tSTAR :
- kind = IASTExpression.Kind.MULTIPLICATIVE_MULTIPLY;
- break;
- case IToken.tDIV :
- kind = IASTExpression.Kind.MULTIPLICATIVE_DIVIDE;
- break;
- case IToken.tMOD :
- kind = IASTExpression.Kind.MULTIPLICATIVE_MODULUS;
- break;
- }
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- kind,
- firstExpression,
- secondExpression,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- break;
- default :
- return firstExpression;
- }
- }
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression pmExpression( IASTScope scope ) throws EndOfFileException, BacktrackException
- {
- IASTExpression firstExpression = castExpression(scope);
- for (;;)
- {
- if( ! queryLookaheadCapability() ) return firstExpression;
- switch (LT(1))
- {
- case IToken.tDOTSTAR :
- case IToken.tARROWSTAR :
- IToken t = consume();
- IASTExpression secondExpression =
- castExpression(scope);
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- ((t.getType() == IToken.tDOTSTAR)
- ? IASTExpression.Kind.PM_DOTSTAR
- : IASTExpression.Kind.PM_ARROWSTAR),
- firstExpression,
- secondExpression,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- break;
- default :
- return firstExpression;
- }
- }
- }
- /**
- * castExpression
- * : unaryExpression
- * | "(" typeId ")" castExpression
- */
- protected IASTExpression castExpression( IASTScope scope ) throws EndOfFileException, BacktrackException
- {
- // TO DO: we need proper symbol checkint to ensure type name
- if( ! queryLookaheadCapability() ) return unaryExpression(scope);
- if (LT(1) == IToken.tLPAREN)
- {
- IToken mark = mark();
- consume();
- IASTTypeId typeId = null;
- // If this isn't a type name, then we shouldn't be here
- try
- {
- typeId = typeId(scope, false);
- consume(IToken.tRPAREN);
- IASTExpression castExpression = castExpression(scope);
- try
- {
- return astFactory.createExpression(
- scope,
- IASTExpression.Kind.CASTEXPRESSION,
- castExpression,
- null,
- null,
- typeId,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- catch (BacktrackException b)
- {
- backup(mark);
- }
- }
- return unaryExpression(scope);
-
- }
-
- /**
- * @throws BacktrackException
- */
- protected IASTTypeId typeId(IASTScope scope, boolean skipArrayModifiers ) throws EndOfFileException, BacktrackException
- {
- IToken mark = mark();
- ITokenDuple name = null;
- boolean isConst = false, isVolatile = false;
- boolean isSigned = false, isUnsigned = false;
- boolean isShort = false, isLong = false;
- boolean isTypename = false;
-
- IASTSimpleTypeSpecifier.Type kind = null;
- do
- {
- try
- {
- name = name();
- kind = IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME;
- break;
- }
- catch (BacktrackException b)
- {
- // do nothing
- }
-
- boolean encounteredType = false;
- simpleMods : for (;;)
- {
- switch (LT(1))
- {
- case IToken.t_signed :
- consume();
- isSigned = true;
- break;
-
- case IToken.t_unsigned :
- consume();
- isUnsigned = true;
- break;
-
- case IToken.t_short :
- consume();
- isShort = true;
- break;
-
- case IToken.t_long :
- consume();
- isLong = true;
- break;
-
- case IToken.t_const :
- consume();
- isConst = true;
- break;
-
- case IToken.t_volatile :
- consume();
- isVolatile = true;
- break;
-
- case IToken.tIDENTIFIER :
- if( encounteredType ) break simpleMods;
- encounteredType = true;
- name = name();
- kind = IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME;
- break;
-
- case IToken.t_int :
- if( encounteredType ) break simpleMods;
- encounteredType = true;
- kind = IASTSimpleTypeSpecifier.Type.INT;
- consume();
- break;
-
- case IToken.t_char :
- if( encounteredType ) break simpleMods;
- encounteredType = true;
- kind = IASTSimpleTypeSpecifier.Type.CHAR;
- consume();
- break;
-
- case IToken.t_bool :
- if( encounteredType ) break simpleMods;
- encounteredType = true;
- kind = IASTSimpleTypeSpecifier.Type.BOOL;
- consume();
- break;
-
- case IToken.t_double :
- if( encounteredType ) break simpleMods;
- encounteredType = true;
- kind = IASTSimpleTypeSpecifier.Type.DOUBLE;
- consume();
- break;
-
- case IToken.t_float :
- if( encounteredType ) break simpleMods;
- encounteredType = true;
- kind = IASTSimpleTypeSpecifier.Type.FLOAT;
- consume();
- break;
-
- case IToken.t_wchar_t :
- if( encounteredType ) break simpleMods;
- encounteredType = true;
- kind = IASTSimpleTypeSpecifier.Type.WCHAR_T;
- consume();
- break;
-
-
- case IToken.t_void :
- if( encounteredType ) break simpleMods;
- encounteredType = true;
- kind = IASTSimpleTypeSpecifier.Type.VOID;
- consume();
- break;
-
-
- default :
- break simpleMods;
- }
- }
-
- if( kind != null ) break;
-
- if( isShort || isLong || isUnsigned || isSigned )
- {
- kind = IASTSimpleTypeSpecifier.Type.INT;
- break;
- }
-
- if (
- LT(1) == IToken.t_typename
- || LT(1) == IToken.t_struct
- || LT(1) == IToken.t_class
- || LT(1) == IToken.t_enum
- || LT(1) == IToken.t_union)
- {
- consume();
- try
- {
- name = name();
- kind = IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME;
- } catch( BacktrackException b )
- {
- backup( mark );
- throw backtrack;
- }
- }
-
- } while( false );
-
- if( kind == null )
- throw backtrack;
-
- TypeId id = new TypeId();
- IToken last = lastToken;
-
- lastToken = consumeTemplateParameters( last );
- if( lastToken == null ) lastToken = last;
-
- consumePointerOperators( id );
- if( lastToken == null ) lastToken = last;
-
- if( ! skipArrayModifiers )
- {
- last = lastToken;
- consumeArrayModifiers( id, scope );
- if( lastToken == null ) lastToken = last;
- }
-
- try
- {
- return astFactory.createTypeId( scope, kind, isConst, isVolatile, isShort, isLong, isSigned, isUnsigned, isTypename, name, id.getPointerOperators(), id.getArrayModifiers());
- }
- catch (ASTSemanticException e)
- {
- backup( mark );
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression deleteExpression( IASTScope scope )
- throws EndOfFileException, BacktrackException
- {
- if (LT(1) == IToken.tCOLONCOLON)
- {
- // global scope
- consume();
- }
- consume(IToken.t_delete);
- boolean vectored = false;
- if (LT(1) == IToken.tLBRACKET)
- {
- // array delete
- consume();
- consume(IToken.tRBRACKET);
- vectored = true;
- }
- IASTExpression castExpression = castExpression(scope);
- try
- {
- return astFactory.createExpression(
- scope,
- (vectored
- ? IASTExpression.Kind.DELETE_VECTORCASTEXPRESSION
- : IASTExpression.Kind.DELETE_CASTEXPRESSION),
- castExpression,
- null,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- /**
- * Pazse a new-expression.
- *
- * @param expression
- * @throws BacktrackException
- *
- *
- * newexpression: ::? new newplacement? newtypeid newinitializer?
- * ::? new newplacement? ( typeid ) newinitializer?
- * newplacement: ( expressionlist )
- * newtypeid: typespecifierseq newdeclarator?
- * newdeclarator: ptroperator newdeclarator? | directnewdeclarator
- * directnewdeclarator: [ expression ]
- * directnewdeclarator [ constantexpression ]
- * newinitializer: ( expressionlist? )
- */
- protected IASTExpression newExpression( IASTScope scope ) throws BacktrackException, EndOfFileException
- {
- if (LT(1) == IToken.tCOLONCOLON)
- {
- // global scope
- consume();
- }
- consume(IToken.t_new);
- boolean typeIdInParen = false;
- boolean placementParseFailure = true;
- IToken beforeSecondParen = null;
- IToken backtrackMarker = null;
- IASTTypeId typeId = null;
- ArrayList newPlacementExpressions = new ArrayList();
- ArrayList newTypeIdExpressions = new ArrayList();
- ArrayList newInitializerExpressions = new ArrayList();
-
- if (LT(1) == IToken.tLPAREN)
- {
- consume(IToken.tLPAREN);
- try
- {
- // Try to consume placement list
- // Note: since expressionList and expression are the same...
- backtrackMarker = mark();
- newPlacementExpressions.add(expression(scope));
- consume(IToken.tRPAREN);
- placementParseFailure = false;
- if (LT(1) == IToken.tLPAREN)
- {
- beforeSecondParen = mark();
- consume(IToken.tLPAREN);
- typeIdInParen = true;
- }
- }
- catch (BacktrackException e)
- {
- backup(backtrackMarker);
- }
- if (placementParseFailure)
- {
- // CASE: new (typeid-not-looking-as-placement) ...
- // the first expression in () is not a placement
- // - then it has to be typeId
- typeId = typeId(scope, true );
- consume(IToken.tRPAREN);
- }
- else
- {
- if (!typeIdInParen)
- {
- if (LT(1) == IToken.tLBRACKET)
- {
- // CASE: new (typeid-looking-as-placement) [expr]...
- // the first expression in () has been parsed as a placement;
- // however, we assume that it was in fact typeId, and this
- // new statement creates an array.
- // Do nothing, fallback to array/initializer processing
- }
- else
- {
- // CASE: new (placement) typeid ...
- // the first expression in () is parsed as a placement,
- // and the next expression doesn't start with '(' or '['
- // - then it has to be typeId
- try
- {
- backtrackMarker = mark();
- typeId = typeId(scope, true);
- }
- catch (BacktrackException e)
- {
- // Hmmm, so it wasn't typeId after all... Then it is
- // CASE: new (typeid-looking-as-placement)
- backup(backtrackMarker);
- // TODO fix this
- return null;
- }
- }
- }
- else
- {
- // Tricky cases: first expression in () is parsed as a placement,
- // and the next expression starts with '('.
- // The problem is, the first expression might as well be a typeid
- try
- {
- typeId = typeId(scope, true);
- consume(IToken.tRPAREN);
- if (LT(1) == IToken.tLPAREN
- || LT(1) == IToken.tLBRACKET)
- {
- // CASE: new (placement)(typeid)(initializer)
- // CASE: new (placement)(typeid)[] ...
- // Great, so far all our assumptions have been correct
- // Do nothing, fallback to array/initializer processing
- }
- else
- {
- // CASE: new (placement)(typeid)
- // CASE: new (typeid-looking-as-placement)(initializer-looking-as-typeid)
- // Worst-case scenario - this cannot be resolved w/o more semantic information.
- // Luckily, we don't need to know what was that - we only know that
- // new-expression ends here.
- try
- {
- return astFactory.createExpression(
- scope, IASTExpression.Kind.NEW_TYPEID,
- null, null, null, typeId, null,
- "", astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions));
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- }
- catch (BacktrackException e)
- {
- // CASE: new (typeid-looking-as-placement)(initializer-not-looking-as-typeid)
- // Fallback to initializer processing
- backup(beforeSecondParen);
- }
- }
- }
- }
- else
- {
- // CASE: new typeid ...
- // new parameters do not start with '('
- // i.e it has to be a plain typeId
- typeId = typeId(scope, true);
- }
- while (LT(1) == IToken.tLBRACKET)
- {
- // array new
- consume();
- newTypeIdExpressions.add(assignmentExpression(scope));
- consume(IToken.tRBRACKET);
- }
- // newinitializer
- if (LT(1) == IToken.tLPAREN)
- {
- consume(IToken.tLPAREN);
- if (LT(1) != IToken.tRPAREN)
- newInitializerExpressions.add(expression(scope));
- consume(IToken.tRPAREN);
- }
- try
- {
- return astFactory.createExpression(
- scope, IASTExpression.Kind.NEW_TYPEID,
- null, null, null, typeId, null,
- "", astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions));
- }
- catch (ASTSemanticException e)
- {
- return null;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- protected IASTExpression unaryOperatorCastExpression( IASTScope scope,
- IASTExpression.Kind kind)
- throws EndOfFileException, BacktrackException
- {
- IASTExpression castExpression = castExpression(scope);
- try
- {
- return astFactory.createExpression(
- scope,
- kind,
- castExpression,
- null,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression unaryExpression( IASTScope scope )
- throws EndOfFileException, BacktrackException
- {
- if( ! queryLookaheadCapability() ) return postfixExpression( scope );
- switch (LT(1))
- {
- case IToken.tSTAR :
- consume();
- return unaryOperatorCastExpression(scope,
- IASTExpression.Kind.UNARY_STAR_CASTEXPRESSION);
- case IToken.tAMPER :
- consume();
- return unaryOperatorCastExpression(scope,
- IASTExpression.Kind.UNARY_AMPSND_CASTEXPRESSION);
- case IToken.tPLUS :
- consume();
- return unaryOperatorCastExpression(scope,
- IASTExpression.Kind.UNARY_PLUS_CASTEXPRESSION);
- case IToken.tMINUS :
- consume();
- return unaryOperatorCastExpression(scope,
- IASTExpression.Kind.UNARY_MINUS_CASTEXPRESSION);
- case IToken.tNOT :
- consume();
- return unaryOperatorCastExpression(scope,
- IASTExpression.Kind.UNARY_NOT_CASTEXPRESSION);
- case IToken.tCOMPL :
- consume();
- return unaryOperatorCastExpression(scope,
- IASTExpression.Kind.UNARY_TILDE_CASTEXPRESSION);
- case IToken.tINCR :
- consume();
- return unaryOperatorCastExpression(scope,
- IASTExpression.Kind.UNARY_INCREMENT);
- case IToken.tDECR :
- consume();
- return unaryOperatorCastExpression(scope,
- IASTExpression.Kind.UNARY_DECREMENT);
- case IToken.t_sizeof :
- consume(IToken.t_sizeof);
- IToken mark = LA(1);
- IASTTypeId d = null;
- IASTExpression unaryExpression = null;
- if (LT(1) == IToken.tLPAREN)
- {
- try
- {
- consume(IToken.tLPAREN);
- d = typeId(scope, false);
- consume(IToken.tRPAREN);
- }
- catch (BacktrackException bt)
- {
- backup(mark);
- unaryExpression = unaryExpression(scope);
- }
- }
- else
- {
- unaryExpression = unaryExpression(scope);
- }
- if (d != null & unaryExpression == null)
- try
- {
- return astFactory.createExpression(
- scope,
- IASTExpression.Kind.UNARY_SIZEOF_TYPEID,
- null,
- null,
- null,
- d,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- else if (unaryExpression != null && d == null)
- try
- {
- return astFactory.createExpression(
- scope,
- IASTExpression.Kind.UNARY_SIZEOF_UNARYEXPRESSION,
- unaryExpression,
- null,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e1)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- else
- throw backtrack;
- case IToken.t_new :
- return newExpression(scope);
- case IToken.t_delete :
- return deleteExpression(scope);
- case IToken.tCOLONCOLON :
- switch (LT(2))
- {
- case IToken.t_new :
- return newExpression(scope);
- case IToken.t_delete :
- return deleteExpression(scope);
- default :
- return postfixExpression(scope);
- }
- default :
- return postfixExpression(scope);
- }
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression postfixExpression( IASTScope scope )
- throws EndOfFileException, BacktrackException
- {
- IASTExpression firstExpression = null;
- boolean isTemplate = false;
-
- if( ! queryLookaheadCapability() ) return primaryExpression(scope);
- switch (LT(1))
- {
- case IToken.t_typename :
- consume(IToken.t_typename);
- ITokenDuple nestedName = name();
- boolean templateTokenConsumed = false;
- if( LT(1) == IToken.t_template )
- {
- consume( IToken.t_template );
- templateTokenConsumed = true;
- }
- IToken current = mark();
- ITokenDuple templateId = null;
- try
- {
- templateId = new TokenDuple( current, templateId() );
- }
- catch( BacktrackException bt )
- {
- if( templateTokenConsumed )
- throw bt;
- backup( current );
- }
- consume( IToken.tLPAREN );
- IASTExpression expressionList = expression( scope );
- consume( IToken.tRPAREN );
- try {
- firstExpression =
- astFactory.createExpression( scope,
- (( templateId != null )? IASTExpression.Kind.POSTFIX_TYPENAME_TEMPLATEID : IASTExpression.Kind.POSTFIX_TYPENAME_IDENTIFIER ),
- expressionList,
- null,
- null,
- null,
- nestedName,
- "",
- null );
- } catch (ASTSemanticException ase ) {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- break;
- // simple-type-specifier ( assignment-expression , .. )
- case IToken.t_char :
- firstExpression =
- simpleTypeConstructorExpression(scope,
- IASTExpression.Kind.POSTFIX_SIMPLETYPE_CHAR);
- break;
- case IToken.t_wchar_t :
- firstExpression =
- simpleTypeConstructorExpression(scope,
- IASTExpression.Kind.POSTFIX_SIMPLETYPE_WCHART);
- break;
- case IToken.t_bool :
- firstExpression =
- simpleTypeConstructorExpression(scope,
- IASTExpression.Kind.POSTFIX_SIMPLETYPE_BOOL);
- break;
- case IToken.t_short :
- firstExpression =
- simpleTypeConstructorExpression(scope,
- IASTExpression.Kind.POSTFIX_SIMPLETYPE_SHORT);
- break;
- case IToken.t_int :
- firstExpression =
- simpleTypeConstructorExpression(scope,
- IASTExpression.Kind.POSTFIX_SIMPLETYPE_INT);
- break;
- case IToken.t_long :
- firstExpression =
- simpleTypeConstructorExpression(scope,
- IASTExpression.Kind.POSTFIX_SIMPLETYPE_LONG);
- break;
- case IToken.t_signed :
- firstExpression =
- simpleTypeConstructorExpression(scope,
- IASTExpression.Kind.POSTFIX_SIMPLETYPE_SIGNED);
- break;
- case IToken.t_unsigned :
- firstExpression =
- simpleTypeConstructorExpression(scope,
- IASTExpression.Kind.POSTFIX_SIMPLETYPE_UNSIGNED);
- break;
- case IToken.t_float :
- firstExpression =
- simpleTypeConstructorExpression(scope,
- IASTExpression.Kind.POSTFIX_SIMPLETYPE_FLOAT);
- break;
- case IToken.t_double :
- firstExpression =
- simpleTypeConstructorExpression( scope,
- IASTExpression.Kind.POSTFIX_SIMPLETYPE_DOUBLE);
- break;
- case IToken.t_dynamic_cast :
- firstExpression =
- specialCastExpression(scope,
- IASTExpression.Kind.POSTFIX_DYNAMIC_CAST);
- break;
- case IToken.t_static_cast :
- firstExpression =
- specialCastExpression(scope,
- IASTExpression.Kind.POSTFIX_STATIC_CAST);
- break;
- case IToken.t_reinterpret_cast :
- firstExpression =
- specialCastExpression(scope,
- IASTExpression.Kind.POSTFIX_REINTERPRET_CAST);
- break;
- case IToken.t_const_cast :
- firstExpression =
- specialCastExpression(scope,
- IASTExpression.Kind.POSTFIX_CONST_CAST);
- break;
- case IToken.t_typeid :
- consume();
- consume(IToken.tLPAREN);
- boolean isTypeId = true;
- IASTExpression lhs = null;
- IASTTypeId typeId = null;
- try
- {
- typeId = typeId(scope, false);
- }
- catch (BacktrackException b)
- {
- isTypeId = false;
- lhs = expression(scope);
- }
- consume(IToken.tRPAREN);
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- (isTypeId
- ? IASTExpression.Kind.POSTFIX_TYPEID_TYPEID
- : IASTExpression.Kind.POSTFIX_TYPEID_EXPRESSION),
- lhs,
- null,
- null,
- typeId,
- null, "", null);
- }
- catch (ASTSemanticException e6)
- {
- failParse();
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- break;
- default :
- firstExpression = primaryExpression(scope);
- }
- IASTExpression secondExpression = null;
- for (;;)
- {
- if( ! queryLookaheadCapability() )return firstExpression;
- switch (LT(1))
- {
- case IToken.tLBRACKET :
- // array access
- consume();
- secondExpression = expression(scope);
- consume(IToken.tRBRACKET);
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- IASTExpression.Kind.POSTFIX_SUBSCRIPT,
- firstExpression,
- secondExpression,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e2)
- {
- failParse();
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- break;
- case IToken.tLPAREN :
- // function call
- consume(IToken.tLPAREN);
- secondExpression = expression(scope);
- consume(IToken.tRPAREN);
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- IASTExpression.Kind.POSTFIX_FUNCTIONCALL,
- firstExpression,
- secondExpression,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e3)
- {
- failParse();
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- break;
- case IToken.tINCR :
- consume();
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- IASTExpression.Kind.POSTFIX_INCREMENT,
- firstExpression,
- null,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e1)
- {
- failParse();
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- break;
- case IToken.tDECR :
- consume();
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- IASTExpression.Kind.POSTFIX_DECREMENT,
- firstExpression,
- null,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e4)
- {
- failParse();
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- break;
- case IToken.tDOT :
- // member access
- consume(IToken.tDOT);
-
- try
- {
- if (LT(1) == IToken.t_template)
- {
- consume(IToken.t_template);
- isTemplate = true;
- }
- } catch( OffsetLimitReachedException olre )
- {
- setCompletionToken( null );
- }
-
- IASTNode context = astFactory.getCompletionContext( (isTemplate
- ? IASTExpression.Kind.POSTFIX_DOT_TEMPL_IDEXPRESS
- : IASTExpression.Kind.POSTFIX_DOT_IDEXPRESSION),
- firstExpression );
- setCompletionContext( context );
- setCompletionKind( IASTCompletionNode.CompletionKind.MEMBER_REFERENCE );
-
- secondExpression = primaryExpression(scope);
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- (isTemplate
- ? IASTExpression.Kind.POSTFIX_DOT_TEMPL_IDEXPRESS
- : IASTExpression.Kind.POSTFIX_DOT_IDEXPRESSION),
- firstExpression,
- secondExpression,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e5)
- {
- failParse();
- setCompletionContext( null );
- throw backtrack;
- } catch (Exception e)
- {
- setCompletionContext( null );
- throw backtrack;
- }
-
- break;
- case IToken.tARROW :
- // member access
- consume(IToken.tARROW);
-
- try
- {
- if (LT(1) == IToken.t_template)
- {
- consume(IToken.t_template);
- isTemplate = true;
- }
- } catch( OffsetLimitReachedException olre )
- {
- setCompletionToken( null );
- }
-
- context = astFactory.getCompletionContext( (isTemplate
- ? IASTExpression.Kind.POSTFIX_ARROW_TEMPL_IDEXP
- : IASTExpression.Kind.POSTFIX_ARROW_IDEXPRESSION),
- firstExpression );
- setCompletionContext( context );
- setCompletionKind( IASTCompletionNode.CompletionKind.MEMBER_REFERENCE );
-
- secondExpression = primaryExpression(scope);
- try
- {
- firstExpression =
- astFactory.createExpression(
- scope,
- (isTemplate
- ? IASTExpression.Kind.POSTFIX_ARROW_TEMPL_IDEXP
- : IASTExpression.Kind.POSTFIX_ARROW_IDEXPRESSION),
- firstExpression,
- secondExpression,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- failParse();
- setCompletionContext( null );
- throw backtrack;
- } catch (Exception e)
- {
- setCompletionContext( null );
- throw backtrack;
- }
- break;
- default :
- return firstExpression;
- }
- }
- }
-
-
-
- /**
- * @return
- * @throws EndOfFileException
- */
- protected boolean queryLookaheadCapability() throws EndOfFileException {
- //make sure we can look ahead one before doing this
- boolean result = true;
- try
- {
- LA(1);
- }
- catch( OffsetLimitReachedException olre )
- {
- result = false;
- }
- return result;
- }
- protected IASTExpression specialCastExpression( IASTScope scope,
- IASTExpression.Kind kind)
- throws EndOfFileException, BacktrackException
- {
- consume();
- consume(IToken.tLT);
- IASTTypeId duple = typeId(scope, false);
- consume(IToken.tGT);
- consume(IToken.tLPAREN);
- IASTExpression lhs = expression(scope);
- consume(IToken.tRPAREN);
- try
- {
- return astFactory.createExpression(
- scope,
- kind,
- lhs,
- null,
- null,
- duple,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- protected IASTExpression simpleTypeConstructorExpression( IASTScope scope,
- Kind type)
- throws EndOfFileException, BacktrackException
- {
- consume();
- consume(IToken.tLPAREN);
- IASTExpression inside = expression(scope);
- consume(IToken.tRPAREN);
- try
- {
- return astFactory.createExpression(
- scope,
- type,
- inside,
- null,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e)
- {
- failParse();
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- }
- /**
- * @param expression
- * @throws BacktrackException
- */
- protected IASTExpression primaryExpression( IASTScope scope )
- throws EndOfFileException, BacktrackException
- {
- IToken t = null;
- IASTExpression emptyExpression = null;
- try {
- emptyExpression = astFactory.createExpression(
- scope,
- IASTExpression.Kind.PRIMARY_EMPTY,
- null,
- null,
- null,
- null,
- null, "", null);
- } catch (ASTSemanticException e9) {
- // TODO Auto-generated catch block
- e9.printStackTrace();
- }
- if( !queryLookaheadCapability() ) return emptyExpression;
- switch (LT(1))
- {
- // TO DO: we need more literals...
- case IToken.tINTEGER :
- t = consume();
- try
- {
- return astFactory.createExpression(
- scope,
- IASTExpression.Kind.PRIMARY_INTEGER_LITERAL,
- null,
- null,
- null,
- null,
- null, t.getImage(), null);
- }
- catch (ASTSemanticException e1)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- case IToken.tFLOATINGPT :
- t = consume();
- try
- {
- return astFactory.createExpression(
- scope,
- IASTExpression.Kind.PRIMARY_FLOAT_LITERAL,
- null,
- null,
- null,
- null,
- null, t.getImage(), null);
- }
- catch (ASTSemanticException e2)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- case IToken.tSTRING :
- case IToken.tLSTRING :
- t = consume();
- try
- {
- return astFactory.createExpression( scope, IASTExpression.Kind.PRIMARY_STRING_LITERAL, null, null, null, null, null, t.getImage(), null );
- }
- catch (ASTSemanticException e5)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
-
- case IToken.t_false :
- case IToken.t_true :
- t = consume();
- try
- {
- return astFactory.createExpression(
- scope,
- IASTExpression.Kind.PRIMARY_BOOLEAN_LITERAL,
- null,
- null,
- null,
- null,
- null, t.getImage(), null);
- }
- catch (ASTSemanticException e3)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
-
- case IToken.tCHAR :
- case IToken.tLCHAR :
-
- t = consume();
- try
- {
- return astFactory.createExpression(
- scope,
- IASTExpression.Kind.PRIMARY_CHAR_LITERAL,
- null,
- null,
- null,
- null,
- null, t.getImage(), null);
- }
- catch (ASTSemanticException e4)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
-
- case IToken.t_this :
- consume(IToken.t_this);
- try
- {
- return astFactory.createExpression(
- scope,
- IASTExpression.Kind.PRIMARY_THIS,
- null,
- null,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e7)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- case IToken.tLPAREN :
- consume();
- IASTExpression lhs = expression(scope);
- consume(IToken.tRPAREN);
- try
- {
- return astFactory.createExpression(
- scope,
- IASTExpression.Kind.PRIMARY_BRACKETED_EXPRESSION,
- lhs,
- null,
- null,
- null,
- null, "", null);
- }
- catch (ASTSemanticException e6)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- case IToken.tIDENTIFIER :
- case IToken.tCOLONCOLON :
- case IToken.t_operator :
- ITokenDuple duple = null;
-
- IToken mark = mark();
- try
- {
- duple = name();
- }
- catch( BacktrackException bt )
- {
- Declarator d = new Declarator( new DeclarationWrapper(scope, 0, null) );
-
- if (LT(1) == IToken.tCOLONCOLON || LT(1) == IToken.tIDENTIFIER)
- {
- IToken start = consume();
- IToken end = null;
- if (start.getType() == IToken.tIDENTIFIER)
- end = consumeTemplateParameters(end);
- while (LT(1) == IToken.tCOLONCOLON || LT(1) == IToken.tIDENTIFIER)
- {
- end = consume();
- if (end.getType() == IToken.tIDENTIFIER)
- end = consumeTemplateParameters(end);
- }
- if (LT(1) == IToken.t_operator)
- operatorId(d, start);
- else
- {
- backup(mark);
- throw backtrack;
- }
- }
- else if( LT(1) == IToken.t_operator )
- operatorId( d, null);
-
- duple = d.getNameDuple();
- }
- catch(OffsetLimitReachedException olre )
- {
- backup(mark);
- throw backtrack;
- }
-
-
- try
- {
- return astFactory.createExpression(
- scope,
- IASTExpression.Kind.ID_EXPRESSION,
- null,
- null,
- null,
- null,
- duple, "", null);
- }
- catch (ASTSemanticException e8)
- {
- throw backtrack;
- } catch (Exception e)
- {
- throw backtrack;
- }
- default :
- return emptyExpression;
- }
- }
- /**
- * @throws Exception
- */
- protected void varName() throws Exception
- {
- if (LT(1) == IToken.tCOLONCOLON)
- consume();
- for (;;)
- {
- switch (LT(1))
- {
- case IToken.tIDENTIFIER :
- consume();
- //if (isTemplateArgs()) {
- // rTemplateArgs();
- //}
- if (LT(1) == IToken.tCOLONCOLON)
- {
- switch (LT(2))
- {
- case IToken.tIDENTIFIER :
- case IToken.tCOMPL :
- case IToken.t_operator :
- consume();
- break;
- default :
- return;
- }
- }
- else
- return;
- break;
- case IToken.tCOMPL :
- consume();
- consume(IToken.tIDENTIFIER);
- return;
- case IToken.t_operator :
- consume();
- //rOperatorName();
- return;
- default :
- throw backtrack;
- }
- }
- }
-
- // the static instance we always use
- private static BacktrackException backtrack = new BacktrackException();
-
- // Token management
- protected IScanner scanner;
- protected IToken currToken, // current token we plan to consume next
- lastToken; // last token we consumed
- private boolean limitReached = false;
-
- protected void setCurrentScope( IASTScope scope )
- {
- }
-
- /**
- * Fetches a token from the scanner.
- *
- * @return the next token from the scanner
- * @throws EndOfFileException thrown when the scanner.nextToken() yields no tokens
- */
- protected IToken fetchToken() throws EndOfFileException
- {
- if(limitReached) throw new OffsetLimitReachedException(getCompletionToken());
-
- try
- {
- return scanner.nextToken();
- }
- catch( OffsetLimitReachedException olre )
- {
- limitReached = true;
- handleOffsetLimitException(olre);
- return null;
- }
- catch (ScannerException e)
- {
- log.traceLog( "ScannerException thrown : " + e.getProblem().getMessage() );
- log.errorLog( "Scanner Exception: " + e.getProblem().getMessage()); //$NON-NLS-1$h
- failParse();
- return fetchToken();
- }
- }
-
- protected void handleOffsetLimitException(OffsetLimitReachedException exception) throws EndOfFileException {
- // unexpected, throw EOF instead (equivalent)
- throw new EndOfFileException();
- }
- /**
- * Look Ahead in the token list to see what is coming.
- *
- * @param i How far ahead do you wish to peek?
- * @return the token you wish to observe
- * @throws EndOfFileException if looking ahead encounters EOF, throw EndOfFile
- */
- protected IToken LA(int i) throws EndOfFileException
- {
- if (i < 1) // can't go backwards
- return null;
- if (currToken == null)
- currToken = fetchToken();
- IToken retToken = currToken;
- for (; i > 1; --i)
- {
- retToken = retToken.getNext();
- if (retToken == null)
- retToken = fetchToken();
- }
- return retToken;
- }
- /**
- * Look ahead in the token list and return the token type.
- *
- * @param i How far ahead do you wish to peek?
- * @return The type of that token
- * @throws EndOfFileException if looking ahead encounters EOF, throw EndOfFile
- */
- protected int LT(int i) throws EndOfFileException
- {
- return LA(i).getType();
- }
- /**
- * Consume the next token available, regardless of the type.
- *
- * @return The token that was consumed and removed from our buffer.
- * @throws EndOfFileException If there is no token to consume.
- */
- protected IToken consume() throws EndOfFileException
- {
- if (currToken == null)
- currToken = fetchToken();
- if (currToken != null)
- lastToken = currToken;
- currToken = currToken.getNext();
- return lastToken;
- }
- /**
- * Consume the next token available only if the type is as specified.
- *
- * @param type The type of token that you are expecting.
- * @return the token that was consumed and removed from our buffer.
- * @throws BacktrackException If LT(1) != type
- */
- protected IToken consume(int type) throws EndOfFileException, BacktrackException
- {
- if (LT(1) == type)
- return consume();
- else
- throw backtrack;
- }
- /**
- * Mark our place in the buffer so that we could return to it should we have to.
- *
- * @return The current token.
- * @throws EndOfFileException If there are no more tokens.
- */
- protected IToken mark() throws EndOfFileException
- {
- if (currToken == null)
- currToken = fetchToken();
- return currToken;
- }
- /**
- * Rollback to a previous point, reseting the queue of tokens.
- *
- * @param mark The point that we wish to restore to.
- *
- */
- protected void backup(IToken mark)
- {
- currToken = (Token)mark;
- lastToken = null; // this is not entirely right ...
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IParser#getLanguage()
- */
- public ParserLanguage getLanguage()
- {
- return language;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IParser#setLanguage(Language)
- */
- public void setLanguage( ParserLanguage l )
- {
- language = l;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IParser#getLastErrorOffset()
- */
- public int getLastErrorOffset()
- {
- return firstErrorOffset;
- }
-
- protected void setCompletionContext( IASTNode node )
- {
- }
-
- protected void setCompletionKind( IASTCompletionNode.CompletionKind kind )
- {
- }
-
- protected void setCompletionKeywords(KeywordSets.Key key )
- {
- }
-
- protected void setCompletionToken( IToken token )
- {
- }
-
- protected IToken getCompletionToken()
- {
- return null;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParserException.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParserException.java
deleted file mode 100644
index d50223aebef..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParserException.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001 Rational Software Corp. 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 implementation
- ******************************************************************************/
-package org.eclipse.cdt.internal.core.parser;
-
-
-public class ParserException extends Exception {
-
- public ParserException( String msg )
- {
- super( msg );
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Preprocessor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Preprocessor.java
deleted file mode 100644
index 43c78edf831..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Preprocessor.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**********************************************************************
- * 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.io.Reader;
-
-import org.eclipse.cdt.core.parser.EndOfFileException;
-import org.eclipse.cdt.core.parser.IParserLogService;
-import org.eclipse.cdt.core.parser.IPreprocessor;
-import org.eclipse.cdt.core.parser.IScannerInfo;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.OffsetLimitReachedException;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.core.parser.ParserMode;
-import org.eclipse.cdt.core.parser.ScannerException;
-
-
-/**
- * @author jcamelon
- *
- */
-public class Preprocessor extends Scanner implements IPreprocessor {
-
- /**
- * @param reader
- * @param filename
- * @param defns
- */
- public Preprocessor(Reader reader, String filename, IScannerInfo info, ISourceElementRequestor requestor, ParserMode mode, ParserLanguage language, IParserLogService logService ) {
- super(reader, filename, info, requestor, mode, language, logService );
- }
-
- public void process()
- {
- try
- {
- while( true )
- nextToken();
- }
- catch( ScannerException se )
- {
- // callback IProblem here
- log.errorLog("Preprocessor Exception "+ se.getProblem().getMessage()); //$NON-NLS-1$h
- }
- catch( OffsetLimitReachedException olre )
- {
- // callback IProblem here
- log.errorLog("Preprocessor Exception "+ olre.getMessage()); //$NON-NLS-1$h
- }
- catch( EndOfFileException eof )
- {
- // expected
- }
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Problem.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Problem.java
deleted file mode 100644
index 3470108560f..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Problem.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/**********************************************************************
- * 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.Map;
-
-import org.eclipse.cdt.core.parser.IProblem;
-
-/**
- * @author jcamelon
- *
- */
-public class Problem implements IProblem {
-
- private final Map arguments;
- private final int id;
- private final int sourceStart;
- private final int sourceEnd;
- private final int lineNumber;
-
- private final boolean isError;
- private final boolean isWarning;
- private final char[] originatingFileName;
- private final String message;
-
- public Problem( int id, int start, int end, int line, char [] file, String message, Map arguments, boolean warn, boolean error )
- {
- this.id = id;
- this.sourceStart = start;
- this.sourceEnd = end;
- this.lineNumber = line;
- this.originatingFileName = file;
- this.message = message;
- this.arguments = arguments;
- this.isWarning = warn;
- this.isError = error;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#getID()
- */
- public int getID() {
- return id;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#getOriginatingFileName()
- */
- public char[] getOriginatingFileName() {
- return originatingFileName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#getSourceEnd()
- */
- public int getSourceEnd() {
- return sourceEnd;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#getSourceLineNumber()
- */
- public int getSourceLineNumber() {
- return lineNumber;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#getSourceStart()
- */
- public int getSourceStart() {
- return sourceStart;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#isError()
- */
- public boolean isError() {
- return isError;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#isWarning()
- */
- public boolean isWarning() {
- return isWarning;
- }
-
-
- public String getMessage()
- {
- return message;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#checkCategory(int)
- */
- public boolean checkCategory(int bitmask) {
- return ((id & bitmask) != 0 );
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#getArguments()
- */
- public Map getArguments() {
- return arguments;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/QuickParseCallback.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/QuickParseCallback.java
deleted file mode 100644
index cf413b3291c..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/QuickParseCallback.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/**********************************************************************
- * 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.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-
-import org.eclipse.cdt.core.parser.*;
-import org.eclipse.cdt.core.parser.IQuickParseCallback;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
-import org.eclipse.cdt.core.parser.ast.IASTFunction;
-import org.eclipse.cdt.core.parser.ast.IASTInclusion;
-import org.eclipse.cdt.core.parser.ast.IASTMacro;
-import org.eclipse.cdt.core.parser.ast.IASTMethod;
-import org.eclipse.cdt.core.parser.ast.IASTOffsetableElement;
-
-
-public class QuickParseCallback extends NullSourceElementRequestor implements IQuickParseCallback
-{
- protected IASTCompilationUnit compilationUnit = null;
- protected List inclusions = new ArrayList();
- protected List macros = new ArrayList();
-
- public Iterator getInclusions()
- {
- return inclusions.iterator();
- }
-
- public Iterator getMacros()
- {
- return macros.iterator();
- }
-
- public Iterator getDeclarations(){
- try{
- return compilationUnit.getDeclarations();
- }
- catch (ASTNotImplementedException ne )
- {
- return null;
- }
- }
-
- public void exitMethodBody( IASTMethod method )
- {
- method.setHasFunctionBody( true );
- }
-
-
- public void exitFunctionBody( IASTFunction function )
- {
- function.setHasFunctionBody( true );
- }
-
-
-
- public void exitCompilationUnit( IASTCompilationUnit compilationUnit )
- {
- this.compilationUnit = compilationUnit;
- }
-
- public void exitInclusion( IASTInclusion inclusion )
- {
- inclusions.add( inclusion );
- }
-
- public void acceptMacro( IASTMacro macro )
- {
- macros.add( macro );
- }
-
- /**
- * @return
- */
- public IASTCompilationUnit getCompilationUnit()
- {
- return compilationUnit;
- }
-
- public class OffsetableIterator implements Iterator
- {
- private Iterator declarationIter;
- private final Iterator inclusionIter;
- private final Iterator macroIter;
-
- private IASTOffsetableElement currentMacro = null, currentInclusion= null, currentDeclaration= null;
-
- public OffsetableIterator()
- {
- declarationIter = getDeclarations();
- inclusionIter = getInclusions();
- macroIter = getMacros();
- updateInclusionIterator();
- updateMacroIterator();
- updateDeclarationIterator();
- }
-
- private Object updateDeclarationIterator()
- {
- Object offsetable = currentDeclaration;
- if(declarationIter != null)
- currentDeclaration = ( declarationIter.hasNext() ) ? (IASTOffsetableElement)declarationIter.next() : null;
- return offsetable;
- }
-
- private Object updateMacroIterator()
- {
- Object offsetable = currentMacro;
- currentMacro = ( macroIter.hasNext() ) ? (IASTOffsetableElement)macroIter.next() : null;
- return offsetable;
- }
-
- private Object updateInclusionIterator()
- {
- Object offsetable = currentInclusion;
- currentInclusion = ( inclusionIter.hasNext() ) ? (IASTOffsetableElement)inclusionIter.next() : null;
- return offsetable;
- }
- /* (non-Javadoc)
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext() {
- return (( currentMacro == null && currentInclusion == null && currentDeclaration == null ) ?
- false : true);
- }
-
- /* (non-Javadoc)
- * @see java.util.Iterator#next()
- */
- public Object next() {
- // case 1: all are null
- if( ! hasNext() )
- throw new NoSuchElementException();
-
- // case 2: two of three are null
- if( currentMacro == null && currentInclusion == null )
- return updateDeclarationIterator();
- if( currentDeclaration == null && currentInclusion == null )
- return updateMacroIterator();
- if( currentMacro == null && currentDeclaration == null )
- return updateInclusionIterator();
-
- // case 3: 1 is null
- if( currentMacro == null )
- if( currentDeclaration.getStartingOffset() < currentInclusion.getStartingOffset() )
- return updateDeclarationIterator();
- else
- return updateInclusionIterator();
-
- if( currentInclusion == null )
- if( currentDeclaration.getStartingOffset() < currentMacro.getStartingOffset() )
- return updateDeclarationIterator();
- else
- return updateMacroIterator();
-
- if( currentDeclaration == null )
- if( currentInclusion.getStartingOffset() < currentMacro.getStartingOffset() )
- return updateInclusionIterator();
- else
- return updateMacroIterator();
-
- // case 4: none are null
- if( currentInclusion.getStartingOffset() < currentMacro.getStartingOffset() &&
- currentInclusion.getStartingOffset() < currentDeclaration.getStartingOffset() )
- return updateInclusionIterator();
-
- if( currentMacro.getStartingOffset() < currentInclusion.getStartingOffset() &&
- currentMacro.getStartingOffset() < currentDeclaration.getStartingOffset() )
- return updateMacroIterator();
- // only remaining case
- return updateDeclarationIterator();
- }
-
- /* (non-Javadoc)
- * @see java.util.Iterator#remove()
- */
- public void remove() {
- throw new UnsupportedOperationException( "OffsetableIterator is a const iterator");
- }
- }
-
- public Iterator iterateOffsetableElements()
- {
- return new OffsetableIterator();
- }
-} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/QuickParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/QuickParser.java
deleted file mode 100644
index a5c05a5d58d..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/QuickParser.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**********************************************************************
- * 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 org.eclipse.cdt.core.parser.BacktrackException;
-import org.eclipse.cdt.core.parser.EndOfFileException;
-import org.eclipse.cdt.core.parser.IParserLogService;
-import org.eclipse.cdt.core.parser.IScanner;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ParserFactory;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.core.parser.ParserMode;
-import org.eclipse.cdt.core.parser.ParserNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTCompletionNode;
-import org.eclipse.cdt.core.parser.ast.IASTNode;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-
-/**
- * @author jcamelon
- */
-public class QuickParser extends Parser {
-
- /**
- * @param scanner
- * @param callback
- * @param mode
- * @param language
- * @param log
- */
- public QuickParser(IScanner scanner, ISourceElementRequestor callback, ParserLanguage language, IParserLogService log) {
- super(scanner, callback, language, log);
- astFactory = ParserFactory.createASTFactory( ParserMode.QUICK_PARSE, language);
- scanner.setASTFactory(astFactory);
- }
-
- protected void handleFunctionBody(IASTScope scope, boolean isInlineFunction) throws BacktrackException, EndOfFileException
- {
- skipOverCompoundStatement();
- }
-
- protected void catchBlockCompoundStatement(IASTScope scope) throws BacktrackException, EndOfFileException
- {
- skipOverCompoundStatement();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IParser#parse(int)
- */
- public IASTCompletionNode parse(int offset) throws ParserNotImplementedException {
- throw new ParserNotImplementedException();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IParser#parse(int, int)
- */
- public IASTNode parse(int startingOffset, int endingOffset) throws ParserNotImplementedException {
- throw new ParserNotImplementedException();
- }
-
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Scanner.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Scanner.java
deleted file mode 100644
index 6b6959b3384..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Scanner.java
+++ /dev/null
@@ -1,2749 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001 Rational Software Corp. 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 implementation
- ******************************************************************************/
-package org.eclipse.cdt.internal.core.parser;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.EmptyStackException;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import org.eclipse.cdt.core.parser.BacktrackException;
-import org.eclipse.cdt.core.parser.EndOfFileException;
-import org.eclipse.cdt.core.parser.ILineOffsetReconciler;
-import org.eclipse.cdt.core.parser.IMacroDescriptor;
-import org.eclipse.cdt.core.parser.IParser;
-import org.eclipse.cdt.core.parser.IParserLogService;
-import org.eclipse.cdt.core.parser.IProblem;
-import org.eclipse.cdt.core.parser.IScanner;
-import org.eclipse.cdt.core.parser.IScannerInfo;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.IToken;
-import org.eclipse.cdt.core.parser.Keywords;
-import org.eclipse.cdt.core.parser.NullSourceElementRequestor;
-import org.eclipse.cdt.core.parser.OffsetLimitReachedException;
-import org.eclipse.cdt.core.parser.ParserFactory;
-import org.eclipse.cdt.core.parser.ParserFactoryException;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.core.parser.ParserMode;
-import org.eclipse.cdt.core.parser.ScannerException;
-import org.eclipse.cdt.core.parser.ScannerInfo;
-import org.eclipse.cdt.core.parser.ast.ExpressionEvaluationException;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.core.parser.ast.IASTFactory;
-import org.eclipse.cdt.core.parser.ast.IASTInclusion;
-
-/**
- * @author jcamelon
- *
- */
-
-public class Scanner implements IScanner {
-
-
- protected final IParserLogService log;
- private final static String SCRATCH = "<scratch>";
- private Reader backupReader;
- private IProblemFactory problemFactory = new ScannerProblemFactory();
- private boolean initialContextInitialized = false;
- private final String filename;
- private final Reader reader;
- protected IToken finalToken;
-
- protected void handleProblem( int problemID, String argument, int beginningOffset, boolean warning, boolean error ) throws ScannerException
- {
- handleProblem( problemID, argument, beginningOffset, warning, error, true );
- }
-
- protected void handleProblem( int problemID, String argument, int beginningOffset, boolean warning, boolean error, boolean extra ) throws ScannerException
- {
- Map arguments = new HashMap();
- if( argument != null )
- {
- String attributes [] = problemFactory.getRequiredAttributesForId( problemID );
- arguments.put( attributes[ 0 ], argument );
- }
- IProblem p = problemFactory.createProblem( problemID, beginningOffset, getCurrentOffset(), contextStack.getCurrentLineNumber(), getCurrentFile().toCharArray(), arguments, warning, error );
- if( (! requestor.acceptProblem( p )) && extra )
- throw new ScannerException( p );
- }
-
- public Scanner(Reader reader, String filename, IScannerInfo info, ISourceElementRequestor requestor, ParserMode parserMode, ParserLanguage language, IParserLogService log ) {
- this.log = log;
- this.requestor = requestor;
- this.mode = parserMode;
- this.filename = filename;
- this.reader = reader;
- this.language = language;
- astFactory = ParserFactory.createASTFactory( mode, language );
- this.backupReader = reader;
- contextStack = new ContextStack( log );
- try {
- //this is a hack to get around a sudden EOF experience
- contextStack.push(
- new ScannerContext(
- new StringReader("\n"),
- START,
- ScannerContext.ContextKind.SENTINEL, null), requestor);
-
- } catch( ContextException ce ) {
- //won't happen since we aren't adding an include or a macro
- }
-
- originalConfig = info;
- if( info.getDefinedSymbols() != null )
- definitions.putAll( info.getDefinedSymbols() );
-
- if( info.getIncludePaths() != null )
- overwriteIncludePath( info.getIncludePaths() );
-
-
- }
-
- private void setupInitialContext()
- {
- String resolvedFilename = filename == null ? TEXT : filename;
- IScannerContext context = null;
- try
- {
- if( offsetLimit == NO_OFFSET_LIMIT )
- context = new ScannerContext(reader, resolvedFilename, ScannerContext.ContextKind.TOP, null );
- else
- context = new LimitedScannerContext( reader, resolvedFilename, ScannerContext.ContextKind.TOP, offsetLimit );
- contextStack.push( context, requestor );
- } catch( ContextException ce )
- {
- handleInternalError();
- }
- initialContextInitialized = true;
- }
- public void addIncludePath(String includePath) {
- includePathNames.add(includePath);
- includePaths.add( new File( includePath ) );
- }
-
- public void overwriteIncludePath(String [] newIncludePaths) {
- if( newIncludePaths == null ) return;
- includePathNames = null;
- includePaths = null;
- includePathNames = new ArrayList();
- includePaths = new ArrayList();
-
- for( int i = 0; i < newIncludePaths.length; ++i )
- includePathNames.add( newIncludePaths[i] );
-
- Iterator i = includePathNames.iterator();
- while( i.hasNext() )
- {
- String path = (String) i.next();
- includePaths.add( new File( path ));
- }
-
-
- }
-
- public void addDefinition(String key, IMacroDescriptor macro) {
- definitions.put(key, macro);
- }
-
- public void addDefinition(String key, String value) {
- definitions.put(key, value);
- }
-
- public final Object getDefinition(String key) {
- return definitions.get(key);
- }
-
- public final String[] getIncludePaths() {
- return (String[])includePathNames.toArray();
- }
-
- protected boolean skipOverWhitespace() throws ScannerException {
- int c = getChar();
- boolean result = false;
- while ((c != NOCHAR) && ((c == ' ') || (c == '\t')))
- {
- c = getChar();
- result = true;
- }
- if (c != NOCHAR)
- ungetChar(c);
- return result;
-
- }
-
- protected String getRestOfPreprocessorLine() throws ScannerException {
- StringBuffer buffer = new StringBuffer();
- skipOverWhitespace();
- int c = getChar();
- boolean inString = false;
- boolean inChar = false;
- while (true) {
- while ((c != '\n')
- && (c != '\r')
- && (c != '\\')
- && (c != '/')
- && (c != '"' || ( c == '"' && inChar ) )
- && (c != '\'' || ( c == '\'' && inString ) )
- && (c != NOCHAR)) {
- buffer.append((char) c);
- c = getChar( true );
- }
-
- if (c == '/') {
- //only care about comments outside of a quote
- if( inString || inChar ){
- buffer.append( (char) c );
- c = getChar( true );
- continue;
- }
-
- // we need to peek ahead at the next character to see if
- // this is a comment or not
- int next = getChar();
- if (next == '/') {
- // single line comment
- skipOverSinglelineComment();
- break;
- } else if (next == '*') {
- // multiline comment
- if (skipOverMultilineComment())
- break;
- else
- c = getChar( true );
- continue;
- } else {
- // we are not in a comment
- buffer.append((char) c);
- c = next;
- continue;
- }
- } else if( c == '"' ){
- inString = !inString;
- buffer.append((char) c);
- c = getChar( true );
- continue;
- } else if( c == '\'' ){
- inChar = !inChar;
- buffer.append((char) c);
- c = getChar( true );
- continue;
- } else if( c == '\\' ){
- c = getChar(true);
- if( c == '\r' ){
- c = getChar(true);
- if( c == '\n' ){
- c = getChar(true);
- }
- } else if( c == '\n' ){
- c = getChar(true);
- } else {
- buffer.append('\\');
- if( c == '"' || c == '\'' ){
- buffer.append((char)c);
- c = getChar( true );
- }
- }
- continue;
- } else {
- ungetChar(c);
- break;
- }
- }
-
- return buffer.toString();
- }
-
- protected void skipOverTextUntilNewline() throws ScannerException {
- for (;;) {
- switch (getChar()) {
- case NOCHAR :
- case '\n' :
- return;
- case '\\' :
- getChar();
- }
- }
- }
-
- private void setCurrentToken(IToken t) {
- if (currentToken != null)
- currentToken.setNext(t);
- finalToken = t;
- currentToken = t;
- }
-
- protected void resetStorageBuffer()
- {
- if( storageBuffer != null )
- storageBuffer = null;
- }
-
- protected IToken newToken(int t, String i, IScannerContext c) {
- setCurrentToken(new Token(t, i, c));
- return currentToken;
- }
-
- protected IToken newToken(int t, String i) {
- setCurrentToken(new Token(t, i));
- return currentToken;
- }
-
- protected String getNextIdentifier() throws ScannerException {
- StringBuffer buffer = new StringBuffer();
- skipOverWhitespace();
- int c = getChar();
-
- if (((c >= 'a') && (c <= 'z'))
- || ((c >= 'A') && (c <= 'Z')) | (c == '_')) {
- buffer.append((char) c);
-
- c = getChar();
- while (((c >= 'a') && (c <= 'z'))
- || ((c >= 'A') && (c <= 'Z'))
- || ((c >= '0') && (c <= '9'))
- || (c == '_')) {
- buffer.append((char) c);
- c = getChar();
- }
- }
- ungetChar(c);
-
- return buffer.toString();
- }
-
- protected void handleInclusion(String fileName, boolean useIncludePaths, int nameOffset, int beginOffset, int endOffset ) throws ScannerException {
-
- FileReader inclusionReader = null;
- String newPath = null;
- if( useIncludePaths ) // search include paths for this file
- {
- // iterate through the include paths
- Iterator iter = includePaths.iterator();
-
- while (iter.hasNext()) {
-
- File pathFile = (File)iter.next();
- String path = pathFile.getPath();
- if( !pathFile.exists() && path.indexOf('\"') != -1 )
- {
- StringTokenizer tokenizer = new StringTokenizer(path, "\"" ); //$NON-NLS-1$
- StringBuffer buffer = new StringBuffer(path.length() );
- while( tokenizer.hasMoreTokens() ){
- buffer.append( tokenizer.nextToken() );
- }
- pathFile = new File( buffer.toString() );
- }
- if (pathFile.isDirectory()) {
- newPath = pathFile.getPath() + File.separatorChar + fileName;
- File includeFile = new File(newPath);
- if (includeFile.exists() && includeFile.isFile()) {
- try {
- inclusionReader = new FileReader(includeFile);
- break;
- } catch (FileNotFoundException fnf) {
- // do nothing - check the next directory
- }
- }
- }
- }
-
- if (inclusionReader == null )
- {
- handleProblem( IProblem.PREPROCESSOR_INCLUSION_NOT_FOUND, fileName, beginOffset, false, true, true );
- }
- }
- else // local inclusion
- {
- String currentFilename = contextStack.getCurrentContext().getFilename();
- File currentIncludeFile = new File( currentFilename );
- String parentDirectory = currentIncludeFile.getParentFile().getAbsolutePath();
- currentIncludeFile = null;
- newPath = parentDirectory + File.separatorChar + fileName;
- File includeFile = new File( newPath );
- if (includeFile.exists() && includeFile.isFile()) {
- try {
- inclusionReader =
- new FileReader(includeFile);
- } catch (FileNotFoundException fnf) {
- // the spec says that if finding in the local directory fails, search the include paths
- handleInclusion( fileName, true, nameOffset, beginOffset, endOffset );
- }
- }
- else
- {
- // the spec says that if finding in the local directory fails, search the include paths
- handleInclusion( fileName, true, nameOffset, beginOffset, endOffset );
- }
- }
- if (inclusionReader != null) {
- IASTInclusion inclusion = null;
- try
- {
- inclusion =
- astFactory.createInclusion(
- fileName,
- newPath,
- !useIncludePaths,
- beginOffset,
- nameOffset,
- nameOffset + fileName.length(),
- endOffset);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
-
- try
- {
- contextStack.updateContext(inclusionReader, newPath, ScannerContext.ContextKind.INCLUSION, inclusion, requestor );
- }
- catch (ContextException e1)
- {
- handleProblem( e1.getId(), fileName, beginOffset, false, true, true );
- }
- }
- }
-
- // constants
- private static final int NOCHAR = -1;
-
- private static final String TEXT = "<text>";
- private static final String START = "<initial reader>";
- private static final String EXPRESSION = "<expression>";
- private static final String PASTING = "<pasting>";
-
- private static final String DEFINED = "defined";
- private static final String _PRAGMA = "_Pragma";
- private static final String POUND_DEFINE = "#define ";
-
- private ContextStack contextStack = null;
- private IScannerContext lastContext = null;
-
- private IScannerInfo originalConfig;
- private List includePathNames = new ArrayList();
- private List includePaths = new ArrayList();
- private Hashtable definitions = new Hashtable();
- private StringBuffer storageBuffer = null;
-
- private int count = 0;
- private static HashMap cppKeywords = new HashMap();
- private static HashMap cKeywords = new HashMap();
- private static HashMap ppDirectives = new HashMap();
-
- private IToken currentToken = null;
- private IToken cachedToken = null;
-
- private boolean passOnToClient = true;
- private BranchTracker branches = new BranchTracker();
-
- // these are scanner configuration aspects that we perhaps want to tweak
- // eventually, these should be configurable by the client, but for now
- // we can just leave it internal
- private boolean enableDigraphReplacement = true;
- private boolean enableTrigraphReplacement = true;
- private boolean enableTrigraphReplacementInStrings = true;
- private boolean throwExceptionOnBadCharacterRead = false;
- private boolean atEOF = false;
-
- private boolean tokenizingMacroReplacementList = false;
- public void setTokenizingMacroReplacementList( boolean mr ){
- tokenizingMacroReplacementList = mr;
- }
-
- private final ParserMode mode;
-
- public int getCharacter() throws ScannerException
- {
- if( ! initialContextInitialized )
- setupInitialContext();
-
- return getChar();
- }
-
- private int getChar() throws ScannerException
- {
- return getChar( false );
- }
-
- private int getChar( boolean insideString ) throws ScannerException {
- int c = NOCHAR;
-
- lastContext = contextStack.getCurrentContext();
-
- if (contextStack.getCurrentContext() == null)
- // past the end of file
- return c;
-
- c = accountForUndo(c);
-
- int baseOffset = lastContext.getOffset() - lastContext.undoStackSize() - 1;
-
- if (enableTrigraphReplacement && (!insideString || enableTrigraphReplacementInStrings)) {
- // Trigraph processing
- enableTrigraphReplacement = false;
- if (c == '?') {
- c = getChar(insideString);
- if (c == '?') {
- c = getChar(insideString);
- switch (c) {
- case '(':
- expandDefinition("??(", "[", baseOffset);
- c = getChar(insideString);
- break;
- case ')':
- expandDefinition("??)", "]", baseOffset);
- c = getChar(insideString);
- break;
- case '<':
- expandDefinition("??<", "{", baseOffset);
- c = getChar(insideString);
- break;
- case '>':
- expandDefinition("??>", "}", baseOffset);
- c = getChar(insideString);
- break;
- case '=':
- expandDefinition("??=", "#", baseOffset);
- c = getChar(insideString);
- break;
- case '/':
- expandDefinition("??/", "\\", baseOffset);
- c = getChar(insideString);
- break;
- case '\'':
- expandDefinition("??\'", "^", baseOffset);
- c = getChar(insideString);
- break;
- case '!':
- expandDefinition("??!", "|", baseOffset);
- c = getChar(insideString);
- break;
- case '-':
- expandDefinition("??-", "~", baseOffset);
- c = getChar(insideString);
- break;
- default:
- // Not a trigraph
- ungetChar(c);
- ungetChar('?');
- c = '?';
- }
- } else {
- // Not a trigraph
- ungetChar(c);
- c = '?';
- }
- }
- enableTrigraphReplacement = true;
- }
-
- if (!insideString)
- {
- if (c == '\\') {
- c = getChar(false);
- if (c == '\r') {
- c = getChar(false);
- if (c == '\n')
- {
- c = getChar(false);
- }
- } else if (c == '\n')
- {
- c = getChar(false);
-
- } else // '\' is not the last character on the line
- {
- ungetChar(c);
- c = '\\';
- }
- } else if (enableDigraphReplacement) {
- enableDigraphReplacement = false;
- // Digraph processing
- if (c == '<') {
- c = getChar(false);
- if (c == '%') {
- expandDefinition("<%", "{", baseOffset);
- c = getChar(false);
- } else if (c == ':') {
- expandDefinition("<:", "[", baseOffset);
- c = getChar(false);
- } else {
- // Not a digraph
- ungetChar(c);
- c = '<';
- }
- } else if (c == ':') {
- c = getChar(false);
- if (c == '>') {
- expandDefinition(":>", "]", baseOffset);
- c = getChar(false);
- } else {
- // Not a digraph
- ungetChar(c);
- c = ':';
- }
- } else if (c == '%') {
- c = getChar(false);
- if (c == '>') {
- expandDefinition("%>", "}", baseOffset);
- c = getChar(false);
- } else if (c == ':') {
- expandDefinition("%:", "#", baseOffset);
- c = getChar(false);
- } else {
- // Not a digraph
- ungetChar(c);
- c = '%';
- }
- }
- enableDigraphReplacement = true;
- }
- }
-
- return c;
- }
-
-
-
- protected int accountForUndo(int c)
- {
- boolean done;
- do {
- done = true;
-
- if (contextStack.getCurrentContext().undoStackSize() != 0 ) {
- c = contextStack.getCurrentContext().popUndo();
- } else {
- try {
- c = contextStack.getCurrentContext().read();
- if (c == NOCHAR) {
- if (contextStack.rollbackContext(requestor) == false) {
- c = NOCHAR;
- break;
- } else {
- done = false;
- }
- }
- } catch (IOException e) {
- if (contextStack.rollbackContext(requestor) == false) {
- c = NOCHAR;
- } else {
- done = false;
- }
- }
- }
- } while (!done);
- return c;
- }
-
- private void ungetChar(int c) throws ScannerException{
- contextStack.getCurrentContext().pushUndo(c);
- try
- {
- contextStack.undoRollback( lastContext, requestor );
- }
- catch (ContextException e)
- {
- handleProblem( e.getId(), contextStack.getCurrentContext().getFilename(), getCurrentOffset(), false, true, true );
- }
- }
-
- protected boolean lookAheadForTokenPasting() throws ScannerException
- {
- int c = getChar();
- if( c == '#' )
- {
- c = getChar();
- if( c == '#' )
- {
- return true;
- }
- else
- {
- ungetChar( c );
- }
- }
-
- ungetChar( c );
- return false;
-
- }
-
- protected void consumeUntilOutOfMacroExpansion() throws ScannerException
- {
- while( contextStack.getCurrentContext().getKind() == IScannerContext.ContextKind.MACROEXPANSION )
- getChar();
- }
-
- public IToken nextToken() throws ScannerException, EndOfFileException, OffsetLimitReachedException {
- return nextToken( true, false );
- }
-
- public IToken nextToken(boolean pasting) throws ScannerException, EndOfFileException, OffsetLimitReachedException {
- return nextToken( pasting, false );
- }
-
- public IToken nextToken( boolean pasting, boolean lookingForNextAlready ) throws ScannerException, EndOfFileException, OffsetLimitReachedException
- {
- if( ! initialContextInitialized )
- setupInitialContext();
-
- if( cachedToken != null ){
- setCurrentToken( cachedToken );
- cachedToken = null;
- return currentToken;
- }
-
- count++;
- boolean possibleWideLiteral = true;
- boolean wideLiteral = false;
- int c = getChar();
-
- while (c != NOCHAR) {
- if ( ! passOnToClient ) {
-
-
- while (c != NOCHAR && c != '#' )
- {
- c = getChar();
- if( c == '/' )
- {
- c = getChar();
- if( c == '/' )
- {
- skipOverSinglelineComment();
- c = getChar();
- continue;
- }
- else if( c == '*' )
- {
- skipOverMultilineComment();
- c = getChar();
- continue;
- }
- }
- }
-
- if( c == NOCHAR ) continue;
- }
-
- if ((c == ' ') || (c == '\r') || (c == '\t') || (c == '\n')) {
- c = getChar();
- continue;
- } else if (c == 'L' && possibleWideLiteral ) {
- int oldChar = c;
- c = getChar();
- if(!(c == '"' || c == '\'')) {
- // we have made a mistake
- ungetChar(c);
- c = oldChar;
- possibleWideLiteral = false;
- continue;
- }
- wideLiteral = true;
- continue;
- } else if (c == '"') {
- int beginOffset = getCurrentOffset();
- // string
- StringBuffer buff = new StringBuffer();
- int beforePrevious = NOCHAR;
- int previous = c;
- c = getChar(true);
-
- for( ; ; )
- {
- if ( ( c =='"' ) && ( previous != '\\' || beforePrevious == '\\') ) break;
- if ( ( c == '\n' ) && ( previous != '\\' || beforePrevious == '\\') )
- {
- handleProblem( IProblem.SCANNER_UNBOUNDED_STRING, null, beginOffset, false, true, true );
- }
-
- if( c == NOCHAR) break;
- buff.append((char) c);
- beforePrevious = previous;
- previous = c;
- c = getChar(true);
- }
-
- if (c != NOCHAR )
- {
- int type = wideLiteral ? IToken.tLSTRING : IToken.tSTRING;
-
- //If the next token is going to be a string as well, we need to concatenate
- //it with this token.
- IToken returnToken = newToken( type, buff.toString(), contextStack.getCurrentContext());
-
- if (!lookingForNextAlready) {
- IToken next = null;
- try{
- next = nextToken( true, true );
- } catch( EndOfFileException e ){
- next = null;
- }
-
- while( next != null && ( next.getType() == IToken.tSTRING ||
- next.getType() == IToken.tLSTRING ) ){
- returnToken.setImage( returnToken.getImage() + next.getImage() );
- returnToken.setNext( null );
- currentToken = returnToken;
- try{
- next = nextToken( true, true );
- } catch( EndOfFileException e ){
- next = null;
- }
- }
-
- cachedToken = next;
-
- }
-
- currentToken = returnToken;
- returnToken.setNext( null );
-
- return returnToken;
-
- } else
- handleProblem( IProblem.SCANNER_UNBOUNDED_STRING, null, beginOffset, false, true, true );
-
-
- } else if (
- ((c >= 'a') && (c <= 'z'))
- || ((c >= 'A') && (c <= 'Z')) || (c == '_')) {
-
- int baseOffset = lastContext.getOffset() - lastContext.undoStackSize() - 1;
-
- // String buffer is slow, we need a better way such as memory mapped files
- StringBuffer buff = new StringBuffer();
- buff.append((char) c);
-
- c = getChar();
-
- while (((c >= 'a') && (c <= 'z'))
- || ((c >= 'A') && (c <= 'Z'))
- || ((c >= '0') && (c <= '9'))
- || (c == '_')) {
- buff.append((char) c);
- c = getChar();
- }
-
- ungetChar(c);
-
- String ident = buff.toString();
-
- if (ident.equals(DEFINED))
- return newToken(IToken.tINTEGER, handleDefinedMacro());
-
- if( ident.equals(_PRAGMA) && language == ParserLanguage.C )
- {
- handlePragmaOperator();
- c = getChar();
- continue;
- }
-
- Object mapping = definitions.get(ident);
-
- if (mapping != null) {
- if( contextStack.shouldExpandDefinition( POUND_DEFINE + ident ) ) {
- expandDefinition(ident, mapping, baseOffset);
- c = getChar();
- continue;
- }
- }
-
- Object tokenTypeObject;
-
- if( language == ParserLanguage.CPP )
- tokenTypeObject = cppKeywords.get(ident);
- else
- tokenTypeObject = cKeywords.get(ident);
-
- int tokenType = IToken.tIDENTIFIER;
- if (tokenTypeObject != null)
- tokenType = ((Integer) tokenTypeObject).intValue();
-
- if( pasting )
- {
- if( lookAheadForTokenPasting() )
- {
- if( storageBuffer == null )
- storageBuffer = buff;
- else
- storageBuffer.append( ident );
-
- c = getChar();
- continue;
- }
- else
- {
- if( storageBuffer != null )
- {
- storageBuffer.append( ident );
- try
- {
- contextStack.updateContext( new StringReader( storageBuffer.toString()), PASTING, IScannerContext.ContextKind.MACROEXPANSION, null, requestor );
- }
- catch (ContextException e)
- {
- handleProblem( e.getId(), contextStack.getCurrentContext().getFilename(), getCurrentOffset(), false, true, true );
- }
- storageBuffer = null;
- c = getChar();
- continue;
- }
- }
- }
-
- return newToken(tokenType, ident, contextStack.getCurrentContext());
- } else if ((c >= '0') && (c <= '9') || c == '.' ) {
- int beginOffset = getCurrentOffset();
- StringBuffer buff;
-
- if( pasting )
- {
- if( storageBuffer != null )
- buff = storageBuffer;
- else
- buff = new StringBuffer();
- }
- else
- buff = new StringBuffer();
-
-
- boolean hex = false;
- boolean floatingPoint = ( c == '.' ) ? true : false;
- boolean firstCharZero = ( c== '0' )? true : false;
-
- buff.append((char) c);
-
- c = getChar();
-
- if( ! firstCharZero && floatingPoint && !(c >= '0' && c <= '9') ){
- //if pasting, there could actually be a float here instead of just a .
- if( buff.toString().equals( "." ) ){
- if( c == '*' ){
- return newToken( IToken.tDOTSTAR, ".*", contextStack.getCurrentContext() );
- } else if( c == '.' ){
- if( getChar() == '.' )
- return newToken( IToken.tELLIPSIS, "..." );
- else
- handleProblem( IProblem.SCANNER_BAD_FLOATING_POINT, null, beginOffset, false, true, true );
- } else {
- ungetChar( c );
- return newToken( IToken.tDOT, ".", contextStack.getCurrentContext() );
- }
- }
- } else if (c == 'x') {
- if( ! firstCharZero )
- {
- handleProblem( IProblem.SCANNER_BAD_HEX_FORMAT, null, beginOffset, false, true, true );
- c = getChar();
- continue;
- }
- buff.append( (char)c );
- hex = true;
- c = getChar();
- }
-
- while ((c >= '0' && c <= '9')
- || (hex
- && ((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')))) {
- buff.append((char) c);
- c = getChar();
- }
-
- if( c == '.' )
- {
- buff.append( (char)c);
-
- floatingPoint = true;
- c= getChar();
- while ((c >= '0' && c <= '9')
- || (hex
- && ((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'))))
- {
- buff.append((char) c);
- c = getChar();
- }
- }
-
-
- if (c == 'e' || c == 'E' || (hex && (c == 'p' || c == 'P')))
- {
- if( ! floatingPoint ) floatingPoint = true;
- // exponent type for floating point
- buff.append((char)c);
- c = getChar();
-
- // optional + or -
- if( c == '+' || c == '-' )
- {
- buff.append( (char)c );
- c = getChar();
- }
-
- // digit sequence of exponent part
- while ((c >= '0' && c <= '9') )
- {
- buff.append((char) c);
- c = getChar();
- }
-
- // optional suffix
- if( c == 'l' || c == 'L' || c == 'f' || c == 'F' )
- {
- buff.append( (char)c );
- c = getChar();
- }
- } else {
- if( floatingPoint ){
- //floating-suffix
- if( c == 'l' || c == 'L' || c == 'f' || c == 'F' ){
- c = getChar();
- }
- } else {
- //integer suffix
- if( c == 'u' || c == 'U' ){
- c = getChar();
- if( c == 'l' || c == 'L')
- c = getChar();
- if( c == 'l' || c == 'L')
- c = getChar();
- } else if( c == 'l' || c == 'L' ){
- c = getChar();
- if( c == 'l' || c == 'L')
- c = getChar();
- if( c == 'u' || c == 'U' )
- c = getChar();
- }
- }
- }
-
- ungetChar( c );
-
- if( pasting )
- {
- if( lookAheadForTokenPasting() )
- {
- storageBuffer = buff;
- c = getChar();
- continue;
- }
- else
- {
- if( storageBuffer != null )
- {
- try
- {
- contextStack.updateContext( new StringReader( buff.toString()), PASTING, IScannerContext.ContextKind.MACROEXPANSION, null, requestor );
- }
- catch (ContextException e)
- {
- handleProblem( e.getId(), contextStack.getCurrentContext().getFilename(), getCurrentOffset(), false, true, true );
- }
- storageBuffer = null;
- c = getChar();
- continue;
- }
- }
- }
-
- int tokenType;
- String result = buff.toString();
-
- if( floatingPoint && result.equals(".") )
- tokenType = IToken.tDOT;
- else
- tokenType = floatingPoint ? IToken.tFLOATINGPT : IToken.tINTEGER;
-
- return newToken(
- tokenType,
- result,
- contextStack.getCurrentContext());
-
- } else if (c == '#') {
- int beginningOffset = contextStack.getCurrentContext().getOffset() - 1;
- // lets prepare for a preprocessor statement
- StringBuffer buff = new StringBuffer();
- buff.append((char) c);
-
- // we are allowed arbitrary whitespace after the '#' and before the rest of the text
- boolean skipped = skipOverWhitespace();
-
- c = getChar();
-
- if( c == '#' )
- {
- if( skipped )
- handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "# #", beginningOffset, false, true, true );
- else
- return newToken( tPOUNDPOUND, "##" );
- } else if( tokenizingMacroReplacementList ) {
- ungetChar( c );
- return newToken( tPOUND, "#" );
- }
-
- while (((c >= 'a') && (c <= 'z'))
- || ((c >= 'A') && (c <= 'Z')) || (c == '_') ) {
- buff.append((char) c);
- c = getChar();
- }
- ungetChar(c);
-
- String token = buff.toString();
-
- Object directive = ppDirectives.get(token);
- if (directive == null) {
- if (true)
- handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#"+token, beginningOffset, false, true, true );
- } else {
- int type = ((Integer) directive).intValue();
- switch (type) {
- case PreprocessorDirectives.DEFINE :
- if ( ! passOnToClient ) {
- skipOverTextUntilNewline();
- c = getChar();
- continue;
- }
-
- poundDefine(beginningOffset);
-
- c = getChar();
- continue;
-
- case PreprocessorDirectives.INCLUDE :
- if (! passOnToClient ) {
- skipOverTextUntilNewline();
- c = getChar();
- continue;
- }
-
- poundInclude( beginningOffset );
-
- c = getChar();
- continue;
- case PreprocessorDirectives.UNDEFINE :
- if (! passOnToClient) {
- skipOverTextUntilNewline();
- c = getChar();
- continue;
- }
- skipOverWhitespace();
- // definition
- String toBeUndefined = getNextIdentifier();
-
- definitions.remove(toBeUndefined);
-
- skipOverTextUntilNewline();
- c = getChar();
- continue;
- case PreprocessorDirectives.IF :
- // get the rest of the line
- int currentOffset = getCurrentOffset();
- String expression = getRestOfPreprocessorLine();
-
- boolean expressionEvalResult = false;
- try{
- expressionEvalResult = evaluateExpression(expression, currentOffset);
- } catch( ScannerException e ){}
-
- passOnToClient = branches.poundif( expressionEvalResult );
- c = getChar();
- continue;
-
-
-
- case PreprocessorDirectives.IFDEF :
- skipOverWhitespace();
- String definition = getNextIdentifier();
- Object mapping = definitions.get(definition);
-
- if (mapping == null) {
- // not defined
- passOnToClient = branches.poundif( false );
- skipOverTextUntilNewline();
- } else {
- passOnToClient = branches.poundif( true );
- // continue along, act like nothing is wrong :-)
- c = getChar();
- }
- continue;
- case PreprocessorDirectives.ENDIF :
- String restOfLine = getRestOfPreprocessorLine().trim();
- if( ! restOfLine.equals( "" ) && true )
- handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#endif " + restOfLine, beginningOffset, false, true, true );
- passOnToClient = branches.poundendif();
- c = getChar();
- continue;
-
- case PreprocessorDirectives.IFNDEF :
- skipOverWhitespace();
- String def = getNextIdentifier();
- Object map = definitions.get(def);
-
- if (map != null) {
- // not defined
- skipOverTextUntilNewline();
- passOnToClient = branches.poundif( false );
- } else {
- passOnToClient = branches.poundif( true );
- // continue along, act like nothing is wrong :-)
- c = getChar();
- }
- continue;
-
- case PreprocessorDirectives.ELSE :
- try
- {
- passOnToClient = branches.poundelse();
- }
- catch( EmptyStackException ese )
- {
- handleProblem( IProblem.PREPROCESSOR_UNBALANCE_CONDITION,
- token,
- beginningOffset,
- false, true, true );
- }
-
- skipOverTextUntilNewline();
- c = getChar();
- continue;
-
- case PreprocessorDirectives.ELIF :
- int co = getCurrentOffset();
- String elsifExpression = getRestOfPreprocessorLine().trim();
-
- if (elsifExpression.equals(""))
- handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#elif", beginningOffset, false, true, true );
-
- boolean elsifResult = false;
- elsifResult = evaluateExpression(elsifExpression, co );
-
- try
- {
- passOnToClient = branches.poundelif( elsifResult );
- }
- catch( EmptyStackException ese )
- {
- handleProblem( IProblem.PREPROCESSOR_UNBALANCE_CONDITION,
- token + ' ' + elsifExpression,
- beginningOffset,
- false, true, true );
- }
- c = getChar();
- continue;
-
- case PreprocessorDirectives.LINE :
- //TO DO
- skipOverTextUntilNewline();
- c = getChar();
- continue;
- case PreprocessorDirectives.ERROR :
- if (! passOnToClient) {
- skipOverTextUntilNewline();
- c = getChar();
- continue;
- }
- handleProblem( IProblem.PREPROCESSOR_POUND_ERROR, getRestOfPreprocessorLine(), beginningOffset, false, true, true );
- c = getChar();
- continue;
- case PreprocessorDirectives.PRAGMA :
- skipOverTextUntilNewline();
- c = getChar();
- continue;
- case PreprocessorDirectives.BLANK :
- String remainderOfLine =
- getRestOfPreprocessorLine().trim();
- if (!remainderOfLine.equals("")) {
- handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "# " + remainderOfLine, beginningOffset, false, true, true );
- }
- c = getChar();
- continue;
- default :
- handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#" + token, beginningOffset, false, true, true );
- }
- }
- } else {
- switch (c) {
- case '\'' :
- return processCharacterLiteral( c, wideLiteral );
- case ':' :
- c = getChar();
- switch (c) {
- case ':' :
- return newToken(
- IToken.tCOLONCOLON,
- "::",
- contextStack.getCurrentContext());
- default :
- ungetChar(c);
- return newToken(
- IToken.tCOLON,
- ":",
- contextStack.getCurrentContext());
- }
- case ';' :
- return newToken(IToken.tSEMI, ";", contextStack.getCurrentContext());
- case ',' :
- return newToken(IToken.tCOMMA, ",", contextStack.getCurrentContext());
- case '?' :
- return newToken(IToken.tQUESTION, "?", contextStack.getCurrentContext());
- case '(' :
- return newToken(IToken.tLPAREN, "(", contextStack.getCurrentContext());
- case ')' :
- return newToken(IToken.tRPAREN, ")", contextStack.getCurrentContext());
- case '[' :
- return newToken(IToken.tLBRACKET, "[", contextStack.getCurrentContext());
- case ']' :
- return newToken(IToken.tRBRACKET, "]", contextStack.getCurrentContext());
- case '{' :
- return newToken(IToken.tLBRACE, "{", contextStack.getCurrentContext());
- case '}' :
- return newToken(IToken.tRBRACE, "}", contextStack.getCurrentContext());
- case '+' :
- c = getChar();
- switch (c) {
- case '=' :
- return newToken(
- IToken.tPLUSASSIGN,
- "+=",
- contextStack.getCurrentContext());
- case '+' :
- return newToken(
- IToken.tINCR,
- "++",
- contextStack.getCurrentContext());
- default :
- ungetChar(c);
- return newToken(
- IToken.tPLUS,
- "+",
- contextStack.getCurrentContext());
- }
- case '-' :
- c = getChar();
- switch (c) {
- case '=' :
- return newToken(
- IToken.tMINUSASSIGN,
- "-=",
- contextStack.getCurrentContext());
- case '-' :
- return newToken(
- IToken.tDECR,
- "--",
- contextStack.getCurrentContext());
- case '>' :
- c = getChar();
- switch (c) {
- case '*' :
- return newToken(
- IToken.tARROWSTAR,
- "->*",
- contextStack.getCurrentContext());
- default :
- ungetChar(c);
- return newToken(
- IToken.tARROW,
- "->",
- contextStack.getCurrentContext());
- }
- default :
- ungetChar(c);
- return newToken(
- IToken.tMINUS,
- "-",
- contextStack.getCurrentContext());
- }
- case '*' :
- c = getChar();
- switch (c) {
- case '=' :
- return newToken(
- IToken.tSTARASSIGN,
- "*=",
- contextStack.getCurrentContext());
- default :
- ungetChar(c);
- return newToken(
- IToken.tSTAR,
- "*",
- contextStack.getCurrentContext());
- }
- case '%' :
- c = getChar();
- switch (c) {
- case '=' :
- return newToken(
- IToken.tMODASSIGN,
- "%=",
- contextStack.getCurrentContext());
- default :
- ungetChar(c);
- return newToken(
- IToken.tMOD,
- "%",
- contextStack.getCurrentContext());
- }
- case '^' :
- c = getChar();
- switch (c) {
- case '=' :
- return newToken(
- IToken.tXORASSIGN,
- "^=",
- contextStack.getCurrentContext());
- default :
- ungetChar(c);
- return newToken(
- IToken.tXOR,
- "^",
- contextStack.getCurrentContext());
- }
- case '&' :
- c = getChar();
- switch (c) {
- case '=' :
- return newToken(
- IToken.tAMPERASSIGN,
- "&=",
- contextStack.getCurrentContext());
- case '&' :
- return newToken(
- IToken.tAND,
- "&&",
- contextStack.getCurrentContext());
- default :
- ungetChar(c);
- return newToken(
- IToken.tAMPER,
- "&",
- contextStack.getCurrentContext());
- }
- case '|' :
- c = getChar();
- switch (c) {
- case '=' :
- return newToken(
- IToken.tBITORASSIGN,
- "|=",
- contextStack.getCurrentContext());
- case '|' :
- return newToken(
- IToken.tOR,
- "||",
- contextStack.getCurrentContext());
- default :
- ungetChar(c);
- return newToken(
- IToken.tBITOR,
- "|",
- contextStack.getCurrentContext());
- }
- case '~' :
- return newToken(IToken.tCOMPL, "~", contextStack.getCurrentContext());
- case '!' :
- c = getChar();
- switch (c) {
- case '=' :
- return newToken(
- IToken.tNOTEQUAL,
- "!=",
- contextStack.getCurrentContext());
- default :
- ungetChar(c);
- return newToken(
- IToken.tNOT,
- "!",
- contextStack.getCurrentContext());
- }
- case '=' :
- c = getChar();
- switch (c) {
- case '=' :
- return newToken(
- IToken.tEQUAL,
- "==",
- contextStack.getCurrentContext());
- default :
- ungetChar(c);
- return newToken(
- IToken.tASSIGN,
- "=",
- contextStack.getCurrentContext());
- }
- case '<' :
- c = getChar();
- switch (c) {
- case '<' :
- c = getChar();
- switch (c) {
- case '=' :
- return newToken(
- IToken.tSHIFTLASSIGN,
- "<<=",
- contextStack.getCurrentContext());
- default :
- ungetChar(c);
- return newToken(
- IToken.tSHIFTL,
- "<<",
- contextStack.getCurrentContext());
- }
- case '=' :
- return newToken(
- IToken.tLTEQUAL,
- "<=",
- contextStack.getCurrentContext());
- default :
- ungetChar(c);
- if( forInclusion )
- temporarilyReplaceDefinitionsMap();
- return newToken(IToken.tLT, "<", contextStack.getCurrentContext());
- }
- case '>' :
- c = getChar();
- switch (c) {
- case '>' :
- c = getChar();
- switch (c) {
- case '=' :
- return newToken(
- IToken.tSHIFTRASSIGN,
- ">>=",
- contextStack.getCurrentContext());
- default :
- ungetChar(c);
- return newToken(
- IToken.tSHIFTR,
- ">>",
- contextStack.getCurrentContext());
- }
- case '=' :
- return newToken(
- IToken.tGTEQUAL,
- ">=",
- contextStack.getCurrentContext());
- default :
- ungetChar(c);
- if( forInclusion )
- restoreDefinitionsMap();
- return newToken(IToken.tGT, ">", contextStack.getCurrentContext());
- }
- case '.' :
- c = getChar();
- switch (c) {
- case '.' :
- c = getChar();
- switch (c) {
- case '.' :
- return newToken(
- IToken.tELLIPSIS,
- "...",
- contextStack.getCurrentContext());
- default :
- break;
- }
- break;
- case '*' :
- return newToken(
- IToken.tDOTSTAR,
- ".*",
- contextStack.getCurrentContext());
- default :
- ungetChar(c);
- return newToken(
- IToken.tDOT,
- ".",
- contextStack.getCurrentContext());
- }
- break;
- case '/' :
- c = getChar();
- switch (c) {
- case '/' :
- skipOverSinglelineComment();
- c = getChar();
- continue;
- case '*' :
- skipOverMultilineComment();
- c = getChar();
- continue;
- case '=' :
- return newToken(
- IToken.tDIVASSIGN,
- "/=",
- contextStack.getCurrentContext());
- default :
- ungetChar(c);
- return newToken(
- IToken.tDIV,
- "/",
- contextStack.getCurrentContext());
- }
- default :
- handleProblem( IProblem.SCANNER_BAD_CHARACTER, new Character( (char)c ).toString(), getCurrentOffset(), false, true, throwExceptionOnBadCharacterRead );
- c = getChar();
- continue;
- }
-
- throwEOF();
- }
- }
-
- if (( getDepth() != 0) && !atEOF )
- {
- atEOF = true;
- handleProblem( IProblem.SCANNER_UNEXPECTED_EOF, null, getCurrentOffset(), false, true, true );
- }
-
- // we're done
- throwEOF();
- return null;
- }
-
-
-
- /**
- *
- */
- protected void handlePragmaOperator() throws ScannerException
- {
- // until we know what to do with pragmas, do the equivalent as
- // to what we do for #pragma blah blah blah (ignore it)
- getRestOfPreprocessorLine();
- }
-
- /**
- * @param c
- * @param wideLiteral
- */
- protected IToken processCharacterLiteral(int c, boolean wideLiteral)
- throws ScannerException
- {
- int beginOffset = getCurrentOffset();
- int type = wideLiteral ? IToken.tLCHAR : IToken.tCHAR;
-
- StringBuffer buffer = new StringBuffer();
- int prev = c;
- int prevPrev = c;
- c = getChar(true);
-
- for( ; ; )
- {
- // error conditions
- if( ( c == '\n' ) ||
- ( ( c == '\\' || c =='\'' )&& prev == '\\' ) ||
- ( c == NOCHAR ) )
- {
- handleProblem( IProblem.SCANNER_BAD_CHARACTER, new Character( (char)c ).toString(),beginOffset, false, true, throwExceptionOnBadCharacterRead );
- c = ' ';
- }
- // exit condition
- if ( ( c =='\'' ) && ( prev != '\\' || prevPrev == '\\' ) ) break;
-
- buffer.append( (char)c);
- prevPrev = prev;
- prev = c;
- c = getChar(true);
- }
-
- return newToken( type, buffer.toString(), contextStack.getCurrentContext());
- }
-
-
-
- protected String getCurrentFile()
- {
- return contextStack.getMostRelevantFileContext() != null ? contextStack.getMostRelevantFileContext().getFilename() : "";
- }
-
-
- protected int getCurrentOffset()
- {
- return contextStack.getMostRelevantFileContext() != null ? contextStack.getMostRelevantFileContext().getOffset() : -1;
- }
-
-
- protected static class endOfMacroTokenException extends Exception {};
- // the static instance we always use
- protected static endOfMacroTokenException endOfMacroToken = new endOfMacroTokenException();
-
- public IToken nextTokenForStringizing() throws ScannerException, EndOfFileException, OffsetLimitReachedException
- {
- int beginOffset = getCurrentOffset();
- int c = getChar();
- StringBuffer tokenImage = new StringBuffer();
-
- try {
- while (c != NOCHAR) {
-
- if ((c == ' ') || (c == '\r') || (c == '\t') || (c == '\n')) {
-
- if (tokenImage.length() > 0) throw endOfMacroToken;
- c = getChar();
- continue;
-
- } else if (c == '"') {
-
- if (tokenImage.length() > 0) throw endOfMacroToken;
-
- // string
- StringBuffer buff = new StringBuffer();
- c = getChar(true);
-
- for( ; ; )
- {
- if ( c =='"' ) break;
- if( c == NOCHAR) break;
- buff.append((char) c);
- c = getChar(true);
- }
-
- if (c != NOCHAR )
- {
- return newToken( IToken.tSTRING, buff.toString(), contextStack.getCurrentContext());
-
- } else {
- handleProblem( IProblem.SCANNER_UNBOUNDED_STRING, null, beginOffset, false, true, true );
- c = getChar();
- continue;
- }
-
- } else {
- switch (c) {
- case '\'' :
- if (tokenImage.length() > 0) throw endOfMacroToken;
- return processCharacterLiteral( c, false );
- case ',' :
- if (tokenImage.length() > 0) throw endOfMacroToken;
- return newToken(IToken.tCOMMA, ",", contextStack.getCurrentContext());
- case '(' :
- if (tokenImage.length() > 0) throw endOfMacroToken;
- return newToken(IToken.tLPAREN, "(", contextStack.getCurrentContext());
- case ')' :
- if (tokenImage.length() > 0) throw endOfMacroToken;
- return newToken(IToken.tRPAREN, ")", contextStack.getCurrentContext());
- case '/' :
- if (tokenImage.length() > 0) throw endOfMacroToken;
- c = getChar();
- switch (c) {
- case '/' :
- skipOverSinglelineComment();
- c = getChar();
- continue;
- case '*' :
- skipOverMultilineComment();
- c = getChar();
- continue;
- default:
- tokenImage.append('/');
- continue;
- }
- default :
- tokenImage.append((char)c);
- c = getChar();
- }
- }
- }
- } catch (endOfMacroTokenException e) {
- // unget the first character after the end of token
- ungetChar(c);
- }
-
- // return completed token
- if (tokenImage.length() > 0) {
- return newToken(IToken.tIDENTIFIER, tokenImage.toString(), contextStack.getCurrentContext());
- }
-
- // we're done
- throwEOF();
- return null;
- }
-
-
- /**
- *
- */
- protected void throwEOF() throws EndOfFileException, OffsetLimitReachedException {
- if( offsetLimit == NO_OFFSET_LIMIT )
- throw new EndOfFileException();
-
- if( finalToken.getEndOffset() == offsetLimit )
- throw new OffsetLimitReachedException(finalToken);
- throw new OffsetLimitReachedException( null );
- }
-
-
- static {
- cppKeywords.put( Keywords.AND, new Integer(IToken.t_and));
- cppKeywords.put( Keywords.AND_EQ, new Integer(IToken.t_and_eq));
- cppKeywords.put( Keywords.ASM, new Integer(IToken.t_asm));
- cppKeywords.put( Keywords.AUTO, new Integer(IToken.t_auto));
- cppKeywords.put( Keywords.BITAND, new Integer(IToken.t_bitand));
- cppKeywords.put( Keywords.BITOR, new Integer(IToken.t_bitor));
- cppKeywords.put( Keywords.BOOL, new Integer(IToken.t_bool));
- cppKeywords.put( Keywords.BREAK, new Integer(IToken.t_break));
- cppKeywords.put( Keywords.CASE, new Integer(IToken.t_case));
- cppKeywords.put( Keywords.CATCH, new Integer(IToken.t_catch));
- cppKeywords.put( Keywords.CHAR, new Integer(IToken.t_char));
- cppKeywords.put( Keywords.CLASS, new Integer(IToken.t_class));
- cppKeywords.put( Keywords.COMPL, new Integer(IToken.t_compl));
- cppKeywords.put( Keywords.CONST, new Integer(IToken.t_const));
- cppKeywords.put( Keywords.CONST_CAST, new Integer(IToken.t_const_cast));
- cppKeywords.put( Keywords.CONTINUE, new Integer(IToken.t_continue));
- cppKeywords.put( Keywords.DEFAULT, new Integer(IToken.t_default));
- cppKeywords.put( Keywords.DELETE, new Integer(IToken.t_delete));
- cppKeywords.put( Keywords.DO, new Integer(IToken.t_do));
- cppKeywords.put( Keywords.DOUBLE, new Integer(IToken.t_double));
- cppKeywords.put( Keywords.DYNAMIC_CAST, new Integer(IToken.t_dynamic_cast));
- cppKeywords.put( Keywords.ELSE, new Integer(IToken.t_else));
- cppKeywords.put( Keywords.ENUM, new Integer(IToken.t_enum));
- cppKeywords.put( Keywords.EXPLICIT, new Integer(IToken.t_explicit));
- cppKeywords.put( Keywords.EXPORT, new Integer(IToken.t_export));
- cppKeywords.put( Keywords.EXTERN, new Integer(IToken.t_extern));
- cppKeywords.put( Keywords.FALSE, new Integer(IToken.t_false));
- cppKeywords.put( Keywords.FLOAT, new Integer(IToken.t_float));
- cppKeywords.put( Keywords.FOR, new Integer(IToken.t_for));
- cppKeywords.put( Keywords.FRIEND, new Integer(IToken.t_friend));
- cppKeywords.put( Keywords.GOTO, new Integer(IToken.t_goto));
- cppKeywords.put( Keywords.IF, new Integer(IToken.t_if));
- cppKeywords.put( Keywords.INLINE, new Integer(IToken.t_inline));
- cppKeywords.put( Keywords.INT, new Integer(IToken.t_int));
- cppKeywords.put( Keywords.LONG, new Integer(IToken.t_long));
- cppKeywords.put( Keywords.MUTABLE, new Integer(IToken.t_mutable));
- cppKeywords.put( Keywords.NAMESPACE, new Integer(IToken.t_namespace));
- cppKeywords.put( Keywords.NEW, new Integer(IToken.t_new));
- cppKeywords.put( Keywords.NOT, new Integer(IToken.t_not));
- cppKeywords.put( Keywords.NOT_EQ, new Integer(IToken.t_not_eq));
- cppKeywords.put( Keywords.OPERATOR, new Integer(IToken.t_operator));
- cppKeywords.put( Keywords.OR, new Integer(IToken.t_or));
- cppKeywords.put( Keywords.OR_EQ, new Integer(IToken.t_or_eq));
- cppKeywords.put( Keywords.PRIVATE, new Integer(IToken.t_private));
- cppKeywords.put( Keywords.PROTECTED, new Integer(IToken.t_protected));
- cppKeywords.put( Keywords.PUBLIC, new Integer(IToken.t_public));
- cppKeywords.put( Keywords.REGISTER, new Integer(IToken.t_register));
- cppKeywords.put( Keywords.REINTERPRET_CAST, new Integer(IToken.t_reinterpret_cast));
- cppKeywords.put( Keywords.RETURN, new Integer(IToken.t_return));
- cppKeywords.put( Keywords.SHORT, new Integer(IToken.t_short));
- cppKeywords.put( Keywords.SIGNED, new Integer(IToken.t_signed));
- cppKeywords.put( Keywords.SIZEOF, new Integer(IToken.t_sizeof));
- cppKeywords.put( Keywords.STATIC, new Integer(IToken.t_static));
- cppKeywords.put( Keywords.STATIC_CAST, new Integer(IToken.t_static_cast));
- cppKeywords.put( Keywords.STRUCT, new Integer(IToken.t_struct));
- cppKeywords.put( Keywords.SWITCH, new Integer(IToken.t_switch));
- cppKeywords.put( Keywords.TEMPLATE, new Integer(IToken.t_template));
- cppKeywords.put( Keywords.THIS, new Integer(IToken.t_this));
- cppKeywords.put( Keywords.THROW, new Integer(IToken.t_throw));
- cppKeywords.put( Keywords.TRUE, new Integer(IToken.t_true));
- cppKeywords.put( Keywords.TRY, new Integer(IToken.t_try));
- cppKeywords.put( Keywords.TYPEDEF, new Integer(IToken.t_typedef));
- cppKeywords.put( Keywords.TYPEID, new Integer(IToken.t_typeid));
- cppKeywords.put( Keywords.TYPENAME, new Integer(IToken.t_typename));
- cppKeywords.put( Keywords.UNION, new Integer(IToken.t_union));
- cppKeywords.put( Keywords.UNSIGNED, new Integer(IToken.t_unsigned));
- cppKeywords.put( Keywords.USING, new Integer(IToken.t_using));
- cppKeywords.put( Keywords.VIRTUAL, new Integer(IToken.t_virtual));
- cppKeywords.put( Keywords.VOID, new Integer(IToken.t_void));
- cppKeywords.put( Keywords.VOLATILE, new Integer(IToken.t_volatile));
- cppKeywords.put( Keywords.WCHAR_T, new Integer(IToken.t_wchar_t));
- cppKeywords.put( Keywords.WHILE, new Integer(IToken.t_while));
- cppKeywords.put( Keywords.XOR, new Integer(IToken.t_xor));
- cppKeywords.put( Keywords.XOR_EQ, new Integer(IToken.t_xor_eq));
-
- ppDirectives.put("#define", new Integer(PreprocessorDirectives.DEFINE));
- ppDirectives.put("#undef",new Integer(PreprocessorDirectives.UNDEFINE));
- ppDirectives.put("#if", new Integer(PreprocessorDirectives.IF));
- ppDirectives.put("#ifdef", new Integer(PreprocessorDirectives.IFDEF));
- ppDirectives.put("#ifndef", new Integer(PreprocessorDirectives.IFNDEF));
- ppDirectives.put("#else", new Integer(PreprocessorDirectives.ELSE));
- ppDirectives.put("#endif", new Integer(PreprocessorDirectives.ENDIF));
- ppDirectives.put(
- "#include",
- new Integer(PreprocessorDirectives.INCLUDE));
- ppDirectives.put("#line", new Integer(PreprocessorDirectives.LINE));
- ppDirectives.put("#error", new Integer(PreprocessorDirectives.ERROR));
- ppDirectives.put("#pragma", new Integer(PreprocessorDirectives.PRAGMA));
- ppDirectives.put("#elif", new Integer(PreprocessorDirectives.ELIF));
- ppDirectives.put("#", new Integer(PreprocessorDirectives.BLANK));
-
- cKeywords.put( Keywords.AUTO, new Integer(IToken.t_auto));
- cKeywords.put( Keywords.BREAK, new Integer(IToken.t_break));
- cKeywords.put( Keywords.CASE, new Integer(IToken.t_case));
- cKeywords.put( Keywords.CHAR, new Integer(IToken.t_char));
- cKeywords.put( Keywords.CONST, new Integer(IToken.t_const));
- cKeywords.put( Keywords.CONTINUE, new Integer(IToken.t_continue));
- cKeywords.put( Keywords.DEFAULT, new Integer(IToken.t_default));
- cKeywords.put( Keywords.DELETE, new Integer(IToken.t_delete));
- cKeywords.put( Keywords.DO, new Integer(IToken.t_do));
- cKeywords.put( Keywords.DOUBLE, new Integer(IToken.t_double));
- cKeywords.put( Keywords.ELSE, new Integer(IToken.t_else));
- cKeywords.put( Keywords.ENUM, new Integer(IToken.t_enum));
- cKeywords.put( Keywords.EXTERN, new Integer(IToken.t_extern));
- cKeywords.put( Keywords.FLOAT, new Integer(IToken.t_float));
- cKeywords.put( Keywords.FOR, new Integer(IToken.t_for));
- cKeywords.put( Keywords.GOTO, new Integer(IToken.t_goto));
- cKeywords.put( Keywords.IF, new Integer(IToken.t_if));
- cKeywords.put( Keywords.INLINE, new Integer(IToken.t_inline));
- cKeywords.put( Keywords.INT, new Integer(IToken.t_int));
- cKeywords.put( Keywords.LONG, new Integer(IToken.t_long));
- cKeywords.put( Keywords.REGISTER, new Integer(IToken.t_register));
- cKeywords.put( Keywords.RESTRICT, new Integer(IToken.t_restrict));
- cKeywords.put( Keywords.RETURN, new Integer(IToken.t_return));
- cKeywords.put( Keywords.SHORT, new Integer(IToken.t_short));
- cKeywords.put( Keywords.SIGNED, new Integer(IToken.t_signed));
- cKeywords.put( Keywords.SIZEOF, new Integer(IToken.t_sizeof));
- cKeywords.put( Keywords.STATIC, new Integer(IToken.t_static));
- cKeywords.put( Keywords.STRUCT, new Integer(IToken.t_struct));
- cKeywords.put( Keywords.SWITCH, new Integer(IToken.t_switch));
- cKeywords.put( Keywords.TYPEDEF, new Integer(IToken.t_typedef));
- cKeywords.put( Keywords.UNION, new Integer(IToken.t_union));
- cKeywords.put( Keywords.UNSIGNED, new Integer(IToken.t_unsigned));
- cKeywords.put( Keywords.VOID, new Integer(IToken.t_void));
- cKeywords.put( Keywords.VOLATILE, new Integer(IToken.t_volatile));
- cKeywords.put( Keywords.WHILE, new Integer(IToken.t_while));
- cKeywords.put( Keywords._BOOL, new Integer(IToken.t__Bool));
- cKeywords.put( Keywords._COMPLEX, new Integer(IToken.t__Complex));
- cKeywords.put( Keywords._IMAGINARY, new Integer(IToken.t__Imaginary));
-
- }
-
- static public class PreprocessorDirectives {
- static public final int DEFINE = 0;
- static public final int UNDEFINE = 1;
- static public final int IF = 2;
- static public final int IFDEF = 3;
- static public final int IFNDEF = 4;
- static public final int ELSE = 5;
- static public final int ENDIF = 6;
- static public final int INCLUDE = 7;
- static public final int LINE = 8;
- static public final int ERROR = 9;
- static public final int PRAGMA = 10;
- static public final int BLANK = 11;
- static public final int ELIF = 12;
- }
-
- public final int getCount() {
- return count;
- }
-
- public final int getDepth() {
- return branches.getDepth();
- }
-
- protected boolean evaluateExpression(String expression, int beginningOffset )
- throws ScannerException {
-
- if( mode == ParserMode.QUICK_PARSE )
- {
- if( expression.trim().equals( "0" ) )
- return false;
- return true;
- }
- else
- {
- final NullSourceElementRequestor nullCallback = new NullSourceElementRequestor();
- IParser parser = null;
- try
- {
- IScanner trial =
- ParserFactory.createScanner(
- new StringReader(expression + ";"),
- EXPRESSION,
- new ScannerInfo( definitions, originalConfig.getIncludePaths()),
- ParserMode.QUICK_PARSE, language, nullCallback, log );
- parser = ParserFactory.createParser(trial, nullCallback, ParserMode.QUICK_PARSE, language, log );
- } catch( ParserFactoryException pfe )
- {
- handleInternalError();
- }
- try {
- IASTExpression exp = parser.expression(null);
- if( exp.evaluateExpression() == 0 )
- return false;
- return true;
- } catch( BacktrackException backtrack )
- {
- handleProblem( IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR, expression, beginningOffset, false, true, true );
- }
- catch (ExpressionEvaluationException e) {
- handleProblem( IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR, expression, beginningOffset, false, true, true );
- } catch (EndOfFileException e) {
- handleProblem( IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR, expression, beginningOffset, false, true, true );
- }
- return true;
- }
- }
-
-
- protected void skipOverSinglelineComment() throws ScannerException {
-
- StringBuffer comment = new StringBuffer("//");
- int c;
-
- loop:
- for (;;) {
- c = getChar();
- comment.append((char)c);
- switch (c) {
- case NOCHAR :
- case '\n' :
- break loop;
- default :
- break;
- }
- }
-
- }
-
- protected boolean skipOverMultilineComment() throws ScannerException {
- int state = 0;
- boolean encounteredNewline = false;
- StringBuffer comment = new StringBuffer("/*");
- // simple state machine to handle multi-line comments
- // state 0 == no end of comment in site
- // state 1 == encountered *, expecting /
- // state 2 == we are no longer in a comment
-
- int c = getChar();
- comment.append((char)c);
- while (state != 2 && c != NOCHAR) {
- if (c == '\n')
- encounteredNewline = true;
-
- switch (state) {
- case 0 :
- if (c == '*')
- state = 1;
- break;
- case 1 :
- if (c == '/')
- state = 2;
- else if (c != '*')
- state = 0;
- break;
- }
- c = getChar();
- comment.append((char)c);
- }
-
- if (c == NOCHAR)
- handleProblem( IProblem.SCANNER_UNEXPECTED_EOF, null, getCurrentOffset(), false, true, true );
-
- ungetChar(c);
-
- return encounteredNewline;
- }
-
- protected void poundInclude( int beginningOffset ) throws ScannerException {
-
- skipOverWhitespace();
- int baseOffset = lastContext.getOffset() - lastContext.undoStackSize();
- String includeLine = getRestOfPreprocessorLine();
- StringBuffer fileName = new StringBuffer();
- boolean useIncludePath = true;
- int startOffset = baseOffset;
- int endOffset = baseOffset;
-
- if (! includeLine.equals("")) {
- Scanner helperScanner = new Scanner(
- new StringReader(includeLine),
- null,
- new ScannerInfo(definitions, originalConfig.getIncludePaths()),
- new NullSourceElementRequestor(),
- mode,
- language, log );
- helperScanner.setForInclusion( true );
- IToken t = null;
-
- try {
- t = helperScanner.nextToken(false);
- } catch (OffsetLimitReachedException e) {
- handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#include " + includeLine, beginningOffset, false, true, true );
- return;
- } catch (EndOfFileException eof) {
- handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#include " + includeLine, beginningOffset, false, true, true );
- return;
- }
-
- try {
- if (t.getType() == IToken.tSTRING) {
- fileName.append(t.getImage());
- startOffset = baseOffset + t.getOffset();
- endOffset = baseOffset + t.getEndOffset();
- useIncludePath = false;
-
- // This should throw EOF
- t = helperScanner.nextToken(false);
- handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#include " + includeLine, beginningOffset, false, true, true );
- return;
- } else if (t.getType() == IToken.tLT) {
-
- try {
-
- t = helperScanner.nextToken(false);
- startOffset = baseOffset + t.getOffset();
-
- while (t.getType() != IToken.tGT) {
- fileName.append(t.getImage());
- helperScanner.skipOverWhitespace();
- int c = helperScanner.getChar();
- if (c == '\\') fileName.append('\\'); else helperScanner.ungetChar(c);
- t = helperScanner.nextToken(false);
- }
-
- endOffset = baseOffset + t.getEndOffset();
-
- } catch (EndOfFileException eof) {
- handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#include " + includeLine, beginningOffset, false, true, true );
- return;
- }
-
- // This should throw EOF
- t = helperScanner.nextToken(false);
- handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#include " + includeLine, beginningOffset, false, true, true );
-
- return;
-
- } else
- handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#include " + includeLine, beginningOffset, false, true, true );
- }
- catch (OffsetLimitReachedException e) {
- handleInternalError();
- }
- catch( EndOfFileException eof )
- {
- // good
- }
-
- } else
- handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, "#include " + includeLine, beginningOffset, false, true, true );
-
- String f = fileName.toString();
-
- if( mode == ParserMode.QUICK_PARSE )
- {
- if( requestor != null )
- {
- IASTInclusion i = null;
- try
- {
- i =
- astFactory.createInclusion(
- f,
- "",
- !useIncludePath,
- beginningOffset,
- startOffset,
- startOffset + f.length(),
- endOffset);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- if( i != null )
- {
- i.enterScope( requestor );
- i.exitScope( requestor );
- }
- }
- }
- else
- handleInclusion(f.trim(), useIncludePath, startOffset, beginningOffset, endOffset);
- }
-
- protected static final Hashtable emptyMap = new Hashtable();
- protected Hashtable holderMap = null;
-
- protected void temporarilyReplaceDefinitionsMap()
- {
- holderMap = definitions;
- definitions = emptyMap;
- }
-
- protected void restoreDefinitionsMap()
- {
- definitions = holderMap;
- holderMap = null;
- }
-
-
- protected boolean forInclusion = false;
- /**
- * @param b
- */
- protected void setForInclusion(boolean b)
- {
- forInclusion = b;
- }
-
- protected void poundDefine(int beginning) throws ScannerException, EndOfFileException {
- skipOverWhitespace();
- // definition
- String key = getNextIdentifier();
- int offset = contextStack.getCurrentContext().getOffset() - key.length() - contextStack.getCurrentContext().undoStackSize();
-
- // store the previous definition to check against later
- Object previousDefinition = definitions.get( key );
-
- // get the next character
- // the C++ standard says that macros must not put
- // whitespace between the end of the definition
- // identifier and the opening parenthesis
- int c = getChar();
- if (c == '(') {
- StringBuffer buffer = new StringBuffer();
- c = getChar(true);
- while (c != ')') {
- if( c == '\\' ){
- c = getChar();
- if( c == '\r' )
- c = getChar();
-
- if( c == '\n' ){
- c = getChar();
- continue;
- } else {
- ungetChar( c );
- handleProblem( IProblem.PREPROCESSOR_INVALID_MACRO_DEFN, "#define " + buffer.toString() + '\\' + (char)c, beginning, false, true, true );
- return;
- }
- } else if( c == '\r' || c == '\n' ){
- handleProblem( IProblem.PREPROCESSOR_INVALID_MACRO_DEFN, "#define " + buffer.toString() + (char)c, beginning, false, true, true );
- return;
- } else if( c == NOCHAR ){
- handleProblem( IProblem.SCANNER_UNEXPECTED_EOF, null, beginning, false, true, true );
- return;
- }
-
- buffer.append((char) c);
- c = getChar(true);
- }
-
- String parameters = buffer.toString();
-
- // replace StringTokenizer later -- not performant
- StringTokenizer tokenizer = new StringTokenizer(parameters, ",");
- ArrayList parameterIdentifiers =
- new ArrayList(tokenizer.countTokens());
- while (tokenizer.hasMoreTokens()) {
- parameterIdentifiers.add(tokenizer.nextToken().trim());
- }
-
- skipOverWhitespace();
-
- ArrayList macroReplacementTokens = new ArrayList();
- String replacementString = getRestOfPreprocessorLine();
-
- if( ! replacementString.equals( "" ) )
- {
- IScanner helperScanner=null;
- try {
- helperScanner =
- ParserFactory.createScanner(
- new StringReader(replacementString),
- SCRATCH,
- new ScannerInfo(),
- mode,
- language,
- new NullSourceElementRequestor(), log);
- } catch (ParserFactoryException e1) {
- }
- helperScanner.setTokenizingMacroReplacementList( true );
- IToken t = null;
- try {
- t = helperScanner.nextToken(false);
- } catch (OffsetLimitReachedException e2) {
- handleInternalError();
- }
- try {
- while (true) {
- //each # preprocessing token in the replacement list shall be followed
- //by a parameter as the next reprocessing token in the list
- if( t.getType() == tPOUND ){
- macroReplacementTokens.add( t );
- t = helperScanner.nextToken(false);
- int index = parameterIdentifiers.indexOf(t.getImage());
- if (index == -1 ) {
- //not found
-
- handleProblem( IProblem.PREPROCESSOR_MACRO_PASTING_ERROR, "#define " + key + " " + replacementString,
- beginning, false, true, true );
- return;
- }
- }
-
- macroReplacementTokens.add(t);
- t = helperScanner.nextToken(false);
- }
- }
- catch( OffsetLimitReachedException olre )
- {
- handleInternalError();
- }
- catch( EndOfFileException eof )
- {
- // good
- }
- }
-
- IMacroDescriptor descriptor = new MacroDescriptor();
- descriptor.initialize(
- key,
- parameterIdentifiers,
- macroReplacementTokens,
- key + "(" + parameters + ")");
-
- checkValidMacroRedefinition(key, previousDefinition, descriptor, beginning);
- addDefinition(key, descriptor);
-
- }
- else if ((c == '\n') || (c == '\r'))
- {
- checkValidMacroRedefinition(key, previousDefinition, "", beginning);
- addDefinition( key, "" );
- }
- else if ((c == ' ') || (c == '\t') ) {
- // this is a simple definition
- skipOverWhitespace();
-
- // get what we are to map the name to and add it to the definitions list
- String value = getRestOfPreprocessorLine();
-
- checkValidMacroRedefinition(key, previousDefinition, value, beginning);
- addDefinition( key, value );
-
- } else if (c == '/') {
- // this could be a comment
- c = getChar();
- if (c == '/') // one line comment
- {
- skipOverSinglelineComment();
- checkValidMacroRedefinition(key, previousDefinition, "", beginning);
- addDefinition(key, "");
- } else if (c == '*') // multi-line comment
- {
- if (skipOverMultilineComment()) {
- // we have gone over a newline
- // therefore, this symbol was defined to an empty string
- checkValidMacroRedefinition(key, previousDefinition, "", beginning);
- addDefinition(key, "");
- } else {
- String value = getRestOfPreprocessorLine();
-
- checkValidMacroRedefinition(key, previousDefinition, "", beginning);
- addDefinition(key, value);
- }
- } else {
- // this is not a comment
- // it is a bad statement
- handleProblem( IProblem.PREPROCESSOR_INVALID_MACRO_DEFN, "#define " + key + " /" + getRestOfPreprocessorLine(), beginning, false, true, true );
- return;
- }
- } else {
- log.traceLog("Scanner : Encountered unexpected character " + ((char) c));
- handleProblem( IProblem.PREPROCESSOR_INVALID_MACRO_DEFN, "#define " + key + (char)c + getRestOfPreprocessorLine(), beginning, false, true, true );
- return;
- }
-
- try
- {
- astFactory.createMacro( key, beginning, offset, offset + key.length(), contextStack.getCurrentContext().getOffset() ).acceptElement( requestor );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
-
-
- protected void checkValidMacroRedefinition(
- String key,
- Object previousDefinition,
- Object newDefinition, int beginningOffset )
- throws ScannerException
- {
- if( mode != ParserMode.QUICK_PARSE && previousDefinition != null )
- {
- if( newDefinition instanceof IMacroDescriptor )
- {
- if( previousDefinition instanceof IMacroDescriptor )
- {
- if( ((IMacroDescriptor)previousDefinition).compatible( (IMacroDescriptor) newDefinition ) )
- return;
- }
- }
- else if( newDefinition instanceof String )
- {
- if( previousDefinition instanceof String )
- {
- Scanner previous = new Scanner( new StringReader( (String)previousDefinition ), "redef-test", new ScannerInfo(), new NullSourceElementRequestor(),
- mode, language, log );
- Scanner current = new Scanner( new StringReader( (String)newDefinition ), "redef-test", new ScannerInfo(), new NullSourceElementRequestor(),
- mode, language, log );
- for ( ; ; )
- {
- IToken p = null;
- IToken c = null;
- try
- {
- p = previous.nextToken();
- c = current.nextToken();
-
- if ( c.equals( p ) ) continue;
- break;
-
- }
- catch( OffsetLimitReachedException olre )
- {
- handleInternalError();
- }
- catch( EndOfFileException eof )
- {
- if( ( p != null ) && ( c == null ) )
- break;
- if( p == null )
- {
- try
- {
- c = current.nextToken();
- break;
- }
- catch( OffsetLimitReachedException olre )
- {
- handleInternalError();
- }
- catch( EndOfFileException eof2 )
- {
- return;
- }
- }
- }
- }
- }
- }
-
- handleProblem( IProblem.PREPROCESSOR_INVALID_MACRO_REDEFN, key, beginningOffset, false, true, true );
- }
- }
-
- /**
- *
- */
- protected void handleInternalError() {
- // TODO Auto-generated method stub
-
- }
-
- protected Vector getMacroParameters (String params, boolean forStringizing) throws ScannerException {
-
- Scanner tokenizer = new Scanner(new StringReader(params), TEXT, new ScannerInfo( definitions, originalConfig.getIncludePaths() ), new NullSourceElementRequestor(), mode, language, log);
- tokenizer.setThrowExceptionOnBadCharacterRead(false);
- Vector parameterValues = new Vector();
- Token t = null;
- String str = new String();
- boolean space = false;
- int nParen = 0;
-
- try {
- while (true) {
- int c = tokenizer.getCharacter();
- if ((c != ' ') && (c != '\t') && (c != '\r') && (c != '\n')) {
- space = false;
- }
- if (c != NOCHAR) tokenizer.ungetChar(c);
-
- t = (Token)(forStringizing ? tokenizer.nextTokenForStringizing() : tokenizer.nextToken(false));
- if (t.type == IToken.tLPAREN) {
- nParen++;
- } else if (t.type == IToken.tRPAREN) {
- nParen--;
- } else if (t.type == IToken.tCOMMA && nParen == 0) {
- parameterValues.add(str);
- str = "";
- space = false;
- continue;
- }
-
- if (space)
- str += ' ';
-
- switch (t.type) {
- case IToken.tSTRING : str += '\"' + t.image + '\"'; break;
- case IToken.tLSTRING : str += "L\"" + t.image + '\"'; break;
- case IToken.tCHAR : str += '\'' + t.image + '\''; break;
- default : str += t.image; break;
- }
- space = true;
- }
- }
- catch( OffsetLimitReachedException olre )
- {
- handleInternalError();
- }
- catch (EndOfFileException e) {
- // Good
- parameterValues.add(str);
- }
-
-
- return parameterValues;
- }
-
- protected void expandDefinition(String symbol, Object expansion, int symbolOffset)
- throws ScannerException
- {
- // All the tokens generated by the macro expansion
- // will have dimensions (offset and length) equal to the expanding symbol.
- if (expansion instanceof String ) {
- String replacementValue = (String) expansion;
- try
- {
- contextStack.updateContext( new StringReader(replacementValue), (POUND_DEFINE + symbol ), ScannerContext.ContextKind.MACROEXPANSION, null, requestor, symbolOffset, symbol.length());
- }
- catch (ContextException e)
- {
- handleProblem( e.getId(), contextStack.getCurrentContext().getFilename(), getCurrentOffset(), false, true, true );
- consumeUntilOutOfMacroExpansion();
- return;
- }
- } else if (expansion instanceof IMacroDescriptor ) {
- IMacroDescriptor macro = (IMacroDescriptor) expansion;
- skipOverWhitespace();
- int c = getChar();
-
- if (c == '(') {
- StringBuffer buffer = new StringBuffer();
- int bracketCount = 1;
- c = getChar();
-
- while (true) {
- if (c == '(')
- ++bracketCount;
- else if (c == ')')
- --bracketCount;
-
- if(bracketCount == 0 || c == NOCHAR)
- break;
- buffer.append((char) c);
- c = getChar( true );
- }
-
- // Position of the closing ')'
- int endMacroOffset = lastContext.getOffset() - lastContext.undoStackSize() - 1;
-
- String betweenTheBrackets = buffer.toString().trim();
-
- Vector parameterValues = getMacroParameters(betweenTheBrackets, false);
- Vector parameterValuesForStringizing = getMacroParameters(betweenTheBrackets, true);
- Token t = null;
-
- // create a string that represents what needs to be tokenized
- buffer = new StringBuffer();
- List tokens = macro.getTokenizedExpansion();
- List parameterNames = macro.getParameters();
-
- if (parameterNames.size() != parameterValues.size())
- {
- handleProblem( IProblem.PREPROCESSOR_MACRO_USAGE_ERROR, symbol, getCurrentOffset(), false, true, true );
- consumeUntilOutOfMacroExpansion();
- return;
- }
-
- int numberOfTokens = tokens.size();
-
- for (int i = 0; i < numberOfTokens; ++i) {
- t = (Token) tokens.get(i);
- if (t.type == IToken.tIDENTIFIER) {
-
- // is this identifier in the parameterNames
- // list?
- int index = parameterNames.indexOf(t.image);
- if (index == -1 ) {
- // not found
- // just add image to buffer
- buffer.append(t.image );
- } else {
- buffer.append(
- (String) parameterValues.elementAt(index) );
- }
- } else if (t.type == tPOUND) {
- //next token should be a parameter which needs to be turned into
- //a string literal
- t = (Token) tokens.get( ++i );
- int index = parameterNames.indexOf(t.image);
- if( index == -1 ){
- handleProblem( IProblem.PREPROCESSOR_MACRO_USAGE_ERROR, macro.getName(), getCurrentOffset(), false, true, true );
- return;
- } else {
- buffer.append('\"');
- String value = (String)parameterValuesForStringizing.elementAt(index);
- char val [] = value.toCharArray();
- char ch;
- int length = value.length();
- for( int j = 0; j < length; j++ ){
- ch = val[j];
- if( ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n' ){
- //Each occurance of whitespace becomes a single space character
- while( ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n' ){
- ch = val[++j];
- }
- buffer.append(' ');
- }
- //a \ character is inserted before each " and \
- if( ch == '\"' || ch == '\\' ){
- buffer.append('\\');
- buffer.append(ch);
- } else {
- buffer.append(ch);
- }
- }
- buffer.append('\"');
- }
- } else {
- switch( t.type )
- {
- case IToken.tSTRING: buffer.append('\"' + t.image + '\"'); break;
- case IToken.tLSTRING: buffer.append("L\"" + t.image + '\"'); break;
- case IToken.tCHAR: buffer.append('\'' + t.image + '\''); break;
- default: buffer.append(t.image); break;
- }
- }
-
- boolean pastingNext = false;
-
- if( i != numberOfTokens - 1)
- {
- IToken t2 = (IToken) tokens.get(i+1);
- if( t2.getType() == tPOUNDPOUND ) {
- pastingNext = true;
- i++;
- }
- }
-
- if( t.getType() != tPOUNDPOUND && ! pastingNext )
- if (i < (numberOfTokens-1)) // Do not append to the last one
- buffer.append( " " );
- }
- String finalString = buffer.toString();
- try
- {
- contextStack.updateContext(
- new StringReader(finalString),
- POUND_DEFINE + macro.getSignature(), ScannerContext.ContextKind.MACROEXPANSION, null, requestor, symbolOffset, endMacroOffset - symbolOffset + 1 );
- }
- catch (ContextException e)
- {
- handleProblem( e.getId(), contextStack.getCurrentContext().getFilename(), getCurrentOffset(), false, true, true );
- consumeUntilOutOfMacroExpansion();
- return;
- }
- } else
- {
- handleProblem( IProblem.PREPROCESSOR_MACRO_USAGE_ERROR, symbol, getCurrentOffset(), false, true, true );
- consumeUntilOutOfMacroExpansion();
- return;
- }
-
- } else {
- log.traceLog(
- "Unexpected class stored in definitions table. "
- + expansion.getClass().getName() );
- }
-
- }
-
- protected String handleDefinedMacro() throws ScannerException {
- int o = getCurrentOffset();
- skipOverWhitespace();
-
- int c = getChar();
-
- String definitionIdentifier = null;
- if (c == '(') {
-
- definitionIdentifier = getNextIdentifier();
- skipOverWhitespace();
- c = getChar();
- if (c != ')')
- {
- handleProblem( IProblem.PREPROCESSOR_MACRO_USAGE_ERROR, "defined()", o, false, true, true);
- return "0";
- }
- }
- else
- {
- ungetChar(c);
- definitionIdentifier = getNextIdentifier();
- }
-
- if (definitions.get(definitionIdentifier) != null)
- return "1";
-
- return "0";
- }
-
-
-
- private ParserLanguage language = ParserLanguage.CPP;
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IScanner#setCppNature(boolean)
- */
- public void setLanguage( ParserLanguage value) {
- language = value;
- }
-
- public void setThrowExceptionOnBadCharacterRead( boolean throwOnBad ){
- throwExceptionOnBadCharacterRead = throwOnBad;
- }
-
- private final ISourceElementRequestor requestor;
- private IASTFactory astFactory = null;
- private static final int NO_OFFSET_LIMIT = -1;
- private int offsetLimit = NO_OFFSET_LIMIT;
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IScanner#setASTFactory(org.eclipse.cdt.internal.core.parser.ast.IASTFactory)
- */
- public void setASTFactory(IASTFactory f) {
- astFactory = f;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IScanner#getLineNumberForOffset(int)
- */
- public int getLineNumberForOffset(int i)
- {
- ILineOffsetReconciler reconciler = ParserFactory.createLineOffsetReconciler( backupReader );
- return reconciler.getLineNumberForOffset(i);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IScanner#setOffsetBoundary(int)
- */
- public void setOffsetBoundary(int offset) {
- offsetLimit = offset;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ScannerContext.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ScannerContext.java
deleted file mode 100644
index 726587d559b..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ScannerContext.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001 Rational Software Corp. 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 implementation
- ******************************************************************************/
-package org.eclipse.cdt.internal.core.parser;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.util.Stack;
-
-import org.eclipse.cdt.core.parser.ast.IASTInclusion;
-
-public class ScannerContext implements IScannerContext
-{
- private Reader reader;
- private String filename;
- private int macroOffset = -1;
- private int macroLength = -1;
- private int line = 1;
- private int offset;
- private Stack undo = new Stack();
- private ContextKind kind;
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IScannerContext#initialize(Reader, String, int, IASTInclusion, int, int, int)
- */
- public ScannerContext(Reader r, String f, ContextKind k, IASTInclusion i, int mO, int mL, int l)
- {
- reader = r;
- filename = f;
- offset = 0;
- kind = k;
- inc = i;
- macroOffset = mO;
- macroLength = mL;
- line = l;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IScannerContext#initialize(Reader, String, int, IASTInclusion)
- */
- public ScannerContext(Reader r, String f, ContextKind k, IASTInclusion i)
- {
- this(r, f, k, i, -1, -1, 1);
- }
-
- public int read() throws IOException {
- ++offset;
- int c = reader.read();
- if ((char)c == '\n') line++;
- return c;
- }
-
- /**
- * Returns the filename.
- * @return String
- */
- public final String getFilename()
- {
- return filename;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IScannerContext#getExtension()
- */
- public final int getMacroOffset()
- {
- return macroOffset;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IScannerContext#getMacroLength()
- */
- public final int getMacroLength()
- {
- return macroLength;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IScannerContext#getOffset()
- */
- public final int getOffset()
- {
- // All the tokens generated by the macro expansion
- // will have dimensions (offset and length) equal to the expanding symbol.
- return (macroOffset < 0) ? offset : macroOffset;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IScannerContext#getRelativeOffset()
- */
- public final int getRelativeOffset()
- {
- return offset;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IScannerContext#getLine()
- */
- public final int getLine()
- {
- return line;
- }
-
- /**
- * Returns the reader.
- * @return Reader
- */
- public final Reader getReader()
- {
- return reader;
- }
-
- public final int undoStackSize()
- {
- return undo.size();
- }
-
- /**
- * Returns the undo.
- * @return int
- */
- public final int popUndo()
- {
- int c = ((Integer)undo.pop()).intValue();
- if ((char)c == '\n') line++;
- return c;
- }
-
- /**
- * Sets the undo.
- * @param undo The undo to set
- */
- public void pushUndo(int undo)
- {
- if ((char)undo == '\n') line--;
- this.undo.push( new Integer( undo ));
- }
-
-
- /**
- * Returns the kind.
- * @return int
- */
- public ContextKind getKind() {
- return kind;
- }
-
- /**
- * Sets the kind.
- * @param kind The kind to set
- */
- public void setKind(ContextKind kind) {
- this.kind = kind;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IScannerContext#getExtension()
- */
- public IASTInclusion getExtension() {
- return inc;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IScannerContext#setExtension(org.eclipse.cdt.core.parser.ast.IASTInclusion)
- */
- public void setExtension(IASTInclusion ext) {
- inc = ext;
- }
-
- private IASTInclusion inc = null;
-
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ScannerProblemFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ScannerProblemFactory.java
deleted file mode 100644
index ed5c64a9546..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ScannerProblemFactory.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/**********************************************************************
- * 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.HashMap;
-import java.util.Map;
-
-import org.eclipse.cdt.core.parser.IProblem;
-
-/**
- * @author jcamelon
- *
- */
-public class ScannerProblemFactory extends BaseProblemFactory implements IProblemFactory
-{
- protected static Map errorMessages = new HashMap();
- static {
- errorMessages.put(
- new Integer(IProblem.PREPROCESSOR_POUND_ERROR),
- "#error encountered with text: ");
- errorMessages.put(
- new Integer(IProblem.PREPROCESSOR_INCLUSION_NOT_FOUND),
- "Preprocessor Inclusion not found: ");
- errorMessages.put(
- new Integer(IProblem.PREPROCESSOR_DEFINITION_NOT_FOUND),
- "Macro definition not found: ");
- errorMessages.put(
- new Integer(IProblem.PREPROCESSOR_INVALID_MACRO_DEFN),
- "Macro definition malformed for macro: ");
- errorMessages.put(
- new Integer(IProblem.PREPROCESSOR_INVALID_MACRO_REDEFN),
- "Invalid macro redefinition for macro : ");
- errorMessages.put(
- new Integer(IProblem.PREPROCESSOR_UNBALANCE_CONDITION),
- "Preprocessor Conditionals unbalanced : ");
- errorMessages.put(
- new Integer(IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR),
- "Expression Evaluation error for condition : ");
- errorMessages.put(
- new Integer(IProblem.PREPROCESSOR_MACRO_USAGE_ERROR),
- "Macro usage error for macro :");
- errorMessages.put(
- new Integer(IProblem.PREPROCESSOR_CIRCULAR_INCLUSION),
- "Circular inclusion for file : ");
- errorMessages.put(
- new Integer(IProblem.PREPROCESSOR_INVALID_DIRECTIVE),
- "Invalid preprocessor directive : ");
- errorMessages.put(
- new Integer(IProblem.PREPROCESSOR_MACRO_PASTING_ERROR),
- "Invalid use of macro pasting in macro : ");
- errorMessages.put(
- new Integer(IProblem.SCANNER_INVALID_ESCAPECHAR),
- "Invalid escape character encountered ");
- errorMessages.put(
- new Integer(IProblem.SCANNER_UNBOUNDED_STRING),
- "Unbounded string encountered ");
- errorMessages.put(
- new Integer(IProblem.SCANNER_BAD_FLOATING_POINT),
- "Invalid floating point format encountered ");
- errorMessages.put(
- new Integer(IProblem.SCANNER_BAD_HEX_FORMAT),
- "Invalid hexidecimal format encountered ");
- errorMessages.put(
- new Integer(IProblem.SCANNER_UNEXPECTED_EOF),
- "Unexpected End Of File encountered ");
- errorMessages.put(
- new Integer(IProblem.SCANNER_BAD_CHARACTER),
- "Bad character sequence encountered : ");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.BaseProblemFactory#createMessage()
- */
- public String createMessage(int id, Map arguments, int lineNumber, char[] fileName)
- {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append(PROBLEM);
- buffer.append(errorMessages.get(new Integer(id)));
- switch (id)
- {
- case IProblem.PREPROCESSOR_POUND_ERROR :
- buffer.append(arguments.get(IProblem.A_PREPROC_POUND_ERROR));
- break;
- case IProblem.PREPROCESSOR_INCLUSION_NOT_FOUND :
- buffer.append(arguments.get(IProblem.A_PREPROC_INCLUDE_FILENAME));
- break;
- case IProblem.PREPROCESSOR_DEFINITION_NOT_FOUND :
- buffer.append(arguments.get(IProblem.A_PREPROC_MACRO_NAME));
- break;
- case IProblem.PREPROCESSOR_UNBALANCE_CONDITION :
- buffer.append(arguments.get(IProblem.A_PREPROC_CONDITIONAL_MISMATCH));
- break;
- case IProblem.PREPROCESSOR_INVALID_MACRO_DEFN :
- buffer.append(arguments.get(IProblem.A_PREPROC_MACRO_NAME));
- break;
- case IProblem.PREPROCESSOR_INVALID_DIRECTIVE :
- buffer.append(arguments.get(IProblem.A_PREPROC_UNKNOWN_DIRECTIVE));
- break;
- case IProblem.PREPROCESSOR_INVALID_MACRO_REDEFN :
- buffer.append(arguments.get(IProblem.A_PREPROC_MACRO_NAME));
- break;
- case IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR :
- buffer.append(arguments.get(IProblem.A_PREPROC_CONDITION));
- break;
- case IProblem.PREPROCESSOR_MACRO_USAGE_ERROR :
- buffer.append(arguments.get(IProblem.A_PREPROC_MACRO_NAME));
- break;
- case IProblem.PREPROCESSOR_MACRO_PASTING_ERROR :
- buffer.append(arguments.get(IProblem.A_PREPROC_MACRO_NAME));
- break;
- case IProblem.PREPROCESSOR_CIRCULAR_INCLUSION :
- buffer.append(arguments.get(IProblem.A_PREPROC_INCLUDE_FILENAME));
- break;
- case IProblem.SCANNER_BAD_CHARACTER :
- buffer.append( arguments.get(IProblem.A_SCANNER_BADCHAR));
- break;
- case IProblem.SCANNER_UNBOUNDED_STRING :
- case IProblem.SCANNER_INVALID_ESCAPECHAR :
- case IProblem.SCANNER_BAD_FLOATING_POINT :
- case IProblem.SCANNER_BAD_HEX_FORMAT :
- case IProblem.SCANNER_UNEXPECTED_EOF :
- break;
- default :
- return null;
- }
-
- buffer.append( IN_FILE );
- buffer.append(fileName);
- buffer.append( ON_LINE );
- buffer.append(lineNumber);
- return buffer.toString();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IProblemFactory#createProblem(int, int, int, int, char[], java.lang.String, boolean, boolean)
- */
- public IProblem createProblem(
- int id,
- int start,
- int end,
- int line,
- char[] file,
- Map arguments,
- boolean warn,
- boolean error)
- {
- if( checkBitmask( id, IProblem.INTERNAL_RELATED ) )
- return createInternalProblem( id, start, end, line, file, arguments, warn, error );
-
- if ( checkBitmask( id, IProblem.SCANNER_RELATED ) ||
- checkBitmask( id, IProblem.PREPROCESSOR_RELATED ) )
- return super.createProblem(
- id,
- start,
- end,
- line,
- file,
- createMessage(id, arguments, line, file),
- arguments,
- warn,
- error);
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IProblemFactory#getRequiredAttributesForId(int)
- */
- public String[] getRequiredAttributesForId(int id)
- {
- String [] result = new String[1];
- switch (id)
- {
- case IProblem.PREPROCESSOR_POUND_ERROR :
- result[0] = IProblem.A_PREPROC_POUND_ERROR;
- break;
- case IProblem.PREPROCESSOR_INCLUSION_NOT_FOUND :
- result[0] = IProblem.A_PREPROC_INCLUDE_FILENAME;
- break;
- case IProblem.PREPROCESSOR_DEFINITION_NOT_FOUND :
- result[0] = IProblem.A_PREPROC_MACRO_NAME;
- break;
- case IProblem.PREPROCESSOR_UNBALANCE_CONDITION :
- result[0] = IProblem.A_PREPROC_CONDITIONAL_MISMATCH;
- break;
- case IProblem.PREPROCESSOR_INVALID_MACRO_DEFN :
- result[0] = IProblem.A_PREPROC_MACRO_NAME;
- break;
- case IProblem.PREPROCESSOR_INVALID_DIRECTIVE :
- result[0] = IProblem.A_PREPROC_UNKNOWN_DIRECTIVE;
- break;
- case IProblem.PREPROCESSOR_INVALID_MACRO_REDEFN :
- result[0] = IProblem.A_PREPROC_MACRO_NAME;
- break;
- case IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR :
- result[0] = IProblem.A_PREPROC_CONDITION;
- break;
- case IProblem.PREPROCESSOR_MACRO_USAGE_ERROR :
- result[0] = IProblem.A_PREPROC_MACRO_NAME;
- break;
- case IProblem.PREPROCESSOR_MACRO_PASTING_ERROR :
- result[0] = IProblem.A_PREPROC_MACRO_NAME;
- break;
- case IProblem.PREPROCESSOR_CIRCULAR_INCLUSION :
- result[0] = IProblem.A_PREPROC_INCLUDE_FILENAME;
- break;
- case IProblem.SCANNER_BAD_CHARACTER :
- result[0] = IProblem.A_SCANNER_BADCHAR;
- break;
- case IProblem.SCANNER_UNBOUNDED_STRING :
- case IProblem.SCANNER_INVALID_ESCAPECHAR :
- case IProblem.SCANNER_BAD_FLOATING_POINT :
- case IProblem.SCANNER_BAD_HEX_FORMAT :
- case IProblem.SCANNER_UNEXPECTED_EOF :
- break;
- }
- return result;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/SimpleDeclarationStrategy.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/SimpleDeclarationStrategy.java
deleted file mode 100644
index 2a0fef675bf..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/SimpleDeclarationStrategy.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**********************************************************************
- * 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 org.eclipse.cdt.core.parser.Enum;
-
-/**
- * @author jcamelon
- *
- */
-public class SimpleDeclarationStrategy extends Enum
-{
- public static final SimpleDeclarationStrategy TRY_CONSTRUCTOR = new SimpleDeclarationStrategy( 1 );
- public static final SimpleDeclarationStrategy TRY_FUNCTION = new SimpleDeclarationStrategy( 2 );
- public static final SimpleDeclarationStrategy TRY_VARIABLE = new SimpleDeclarationStrategy( 3 );
-
- /**
- * @param enumValue
- */
- public SimpleDeclarationStrategy(int enumValue)
- {
- super(enumValue);
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/StructuralParseCallback.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/StructuralParseCallback.java
deleted file mode 100644
index 6273867783d..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/StructuralParseCallback.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/**********************************************************************
- * 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.LinkedList;
-
-import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTField;
-import org.eclipse.cdt.core.parser.ast.IASTFunction;
-import org.eclipse.cdt.core.parser.ast.IASTInclusion;
-import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
-import org.eclipse.cdt.core.parser.ast.IASTMacro;
-import org.eclipse.cdt.core.parser.ast.IASTMethod;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
-import org.eclipse.cdt.core.parser.ast.IASTNode;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTVariable;
-import org.eclipse.cdt.internal.core.parser.QuickParseCallback;
-import org.eclipse.cdt.internal.core.parser.ast.complete.ASTScope;
-
-/**
- * @author hamer
- *
- * To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-public class StructuralParseCallback extends QuickParseCallback{
-
- protected LinkedList scopeStack = new LinkedList();
- protected IASTScope currentScope = null;
- protected int inclusionLevel = 0;
-
-
- private void addElement (IASTDeclaration element){
- if(inclusionLevel == 0)
- ((ASTScope)currentScope).addDeclaration(element);
- }
-
- private void enterScope(IASTNode node){
- if(node instanceof IASTScope){
- pushScope((IASTScope)node);
- }
- }
-
- private void exitScope(IASTNode node){
- if(node instanceof IASTScope){
- popScope();
- }
- }
-
- private void pushScope( IASTScope scope ){
- scopeStack.addFirst( currentScope );
- currentScope = (IASTScope)scope;
- }
-
- private IASTScope popScope(){
- IASTScope oldScope = currentScope;
- currentScope = (scopeStack.size() > 0 ) ? (IASTScope) scopeStack.removeFirst() : null;
- return oldScope;
- }
-
- private IASTScope peekAtScope(){
- return currentScope;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMacro(org.eclipse.cdt.core.parser.ast.IASTMacro)
- */
- public void acceptMacro(IASTMacro macro) {
- if(inclusionLevel == 0)
- macros.add(macro);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptVariable(org.eclipse.cdt.core.parser.ast.IASTVariable)
- */
- public void acceptVariable(IASTVariable variable) {
- addElement(variable);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFunctionDeclaration(org.eclipse.cdt.core.parser.ast.IASTFunction)
- */
- public void acceptFunctionDeclaration(IASTFunction function) {
- addElement(function);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedefDeclaration(org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration)
- */
- public void acceptTypedefDeclaration(IASTTypedefDeclaration typedef) {
- addElement(typedef);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumerationSpecifier(org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier)
- */
- public void acceptEnumerationSpecifier(IASTEnumerationSpecifier enumeration) {
- enterScope(enumeration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptElaboratedForewardDeclaration(org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier)
- */
- public void acceptElaboratedForewardDeclaration(IASTElaboratedTypeSpecifier elaboratedType) {
- enterScope(elaboratedType);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptAbstractTypeSpecDeclaration(org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration)
- */
- public void acceptAbstractTypeSpecDeclaration(IASTAbstractTypeSpecifierDeclaration abstractDeclaration) {
- addElement(abstractDeclaration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterInclusion(org.eclipse.cdt.core.parser.ast.IASTInclusion)
- */
- public void enterInclusion(IASTInclusion inclusion) {
- if(inclusionLevel == 0)
- inclusions.add(inclusion);
- inclusionLevel++;
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition)
- */
- public void enterNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) {
- addElement(namespaceDefinition);
- enterScope(namespaceDefinition);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier)
- */
- public void enterClassSpecifier(IASTClassSpecifier classSpecification) {
- enterScope(classSpecification);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterLinkageSpecification(org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification)
- */
- public void enterLinkageSpecification(IASTLinkageSpecification linkageSpec) {
- enterScope(linkageSpec);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCompilationUnit(org.eclipse.cdt.core.parser.ast.IASTCompilationUnit)
- */
- public void enterCompilationUnit(IASTCompilationUnit compilationUnit) {
- enterScope(compilationUnit);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMethodDeclaration(org.eclipse.cdt.core.parser.ast.IASTMethod)
- */
- public void acceptMethodDeclaration(IASTMethod method) {
- addElement(method);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptField(org.eclipse.cdt.core.parser.ast.IASTField)
- */
- public void acceptField(IASTField field) {
- addElement(field);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCompilationUnit(org.eclipse.cdt.core.parser.ast.IASTCompilationUnit)
- */
- public void exitCompilationUnit(IASTCompilationUnit compilationUnit) {
- exitScope(compilationUnit);
- this.compilationUnit = compilationUnit;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitInclusion(org.eclipse.cdt.core.parser.ast.IASTInclusion)
- */
- public void exitInclusion( IASTInclusion inclusion )
- {
- inclusionLevel--;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IQuickParseCallback#getCompilationUnit()
- */
- public IASTCompilationUnit getCompilationUnit() {
- return compilationUnit; }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier)
- */
- public void exitClassSpecifier(IASTClassSpecifier classSpecification) {
- exitScope(classSpecification);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitLinkageSpecification(org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification)
- */
- public void exitLinkageSpecification(IASTLinkageSpecification linkageSpec) {
- exitScope(linkageSpec);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition)
- */
- public void exitNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) {
- exitScope(namespaceDefinition);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterFunctionBody(org.eclipse.cdt.core.parser.ast.IASTFunction)
- */
- public void enterFunctionBody(IASTFunction function) {
- addElement(function);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterMethodBody(org.eclipse.cdt.core.parser.ast.IASTMethod)
- */
- public void enterMethodBody(IASTMethod method) {
- addElement(method);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateDeclaration(org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration)
- */
- public void enterTemplateDeclaration(IASTTemplateDeclaration declaration) {
- addElement(declaration);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/StructuralParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/StructuralParser.java
deleted file mode 100644
index 06c3b24c322..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/StructuralParser.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**********************************************************************
- * 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 org.eclipse.cdt.core.parser.BacktrackException;
-import org.eclipse.cdt.core.parser.EndOfFileException;
-import org.eclipse.cdt.core.parser.IParser;
-import org.eclipse.cdt.core.parser.IParserLogService;
-import org.eclipse.cdt.core.parser.IScanner;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ParserFactory;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.core.parser.ParserMode;
-import org.eclipse.cdt.core.parser.ParserNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTCompletionNode;
-import org.eclipse.cdt.core.parser.ast.IASTNode;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-
-/**
- * @author jcamelon
- */
-public class StructuralParser extends Parser implements IParser {
-
- /**
- * @param scanner
- * @param ourCallback
- * @param language
- * @param logService
- */
- public StructuralParser(IScanner scanner, ISourceElementRequestor ourCallback, ParserLanguage language, IParserLogService logService) {
- super(scanner, ourCallback, language, logService);
- astFactory = ParserFactory.createASTFactory( ParserMode.COMPLETE_PARSE, language);
- scanner.setASTFactory(astFactory);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.Parser#handleFunctionBody(org.eclipse.cdt.core.parser.ast.IASTScope, boolean)
- */
- protected void handleFunctionBody(
- IASTScope scope,
- boolean isInlineFunction)
- throws BacktrackException, EndOfFileException {
- skipOverCompoundStatement();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.Parser#catchBlockCompoundStatement(org.eclipse.cdt.core.parser.ast.IASTScope)
- */
- protected void catchBlockCompoundStatement(IASTScope scope)
- throws BacktrackException, EndOfFileException {
- skipOverCompoundStatement();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IParser#parse(int)
- */
- public IASTCompletionNode parse(int offset) throws ParserNotImplementedException {
- throw new ParserNotImplementedException();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IParser#parse(int, int)
- */
- public IASTNode parse(int startingOffset, int endingOffset) throws ParserNotImplementedException {
- throw new ParserNotImplementedException();
- }
-
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Token.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Token.java
deleted file mode 100644
index 4a5a87da7cb..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Token.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001 Rational Software Corp. 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 implementation
- ******************************************************************************/
-package org.eclipse.cdt.internal.core.parser;
-
-import org.eclipse.cdt.core.parser.IToken;
-
-public class Token implements IToken {
-
- public Token(int t, String i, IScannerContext context ) {
- type = t;
- image = i;
- filename = context.getFilename();
- offset = context.getOffset() - image.length() - context.undoStackSize();
- macroOffset = context.getMacroOffset();
- macroLength = context.getMacroLength();
-
- if( type == tLSTRING || type == tSTRING || type == tCHAR ){
- offset--;
- }
- }
-
- public Token(int t, String i) {
- type = t;
- image = i;
- }
-
- public String toString()
- {
- return "Token type=" + type + " image =" + image + " offset=" + offset;
- }
-
- public int type;
- public int getType() { return type; }
-
- protected String image;
- public String getImage() { return image; }
-
- public String filename;
-
- protected int offset;
- protected int macroOffset = -1;
- protected int macroLength = -1;
- // All the tokens generated by the macro expansion
- // will have dimensions (offset and length) equal to the expanding symbol.
- public int getOffset() { return (macroOffset < 0) ? offset : macroOffset; }
- public int getLength() { return (macroLength < 0) ? image.length() : macroLength; }
- public int getEndOffset() { return getOffset() + getLength(); }
-
-
- public int getDelta( IToken other )
- {
- return other.getOffset() + other.getLength() - getOffset();
- }
-
- private IToken next;
- public IToken getNext() { return next; }
- public void setNext(IToken t) { next = t; }
-
- public boolean looksLikeExpression()
- {
- switch( getType() )
- {
- case tINTEGER:
- case t_false:
- case t_true:
- case tSTRING:
- case tLSTRING:
- case tFLOATINGPT:
- case tCHAR:
- case tAMPER:
- case tDOT:
- case tLPAREN:
- case tMINUS:
- case tSTAR:
- case tPLUS:
- case tNOT:
- case tCOMPL:
- return true;
- default:
- break;
- }
-
-
- return false;
- }
-
- public boolean isPointer()
- {
- return (getType() == tAMPER || getType() == tSTAR);
- }
-
- public boolean isOperator()
- {
- switch( getType() )
- {
- case IToken.t_new:
- case IToken.t_delete:
- case IToken.tPLUS:
- case IToken.tMINUS:
- case IToken.tSTAR:
- case IToken.tDIV:
- case IToken.tXOR:
- case IToken.tMOD:
- case IToken.tAMPER:
- case IToken.tBITOR:
- case IToken.tCOMPL:
- case IToken.tNOT:
- case IToken.tASSIGN:
- case IToken.tLT:
- case IToken.tGT:
- case IToken.tPLUSASSIGN:
- case IToken.tMINUSASSIGN:
- case IToken.tSTARASSIGN:
- case IToken.tDIVASSIGN:
- case IToken.tMODASSIGN:
- case IToken.tBITORASSIGN:
- case IToken.tAMPERASSIGN:
- case IToken.tXORASSIGN:
- case IToken.tSHIFTL:
- case IToken.tSHIFTR:
- case IToken.tSHIFTLASSIGN:
- case IToken.tSHIFTRASSIGN:
- case IToken.tEQUAL:
- case IToken.tNOTEQUAL:
- case IToken.tLTEQUAL:
- case IToken.tGTEQUAL:
- case IToken.tAND:
- case IToken.tOR:
- case IToken.tINCR:
- case IToken.tDECR:
- case IToken.tCOMMA:
- case IToken.tARROW:
- case IToken.tARROWSTAR:
- return true;
- default:
- return false;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IToken#setImage()
- */
- public void setImage( String i ) {
- image = i;
- }
-
-
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object other) {
- if( other == null ) return false;
- if( !( other instanceof IToken ) )
- return false;
- if( !(((IToken)other).getImage().equals( image )))
- return false;
- if( ((IToken)other).getType() != type )
- return false;
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IToken#setType(int)
- */
- public void setType(int i) {
- type = i;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/TokenDuple.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/TokenDuple.java
deleted file mode 100644
index e0d0c99b78f..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/TokenDuple.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/**********************************************************************
- * 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.Iterator;
-import java.util.NoSuchElementException;
-
-import org.eclipse.cdt.core.parser.IToken;
-import org.eclipse.cdt.core.parser.ITokenDuple;
-
-/**
- * @author jcamelon
- *
- */
-public class TokenDuple implements ITokenDuple {
-
- public TokenDuple( IToken first, IToken last )
- {
- firstToken = first;
- lastToken = last;
- }
- protected final IToken firstToken, lastToken;
- /**
- * @return
- */
- public IToken getFirstToken() {
- return firstToken;
- }
-
- /**
- * @return
- */
- public IToken getLastToken() {
- return lastToken;
- }
-
- public Iterator iterator()
- {
- return new TokenIterator();
- }
-
- private class TokenIterator implements Iterator
- {
- private IToken iter = TokenDuple.this.firstToken;
-
- /* (non-Javadoc)
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext() {
- return ( iter != null );
- }
-
- /* (non-Javadoc)
- * @see java.util.Iterator#next()
- */
- public Object next() {
- if( ! hasNext() )
- throw new NoSuchElementException();
- IToken temp = iter;
- if( iter == lastToken )
- iter = null;
- else
- iter = iter.getNext();
- return temp;
- }
-
- /* (non-Javadoc)
- * @see java.util.Iterator#remove()
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- }
-
- public String toString()
- {
- StringBuffer buff = new StringBuffer();
- IToken prev = null;
- IToken iter = firstToken;
- for( ; ; )
- {
- if( prev != null &&
- prev.getType() != IToken.tCOLONCOLON &&
- prev.getType() != IToken.tIDENTIFIER &&
- prev.getType() != IToken.tLT &&
- prev.getType() != IToken.tCOMPL &&
- iter.getType() != IToken.tGT &&
- prev.getType() != IToken.tLBRACKET &&
- iter.getType() != IToken.tRBRACKET &&
- iter.getType() != IToken.tCOLONCOLON )
- buff.append( ' ');
-
-
- buff.append( iter.getImage() );
- if( iter == lastToken ) break;
- prev = iter;
- iter = iter.getNext();
- }
- return buff.toString().trim();
- }
-
- public boolean isIdentifier()
- {
- return ( firstToken == lastToken );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ITokenDuple#length()
- */
- public int length()
- {
- int count = 0;
- Iterator i = iterator();
- while( i.hasNext() )
- {
- ++count;
- i.next();
- }
- return count;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ITokenDuple#getSubDuple(int, int)
- */
- public ITokenDuple getSubrange(int startIndex, int endIndex)
- {
- return new TokenDuple( getToken( startIndex ), getToken( endIndex) );
- }
-
- /**
- * @param endIndex
- */
- public IToken getToken(int index)
- {
- if( index < 0 || index >= length() ) return null;
- Iterator i = iterator();
- int count = 0;
- while( i.hasNext() )
- {
- IToken r = (IToken)i.next();
- if( count == index )
- return r;
- ++count;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ITokenDuple#findLastTokenType(int)
- */
- public int findLastTokenType(int type)
- {
- int count = 0;
- int lastFound = -1;
- Iterator i = iterator();
- while( i.hasNext() )
- {
- IToken token = (IToken)i.next();
- if( token.getType() == type )
- lastFound = count;
- ++count;
- }
-
- return lastFound;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/TypeId.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/TypeId.java
deleted file mode 100644
index af554f0a2b8..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/TypeId.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**********************************************************************
- * 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.List;
-
-import org.eclipse.cdt.core.parser.ITokenDuple;
-import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
-import org.eclipse.cdt.core.parser.ast.IASTArrayModifier;
-
-/**
- * @author jcamelon
- *
- */
-public class TypeId implements IDeclarator
-{
- private ITokenDuple name;
- private List arrayModifiers = new ArrayList();
- private List pointerOperators = new ArrayList();
- /**
- *
- */
- public TypeId()
- {
- super();
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IDeclarator#getPointerOperators()
- */
- public List getPointerOperators()
- {
- return pointerOperators;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IDeclarator#addPointerOperator(org.eclipse.cdt.core.parser.ast.ASTPointerOperator)
- */
- public void addPointerOperator(ASTPointerOperator ptrOp)
- {
- pointerOperators.add( ptrOp );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IDeclarator#addArrayModifier(org.eclipse.cdt.core.parser.ast.IASTArrayModifier)
- */
- public void addArrayModifier(IASTArrayModifier arrayMod)
- {
- arrayModifiers.add( arrayMod );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IDeclarator#getArrayModifiers()
- */
- public List getArrayModifiers()
- {
- return arrayModifiers;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IDeclarator#setPointerOperatorName(org.eclipse.cdt.core.parser.ITokenDuple)
- */
- public void setPointerOperatorName(ITokenDuple nameDuple)
- {
- name = nameDuple;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IDeclarator#getPointerOperatorNameDuple()
- */
- public ITokenDuple getPointerOperatorNameDuple()
- {
- return name;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTAbstractDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTAbstractDeclaration.java
deleted file mode 100644
index e3468ee10cb..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTAbstractDeclaration.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/**********************************************************************
- * 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.ast;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTArrayModifier;
-import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTAbstractDeclaration implements IASTAbstractDeclaration
-{
- private final boolean isVolatile;
- private final List parms;
- private final boolean isConst;
- private final IASTTypeSpecifier typeSpecifier;
- private final List pointerOperators;
- private final List arrayModifiers;
- private final ASTPointerOperator pointerOperator;
- /**
- * @param isConst
- * @param typeSpecifier
- * @param pointerOperators
- * @param arrayModifiers
- */
- public ASTAbstractDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp )
- {
- this.isConst = isConst;
- this.typeSpecifier = typeSpecifier;
- this.pointerOperators = pointerOperators;
- this.arrayModifiers = arrayModifiers;
- this.parms = parameters;
- this.pointerOperator = pointerOp;
- this.isVolatile = isVolatile;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#isConst()
- */
- public boolean isConst()
- {
- return isConst;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getTypeSpecifier()
- */
- public IASTTypeSpecifier getTypeSpecifier()
- {
- return typeSpecifier;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getPointerOperators()
- */
- public Iterator getPointerOperators()
- {
- if( pointerOperators == null ) return new EmptyIterator();
- return pointerOperators.iterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getArrayModifiers()
- */
- public Iterator getArrayModifiers()
- {
- if( arrayModifiers == null ) return new EmptyIterator();
- return arrayModifiers.iterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getParameters()
- */
- public Iterator getParameters()
- {
- if( parms == null ) return new EmptyIterator();
- return parms.iterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getPointerToFunctionOperator()
- */
- public ASTPointerOperator getPointerToFunctionOperator()
- {
- return pointerOperator;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#isVolatile()
- */
- public boolean isVolatile()
- {
- return isVolatile;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- Iterator arrayMods = getArrayModifiers();
- while( arrayMods.hasNext() )
- ((IASTArrayModifier)arrayMods.next()).acceptElement(requestor);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTArrayModifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTArrayModifier.java
deleted file mode 100644
index bd0839088a0..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTArrayModifier.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**********************************************************************
- * 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.ast;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTArrayModifier;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTArrayModifier implements IASTArrayModifier
-{
- private final IASTExpression expression;
- /**
- * @param exp
- */
- public ASTArrayModifier(IASTExpression exp)
- {
- expression = exp;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.IASTArrayModifier#getExpression()
- */
- public IASTExpression getExpression()
- {
- return expression;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- if( expression != null )
- expression.acceptElement( requestor );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTCompletionNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTCompletionNode.java
deleted file mode 100644
index 6dfa5dac3dd..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTCompletionNode.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**********************************************************************
- * 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.ast;
-
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.cdt.core.parser.ast.IASTCompletionNode;
-import org.eclipse.cdt.core.parser.ast.IASTNode;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-
-/**
- * @author jcamelon
- */
-public class ASTCompletionNode implements IASTCompletionNode {
-
- private final String prefix;
- private final IASTNode context;
- private final IASTScope scope;
- private final CompletionKind kind;
- private final Set keywordSet;
-
- public ASTCompletionNode( CompletionKind kind, IASTScope scope, IASTNode context, String prefix, Set keywords )
- {
- this.kind = kind;
- this.context = context;
- this.scope = scope;
- this.prefix = prefix;
- this.keywordSet = keywords;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTCompletionNode#getCompletionKind()
- */
- public CompletionKind getCompletionKind() {
- return kind;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTCompletionNode#getCompletionScope()
- */
- public IASTScope getCompletionScope() {
- return scope;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTCompletionNode#getCompletionContext()
- */
- public IASTNode getCompletionContext() {
- return context;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTCompletionNode#getCompletionPrefix()
- */
- public String getCompletionPrefix() {
- return prefix;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTCompletionNode#getKeywords()
- */
- public Iterator getKeywords() {
- if( keywordSet == null )
- return new EmptyIterator();
- return keywordSet.iterator();
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTDesignator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTDesignator.java
deleted file mode 100644
index 39f1af97226..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTDesignator.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**********************************************************************
- * 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.ast;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTDesignator;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTDesignator implements IASTDesignator
-{
- /**
- * @param kind
- * @param constantExpression
- * @param string
- */
- public ASTDesignator(DesignatorKind kind, IASTExpression constantExpression, String fieldName, int fieldOffset )
- {
- this.fieldName = fieldName;
- this.constantExpression = constantExpression;
- this.kind = kind;
- this.fieldOffset = fieldOffset;
- }
-
- private int fieldOffset;
- private final String fieldName;
- private final IASTExpression constantExpression;
- private final DesignatorKind kind;
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTDesignator#getKind()
- */
- public DesignatorKind getKind()
- {
- return kind;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTDesignator#arraySubscriptExpression()
- */
- public IASTExpression arraySubscriptExpression()
- {
- return constantExpression;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTDesignator#fieldName()
- */
- public String fieldName()
- {
- return fieldName;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- if( constantExpression != null )
- constantExpression.acceptElement(requestor);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTDesignator#fieldOffset()
- */
- public int fieldOffset()
- {
- return fieldOffset;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTInclusion.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTInclusion.java
deleted file mode 100644
index 2e4c9df1538..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTInclusion.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/**********************************************************************
- * 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.ast;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTInclusion;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTInclusion implements IASTInclusion {
-
- public ASTInclusion( String name, String fileName, boolean local, int startingOffset, int nameOffset, int nameEndOffset, int endOffset )
- {
- this.name = name;
- this.fileName = fileName;
- this.local = local;
- setStartingOffset(startingOffset);
- setNameOffset(nameOffset);
- setNameEndOffset(nameEndOffset);
- setEndingOffset(endOffset);
- }
-
- private int nameEndOffset;
- private final String name, fileName;
- private final boolean local;
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTInclusion#getName()
- */
- public String getName() {
- return name;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTInclusion#getFullFileName()
- */
- public String getFullFileName() {
- return fileName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTInclusion#isLocal()
- */
- public boolean isLocal() {
- return local;
- }
-
-
- private int startingOffset = 0, nameOffset = 0, endingOffset = 0;
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset() {
- return startingOffset;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset() {
- return endingOffset;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementNameOffset()
- */
- public int getNameOffset() {
- return nameOffset;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.IOffsetableElementRW#setStartingOffset(int)
- */
- public void setStartingOffset(int o) {
- startingOffset = o;
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.IOffsetableElementRW#setEndingOffset(int)
- */
- public void setEndingOffset(int o) {
- endingOffset = o;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.IOffsetableElementRW#setNameOffset(int)
- */
- public void setNameOffset(int o) {
- nameOffset = o;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.enterInclusion(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.exitInclusion(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return nameEndOffset;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- nameEndOffset = o;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTMacro.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTMacro.java
deleted file mode 100644
index 257e74345e8..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTMacro.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/**********************************************************************
- * 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.ast;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTMacro;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTMacro implements IASTMacro {
-
- private int nameEndOffset = 0;
- private final String name;
- public ASTMacro( String name, int start, int end, int nameBeg, int nameEnd )
- {
- this.name =name;
- setStartingOffset(start);
- setNameOffset(nameBeg);
- setNameEndOffset(nameEnd);
- setEndingOffset(end);
- }
-
- private int startingOffset = 0, endingOffset = 0, nameOffset = 0;
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMacro#getName()
- */
- public String getName() {
- return name;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IOffsetableElementRW#setStartingOffset(int)
- */
- public void setStartingOffset(int o) {
- startingOffset = o;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IOffsetableElementRW#setEndingOffset(int)
- */
- public void setEndingOffset(int o) {
- endingOffset = o;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IOffsetableElementRW#setNameOffset(int)
- */
- public void setNameOffset(int o) {
- nameOffset = o;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset() {
- return startingOffset;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset() {
- return endingOffset;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementNameOffset()
- */
- public int getNameOffset() {
- return nameOffset;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptMacro( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return nameEndOffset;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- nameEndOffset = o;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTQualifiedNamedElement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTQualifiedNamedElement.java
deleted file mode 100644
index 2c094c78da4..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTQualifiedNamedElement.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**********************************************************************
- * 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.ast;
-
-import java.util.Stack;
-
-import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
-import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
-import org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTScopedElement;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTQualifiedNamedElement implements IASTQualifiedNameElement
-{
-
- /**
- * @param scope
- */
- public ASTQualifiedNamedElement(IASTScope scope, String name )
- {
- Stack names = new Stack();
- IASTScope parent = scope;
-
- names.push( name ); // push on our own name
- while (parent != null)
- {
- if (parent instanceof IASTNamespaceDefinition
- || parent instanceof IASTClassSpecifier )
- {
- names.push(((IASTOffsetableNamedElement)parent).getName());
- if( parent instanceof IASTScopedElement )
- parent = ((IASTScopedElement)parent).getOwnerScope();
- }
- else
- break;
- }
- if (names.size() != 0)
- {
- qualifiedNames = new String[names.size()];
- int counter = 0;
- while (!names.empty())
- qualifiedNames[counter++] = (String)names.pop();
- }
- else
- qualifiedNames = null;
-
- }
-
- public String[] getFullyQualifiedName()
- {
- return qualifiedNames;
- }
-
- private final String[] qualifiedNames;
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java
deleted file mode 100644
index fe9e0807446..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**********************************************************************
- * 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.ast;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.IToken;
-import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTArrayModifier;
-import org.eclipse.cdt.core.parser.ast.IASTDesignator;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.core.parser.ast.IASTInclusion;
-import org.eclipse.cdt.core.parser.ast.IASTMacro;
-import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTDesignator.DesignatorKind;
-
-
-/**
- * @author jcamelon
- *
- */
-public class BaseASTFactory {
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createMacro(java.lang.String, int, int, int)
- */
- public IASTMacro createMacro(String name, int startingOffset, int nameOffset, int nameEndOffset, int endingOffset) {
- IASTMacro m = new ASTMacro( name, startingOffset, endingOffset, nameOffset, nameEndOffset );
- return m;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createInclusion(java.lang.String, java.lang.String, boolean)
- */
- public IASTInclusion createInclusion(String name, String fileName, boolean local, int startingOffset, int nameOffset, int nameEndOffset, int endingOffset) {
- IASTInclusion inclusion = new ASTInclusion( name, fileName, local, startingOffset, nameOffset, nameEndOffset, endingOffset );
- return inclusion;
- }
-
- public IASTAbstractDeclaration createAbstractDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOperator)
- {
- return new ASTAbstractDeclaration( isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOperator );
- }
-
- public IASTArrayModifier createArrayModifier(IASTExpression exp)
- {
- return new ASTArrayModifier( exp );
- }
-
- public IASTDesignator createDesignator(DesignatorKind kind, IASTExpression constantExpression, IToken fieldIdentifier)
- {
- return new ASTDesignator( kind, constantExpression,
- fieldIdentifier == null ? "" : fieldIdentifier.getImage(),
- fieldIdentifier == null ? -1 : fieldIdentifier.getOffset() );
- }
-
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/EmptyIterator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/EmptyIterator.java
deleted file mode 100644
index 7024c6e16a6..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/EmptyIterator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**********************************************************************
- * 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.ast;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-
-public class EmptyIterator implements Iterator
-{
-
- /* (non-Javadoc)
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext()
- {
- return false;
- }
-
- /* (non-Javadoc)
- * @see java.util.Iterator#next()
- */
- public Object next()
- {
- throw new NoSuchElementException();
- }
-
- /* (non-Javadoc)
- * @see java.util.Iterator#remove()
- */
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
-
-} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/NamedOffsets.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/NamedOffsets.java
deleted file mode 100644
index 885c038c4b3..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/NamedOffsets.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**********************************************************************
- * 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.ast;
-
-
-/**
- * @author jcamelon
- *
- */
-public class NamedOffsets extends Offsets {
-
- private int nameEndOffset = 0;
- private int nameOffset = 0;
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
- */
- public int getNameOffset() {
- return nameOffset;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o) {
- nameOffset = o;
- }
-
- public int getNameEndOffset()
- {
- return nameEndOffset;
- }
-
- public void setNameEndOffset( int offset )
- {
- nameEndOffset = offset;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/Offsets.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/Offsets.java
deleted file mode 100644
index 5e11a809611..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/Offsets.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**********************************************************************
- * 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.ast;
-
-/**
- * @author jcamelon
- *
- */
-public class Offsets {
-
- protected int startingOffset = 0;
-
- protected int endingOffset = 0;
-
- public void setStartingOffset(int o) {
- startingOffset = o;
- }
-
- public void setEndingOffset(int o) {
- endingOffset = o;
- }
-
- public int getStartingOffset() {
- return startingOffset;
- }
-
- public int getEndingOffset() {
- return endingOffset;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTASMDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTASMDefinition.java
deleted file mode 100644
index a21cdcfd5ea..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTASMDefinition.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
-import org.eclipse.cdt.internal.core.parser.ast.Offsets;
-import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTASMDefinition extends ASTAnonymousDeclaration implements IASTASMDefinition
-{
- private Offsets offsets = new Offsets();
- private final String assembly;
- /**
- *
- */
- public ASTASMDefinition( IContainerSymbol scope, String assembly, int first, int last )
- {
- super( scope );
- this.assembly = assembly;
- setStartingOffset(first);
- setEndingOffset(last);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTASMDefinition#getBody()
- */
- public String getBody()
- {
- return assembly;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptASMDefinition(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTAbstractTypeSpecifierDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTAbstractTypeSpecifierDeclaration.java
deleted file mode 100644
index b18bd438c23..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTAbstractTypeSpecifierDeclaration.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTTemplate;
-import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
-import org.eclipse.cdt.internal.core.parser.ast.Offsets;
-import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
-
-
-/**
- * @author jcamelon
- *
- */
-public class ASTAbstractTypeSpecifierDeclaration
- extends ASTAnonymousDeclaration
- implements IASTAbstractTypeSpecifierDeclaration
-{
- private final IASTTypeSpecifier typeSpec;
- private final IASTTemplate ownerTemplate;
- private Offsets offsets = new Offsets();
- /**
- * @param ownerScope
- */
- public ASTAbstractTypeSpecifierDeclaration(IContainerSymbol ownerScope, IASTTypeSpecifier typeSpecifier, IASTTemplate ownerTemplate, int startingOffset, int endingOffset )
- {
- super(ownerScope);
- this.typeSpec = typeSpecifier;
- this.ownerTemplate = ownerTemplate;
- setStartingOffset(startingOffset);
- setEndingOffset(endingOffset);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptAbstractTypeSpecDeclaration(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeSpecifierOwner#getTypeSpecifier()
- */
- public IASTTypeSpecifier getTypeSpecifier()
- {
- return typeSpec;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplatedDeclaration#getOwnerTemplateDeclaration()
- */
- public IASTTemplate getOwnerTemplateDeclaration()
- {
- return ownerTemplate;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTAnonymousDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTAnonymousDeclaration.java
deleted file mode 100644
index dca696eb68d..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTAnonymousDeclaration.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
-
-/**
- * @author jcamelon
- *
- */
-public abstract class ASTAnonymousDeclaration extends ASTNode implements IASTDeclaration
-{
- private final IContainerSymbol ownerScope;
- /**
- *
- */
- public ASTAnonymousDeclaration( IContainerSymbol ownerScope )
- {
- this.ownerScope = ownerScope;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
- */
- public IASTScope getOwnerScope()
- {
- return (IASTScope)ownerScope.getASTExtension().getPrimaryDeclaration();
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTBaseSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTBaseSpecifier.java
deleted file mode 100644
index 1b3f9b44afd..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTBaseSpecifier.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTBaseSpecifier implements IASTBaseSpecifier
-{
- private ASTReferenceStore referenceDelegate;
- private final boolean isVirtual;
- private final ISymbol symbol;
- private final ASTAccessVisibility visibility;
- private final int offset;
- /**
- * @param symbol
- * @param b
- * @param visibility
- */
- public ASTBaseSpecifier(ISymbol symbol, boolean b, ASTAccessVisibility visibility, int nameOffset, List references)
- {
- isVirtual = b;
- this.visibility = visibility;
- this.symbol = symbol;
- this.offset = nameOffset;
- referenceDelegate = new ASTReferenceStore( references );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#getAccess()
- */
- public ASTAccessVisibility getAccess()
- {
- return visibility;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#isVirtual()
- */
- public boolean isVirtual()
- {
- return isVirtual;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#getParentClassName()
- */
- public String getParentClassName()
- {
- return symbol.getName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#getParentClassSpecifier()
- */
- public IASTClassSpecifier getParentClassSpecifier()
- throws ASTNotImplementedException
- {
- return (IASTClassSpecifier)symbol.getASTExtension().getPrimaryDeclaration();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#getNameOffset()
- */
- public int getNameOffset()
- {
- return offset;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTReferenceStore#processReferences()
- */
- public void processReferences(ISourceElementRequestor requestor) throws ASTNotImplementedException
- {
- referenceDelegate.processReferences(requestor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- referenceDelegate.processReferences(requestor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassReference.java
deleted file mode 100644
index 99424e8ac63..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassReference.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTClassReference;
-import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTClassReference
- extends ASTReference
- implements IASTClassReference
-{
- private final IASTTypeSpecifier reference;
- /**
- * @param i
- * @param string
- * @param specifier
- */
- public ASTClassReference(int i, String string, IASTTypeSpecifier specifier)
- {
- super( i, string );
- reference = specifier;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTReference#getReferencedElement()
- */
- public ISourceElementCallbackDelegate getReferencedElement()
- {
- return (ISourceElementCallbackDelegate)reference;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptClassReference( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTClassReference#isResolved()
- */
- public boolean isResolved()
- {
- return ( reference instanceof IASTClassSpecifier );
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java
deleted file mode 100644
index d343045049b..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.core.parser.ast.ASTClassKind;
-import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-import org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-import org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol.IParentSymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTClassSpecifier extends ASTScope implements IASTClassSpecifier
-{
- private List declarations = new ArrayList();
- public class BaseIterator implements Iterator
- {
-
- private final Iterator parents;
- /**
- * @param symbol
- */
- public BaseIterator(IDerivableContainerSymbol symbol)
- {
- if( symbol.getParents() != null )
- parents = symbol.getParents().iterator();
- else
- parents = null;
- }
- /* (non-Javadoc)
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext()
- {
- if( parents == null )
- return false;
- return parents.hasNext();
- }
- /* (non-Javadoc)
- * @see java.util.Iterator#next()
- */
- public Object next()
- {
- if( ! hasNext() )
- throw new NoSuchElementException();
-
- IParentSymbol pw = (IParentSymbol)parents.next();
-
- return new ASTBaseSpecifier( pw.getParent(), pw.isVirtual(), pw.getAccess(), pw.getOffset(), pw.getReferences() );
-
- }
- /* (non-Javadoc)
- * @see java.util.Iterator#remove()
- */
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- }
-
-
-
- private NamedOffsets offsets = new NamedOffsets();
- private final ClassNameType classNameType;
- private final ASTClassKind classKind;
- private ASTAccessVisibility currentVisibility;
- private final ASTQualifiedNamedElement qualifiedName;
- private final ASTReferenceStore references;
-
- /**
- * @param symbol
- */
- public ASTClassSpecifier(ISymbol symbol, ASTClassKind kind, ClassNameType type, ASTAccessVisibility access, int startingOffset, int nameOffset, int nameEndOffset, List references )
- {
- super(symbol);
- classKind = kind;
- classNameType = type;
- currentVisibility = access;
- setStartingOffset(startingOffset);
- setNameOffset(nameOffset);
- setNameEndOffset(nameEndOffset);
- qualifiedName = new ASTQualifiedNamedElement( getOwnerScope(), symbol.getName() );
- this.references = new ASTReferenceStore( references );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getClassNameType()
- */
- public ClassNameType getClassNameType()
- {
- return classNameType;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getClassKind()
- */
- public ASTClassKind getClassKind()
- {
- return classKind;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getBaseClauses()
- */
- public Iterator getBaseClauses()
- {
- return new BaseIterator( (IDerivableContainerSymbol)getSymbol() );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getCurrentVisibilityMode()
- */
- public ASTAccessVisibility getCurrentVisibilityMode()
- {
- return currentVisibility;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#setCurrentVisibility(org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
- */
- public void setCurrentVisibility(ASTAccessVisibility visibility)
- {
- currentVisibility = visibility;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
- */
- public String getName()
- {
- return symbol.getName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
- */
- public int getNameOffset()
- {
- return offsets.getNameOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- offsets.setNameOffset(o);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- references.processReferences( requestor );
- try
- {
- requestor.enterClassSpecifier(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- Iterator i = getBaseClauses();
- while( i.hasNext() )
- {
- IASTBaseSpecifier baseSpec = (IASTBaseSpecifier)i.next();
- baseSpec.acceptElement(requestor);
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.exitClassSpecifier(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
- */
- public String[] getFullyQualifiedName()
- {
- return qualifiedName.getFullyQualifiedName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
- */
- public IASTScope getOwnerScope()
- {
- return (IASTScope)symbol.getContainingSymbol().getASTExtension().getPrimaryDeclaration();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-
- public Iterator getDeclarations()
- {
- return declarations.iterator();
- }
- public void addDeclaration(IASTDeclaration declaration)
- {
- declarations.add(declaration);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCodeScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCodeScope.java
deleted file mode 100644
index 218dc24809d..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCodeScope.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Created on Sep 2, 2003
- *
- * To change the template for this generated file go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-package org.eclipse.cdt.internal.core.parser.ast.complete;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTCodeScope;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
-
-/**
- * @author jcamelon
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-public class ASTCodeScope extends ASTScope implements IASTCodeScope {
-
- private List declarations = new ArrayList();
- private final IASTCodeScope ownerCodeScope;
-
- /**
- * @param newScope
- */
- public ASTCodeScope(IContainerSymbol newScope) {
- super( newScope );
- ownerCodeScope = ( newScope.getContainingSymbol().getASTExtension().getPrimaryDeclaration() instanceof IASTCodeScope ) ?
- (IASTCodeScope) newScope.getContainingSymbol().getASTExtension().getPrimaryDeclaration() : null;
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor) {
- try
- {
- requestor.enterCodeBlock( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor) {
- try
- {
- requestor.exitCodeBlock( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTCodeScope#getOwnerCodeScope()
- */
- public IASTCodeScope getOwnerCodeScope()
- {
- return ownerCodeScope;
- }
-
- public Iterator getDeclarations()
- {
- return declarations.iterator();
- }
-
- public void addDeclaration(IASTDeclaration declaration)
- {
- declarations.add(declaration);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCompilationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCompilationUnit.java
deleted file mode 100644
index 2b926efec56..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCompilationUnit.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTCompilationUnit
- extends ASTScope
- implements IASTCompilationUnit
-{
- private List declarations = new ArrayList();
- /**
- * @param symbol
- */
- public ASTCompilationUnit(ISymbol symbol)
- {
- super(symbol);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.enterCompilationUnit( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.exitCompilationUnit( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
- public Iterator getDeclarations()
- {
- return declarations.iterator();
- }
- public void addDeclaration(IASTDeclaration declaration)
- {
- declarations.add(declaration);
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTConstructorMemberInitializer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTConstructorMemberInitializer.java
deleted file mode 100644
index bc395dcae94..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTConstructorMemberInitializer.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTConstructorMemberInitializer
- implements IASTConstructorMemberInitializer
-{
- private final int nameOffset;
- private final boolean requireNameResolution;
- private final String name;
- private final IASTExpression expression;
- private final List references;
- /**
- *
- */
- public ASTConstructorMemberInitializer( IASTExpression expression, String name, int nameOffset, List references, boolean requireNameResolution )
- {
- this.expression = expression;
- this.name = name;
- this.nameOffset = nameOffset;
- this.references = references;
- this.requireNameResolution = requireNameResolution;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer#getExpressionList()
- */
- public IASTExpression getExpressionList()
- {
- return expression;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer#getName()
- */
- public String getName()
- {
- return name;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- ASTReferenceStore store = new ASTReferenceStore( references );
- store.processReferences( requestor );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
- /**
- * @return
- */
- public boolean requiresNameResolution()
- {
- return requireNameResolution;
- }
-
- /**
- * @return
- */
- public List getReferences()
- {
- return references;
- }
- /**
- * @return
- */
- public int getNameOffset()
- {
- return nameOffset;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTElaboratedTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTElaboratedTypeSpecifier.java
deleted file mode 100644
index 576e84ef206..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTElaboratedTypeSpecifier.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTClassKind;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
-import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTElaboratedTypeSpecifier extends ASTSymbol implements IASTElaboratedTypeSpecifier
-{
- private List references;
- private final boolean isForwardDeclaration;
- private final ASTClassKind kind;
- private final ASTQualifiedNamedElement qualifiedName;
- private NamedOffsets offsets = new NamedOffsets();
- private final ASTReferenceStore store;
-
- /**
- * @param checkSymbol
- * @param kind
- * @param startingOffset
- * @param endOffset
- */
- public ASTElaboratedTypeSpecifier(ISymbol checkSymbol, ASTClassKind kind, int startingOffset, int nameOffset, int nameEndOffset, int endOffset, List references, boolean isDecl )
- {
- super( checkSymbol );
- this.kind = kind;
- setStartingOffset( startingOffset );
- setNameOffset( nameOffset );
- setNameEndOffset(nameEndOffset);
- setEndingOffset( endOffset );
- qualifiedName = new ASTQualifiedNamedElement( getOwnerScope(), checkSymbol.getName() );
- store = new ASTReferenceStore( references );
- isForwardDeclaration = isDecl;
- this.references = references;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier#getName()
- */
- public String getName()
- {
- return getSymbol().getName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier#getClassKind()
- */
- public ASTClassKind getClassKind()
- {
- return kind;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier#isResolved()
- */
- public boolean isResolved() throws ASTNotImplementedException
- {
- return ! getSymbol().isForwardDeclaration();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset( o );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- if( isForwardDeclaration )
- try
- {
- requestor.acceptElaboratedForewardDeclaration(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- store.processReferences(requestor);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
- */
- public String[] getFullyQualifiedName()
- {
- return qualifiedName.getFullyQualifiedName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
- */
- public int getNameOffset() {
- return offsets.getNameOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o) {
- offsets.setNameOffset(o);
- }
-
- public List getReferences()
- {
- return references;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerationReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerationReference.java
deleted file mode 100644
index d7d503aa3d1..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerationReference.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTEnumerationReference;
-import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTEnumerationReference
- extends ASTReference
- implements IASTEnumerationReference
-{
- private final IASTEnumerationSpecifier referencedElement;
- /**
- * @param offset
- * @param string
- * @param specifier
- */
- public ASTEnumerationReference(int offset, String string, IASTEnumerationSpecifier specifier)
- {
- super( offset, string );
- referencedElement = specifier;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTReference#getReferencedElement()
- */
- public ISourceElementCallbackDelegate getReferencedElement()
- {
- return referencedElement;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptEnumerationReference( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerationSpecifier.java
deleted file mode 100644
index 0fd3ae5a5af..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerationSpecifier.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
-import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTEnumerationSpecifier
- extends ASTSymbol
- implements IASTEnumerationSpecifier
-{
- private NamedOffsets offsets = new NamedOffsets();
- private final ASTQualifiedNamedElement qualifiedName;
- /**
- * @param symbol
- */
- public ASTEnumerationSpecifier(ISymbol symbol, int startingOffset, int nameOffset, int nameEndOffset )
- {
- super(symbol);
- setStartingOffset(startingOffset);
- setNameOffset( nameOffset );
- setNameEndOffset(nameEndOffset);
- qualifiedName = new ASTQualifiedNamedElement( getOwnerScope(), symbol.getName() );
- }
-
-
- private List enumerators = new ArrayList();
- public void addEnumerator(IASTEnumerator enumerator)
- {
- enumerators.add(enumerator);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier#getEnumerators()
- */
- public Iterator getEnumerators()
- {
- return enumerators.iterator();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptEnumerationSpecifier(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
- */
- public String getName()
- {
- return getSymbol().getName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
- */
- public int getNameOffset()
- {
- return offsets.getNameOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- offsets.setNameOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
- */
- public String[] getFullyQualifiedName()
- {
- return qualifiedName.getFullyQualifiedName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset( o );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset( o );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerator.java
deleted file mode 100644
index 43b8e482115..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumerator.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTEnumerator extends ASTSymbol implements IASTEnumerator
-{
- private NamedOffsets offsets = new NamedOffsets();
- private final IASTExpression initialValue;
- private final IASTEnumerationSpecifier owner;
- /**
- * @param enumeratorSymbol
- * @param startingOffset
- * @param endingOffset
- * @param initialValue
- */
- public ASTEnumerator(ISymbol enumeratorSymbol, IASTEnumerationSpecifier owner, int startingOffset, int nameOffset, int nameEndOffset, int endingOffset, IASTExpression initialValue)
- {
- super( enumeratorSymbol );
- setStartingOffset(startingOffset);
- setNameOffset( nameOffset );
- setNameEndOffset( nameEndOffset );
- setEndingOffset( endingOffset );
- this.initialValue = initialValue;
- this.owner = owner;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTEnumerator#getOwnerEnumerationSpecifier()
- */
- public IASTEnumerationSpecifier getOwnerEnumerationSpecifier()
- {
- return owner;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTEnumerator#getInitialValue()
- */
- public IASTExpression getInitialValue()
- {
- return initialValue;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
- */
- public String getName()
- {
- return symbol.getName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
- */
- public int getNameOffset()
- {
- return getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumeratorReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumeratorReference.java
deleted file mode 100644
index 7c68f7efe10..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumeratorReference.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
-import org.eclipse.cdt.core.parser.ast.IASTEnumeratorReference;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTEnumeratorReference extends ASTReference implements IASTEnumeratorReference
-{
-
- private final IASTEnumerator enumerator;
- /**
- * @param offset
- * @param string
- * @param enumerator
- */
- public ASTEnumeratorReference(int offset, String string, IASTEnumerator enumerator)
- {
- super( offset, string );
- this.enumerator = enumerator;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTReference#getReferencedElement()
- */
- public ISourceElementCallbackDelegate getReferencedElement()
- {
- return enumerator;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptEnumeratorReference( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTExceptionSpecification.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTExceptionSpecification.java
deleted file mode 100644
index a1d46cee274..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTExceptionSpecification.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
-import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTExceptionSpecification implements IASTExceptionSpecification
-{
- private final List typeIds;
- private final ASTReferenceStore store;
- /**
- * @param newTypeIds
- * @param references
- */
- public ASTExceptionSpecification(List newTypeIds, List references)
- {
- this.typeIds = newTypeIds;
- store = new ASTReferenceStore( references );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification#getTypeIds()
- */
- public Iterator getTypeIds()
- {
- if( typeIds == null ) return new EmptyIterator();
- return typeIds.iterator();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- store.processReferences(requestor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTExpression.java
deleted file mode 100644
index 7f2c2f1075b..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTExpression.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ITokenDuple;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.ExpressionEvaluationException;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.core.parser.ast.IASTReference;
-import org.eclipse.cdt.core.parser.ast.IASTTypeId;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTExpression implements IASTExpression
-{
- private final Kind kind;
- private final IASTExpression lhs;
- private final IASTExpression rhs;
- private final IASTExpression thirdExpression;
- private final String literal, idExpression;
- private ITokenDuple idExpressionDuple;
- private final IASTTypeId typeId;
- private final IASTNewExpressionDescriptor newDescriptor;
- private final List references;
- private ExpressionResult resultType;
- /**
- *
- */
- public ASTExpression( Kind kind, IASTExpression lhs, IASTExpression rhs,
- IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor, List references )
- {
- this.kind = kind;
- this.lhs = lhs;
- this.rhs = rhs;
- this.thirdExpression = thirdExpression;
- this.literal = literal;
- this.typeId = typeId;
- this.newDescriptor = newDescriptor;
- this.references = references;
- this.idExpressionDuple = idExpression;
- this.idExpression = idExpressionDuple == null ? "" : idExpressionDuple.toString();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getExpressionKind()
- */
- public Kind getExpressionKind()
- {
- return kind;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getLHSExpression()
- */
- public IASTExpression getLHSExpression()
- {
- return lhs;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getRHSExpression()
- */
- public IASTExpression getRHSExpression()
- {
- return rhs;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getThirdExpression()
- */
- public IASTExpression getThirdExpression()
- {
- return thirdExpression;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getLiteralString()
- */
- public String getLiteralString()
- {
- return literal;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getTypeId()
- */
- public IASTTypeId getTypeId()
- {
- return typeId;
- }
- /*
- * returns the type id token
- */
- public ITokenDuple getTypeIdTokenDuple()
- {
- if( typeId == null ) return null;
- return ((ASTTypeId)typeId).getTokenDuple();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getNewExpressionDescriptor()
- */
- public IASTNewExpressionDescriptor getNewExpressionDescriptor()
- {
- return newDescriptor;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#evaluateExpression()
- */
- public int evaluateExpression() throws ExpressionEvaluationException
- {
- throw new ExpressionEvaluationException();
- }
-
- public List getReferences()
- {
- return references;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- reconcileReferences();
- }
- catch (ASTNotImplementedException e)
- {
- // will not get thrown
- }
- if( ! references.isEmpty() )
- new ASTReferenceStore( references ).processReferences(requestor);
-
- if( typeId != null )
- typeId.acceptElement(requestor);
-
- if( lhs != null )
- lhs.acceptElement(requestor);
-
- if( rhs!= null )
- rhs.acceptElement(requestor);
-
- if( thirdExpression != null )
- thirdExpression.acceptElement(requestor);
-
- if( newDescriptor != null )
- newDescriptor.acceptElement(requestor);
-
- try
- {
- purgeReferences();
- }
- catch (ASTNotImplementedException e)
- {
- // will not get thrown
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-
- /**
- * @return
- */
- public ExpressionResult getResultType() {
- return resultType;
- }
-
- /**
- * @param i
- */
- public void setResultType(ExpressionResult i) {
- resultType = i;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getIdExpression()
- */
- public String getIdExpression()
- {
- return idExpression;
- }
- /**
- * @return
- */
- public ITokenDuple getIdExpressionTokenDuple()
- {
- return idExpressionDuple;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#reconcileReferences()
- */
- public void reconcileReferences() throws ASTNotImplementedException
- {
- if( lhs != null )
- lhs.reconcileReferences();
- if( rhs != null )
- rhs.reconcileReferences();
- if( thirdExpression != null )
- thirdExpression.reconcileReferences();
-
- reconcileSubExpression((ASTExpression)lhs);
- reconcileSubExpression((ASTExpression)rhs);
- reconcileSubExpression((ASTExpression)thirdExpression);
- }
- protected void reconcileSubExpression(ASTExpression subExpression)
- {
- if( subExpression != null && subExpression.getReferences() != null )
- {
- Iterator subExp = subExpression.getReferences().iterator();
- while( subExp.hasNext() )
- {
- IASTReference aReference = (IASTReference)subExp.next();
- if( aReference != null && references.contains( aReference ) )
- subExp.remove();
- }
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#purgeReferences()
- */
- public void purgeReferences() throws ASTNotImplementedException
- {
- if( lhs != null )
- lhs.purgeReferences();
- if( rhs != null )
- rhs.purgeReferences();
- if( thirdExpression != null )
- thirdExpression.purgeReferences();
-
- purgeSubExpression((ASTExpression)lhs);
- purgeSubExpression((ASTExpression)rhs);
- purgeSubExpression((ASTExpression)thirdExpression);
- }
- protected void purgeSubExpression(ASTExpression subExpression)
- {
- if( subExpression != null && subExpression.getReferences() != null )
- {
- subExpression.getReferences().clear();
- }
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTField.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTField.java
deleted file mode 100644
index 0ca3e0617e7..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTField.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.core.parser.ast.IASTField;
-import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTField extends ASTVariable implements IASTField
-{
- private final ASTAccessVisibility visibility;
- /**
- * @param newSymbol
- * @param abstractDeclaration
- * @param initializerClause
- * @param bitfieldExpression
- * @param startingOffset
- * @param nameOffset
- * @param references
- * @param visibility
- */
- public ASTField(ISymbol newSymbol, IASTAbstractDeclaration abstractDeclaration, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, int startingOffset, int nameOffset, int nameEndOffset, List references, boolean previouslyDeclared, IASTExpression constructorExpression, ASTAccessVisibility visibility)
- {
- super( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, nameOffset, nameEndOffset, references, constructorExpression, previouslyDeclared );
- this.visibility = visibility;
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMember#getVisiblity()
- */
- public ASTAccessVisibility getVisiblity()
- {
- return visibility;
- }
-
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptField(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- referenceDelegate.processReferences(requestor);
- if( getInitializerClause() != null )
- getInitializerClause().acceptElement(requestor);
- if( getAbstractDeclaration() != null )
- getAbstractDeclaration().acceptElement(requestor);
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFieldReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFieldReference.java
deleted file mode 100644
index 287cd8c3bc7..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFieldReference.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTField;
-import org.eclipse.cdt.core.parser.ast.IASTFieldReference;
-import org.eclipse.cdt.core.parser.ast.IASTReference;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTFieldReference
- extends ASTReference
- implements IASTReference, IASTFieldReference
-{
- private final IASTField referencedElement;
- /**
- * @param offset
- * @param string
- * @param field
- */
- public ASTFieldReference(int offset, String string, IASTField field)
- {
- super(offset, string);
- referencedElement = field;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTReference#getReferencedElement()
- */
- public ISourceElementCallbackDelegate getReferencedElement()
- {
- return referencedElement;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptFieldReference(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java
deleted file mode 100644
index fe800d53c1a..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTArrayModifier;
-import org.eclipse.cdt.core.parser.ast.IASTCodeScope;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
-import org.eclipse.cdt.core.parser.ast.IASTFunction;
-import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTTemplate;
-import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-import org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol;
-import org.eclipse.cdt.internal.core.parser.pst.TypeInfo;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTFunction extends ASTScope implements IASTFunction
-{
- private final boolean previouslyDeclared;
- private boolean hasFunctionBody = false;
- private final IASTTemplate ownerTemplate;
- private final IASTAbstractDeclaration returnType;
- private final IASTExceptionSpecification exception;
- private NamedOffsets offsets = new NamedOffsets();
- private final ASTQualifiedNamedElement qualifiedName;
- private final List parameters;
- protected final ASTReferenceStore references;
- private final int nameEndOffset;
- private List declarations = new ArrayList();
- /**
- * @param symbol
- * @param parameters
- * @param returnType
- * @param exception
- * @param startOffset
- * @param nameOffset
- * @param ownerTemplate
- * @param references
- */
- public ASTFunction(IParameterizedSymbol symbol, int nameEndOffset, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, int startOffset, int nameOffset, IASTTemplate ownerTemplate, List references, boolean previouslyDeclared, boolean hasFunctionTryBlock )
- {
- super( symbol );
- this.parameters = parameters;
- this.nameEndOffset = nameEndOffset;
- this.returnType = returnType;
- this.exception = exception;
- setStartingOffset(startOffset);
- setNameOffset(nameOffset);
- setNameEndOffset(nameEndOffset);
- this.ownerTemplate = ownerTemplate;
- this.references = new ASTReferenceStore( references );
- qualifiedName = new ASTQualifiedNamedElement( getOwnerScope(), symbol.getName() );
- this.previouslyDeclared =previouslyDeclared;
- this.hasFunctionTryBlock = hasFunctionTryBlock;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#isInline()
- */
- public boolean isInline()
- {
- return symbol.getTypeInfo().checkBit( TypeInfo.isInline );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#isFriend()
- */
- public boolean isFriend()
- {
- return symbol.getTypeInfo().checkBit( TypeInfo.isFriend );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#isStatic()
- */
- public boolean isStatic()
- {
- return symbol.getTypeInfo().checkBit( TypeInfo.isStatic );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
- */
- public String getName()
- {
- return symbol.getName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#getReturnType()
- */
- public IASTAbstractDeclaration getReturnType()
- {
- return returnType;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#getParameters()
- */
- public Iterator getParameters()
- {
- return parameters.iterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#getExceptionSpec()
- */
- public IASTExceptionSpecification getExceptionSpec()
- {
- return exception;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#setHasFunctionBody(boolean)
- */
- public void setHasFunctionBody(boolean b)
- {
- hasFunctionBody = true;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#hasFunctionBody()
- */
- public boolean hasFunctionBody()
- {
- return hasFunctionBody;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
- */
- public int getNameOffset()
- {
- return offsets.getNameOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- offsets.setNameOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplatedDeclaration#getOwnerTemplateDeclaration()
- */
- public IASTTemplate getOwnerTemplateDeclaration()
- {
- return ownerTemplate;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
- */
- public String[] getFullyQualifiedName()
- {
- return qualifiedName.getFullyQualifiedName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptFunctionDeclaration(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- functionCallbacks(requestor);
- }
-
- protected void functionCallbacks(ISourceElementRequestor requestor)
- {
- references.processReferences(requestor);
- processParameterInitializersAndArrayMods(requestor);
- if( getReturnType() != null )
- getReturnType().acceptElement(requestor);
- if( getExceptionSpec() != null )
- getExceptionSpec().acceptElement(requestor);
- }
- /**
- * @param requestor
- */
- protected void processParameterInitializersAndArrayMods(ISourceElementRequestor requestor)
- {
- Iterator i = parameters.iterator();
- while( i.hasNext() )
- {
- IASTParameterDeclaration parm = (IASTParameterDeclaration)i.next();
- if( parm.getDefaultValue() != null )
- parm.getDefaultValue().acceptElement(requestor);
- Iterator arrays = parm.getArrayModifiers();
- while( arrays.hasNext() )
- {
- ((IASTArrayModifier)arrays.next()).acceptElement(requestor);
- }
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.enterFunctionBody( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- functionCallbacks( requestor );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.exitFunctionBody( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTCodeScope#getOwnerCodeScope()
- */
- public IASTCodeScope getOwnerCodeScope()
- {
- return ( getSymbol().getContainingSymbol().getASTExtension().getPrimaryDeclaration() ) instanceof IASTCodeScope ?
- (IASTCodeScope) getSymbol().getContainingSymbol().getASTExtension().getPrimaryDeclaration() : null;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#previouslyDeclared()
- */
- public boolean previouslyDeclared()
- {
- return previouslyDeclared;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-
-
- private boolean hasFunctionTryBlock = false;
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#setHasFunctionTryBlock(boolean)
- */
- public void setHasFunctionTryBlock(boolean b)
- {
- hasFunctionTryBlock = b;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#hasFunctionTryBlock()
- */
- public boolean hasFunctionTryBlock()
- {
- return hasFunctionTryBlock;
- }
-
- public Iterator getDeclarations()
- {
- return declarations.iterator();
- }
- public void addDeclaration(IASTDeclaration declaration)
- {
- declarations.add(declaration);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#takesVarArgs()
- */
- public boolean takesVarArgs() {
- return ((IParameterizedSymbol)getSymbol()).hasVariableArgs();
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunctionReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunctionReference.java
deleted file mode 100644
index d359dd38e12..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunctionReference.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTFunction;
-import org.eclipse.cdt.core.parser.ast.IASTFunctionReference;
-import org.eclipse.cdt.core.parser.ast.IASTReference;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTFunctionReference
- extends ASTReference
- implements IASTReference, IASTFunctionReference
-{
- private final IASTFunction declaration;
- /**
- * @param offset
- * @param name
- */
- public ASTFunctionReference(int offset, String name, IASTFunction referencedDeclaration )
- {
- super(offset, name);
- this.declaration = referencedDeclaration;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTReference#getReferencedElement()
- */
- public ISourceElementCallbackDelegate getReferencedElement()
- {
- return declaration;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptFunctionReference( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
-
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTInitializerClause.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTInitializerClause.java
deleted file mode 100644
index 09de3fe33a3..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTInitializerClause.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
-import org.eclipse.cdt.core.parser.ast.IASTVariable;
-import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTInitializerClause implements IASTInitializerClause
-{
- private List references = new ArrayList();
- private IASTVariable ownerDeclaration = null;
- private final IASTInitializerClause.Kind kind;
- private final IASTExpression assignmentExpression;
- private final List initializerClauses;
- private final List designators;
-
- /**
- * @param kind
- * @param assignmentExpression
- * @param initializerClauses
- * @param designators
- */
- public ASTInitializerClause(Kind kind, IASTExpression assignmentExpression, List initializerClauses, List designators)
- {
- this.kind = kind;
- this.assignmentExpression = assignmentExpression;
- this.initializerClauses = initializerClauses;
- this.designators = designators;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getKind()
- */
- public Kind getKind() {
- return kind;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getInitializerList()
- */
- public Iterator getInitializers() {
- if( initializerClauses == null )
- return new EmptyIterator();
- return initializerClauses.iterator();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getAssigmentExpression()
- */
- public IASTExpression getAssigmentExpression() {
- return assignmentExpression;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- Iterator i = getInitializers();
- while( i.hasNext() )
- ((IASTInitializerClause)i.next()).acceptElement(requestor);
-
- if( assignmentExpression != null )
- assignmentExpression.acceptElement( requestor );
-
- ASTReferenceStore store = new ASTReferenceStore( getReferences() );
- store.processReferences(requestor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getDesignators()
- */
- public Iterator getDesignators()
- {
- return designators.iterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#setOwnerDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
- */
- public void setOwnerVariableDeclaration(IASTVariable declaration)
- {
- ownerDeclaration = declaration;
- Iterator subInitializers = getInitializers();
- while( subInitializers.hasNext() )
- ((IASTInitializerClause)subInitializers.next()).setOwnerVariableDeclaration(declaration);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getOwnerDeclaration()
- */
- public IASTVariable getOwnerVariableDeclaration()
- {
- return ownerDeclaration;
- }
-
- public List getReferences()
- {
- return references;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTLinkageSpecification.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTLinkageSpecification.java
deleted file mode 100644
index 82de4e82c4d..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTLinkageSpecification.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.Iterator;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
-import org.eclipse.cdt.internal.core.parser.ast.Offsets;
-import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTLinkageSpecification extends ASTAnonymousDeclaration implements IASTLinkageSpecification
-{
- private final String linkageString;
- private Offsets offsets = new Offsets();
- /**
- *
- */
- public ASTLinkageSpecification( IContainerSymbol scope, String linkageString, int startingOffset )
- {
- super( scope );
- this.linkageString = linkageString;
- setStartingOffset(startingOffset);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification#getLinkageString()
- */
- public String getLinkageString()
- {
- return linkageString;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
- */
- public Iterator getDeclarations() throws ASTNotImplementedException
- {
- throw new ASTNotImplementedException();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.enterLinkageSpecification(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.exitLinkageSpecification(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTMethod.java
deleted file mode 100644
index b1fbb19e06e..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTMethod.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
-import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
-import org.eclipse.cdt.core.parser.ast.IASTMethod;
-import org.eclipse.cdt.core.parser.ast.IASTTemplate;
-import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
-import org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol;
-import org.eclipse.cdt.internal.core.parser.pst.TypeInfo;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTMethod extends ASTFunction implements IASTMethod
-{
- private final List constructorChain;
- private final boolean isConstructor;
- private final boolean isPureVirtual;
- private final ASTAccessVisibility visibility;
- private final boolean isDestructor;
- /**
- * @param symbol
- * @param parameters
- * @param returnType
- * @param exception
- * @param startOffset
- * @param nameOffset
- * @param ownerTemplate
- * @param references
- */
- public ASTMethod(IParameterizedSymbol symbol, int nameEndOffset, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, int startOffset, int nameOffset, IASTTemplate ownerTemplate, List references, boolean previouslyDeclared,
- boolean isConstructor, boolean isDestructor, boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChain, boolean hasFunctionTryBlock )
- {
- super(
- symbol,
- nameEndOffset,
- parameters,
- returnType,
- exception,
- startOffset,
- nameOffset,
- ownerTemplate,
- references, previouslyDeclared, hasFunctionTryBlock );
- this.visibility = visibility;
- this.isConstructor = isConstructor;
- this.isDestructor = isDestructor;
- this.isPureVirtual = isPureVirtual;
- this.constructorChain = constructorChain;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMethod#isVirtual()
- */
- public boolean isVirtual()
- {
- return symbol.getTypeInfo().checkBit( TypeInfo.isVirtual );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMethod#isExplicit()
- */
- public boolean isExplicit()
- {
- return symbol.getTypeInfo().checkBit( TypeInfo.isExplicit);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMethod#isConstructor()
- */
- public boolean isConstructor()
- {
- return isConstructor;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMethod#isDestructor()
- */
- public boolean isDestructor()
- {
- return isDestructor;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMethod#isConst()
- */
- public boolean isConst()
- {
- return symbol.getTypeInfo().checkBit( TypeInfo.isConst);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMethod#isVolatile()
- */
- public boolean isVolatile()
- {
- return symbol.getTypeInfo().checkBit( TypeInfo.isVolatile );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMethod#isPureVirtual()
- */
- public boolean isPureVirtual()
- {
- return isPureVirtual;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMember#getVisiblity()
- */
- public ASTAccessVisibility getVisiblity()
- {
- return visibility;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptMethodDeclaration(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- methodCallbacks(requestor);
- }
- protected void methodCallbacks(ISourceElementRequestor requestor)
- {
- functionCallbacks(requestor);
- processConstructorChain(requestor);
- }
-
- protected void processConstructorChain(ISourceElementRequestor requestor)
- {
- if( constructorChain != null )
- {
- Iterator i = getConstructorChainInitializers();
- while( i.hasNext() )
- {
- IASTConstructorMemberInitializer c = (IASTConstructorMemberInitializer)i.next();
- c.acceptElement(requestor);
- }
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.enterMethodBody(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- methodCallbacks( requestor );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.exitMethodBody( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMethod#getConstructorChainInitializers()
- */
- public Iterator getConstructorChainInitializers()
- {
- if( constructorChain == null )
- return new EmptyIterator();
- return constructorChain.iterator();
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTMethodReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTMethodReference.java
deleted file mode 100644
index 59bdd4160df..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTMethodReference.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTMethod;
-import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTMethodReference
- extends ASTReference
- implements IASTMethodReference
-{
- private final IASTMethod method;
- /**
- * @param offset
- * @param name
- */
- public ASTMethodReference(int offset, String name, IASTMethod method )
- {
- super(offset, name);
- this.method = method;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTReference#getReferencedElement()
- */
- public ISourceElementCallbackDelegate getReferencedElement()
- {
- return method;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptMethodReference( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceAlias.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceAlias.java
deleted file mode 100644
index df7484483e2..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceAlias.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceAlias;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTNamespaceAlias extends ASTSymbol implements IASTNamespaceAlias
-{
- private NamedOffsets offsets = new NamedOffsets();
- private final String alias;
- private final IASTNamespaceDefinition namespace;
- private final ASTReferenceStore store;
- /**
- * @param scope
- * @param symbol
- * @param startingOffset
- * @param nameOffset
- * @param endOffset
- */
- public ASTNamespaceAlias(ISymbol s, String alias, IASTNamespaceDefinition namespaceDefinition, int startingOffset, int nameOffset, int nameEndOffset, int endOffset, List references)
- {
- super( s );
- this.alias = alias;
- this.namespace = namespaceDefinition;
- setStartingOffset(startingOffset);
- setEndingOffset(endOffset);
- setNameOffset(nameOffset);
- setNameEndOffset(nameEndOffset);
- store = new ASTReferenceStore( references);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTNamespaceAlias#getAlias()
- */
- public String getAlias()
- {
- return alias;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTNamespaceAlias#getNamespace()
- */
- public IASTNamespaceDefinition getNamespace()
- throws ASTNotImplementedException
- {
- return namespace;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
- */
- public String getName()
- {
- return getSymbol().getName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
- */
- public int getNameOffset()
- {
- return offsets.getNameOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- offsets.setNameOffset( o );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java
deleted file mode 100644
index 276a570d3d3..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
-import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTNamespaceDefinition
- extends ASTScope
- implements IASTNamespaceDefinition
-{
-
- private NamedOffsets namedOffsets = new NamedOffsets();
- private final ASTQualifiedNamedElement qualifiedName;
- private List declarations = new ArrayList();
-
- /**
- * @param namespaceSymbol
- * @param startingOffset
- * @param nameOffset
- */
- public ASTNamespaceDefinition(ISymbol namespaceSymbol, int startingOffset, int nameOffset, int nameEndOffset )
- {
- super( namespaceSymbol );
- setStartingOffset( startingOffset );
- setNameOffset( nameOffset );
- setNameEndOffset( nameEndOffset );
- qualifiedName = new ASTQualifiedNamedElement( getOwnerScope(), namespaceSymbol.getName() );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
- */
- public String getName()
- {
- return symbol.getName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
- */
- public int getNameOffset()
- {
- return namedOffsets.getNameOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- namedOffsets.setNameOffset( o );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- namedOffsets.setStartingOffset(o);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- namedOffsets.setEndingOffset(o);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- return namedOffsets.getStartingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- return namedOffsets.getEndingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.enterNamespaceDefinition( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.exitNamespaceDefinition( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
- */
- public String[] getFullyQualifiedName()
- {
- return qualifiedName.getFullyQualifiedName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return namedOffsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- namedOffsets.setNameEndOffset(o);
- }
-
- public Iterator getDeclarations()
- {
- return declarations.iterator();
- }
- public void addDeclaration(IASTDeclaration declaration)
- {
- declarations.add(declaration);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceReference.java
deleted file mode 100644
index d7b87dd24a3..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceReference.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTNamespaceReference
- extends ASTReference
- implements IASTNamespaceReference
-{
- private final IASTNamespaceDefinition reference;
-
- /**
- * @param offset
- * @param string
- * @param definition
- */
- public ASTNamespaceReference(int offset, String string, IASTNamespaceDefinition definition)
- {
- super(offset, string);
- reference = definition;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTReference#getReferencedElement()
- */
- public ISourceElementCallbackDelegate getReferencedElement()
- {
- return reference;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptNamespaceReference( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNewDescriptor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNewDescriptor.java
deleted file mode 100644
index 0ac32f98e48..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNewDescriptor.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001 Rational Software Corp. 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 implementation
- ******************************************************************************/
-package org.eclipse.cdt.internal.core.parser.ast.complete;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
-
-/**
- * @author hamer
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class ASTNewDescriptor implements IASTNewExpressionDescriptor {
-
- List newPlacementExpressions;
- List newTypeIdExpressions;
- List newInitializerExpressions;
- public ASTNewDescriptor(List newPlacementExpressions, List newTypeIdExpressions, List newInitializerExpressions) {
- super();
- this.newPlacementExpressions = newPlacementExpressions;
- this.newTypeIdExpressions = newTypeIdExpressions;
- this.newInitializerExpressions = newInitializerExpressions;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor#getExpressions()
- */
- public Iterator getNewPlacementExpressions() {
- return newPlacementExpressions.iterator();
- }
- public Iterator getNewTypeIdExpressions() {
- return newTypeIdExpressions.iterator();
- }
- public Iterator getNewInitializerExpressions() {
- return newInitializerExpressions.iterator();
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- accept( requestor, getNewPlacementExpressions() );
- accept( requestor, getNewTypeIdExpressions() );
- accept( requestor, getNewInitializerExpressions() );
- }
-
-
- /**
- * @param requestor
- * @param iterator
- */
- protected void accept(ISourceElementRequestor requestor, Iterator iterator)
- {
- while( iterator.hasNext() )
- ((IASTExpression)iterator.next()).acceptElement(requestor);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNode.java
deleted file mode 100644
index 1c86f687e38..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNode.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 IBM 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 Corp. - Rational Software - initial implementation
- ******************************************************************************/
-package org.eclipse.cdt.internal.core.parser.ast.complete;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.cdt.core.parser.ast.IASTNode;
-import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbolOwner;
-import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable;
-import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTableException;
-import org.eclipse.cdt.internal.core.parser.pst.TypeFilter;
-
-/**
- * @author aniefer
- */
-public class ASTNode implements IASTNode {
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTNode#lookup(java.lang.String, org.eclipse.cdt.core.parser.ast.IASTNode.LookupKind, org.eclipse.cdt.core.parser.ast.IASTNode)
- */
- public LookupResult lookup(String prefix, LookupKind[] kind, IASTNode context) throws LookupException {
- if( ! ( this instanceof ISymbolOwner ) || ( context != null && !(context instanceof ISymbolOwner) ) ){
- return null;
- }
-
- IContainerSymbol thisContainer = (IContainerSymbol) ((ISymbolOwner)this).getSymbol();
- IContainerSymbol qualification = null;
-
- if( context != null ){
- ISymbol sym = (IContainerSymbol) ((ISymbolOwner)context).getSymbol();
- if( sym == null || !(sym instanceof IContainerSymbol) ){
- throw new LookupException();
- }
- qualification = (IContainerSymbol) sym;
- }
-
- ISymbolOwner owner = (ISymbolOwner) this;
- ISymbol symbol = owner.getSymbol();
- if( symbol == null || !(symbol instanceof IContainerSymbol) ){
- throw new LookupException();
- }
-
- boolean lookInThis = false;
-
- TypeFilter filter = new TypeFilter();
- if( kind != null ){
- for( int i = 0; i < kind.length; i++ ){
- filter.addAcceptedType( kind[i] );
- if( kind[i] == LookupKind.THIS ){
- lookInThis = true;
- if( kind.length == 1 ){
- filter.addAcceptedType( LookupKind.ALL );
- }
- } else {
- filter.addAcceptedType( kind[i] );
- }
- }
- } else {
- filter.addAcceptedType( LookupKind.ALL );
- }
-
- List lookupResults = null;
- try {
- if( lookInThis ){
- ISymbol thisPointer = thisContainer.lookup( ParserSymbolTable.THIS );
- ISymbol thisClass = ( thisPointer != null ) ? thisPointer.getTypeSymbol() : null;
- if( thisClass != null && thisClass instanceof IContainerSymbol ){
- lookupResults = ((IContainerSymbol) thisClass).prefixLookup( filter, prefix, true );
- }
- } else if( qualification != null ){
- lookupResults = qualification.prefixLookup( filter, prefix, true );
- } else {
- lookupResults = thisContainer.prefixLookup( filter, prefix, false );
- }
- } catch (ParserSymbolTableException e) {
- throw new LookupException();
- }
-
- if(lookupResults == null)
- return null;
-
- ListIterator iter = lookupResults.listIterator();
- while( iter.hasNext() ){
- ISymbol s = (ISymbol) iter.next();
- if( !thisContainer.isVisible( s, qualification ) ){
- iter.remove();
- }
- }
-
- SymbolIterator iterator = new SymbolIterator( lookupResults.iterator() );
-
- return new Result( prefix, iterator, lookupResults.size() );
- }
-
- private class Result implements LookupResult{
- private String prefix;
- private Iterator iterator;
- private int resultsNumber;
-
- public Result( String pref, Iterator iter, int resultsSize ){
- prefix = pref;
- iterator = iter;
- resultsNumber = resultsSize;
-
- }
-
- public String getPrefix() { return prefix; }
- public Iterator getNodes() { return iterator; }
- public int getResultsSize() { return resultsNumber; }
- }
-
- private class SymbolIterator implements Iterator{
- Iterator interalIterator;
-
- public SymbolIterator( Iterator iter ){
- interalIterator = iter;
- }
-
- public boolean hasNext() {
- return interalIterator.hasNext();
- }
-
- public Object next() {
- ISymbol nextSymbol = (ISymbol) interalIterator.next();
-
- ISymbolASTExtension extension = (nextSymbol != null ) ? nextSymbol.getASTExtension() : null;
-
- return (extension != null ) ? extension.getPrimaryDeclaration() : null;
- }
-
- public void remove() {
- interalIterator.remove();
- }
- }
-} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterDeclaration.java
deleted file mode 100644
index b58cf01de3d..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterDeclaration.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
-import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
-import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
-import org.eclipse.cdt.internal.core.parser.ast.ASTAbstractDeclaration;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTParameterDeclaration extends ASTSymbol implements IASTParameterDeclaration
-{
- private final ASTAbstractDeclaration abstractDeclaration;
- private final String parameterName;
- private final IASTInitializerClause initializerClause;
- private final NamedOffsets offsets = new NamedOffsets();
- /**
- * @param isConst
- * @param typeSpecifier
- * @param pointerOperators
- * @param arrayModifiers
- * @param parameterName
- * @param initializerClause
- */
- public ASTParameterDeclaration(ISymbol symbol, boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int endingOffset, int nameOffset, int nameEndOffset )
- {
- super( symbol );
- abstractDeclaration = new ASTAbstractDeclaration( isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp );
- this.parameterName = parameterName;
- this.initializerClause = initializerClause;
- setStartingOffset(startingOffset);
- setEndingOffset(endingOffset);
- setNameOffset(nameOffset);
- setNameEndOffset( nameEndOffset );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration#getName()
- */
- public String getName()
- {
- return parameterName;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration#getDefaultValue()
- */
- public IASTInitializerClause getDefaultValue()
- {
- return initializerClause;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#isConst()
- */
- public boolean isConst()
- {
- return abstractDeclaration.isConst();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#isVolatile()
- */
- public boolean isVolatile()
- {
- return abstractDeclaration.isVolatile();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getPointerOperators()
- */
- public Iterator getPointerOperators()
- {
- return abstractDeclaration.getPointerOperators();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getArrayModifiers()
- */
- public Iterator getArrayModifiers()
- {
- return abstractDeclaration.getArrayModifiers();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getParameters()
- */
- public Iterator getParameters()
- {
- return abstractDeclaration.getParameters();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getPointerToFunctionOperator()
- */
- public ASTPointerOperator getPointerToFunctionOperator()
- {
- return abstractDeclaration.getPointerToFunctionOperator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeSpecifierOwner#getTypeSpecifier()
- */
- public IASTTypeSpecifier getTypeSpecifier()
- {
- return abstractDeclaration.getTypeSpecifier();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
- */
- public int getNameOffset()
- {
- return offsets.getNameOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- offsets.setNameOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterReference.java
deleted file mode 100644
index 3f196073e08..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterReference.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTParameterReference;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTParameterReference extends ASTReference implements IASTParameterReference
-{
- private final IASTParameterDeclaration parm;
-
- /**
- * @param offset
- * @param string
- * @param declaration
- */
- public ASTParameterReference(int offset, String string, IASTParameterDeclaration declaration)
- {
- super( offset, string );
- parm = declaration;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTReference#getReferencedElement()
- */
- public ISourceElementCallbackDelegate getReferencedElement()
- {
- return parm;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptParameterReference( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
-
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTReference.java
deleted file mode 100644
index 21dda293009..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTReference.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ast.IASTReference;
-
-
-/**
- * @author jcamelon
- *
- */
-public abstract class ASTReference implements IASTReference
-{
- protected final String name;
- protected final int offset;
- /**
- *
- */
- public ASTReference(int offset, String name)
- {
- this.offset = offset;
- this.name = name;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTReference#getOffset()
- */
- public int getOffset()
- {
- return offset;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTReference#getName()
- */
- public String getName()
- {
- return name;
- }
-
- public boolean equals(Object obj)
- {
- if( obj == null )
- return false;
- if( ! (obj instanceof IASTReference ) )
- return false;
-
- if( ((IASTReference)obj).getName().equals( getName() ) &&
- ((IASTReference)obj).getOffset() == getOffset() )
- return true;
- return false;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTReferenceStore.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTReferenceStore.java
deleted file mode 100644
index f84c0ec77bf..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTReferenceStore.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTReference;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTReferenceStore
-{
- private List references = new ArrayList();
-
- public ASTReferenceStore( List assortedReferences )
- {
- references.addAll( assortedReferences );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTReferenceStore#processReferences()
- */
- public void processReferences(ISourceElementRequestor requestor)
- {
- Iterator i = references.iterator();
- while( i.hasNext() )
- ((IASTReference)i.next()).acceptElement(requestor);
- references.clear();
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTScope.java
deleted file mode 100644
index 530eab9e064..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTScope.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.Iterator;
-
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-
-/**
- * @author jcamelon
- *
- */
-public abstract class ASTScope extends ASTSymbol implements IASTScope
-{
- /**
- * @param symbol
- */
- public ASTScope(ISymbol symbol)
- {
- super(symbol);
- }
-
- public IContainerSymbol getContainerSymbol()
- {
- return (IContainerSymbol)symbol;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
- */
- public Iterator getDeclarations()
- {
- return null;
- }
-
- public void addDeclaration(IASTDeclaration declaration)
- {
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSimpleTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSimpleTypeSpecifier.java
deleted file mode 100644
index 52d217edf0e..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSimpleTypeSpecifier.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-import org.eclipse.cdt.internal.core.parser.pst.TypeInfo;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTSimpleTypeSpecifier extends ASTNode implements IASTSimpleTypeSpecifier
-{
- private final List refs;
- private ISymbol symbol;
- private final boolean isTypename;
- private final String name;
-
- /**
- * @param s
- * @param b
- * @param string
- */
- public ASTSimpleTypeSpecifier(ISymbol s, boolean b, String string, List references )
- {
- this.symbol = s;
- this.isTypename = b;
- this.name = string;
- this.refs = references;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#getType()
- */
- public Type getType()
- {
- if( symbol.getType() == TypeInfo.t_int )
- return IASTSimpleTypeSpecifier.Type.INT;
- if( symbol.getType() == TypeInfo.t_double )
- return IASTSimpleTypeSpecifier.Type.DOUBLE;
- if( symbol.getType() == TypeInfo.t_float )
- return IASTSimpleTypeSpecifier.Type.FLOAT;
- if( symbol.getType() == TypeInfo.t_bool )
- return IASTSimpleTypeSpecifier.Type.BOOL;
- if( symbol.getType() == TypeInfo.t_type )
- return IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME;
- if( symbol.getType() == TypeInfo.t_char )
- return IASTSimpleTypeSpecifier.Type.CHAR;
- if( symbol.getType() == TypeInfo.t_void )
- return IASTSimpleTypeSpecifier.Type.VOID;
- if( symbol.getType() == TypeInfo.t_wchar_t)
- return IASTSimpleTypeSpecifier.Type.WCHAR_T;
- if( symbol.getType() == TypeInfo.t__Bool )
- return IASTSimpleTypeSpecifier.Type._BOOL;
-
- return IASTSimpleTypeSpecifier.Type.UNSPECIFIED;
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#getTypename()
- */
- public String getTypename()
- {
- return name;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isLong()
- */
- public boolean isLong()
- {
- return symbol.getTypeInfo().checkBit( TypeInfo.isLong );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isShort()
- */
- public boolean isShort()
- {
- return symbol.getTypeInfo().checkBit( TypeInfo.isShort );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isSigned()
- */
- public boolean isSigned()
- {
- return ! symbol.getTypeInfo().checkBit( TypeInfo.isUnsigned);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isUnsigned()
- */
- public boolean isUnsigned()
- {
- return symbol.getTypeInfo().checkBit( TypeInfo.isUnsigned );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isTypename()
- */
- public boolean isTypename()
- {
- return isTypename;
- }
- /**
- * @return
- */
- public ISymbol getSymbol()
- {
- return symbol;
- }
-
- public List getReferences()
- {
- return refs;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#getTypeSpecifier()
- */
- public IASTTypeSpecifier getTypeSpecifier() throws ASTNotImplementedException
- {
- return (IASTTypeSpecifier)getSymbol().getTypeSymbol().getASTExtension().getPrimaryDeclaration();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isComplex()
- */
- public boolean isComplex()
- {
- return symbol.getTypeInfo().checkBit( TypeInfo.isComplex );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isImaginary()
- */
- public boolean isImaginary()
- {
- return symbol.getTypeInfo().checkBit( TypeInfo.isImaginary );
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbol.java
deleted file mode 100644
index 658266dc46c..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbol.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbolOwner;
-
-/**
- * @author jcamelon
- *
- */
-public abstract class ASTSymbol extends ASTSymbolOwner implements ISymbolOwner, IASTDeclaration
-{
-
- public ASTSymbol( ISymbol symbol )
- {
- super(symbol);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
- */
- public IASTScope getOwnerScope()
- {
- if( symbol.getContainingSymbol() != null )
- return (IASTScope)symbol.getContainingSymbol().getASTExtension().getPrimaryDeclaration();
- return null;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbolOwner.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbolOwner.java
deleted file mode 100644
index d76e35ad4fb..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbolOwner.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbolOwner;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTSymbolOwner extends ASTNode implements ISymbolOwner
-{
- protected ISymbol symbol;
- /**
- *
- */
- public ASTSymbolOwner( ISymbol symbol )
- {
- this.symbol = symbol;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolOwner#getSymbol()
- */
- public ISymbol getSymbol()
- {
- return symbol;
- }
-
- public void setSymbol( ISymbol symbol )
- {
- this.symbol = symbol;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateDeclaration.java
deleted file mode 100644
index a7d301eaf11..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateDeclaration.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.Iterator;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTTemplateDeclaration extends ASTNode implements IASTTemplateDeclaration
-{
- /**
- *
- */
- public ASTTemplateDeclaration()
- {
- super();
- // TODO Auto-generated constructor stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration#isExported()
- */
- public boolean isExported()
- {
- // TODO Auto-generated method stub
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplate#getOwnedDeclaration()
- */
- public IASTDeclaration getOwnedDeclaration()
- {
- // TODO Auto-generated method stub
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplate#setOwnedDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
- */
- public void setOwnedDeclaration(IASTDeclaration declaration)
- {
- // TODO Auto-generated method stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplateParameterList#getTemplateParameters()
- */
- public Iterator getTemplateParameters()
- {
- // TODO Auto-generated method stub
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- // TODO Auto-generated method stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- // TODO Auto-generated method stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- // TODO Auto-generated method stub
- return 0;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- // TODO Auto-generated method stub
- return 0;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
- */
- public IASTScope getOwnerScope()
- {
- // TODO Auto-generated method stub
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- // TODO Auto-generated method stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- // TODO Auto-generated method stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- // TODO Auto-generated method stub
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateInstantiation.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateInstantiation.java
deleted file mode 100644
index 5bd2752a452..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateInstantiation.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTTemplateInstantiation extends ASTNode implements IASTTemplateInstantiation
-{
- /**
- *
- */
- public ASTTemplateInstantiation()
- {
- super();
- // TODO Auto-generated constructor stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplate#getOwnedDeclaration()
- */
- public IASTDeclaration getOwnedDeclaration()
- {
- // TODO Auto-generated method stub
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplate#setOwnedDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
- */
- public void setOwnedDeclaration(IASTDeclaration declaration)
- {
- // TODO Auto-generated method stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- // TODO Auto-generated method stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- // TODO Auto-generated method stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- // TODO Auto-generated method stub
- return 0;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- // TODO Auto-generated method stub
- return 0;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
- */
- public IASTScope getOwnerScope()
- {
- // TODO Auto-generated method stub
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- // TODO Auto-generated method stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- // TODO Auto-generated method stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- // TODO Auto-generated method stub
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateSpecialization.java
deleted file mode 100644
index 5e72f4652b5..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTemplateSpecialization.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTTemplateSpecialization extends ASTNode implements IASTTemplateSpecialization
-{
- /**
- *
- */
- public ASTTemplateSpecialization()
- {
- super();
- // TODO Auto-generated constructor stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplate#getOwnedDeclaration()
- */
- public IASTDeclaration getOwnedDeclaration()
- {
- // TODO Auto-generated method stub
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplate#setOwnedDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
- */
- public void setOwnedDeclaration(IASTDeclaration declaration)
- {
- // TODO Auto-generated method stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- // TODO Auto-generated method stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- // TODO Auto-generated method stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- // TODO Auto-generated method stub
- return 0;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- // TODO Auto-generated method stub
- return 0;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
- */
- public IASTScope getOwnerScope()
- {
- // TODO Auto-generated method stub
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- // TODO Auto-generated method stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- // TODO Auto-generated method stub
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- // TODO Auto-generated method stub
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypeId.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypeId.java
deleted file mode 100644
index 18a659de5b9..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypeId.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ITokenDuple;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTArrayModifier;
-import org.eclipse.cdt.core.parser.ast.IASTTypeId;
-import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTTypeId implements IASTTypeId
-{
- private final boolean isTypename;
- private final boolean isUnsigned;
- private final boolean isSigned;
- private final boolean isShort;
- private final boolean isLong;
- private final boolean isVolatile;
- private final boolean isConst;
- private final String signature;
- private ITokenDuple tokenDuple;
- private final List arrayModifiers;
- private final String typeName;
- private final List pointerOps;
- private final Type kind;
- private List references = new ArrayList();
- private ISymbol symbol;
-
- /**
- *
- */
- public ASTTypeId( Type kind, ITokenDuple duple, List pointerOps, List arrayMods, String signature,
- boolean isConst, boolean isVolatile, boolean isUnsigned, boolean isSigned, boolean isShort, boolean isLong, boolean isTypeName )
- {
- typeName = ( duple == null ) ? "" : duple.toString() ;
- this.tokenDuple = duple;
- this.kind = kind;
- this.pointerOps = pointerOps;
- this.arrayModifiers = arrayMods;
- this.signature = signature;
- this.isConst = isConst;
- this.isVolatile = isVolatile;
- this.isUnsigned = isUnsigned;
- this.isSigned = isSigned;
- this.isShort = isShort;
- this.isLong = isLong;
- this.isTypename = isTypeName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#getKind()
- */
- public Type getKind()
- {
- return kind;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#getType()
- */
- public String getTypeOrClassName()
- {
- return typeName;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#getPointerOperators()
- */
- public Iterator getPointerOperators()
- {
- return pointerOps.iterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#getArrayModifiers()
- */
- public Iterator getArrayModifiers()
- {
- return arrayModifiers.iterator();
- }
-
- public List getReferences()
- {
- return references;
- }
-
- public void finalize()
- {
- references.clear();
- references = null;
- tokenDuple = null;
- }
-
- public ITokenDuple getTokenDuple()
- {
- return tokenDuple;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#getFullSignature()
- */
- public String getFullSignature()
- {
- return signature;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#createTypeSymbol(org.eclipse.cdt.core.parser.ast.IASTFactory)
- */
- public ISymbol getTypeSymbol() throws ASTNotImplementedException
- {
- return symbol;
- }
-
- public void setTypeSymbol( ISymbol symbol )
- {
- this.symbol = symbol;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#isConst()
- */
- public boolean isConst()
- {
- return isConst;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#isVolatile()
- */
- public boolean isVolatile()
- {
- return isVolatile;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#isLong()
- */
- public boolean isLong()
- {
- return isLong;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#isShort()
- */
- public boolean isShort()
- {
- return isShort;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#isSigned()
- */
- public boolean isSigned()
- {
- return isSigned;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#isUnsigned()
- */
- public boolean isUnsigned()
- {
- return isUnsigned;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#isTypename()
- */
- public boolean isTypename()
- {
- return isTypename;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- if( references != null && ! references.isEmpty() )
- {
- ASTReferenceStore store = new ASTReferenceStore( references );
- store.processReferences(requestor);
- }
- Iterator arrayMods = getArrayModifiers();
- while( arrayMods.hasNext() )
- {
- ((IASTArrayModifier)arrayMods.next()).acceptElement(requestor);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
- /**
- * @param list
- */
- public void addReferences(List list)
- {
- references.addAll( list );
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedef.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedef.java
deleted file mode 100644
index 475473dcc77..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedef.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
-import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTTypedef extends ASTSymbol implements IASTTypedefDeclaration
-{
-
- private final IASTAbstractDeclaration mapping;
- private NamedOffsets offsets = new NamedOffsets();
- private final ASTQualifiedNamedElement qualifiedName;
- private final ASTReferenceStore referenceStore;
-
- /**
- * @param newSymbol
- * @param mapping
- * @param startingOffset
- * @param nameOffset
- * @param references
- */
- public ASTTypedef(ISymbol newSymbol, IASTAbstractDeclaration mapping, int startingOffset, int nameOffset, int nameEndOffset, List references)
- {
- super( newSymbol );
- this.mapping = mapping;
- this.referenceStore = new ASTReferenceStore( references );
- this.qualifiedName = new ASTQualifiedNamedElement( getOwnerScope(), newSymbol.getName());
- setStartingOffset(startingOffset);
- setNameOffset(nameOffset);
- setNameEndOffset( nameEndOffset );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration#getName()
- */
- public String getName()
- {
- return getSymbol().getName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration#getAbstractDeclarator()
- */
- public IASTAbstractDeclaration getAbstractDeclarator()
- {
- return mapping;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptTypedefDeclaration(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- referenceStore.processReferences(requestor);
- getAbstractDeclarator().acceptElement( requestor );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
- */
- public int getNameOffset()
- {
- return offsets.getNameOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- offsets.setNameOffset(o);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
- */
- public String[] getFullyQualifiedName()
- {
- return qualifiedName.getFullyQualifiedName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedefReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedefReference.java
deleted file mode 100644
index 91e557dfec1..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedefReference.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTTypedefReference;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTTypedefReference
- extends ASTReference
- implements IASTTypedefReference
-{
- private final IASTTypedefDeclaration referencedItem;
- /**
- * @param offset
- * @param name
- */
- public ASTTypedefReference(int offset, String name, IASTTypedefDeclaration referencedItem )
- {
- super(offset, name);
- this.referencedItem = referencedItem;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTReference#getReferencedElement()
- */
- public ISourceElementCallbackDelegate getReferencedElement()
- {
- return referencedItem;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptTypedefReference(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTUsingDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTUsingDeclaration.java
deleted file mode 100644
index 65465ad7442..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTUsingDeclaration.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
-import org.eclipse.cdt.internal.core.parser.ast.Offsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTUsingDeclaration extends ASTNode implements IASTUsingDeclaration
-{
- private final IASTScope ownerScope;
- private final boolean isTypeName;
- private final IASTDeclaration declaration;
- private Offsets offsets = new Offsets();
- private final ASTReferenceStore delegate;
-
- /**
- *
- */
- public ASTUsingDeclaration( IASTScope ownerScope, IASTDeclaration declaration, boolean isTypeName, int startingOffset, int endingOffset, List references )
- {
- this.ownerScope = ownerScope;
- this.isTypeName = isTypeName;
- this.declaration = declaration;
- setStartingOffset(startingOffset);
- setEndingOffset(endingOffset);
- delegate = new ASTReferenceStore( references );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration#isTypename()
- */
- public boolean isTypename()
- {
- return isTypeName;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration#usingTypeName()
- */
- public String usingTypeName()
- {
- return ((IASTOffsetableNamedElement)declaration).getName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
- */
- public IASTScope getOwnerScope()
- {
- return ownerScope;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptUsingDeclaration( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- delegate.processReferences(requestor);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration#getUsingType()
- */
- public IASTDeclaration getUsingType() throws ASTNotImplementedException
- {
- return declaration;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTUsingDirective.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTUsingDirective.java
deleted file mode 100644
index af8557caf21..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTUsingDirective.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
-import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
-import org.eclipse.cdt.internal.core.parser.ast.Offsets;
-import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTUsingDirective extends ASTAnonymousDeclaration implements IASTUsingDirective
-{
- private final IASTNamespaceDefinition namespace;
- private Offsets offsets = new Offsets();
- private final ASTReferenceStore referenceDelegate;
- /**
- * @param namespaceDefinition
- * @param startingOffset
- * @param endingOffset
- */
- public ASTUsingDirective(IContainerSymbol ownerSymbol, IASTNamespaceDefinition namespaceDefinition, int startingOffset, int endingOffset, List references )
- {
- super( ownerSymbol );
- namespace = namespaceDefinition;
- setStartingOffset(startingOffset);
- setEndingOffset(endingOffset);
- referenceDelegate = new ASTReferenceStore( references );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTUsingDirective#getNamespaceName()
- */
- public String getNamespaceName()
- {
- String [] fqn = namespace.getFullyQualifiedName();
- StringBuffer buffer = new StringBuffer();
- for( int i = 0; i < fqn.length; ++i )
- {
- buffer.append( fqn[ i ] );
- if( i + 1 != fqn.length )
- buffer.append( "::");
- }
- return buffer.toString();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset( o );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptUsingDirective( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- referenceDelegate.processReferences(requestor);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTUsingDirective#getNamespaceDefinition()
- */
- public IASTNamespaceDefinition getNamespaceDefinition() throws ASTNotImplementedException
- {
- return namespace;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariable.java
deleted file mode 100644
index f40232d4106..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariable.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTVariable;
-import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-import org.eclipse.cdt.internal.core.parser.pst.TypeInfo;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTVariable extends ASTSymbol implements IASTVariable
-{
- private final boolean previouslyDeclared;
- private final IASTExpression constructorExpression;
- protected final ASTReferenceStore referenceDelegate;
- private final ASTQualifiedNamedElement qualifiedName;
- private NamedOffsets offsets = new NamedOffsets();
- private final IASTExpression bitfieldExpression;
- private final IASTInitializerClause initializerClause;
- private final IASTAbstractDeclaration abstractDeclaration;
- /**
- * @param newSymbol
- * @param abstractDeclaration
- * @param initializerClause
- * @param bitfieldExpression
- * @param startingOffset
- * @param nameOffset
- * @param references
- */
- public ASTVariable(ISymbol newSymbol, IASTAbstractDeclaration abstractDeclaration, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, int startingOffset, int nameOffset, int nameEndOffset, List references, IASTExpression constructorExpression, boolean previouslyDeclared )
- {
- super( newSymbol );
- this.abstractDeclaration = abstractDeclaration;
- this.initializerClause = initializerClause;
- this.bitfieldExpression = bitfieldExpression;
- this.constructorExpression = constructorExpression;
- setStartingOffset( startingOffset );
- setNameOffset( nameOffset );
- setNameEndOffset(nameEndOffset);
- referenceDelegate = new ASTReferenceStore( references );
- qualifiedName = new ASTQualifiedNamedElement( getOwnerScope(), newSymbol.getName() );
- this.previouslyDeclared =previouslyDeclared;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#isAuto()
- */
- public boolean isAuto()
- {
- return symbol.getTypeInfo().checkBit( TypeInfo.isAuto );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#isRegister()
- */
- public boolean isRegister()
- {
- return symbol.getTypeInfo().checkBit( TypeInfo.isRegister);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#isStatic()
- */
- public boolean isStatic()
- {
- return symbol.getTypeInfo().checkBit( TypeInfo.isStatic);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#isExtern()
- */
- public boolean isExtern()
- {
- return symbol.getTypeInfo().checkBit( TypeInfo.isExtern );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#isMutable()
- */
- public boolean isMutable()
- {
- return symbol.getTypeInfo().checkBit( TypeInfo.isMutable);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#getAbstractDeclaration()
- */
- public IASTAbstractDeclaration getAbstractDeclaration()
- {
- return abstractDeclaration;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
- */
- public String getName()
- {
- return getSymbol().getName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#getInitializerClause()
- */
- public IASTInitializerClause getInitializerClause()
- {
- return initializerClause;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#isBitfield()
- */
- public boolean isBitfield()
- {
- return ( bitfieldExpression != null );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#getBitfieldExpression()
- */
- public IASTExpression getBitfieldExpression()
- {
- return bitfieldExpression;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
- */
- public int getNameOffset()
- {
- return offsets.getNameOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- offsets.setNameOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
- */
- public String[] getFullyQualifiedName()
- {
- return qualifiedName.getFullyQualifiedName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
- */
- public IASTScope getOwnerScope()
- {
- return (IASTScope)getSymbol().getContainingSymbol().getASTExtension().getPrimaryDeclaration();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptVariable(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- referenceDelegate.processReferences(requestor);
- if( initializerClause != null )
- initializerClause.acceptElement(requestor);
- if( constructorExpression != null )
- constructorExpression.acceptElement(requestor);
- if( getAbstractDeclaration() != null )
- getAbstractDeclaration().acceptElement(requestor);
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#getConstructorExpression()
- */
- public IASTExpression getConstructorExpression()
- {
- return constructorExpression;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariableReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariableReference.java
deleted file mode 100644
index 83663af42ce..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariableReference.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTReference;
-import org.eclipse.cdt.core.parser.ast.IASTVariable;
-import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTVariableReference
- extends ASTReference
- implements IASTReference, IASTVariableReference
-{
-
- private final IASTVariable referencedElement;
- /**
- * @param offset
- * @param string
- * @param variable
- */
- public ASTVariableReference(int offset, String string, IASTVariable variable)
- {
- super( offset, string );
- referencedElement = variable;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTReference#getReferencedElement()
- */
- public ISourceElementCallbackDelegate getReferencedElement()
- {
- return referencedElement;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptVariableReference( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
deleted file mode 100644
index c68f7b28b3f..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
+++ /dev/null
@@ -1,2812 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.cdt.core.parser.Enum;
-import org.eclipse.cdt.core.parser.IToken;
-import org.eclipse.cdt.core.parser.ITokenDuple;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.core.parser.ast.ASTClassKind;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
-import org.eclipse.cdt.core.parser.ast.ASTSemanticException;
-import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTCodeScope;
-import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
-import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
-import org.eclipse.cdt.core.parser.ast.IASTDesignator;
-import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
-import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.core.parser.ast.IASTFactory;
-import org.eclipse.cdt.core.parser.ast.IASTField;
-import org.eclipse.cdt.core.parser.ast.IASTFunction;
-import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
-import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
-import org.eclipse.cdt.core.parser.ast.IASTMethod;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceAlias;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
-import org.eclipse.cdt.core.parser.ast.IASTNode;
-import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTReference;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTTemplate;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateParameter;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
-import org.eclipse.cdt.core.parser.ast.IASTTypeId;
-import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
-import org.eclipse.cdt.core.parser.ast.IASTVariable;
-import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType;
-import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
-import org.eclipse.cdt.core.parser.ast.IASTExpression.Kind;
-import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateParameter.ParamKind;
-import org.eclipse.cdt.internal.core.parser.ast.BaseASTFactory;
-import org.eclipse.cdt.internal.core.parser.pst.ForewardDeclaredSymbolExtension;
-import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
-import org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol;
-import org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbolOwner;
-import org.eclipse.cdt.internal.core.parser.pst.NamespaceSymbolExtension;
-import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable;
-import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTableException;
-import org.eclipse.cdt.internal.core.parser.pst.StandardSymbolExtension;
-import org.eclipse.cdt.internal.core.parser.pst.TypeInfo;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension.ExtensionException;
-
-
-/**
- * @author jcamelon
- *
- * The CompleteParseASTFactory class creates a complete AST
- * for a given parsed code.
- *
- */
-public class CompleteParseASTFactory extends BaseASTFactory implements IASTFactory
-{
- /**
- *
- */
-
- private final static List SUBSCRIPT;
- static
- {
- SUBSCRIPT = new ArrayList();
- SUBSCRIPT.add( TypeInfo.OperatorExpression.subscript );
- }
-
- static private class LookupType extends Enum {
- public static final LookupType QUALIFIED = new LookupType( 1 );
- public static final LookupType UNQUALIFIED = new LookupType( 2 );
- public static final LookupType FORDEFINITION = new LookupType( 3 );
- public static final LookupType FORFRIENDSHIP = new LookupType( 4 );
-
- private LookupType( int constant)
- {
- super( constant );
- }
- }
-
- public CompleteParseASTFactory( ParserLanguage language )
- {
- super();
-
- pst = new ParserSymbolTable( language );
- }
-
- /*
- * Adds a reference to a reference list
- * Overrides an existing reference if it has the same name and offset
- */
- protected void addReference(List references, IASTReference reference){
- if( references == null ) return;
- Iterator i = references.iterator();
- while (i.hasNext()){
- IASTReference ref = (IASTReference)i.next();
- if (ref != null){
- if( (ref.getName().equals(reference.getName()))
- && (ref.getOffset() == reference.getOffset())
- ){
- i.remove();
- break;
- }
- }
- }
- references.add(reference);
- }
- /*
- * Test if the provided list is a valid parameter list
- * Parameters are list of TypeInfos
- */
- protected boolean validParameterList(List parameters){
- Iterator i = parameters.iterator();
- while (i.hasNext()){
- TypeInfo info = (TypeInfo)i.next();
- if (info != null){
- if((info.getType() == TypeInfo.t_type)
- && (info.getTypeSymbol() == null))
- return false;
- }else
- return false;
- }
- return true;
- }
-
- private ISymbol lookupElement (IContainerSymbol startingScope, String name, TypeInfo.eType type, List parameters, LookupType lookupType ) throws ParserSymbolTableException{
- ISymbol result = null;
- try {
- if((type == TypeInfo.t_function) || (type == TypeInfo.t_constructor)){
- // looking for a function
- if(validParameterList(parameters))
- if(type == TypeInfo.t_constructor){
- IDerivableContainerSymbol startingDerivableScope = (IDerivableContainerSymbol) startingScope;
- result = startingDerivableScope.lookupConstructor( new LinkedList(parameters));
- }
- else {
- if( lookupType == LookupType.QUALIFIED )
- result = startingScope.qualifiedFunctionLookup(name, new LinkedList(parameters));
- else if( lookupType == LookupType.UNQUALIFIED )
- result = startingScope.unqualifiedFunctionLookup( name, new LinkedList( parameters ) );
- else if( lookupType == LookupType.FORDEFINITION )
- result = startingScope.lookupMethodForDefinition( name, new LinkedList( parameters ) );
- else if( lookupType == LookupType.FORFRIENDSHIP ){
- result = ((IDerivableContainerSymbol)startingScope).lookupFunctionForFriendship( name, new LinkedList( parameters) );
- }
- }
- else
- result = null;
- }else{
- // looking for something else
- if( lookupType == LookupType.QUALIFIED )
- result = startingScope.qualifiedLookup(name, type);
- else if( lookupType == LookupType.UNQUALIFIED )
- result = startingScope.elaboratedLookup( type, name );
- else if( lookupType == LookupType.FORDEFINITION )
- result = startingScope.lookupMemberForDefinition( name );
- else if( lookupType == LookupType.FORFRIENDSHIP )
- result = ((IDerivableContainerSymbol)startingScope).lookupForFriendship( name );
- }
- } catch (ParserSymbolTableException e) {
- if( e.reason != ParserSymbolTableException.r_UnableToResolveFunction )
- throw e;
- }
- return result;
- }
-
- protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, String name, List references, boolean throwOnError, LookupType lookup ) throws ASTSemanticException{
- return lookupQualifiedName(startingScope, name, TypeInfo.t_any, null, 0, references, throwOnError, lookup );
- }
-
- protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, String name, TypeInfo.eType type, List parameters, int offset, List references, boolean throwOnError, LookupType lookup ) throws ASTSemanticException
- {
- ISymbol result = null;
- try
- {
- if( name == null ) throw new ASTSemanticException();
- try
- {
- result = lookupElement(startingScope, name, type, parameters, lookup);
- if( result != null )
- addReference(references, createReference( result, name, offset ));
- else
- throw new ASTSemanticException();
- }
- catch (ParserSymbolTableException e)
- {
- throw new ASTSemanticException();
- }
-
- }
- catch( ASTSemanticException se )
- {
- if( throwOnError )
- throw se;
- return null;
- }
- return result;
-
- }
-
- protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, ITokenDuple name, List references, boolean throwOnError ) throws ASTSemanticException{
- return lookupQualifiedName(startingScope, name, references, throwOnError, LookupType.UNQUALIFIED);
- }
- protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, ITokenDuple name, List references, boolean throwOnError, LookupType lookup ) throws ASTSemanticException{
- return lookupQualifiedName(startingScope, name, TypeInfo.t_any, null, references, throwOnError, lookup );
- }
- protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, ITokenDuple name, TypeInfo.eType type, List parameters, List references, boolean throwOnError ) throws ASTSemanticException{
- return lookupQualifiedName( startingScope, name, type, parameters, references, throwOnError, LookupType.UNQUALIFIED );
- }
-
- protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, ITokenDuple name, TypeInfo.eType type, List parameters, List references, boolean throwOnError, LookupType lookup ) throws ASTSemanticException
- {
- ISymbol result = null;
- IToken firstSymbol = null;
- try
- {
- if( name == null ) throw new ASTSemanticException();
-
- switch( name.length() )
- {
- case 0:
- if( throwOnError )
- throw new ASTSemanticException();
- case 1:
- firstSymbol = name.getFirstToken();
- try
- {
- result = lookupElement(startingScope, firstSymbol.getImage(), type, parameters, lookup );
- if( result != null )
- addReference( references, createReference( result, firstSymbol.getImage(), firstSymbol.getOffset() ));
- else
- throw new ASTSemanticException();
- }
- catch (ParserSymbolTableException e)
- {
- throw new ASTSemanticException();
- }
- break;
- default:
- Iterator iter = name.iterator();
- firstSymbol = name.getFirstToken();
- result = startingScope;
- if( firstSymbol.getType() == IToken.tCOLONCOLON )
- result = pst.getCompilationUnit();
-
- while( iter.hasNext() )
- {
- IToken t = (IToken)iter.next();
- if( t.getType() == IToken.tCOLONCOLON ) continue;
- if( t.isPointer() ) break;
- try
- {
- if( t == name.getLastToken() )
- result = lookupElement((IContainerSymbol)result, t.getImage(), type, parameters, ( lookup == LookupType.FORDEFINITION ) ? lookup : LookupType.QUALIFIED );
- else
- result = ((IContainerSymbol)result).lookupNestedNameSpecifier( t.getImage() );
- addReference( references, createReference( result, t.getImage(), t.getOffset() ));
- }
- catch( ParserSymbolTableException pste )
- {
- throw new ASTSemanticException();
- }
- }
-
- }
- }
- catch( ASTSemanticException se )
- {
- if( throwOnError )
- throw se;
- return null;
- }
- return result;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createUsingDirective(org.eclipse.cdt.core.parser.ast.IASTScope, org.eclipse.cdt.core.parser.ITokenDuple, int, int)
- */
- public IASTUsingDirective createUsingDirective(
- IASTScope scope,
- ITokenDuple duple,
- int startingOffset,
- int endingOffset)
- throws ASTSemanticException
- {
- List references = new ArrayList();
- ISymbol symbol = lookupQualifiedName(
- scopeToSymbol( scope), duple, references, true );
-
- try {
- ((ASTScope)scope).getContainerSymbol().addUsingDirective( (IContainerSymbol)symbol );
- } catch (ParserSymbolTableException pste) {
- throw new ASTSemanticException();
- }
-
- IASTUsingDirective astUD = new ASTUsingDirective( scopeToSymbol(scope), ((IASTNamespaceDefinition)symbol.getASTExtension().getPrimaryDeclaration()), startingOffset, endingOffset, references );
- return astUD;
- }
-
-
- protected IContainerSymbol getScopeToSearchUpon(
- IASTScope currentScope,
- IToken firstToken, Iterator iterator ) throws ASTSemanticException
- {
- if( firstToken.getType() == IToken.tCOLONCOLON )
- {
- iterator.next();
- return pst.getCompilationUnit();
- }
- else
- {
- return (IContainerSymbol)scopeToSymbol(currentScope);
- }
-
-
- }
- protected IContainerSymbol scopeToSymbol(IASTScope currentScope)
- {
- if( currentScope instanceof ASTScope )
- return ((ASTScope)currentScope).getContainerSymbol();
- else
- return scopeToSymbol(((ASTAnonymousDeclaration)currentScope).getOwnerScope());
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createUsingDeclaration(org.eclipse.cdt.core.parser.ast.IASTScope, boolean, org.eclipse.cdt.core.parser.ITokenDuple, int, int)
- */
- public IASTUsingDeclaration createUsingDeclaration(
- IASTScope scope,
- boolean isTypeName,
- ITokenDuple name,
- int startingOffset,
- int endingOffset) throws ASTSemanticException
- {
- List references = new ArrayList();
- ISymbol symbol = lookupQualifiedName( scopeToSymbol(scope), name, references, true );
-
- try
- {
- scopeToSymbol(scope).addUsingDeclaration( name.getLastToken().getImage(), symbol.getContainingSymbol() );
- }
- catch (ParserSymbolTableException e)
- {
- throw new ASTSemanticException();
- }
- return new ASTUsingDeclaration( scope,
- symbol.getASTExtension().getPrimaryDeclaration(), isTypeName, startingOffset, endingOffset, references );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createASMDefinition(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, int, int)
- */
- public IASTASMDefinition createASMDefinition(
- IASTScope scope,
- String assembly,
- int first,
- int last)
- {
-
- return new ASTASMDefinition( scopeToSymbol(scope), assembly, first, last );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, int, int)
- */
- public IASTNamespaceDefinition createNamespaceDefinition(
- IASTScope scope,
- String identifier,
- int startingOffset,
- int nameOffset, int nameEndOffset) throws ASTSemanticException
- {
-
- IContainerSymbol pstScope = scopeToSymbol(scope);
- ISymbol namespaceSymbol = null;
-
-
- if( ! identifier.equals( "" ) )
- {
- try
- {
- namespaceSymbol = pstScope.qualifiedLookup( identifier );
- }
- catch (ParserSymbolTableException e)
- {
- throw new ASTSemanticException();
- }
- }
-
- if( namespaceSymbol != null )
- {
- if( namespaceSymbol.getType() != TypeInfo.t_namespace )
- throw new ASTSemanticException();
- }
- else
- {
- namespaceSymbol = pst.newContainerSymbol( identifier, TypeInfo.t_namespace );
- if( identifier.equals( "" ) )
- namespaceSymbol.setContainingSymbol( pstScope );
- else
- {
-
- try
- {
- pstScope.addSymbol( namespaceSymbol );
- }
- catch (ParserSymbolTableException e1)
- {
- // not overloading, should never happen
- }
- }
- }
-
- ASTNamespaceDefinition namespaceDef = new ASTNamespaceDefinition( namespaceSymbol, startingOffset, nameOffset, nameEndOffset );
- try
- {
- attachSymbolExtension( namespaceSymbol, namespaceDef );
- }
- catch (ExtensionException e1)
- {
- // will not happen with namespaces
- }
- return namespaceDef;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createCompilationUnit()
- */
- public IASTCompilationUnit createCompilationUnit()
- {
- ISymbol symbol = pst.getCompilationUnit();
- ASTCompilationUnit compilationUnit = new ASTCompilationUnit( symbol );
- try
- {
- attachSymbolExtension(symbol, compilationUnit );
- }
- catch (ExtensionException e)
- {
- //should not happen with CompilationUnit
- }
- return compilationUnit;
- }
-
-
- protected void attachSymbolExtension(
- ISymbol symbol,
- ASTSymbol astSymbol ) throws ExtensionException
- {
- ISymbolASTExtension extension = symbol.getASTExtension();
- if( extension == null )
- {
- if( astSymbol instanceof IASTNamespaceDefinition ||
- astSymbol instanceof IASTEnumerationSpecifier ||
- astSymbol instanceof IASTClassSpecifier ||
- astSymbol instanceof IASTElaboratedTypeSpecifier )
-
- extension = new NamespaceSymbolExtension( symbol, astSymbol );
- else if( astSymbol instanceof IASTFunction || astSymbol instanceof IASTMethod )
- {
- extension = new ForewardDeclaredSymbolExtension( symbol, astSymbol );
- }
- else
- {
- extension = new StandardSymbolExtension( symbol, astSymbol );
- }
- symbol.setASTExtension( extension );
- }
- else
- {
- extension.addDefinition( astSymbol );
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createLinkageSpecification(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, int)
- */
- public IASTLinkageSpecification createLinkageSpecification(
- IASTScope scope,
- String spec,
- int startingOffset)
- {
- return new ASTLinkageSpecification( scopeToSymbol( scope ), spec, startingOffset );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, org.eclipse.cdt.core.parser.ast.ASTClassKind, org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility, org.eclipse.cdt.core.parser.ast.IASTTemplate, int, int)
- */
- public IASTClassSpecifier createClassSpecifier(
- IASTScope scope,
- ITokenDuple name,
- ASTClassKind kind,
- ClassNameType type,
- ASTAccessVisibility access,
- int startingOffset,
- int nameOffset, int nameEndOffset) throws ASTSemanticException
- {
- IContainerSymbol currentScopeSymbol = scopeToSymbol(scope);
- TypeInfo.eType pstType = classKindToTypeInfo(kind);
- List references = new ArrayList();
-
- String newSymbolName = "";
-
- if( name != null ){
- IToken lastToken = name.getLastToken();
- if( name.length() != 1 ) // qualified name
- {
- ITokenDuple containerSymbolName =
- name.getSubrange( 0, name.length() - 3 ); // -1 for index, -2 for last hop of qualified name
- currentScopeSymbol = (IContainerSymbol)lookupQualifiedName( currentScopeSymbol,
- containerSymbolName, references, true);
- if( currentScopeSymbol == null )
- throw new ASTSemanticException();
- }
- newSymbolName = lastToken.getImage();
- }
-
- ISymbol classSymbol = null;
- if( !newSymbolName.equals("") ){
- try
- {
- classSymbol = currentScopeSymbol.lookupMemberForDefinition(newSymbolName);
- }
- catch (ParserSymbolTableException e)
- {
- throw new ASTSemanticException();
- }
-
- if( classSymbol != null && ! classSymbol.isForwardDeclaration() )
- throw new ASTSemanticException();
-
- if( classSymbol != null && classSymbol.getType() != pstType )
- throw new ASTSemanticException();
- }
-
- IDerivableContainerSymbol newSymbol = pst.newDerivableContainerSymbol( newSymbolName, pstType );
-
- if( classSymbol != null )
- classSymbol.setTypeSymbol( newSymbol );
-
- try
- {
- currentScopeSymbol.addSymbol( newSymbol );
- }
- catch (ParserSymbolTableException e2)
- {
- throw new ASTSemanticException();
- }
-
- ASTClassSpecifier classSpecifier = new ASTClassSpecifier( newSymbol, kind, type, access, startingOffset, nameOffset, nameEndOffset, references );
- try
- {
- attachSymbolExtension(newSymbol, classSpecifier );
- }
- catch (ExtensionException e1)
- {
- throw new ASTSemanticException();
- }
- return classSpecifier;
- }
-
- protected TypeInfo.eType classKindToTypeInfo(ASTClassKind kind)
- throws ASTSemanticException
- {
- TypeInfo.eType pstType = null;
-
- if( kind == ASTClassKind.CLASS )
- pstType = TypeInfo.t_class;
- else if( kind == ASTClassKind.STRUCT )
- pstType = TypeInfo.t_struct;
- else if( kind == ASTClassKind.UNION )
- pstType = TypeInfo.t_union;
- else if( kind == ASTClassKind.ENUM )
- pstType = TypeInfo.t_enumeration;
- else
- throw new ASTSemanticException();
- return pstType;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#addBaseSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility, java.lang.String)
- */
- public void addBaseSpecifier(
- IASTClassSpecifier astClassSpec,
- boolean isVirtual,
- ASTAccessVisibility visibility,
- ITokenDuple parentClassName) throws ASTSemanticException
- {
- IDerivableContainerSymbol classSymbol = (IDerivableContainerSymbol)scopeToSymbol( astClassSpec);
- Iterator iterator = parentClassName.iterator();
- List references = new ArrayList();
-
- if( ! iterator.hasNext() )
- throw new ASTSemanticException();
-
- IContainerSymbol symbol = null;
-
- symbol = getScopeToSearchUpon(astClassSpec, (IToken)parentClassName.getFirstToken(), iterator );
-
- while( iterator.hasNext() )
- {
- IToken t = (IToken)iterator.next();
- if( t.getType() == IToken.tCOLONCOLON ) continue;
- try
- {
- if( t == parentClassName.getLastToken())
- symbol = (IContainerSymbol)symbol.lookup( t.getImage() );
- else
- symbol = symbol.lookupNestedNameSpecifier( t.getImage() );
-
- if( symbol != null )
- addReference( references, createReference( symbol, t.getImage(), t.getOffset() ));
- else
- throw new ASTSemanticException();
- }
- catch( ParserSymbolTableException pste )
- {
- throw new ASTSemanticException();
- }
- }
-
- classSymbol.addParent( symbol, isVirtual, visibility, parentClassName.getFirstToken().getOffset(), references );
-
- }
- /**
- * @param symbol
- * @param string
- * @return
- */
- protected IASTReference createReference(ISymbol symbol, String string, int offset ) throws ASTSemanticException
- {
- if( symbol == null )
- throw new ASTSemanticException();
-
- if( symbol.getType() == TypeInfo.t_namespace )
- {
- return new ASTNamespaceReference( offset, string, (IASTNamespaceDefinition)symbol.getASTExtension().getPrimaryDeclaration());
- }
- else if( symbol.getType() == TypeInfo.t_class ||
- symbol.getType() == TypeInfo.t_struct ||
- symbol.getType() == TypeInfo.t_union )
- {
- return new ASTClassReference( offset, string, (IASTTypeSpecifier)symbol.getASTExtension().getPrimaryDeclaration() );
- }
- else if( symbol.getTypeInfo().checkBit( TypeInfo.isTypedef ))
- {
- return new ASTTypedefReference( offset, string, (IASTTypedefDeclaration)symbol.getASTExtension().getPrimaryDeclaration());
- }
- else if( symbol.getType() == TypeInfo.t_enumeration )
- return new ASTEnumerationReference( offset, string, (IASTEnumerationSpecifier)symbol.getASTExtension().getPrimaryDeclaration() );
- else if( symbol.getType() == TypeInfo.t_enumerator )
- return new ASTEnumeratorReference( offset, string, (IASTEnumerator)symbol.getASTExtension().getPrimaryDeclaration() );
- else if(( symbol.getType() == TypeInfo.t_function ) || (symbol.getType() == TypeInfo.t_constructor))
- {
- if( symbol.getContainingSymbol().getTypeInfo().isType( TypeInfo.t_class, TypeInfo.t_union ) )
- return new ASTMethodReference( offset, string, (IASTMethod)symbol.getASTExtension().getPrimaryDeclaration() );
- else
- return new ASTFunctionReference( offset, string, (IASTFunction)symbol.getASTExtension().getPrimaryDeclaration() );
- }
- else if( ( symbol.getType() == TypeInfo.t_type ) ||
- ( symbol.getType() == TypeInfo.t_bool )||
- ( symbol.getType() == TypeInfo.t_char ) ||
- ( symbol.getType() == TypeInfo.t_wchar_t )||
- ( symbol.getType() == TypeInfo.t_int ) ||
- ( symbol.getType() == TypeInfo.t_float )||
- ( symbol.getType() == TypeInfo.t_double ) ||
- ( symbol.getType() == TypeInfo.t_void ) )
-
- {
- if( symbol.getContainingSymbol().getType() == TypeInfo.t_class ||
- symbol.getContainingSymbol().getType() == TypeInfo.t_struct ||
- symbol.getContainingSymbol().getType() == TypeInfo.t_union )
- {
- return new ASTFieldReference( offset, string, (IASTField)symbol.getASTExtension().getPrimaryDeclaration());
- }
- else if( ( symbol.getContainingSymbol().getType() == TypeInfo.t_function ||
- symbol.getContainingSymbol().getType() == TypeInfo.t_constructor ) &&
- symbol.getContainingSymbol() instanceof IParameterizedSymbol &&
- ((IParameterizedSymbol)symbol.getContainingSymbol()).getParameterList() != null &&
- ((IParameterizedSymbol)symbol.getContainingSymbol()).getParameterList().contains( symbol ) )
- {
- return new ASTParameterReference( offset, string, (IASTParameterDeclaration)symbol.getASTExtension().getPrimaryDeclaration() );
- }
- else
- {
- ASTSymbol s = symbol.getASTExtension().getPrimaryDeclaration();
- if(s instanceof IASTVariable)
- return new ASTVariableReference( offset, string, (IASTVariable)s);
- else if (s instanceof IASTParameterDeclaration)
- return new ASTParameterReference( offset, string, (IASTParameterDeclaration)s);
- }
- }
- throw new ASTSemanticException();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createEnumerationSpecifier(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, int, int)
- */
- public IASTEnumerationSpecifier createEnumerationSpecifier(
- IASTScope scope,
- String name,
- int startingOffset,
- int nameOffset, int nameEndOffset) throws ASTSemanticException
- {
- IContainerSymbol containerSymbol = scopeToSymbol(scope);
- TypeInfo.eType pstType = TypeInfo.t_enumeration;
-
- IDerivableContainerSymbol classSymbol = pst.newDerivableContainerSymbol( name, pstType );
- try
- {
- containerSymbol.addSymbol( classSymbol );
- }
- catch (ParserSymbolTableException e)
- {
- throw new ASTSemanticException();
- }
-
- ASTEnumerationSpecifier enumSpecifier = new ASTEnumerationSpecifier( classSymbol, startingOffset, nameOffset, nameEndOffset );
-
- try
- {
- attachSymbolExtension(classSymbol, enumSpecifier );
- }
- catch (ExtensionException e1)
- {
- throw new ASTSemanticException();
- }
- return enumSpecifier;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#addEnumerator(org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier, java.lang.String, int, int, org.eclipse.cdt.core.parser.ast.IASTExpression)
- */
- public void addEnumerator(
- IASTEnumerationSpecifier enumeration,
- String string,
- int startingOffset,
- int nameOffset,
- int nameEndOffset, int endingOffset, IASTExpression initialValue) throws ASTSemanticException
- {
- IContainerSymbol enumerationSymbol = (IContainerSymbol)((ISymbolOwner)enumeration).getSymbol();
-
- ISymbol enumeratorSymbol = pst.newSymbol( string, TypeInfo.t_enumerator );
- try
- {
- enumerationSymbol.addSymbol( enumeratorSymbol );
- }
- catch (ParserSymbolTableException e1)
- {
- throw new ASTSemanticException();
- }
- ASTEnumerator enumerator = new ASTEnumerator( enumeratorSymbol, enumeration, startingOffset, nameOffset, nameEndOffset, endingOffset, initialValue );
- ((ASTEnumerationSpecifier)enumeration).addEnumerator( enumerator );
- try
- {
- attachSymbolExtension( enumeratorSymbol, enumerator );
- }
- catch (ExtensionException e)
- {
- throw new ASTSemanticException();
- }
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExpression(org.eclipse.cdt.core.parser.ast.IASTExpression.Kind, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTExpression, java.lang.String, java.lang.String, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor)
- */
- public IASTExpression createExpression(
- IASTScope scope,
- Kind kind,
- IASTExpression lhs,
- IASTExpression rhs,
- IASTExpression thirdExpression,
- IASTTypeId typeId,
- ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException
- {
- try{
- List references = new ArrayList();
- ISymbol symbol = getExpressionSymbol(scope, kind, lhs, rhs, idExpression, references );
-
- // Try to figure out the result that this expression evaluates to
- ExpressionResult expressionResult = getExpressionResultType(kind, lhs, rhs, thirdExpression, typeId, literal, symbol);
-
- // expression results could be empty, but should not be null
- if(expressionResult == null)
- throw new ASTSemanticException();
-
- // create the ASTExpression
- ASTExpression expression = new ASTExpression( kind, lhs, rhs, thirdExpression,
- typeId, idExpression, literal, newDescriptor, references);
-
- // Assign the result to the created expression
- expression.setResultType (expressionResult);
-
- return expression;
-
- }catch (ASTSemanticException e){
- throw e;
- }
-
- }
- /*
- * Try and dereference the symbol in the expression
- */
- private ISymbol getExpressionSymbol(
- IASTScope scope,
- Kind kind,
- IASTExpression lhs,
- IASTExpression rhs,
- ITokenDuple idExpression,
- List references )throws ASTSemanticException
- {
- ISymbol symbol = null;
- IContainerSymbol startingScope = scopeToSymbol( scope );
-
- //If the expression has an id, look up id and add it to references
- if( idExpression != null )
- symbol = lookupQualifiedName( startingScope, idExpression, references, false );
-
- // If the expression is lookup symbol if it is in the scope of a type after a "." or an "->"
- IContainerSymbol searchScope = getSearchScope(kind, lhs, startingScope);
- if (!searchScope.equals(startingScope))
- symbol = lookupQualifiedName(searchScope, ((ASTExpression)rhs).getIdExpressionTokenDuple(), references, false, LookupType.QUALIFIED );
-
- // get symbol if it is the "this" pointer
- // go up the scope until you hit a class
- if (kind == IASTExpression.Kind.PRIMARY_THIS){
- try{
- symbol = startingScope.lookup("this");
- }catch (ParserSymbolTableException e){
- throw new ASTSemanticException();
- }
- }
- // lookup symbol if it is a function call
- if (kind == IASTExpression.Kind.POSTFIX_FUNCTIONCALL){
- ITokenDuple functionId = getFunctionId(lhs);
- IContainerSymbol functionScope = getSearchScope(lhs.getExpressionKind(), lhs.getLHSExpression(), startingScope);
- ExpressionResult expResult = ((ASTExpression)rhs).getResultType();
- List parameters = null;
- if(expResult instanceof ExpressionResultList){
- ExpressionResultList expResultList = (ExpressionResultList) expResult;
- parameters = expResultList.getResultList();
-
- }else {
- parameters = new ArrayList();
- parameters.add(expResult.getResult());
- }
- if( functionScope.equals( startingScope ) )
- symbol = lookupQualifiedName(functionScope, functionId, TypeInfo.t_function, parameters, references, false);
- else
- symbol = lookupQualifiedName(functionScope, functionId, TypeInfo.t_function, parameters, references, false, LookupType.QUALIFIED );
- }
-
- return symbol;
- }
- /*
- * Returns the function ID token
- */
- private ITokenDuple getFunctionId (IASTExpression expression){
- if((expression.getExpressionKind() == IASTExpression.Kind.POSTFIX_DOT_IDEXPRESSION)
- || (expression.getExpressionKind() == IASTExpression.Kind.POSTFIX_ARROW_IDEXPRESSION)
- || (expression.getExpressionKind() == IASTExpression.Kind.POSTFIX_DOT_TEMPL_IDEXPRESS)
- || (expression.getExpressionKind() == IASTExpression.Kind.POSTFIX_ARROW_TEMPL_IDEXP)
- || (expression.getExpressionKind() == IASTExpression.Kind.PM_DOTSTAR)
- || (expression.getExpressionKind() == IASTExpression.Kind.PM_ARROWSTAR)
- ){
- return ((ASTExpression)expression.getRHSExpression()).getIdExpressionTokenDuple();
- }
- else {
- return ((ASTExpression)expression).getIdExpressionTokenDuple();
- }
- }
-
- private IContainerSymbol getSearchScope (Kind kind, IASTExpression lhs, IContainerSymbol startingScope) throws ASTSemanticException{
- if((kind == IASTExpression.Kind.POSTFIX_DOT_IDEXPRESSION)
- || (kind == IASTExpression.Kind.POSTFIX_ARROW_IDEXPRESSION)
- || (kind == IASTExpression.Kind.POSTFIX_DOT_TEMPL_IDEXPRESS)
- || (kind == IASTExpression.Kind.POSTFIX_ARROW_TEMPL_IDEXP)
- || (kind == IASTExpression.Kind.PM_DOTSTAR)
- || (kind == IASTExpression.Kind.PM_ARROWSTAR)
- ){
- TypeInfo lhsInfo = (TypeInfo) ((ASTExpression)lhs).getResultType().getResult();
- if(lhsInfo != null){
- ISymbol firstContainingScope = (ISymbol) lhsInfo.getTypeSymbol();
- if(firstContainingScope != null){
- ISymbol containingScope = firstContainingScope.getTypeSymbol();
- if(containingScope != null){
- return (IContainerSymbol)containingScope;
- } else {
- throw new ASTSemanticException();
- }
- } else {
- throw new ASTSemanticException();
- }
- } else {
- throw new ASTSemanticException();
- }
- }
- else {
- return startingScope;
- }
- }
-
- /*
- * Conditional Expression conversion
- */
- protected TypeInfo conditionalExpressionConversions(TypeInfo second, TypeInfo third){
- TypeInfo info = new TypeInfo();
- if(second.equals(third)){
- info = second;
- return info;
- }
- if((second.getType() == TypeInfo.t_void) && (third.getType() != TypeInfo.t_void)){
- info = third;
- return info;
- }
- if((second.getType() != TypeInfo.t_void) && (third.getType() == TypeInfo.t_void)){
- info = second;
- return info;
- }
- if((second.getType() == TypeInfo.t_void) && (third.getType() == TypeInfo.t_void)){
- info = second;
- return info;
- }
- try{
- info = ParserSymbolTable.getConditionalOperand(second, third);
- return info;
- } catch(ParserSymbolTableException e){
- // empty info
- return info;
- }
- }
- /*
- * Apply the usual arithmetic conversions to find out the result of an expression
- * that has a lhs and a rhs as indicated in the specs (section 5.Expressions, page 64)
- */
- protected TypeInfo usualArithmeticConversions(TypeInfo lhs, TypeInfo rhs) throws ASTSemanticException{
-
- // if you have a variable of type basic type, then we need to go to the basic type first
- while( (lhs.getType() == TypeInfo.t_type) && (lhs.getTypeSymbol() != null)){
- lhs = lhs.getTypeSymbol().getTypeInfo();
- }
- while( (rhs.getType() == TypeInfo.t_type) && (rhs.getTypeSymbol() != null)){
- rhs = rhs.getTypeSymbol().getTypeInfo();
- }
-
- if( !lhs.isType(TypeInfo.t_bool, TypeInfo.t_enumerator ) &&
- !rhs.isType(TypeInfo.t_bool, TypeInfo.t_enumerator ) )
- {
- throw new ASTSemanticException();
- }
-
- TypeInfo info = new TypeInfo();
- if(
- ( lhs.checkBit(TypeInfo.isLong) && lhs.getType() == TypeInfo.t_double)
- || ( rhs.checkBit(TypeInfo.isLong) && rhs.getType() == TypeInfo.t_double)
- ){
- info.setType(TypeInfo.t_double);
- info.setBit(true, TypeInfo.isLong);
- return info;
- }
- else if(
- ( lhs.getType() == TypeInfo.t_double )
- || ( rhs.getType() == TypeInfo.t_double )
- ){
- info.setType(TypeInfo.t_double);
- return info;
- }
- else if (
- ( lhs.getType() == TypeInfo.t_float )
- || ( rhs.getType() == TypeInfo.t_float )
- ){
- info.setType(TypeInfo.t_float);
- return info;
- } else {
- // perform intergral promotions (Specs section 4.5)
- info.setType(TypeInfo.t_int);
- }
-
- if(
- ( lhs.checkBit(TypeInfo.isUnsigned) && lhs.checkBit(TypeInfo.isLong))
- || ( rhs.checkBit(TypeInfo.isUnsigned) && rhs.checkBit(TypeInfo.isLong))
- ){
- info.setBit(true, TypeInfo.isUnsigned);
- info.setBit(true, TypeInfo.isLong);
- return info;
- }
- else if(
- ( lhs.checkBit(TypeInfo.isUnsigned) && rhs.checkBit(TypeInfo.isLong) )
- || ( rhs.checkBit(TypeInfo.isUnsigned) && lhs.checkBit(TypeInfo.isLong) )
- ){
- info.setBit(true, TypeInfo.isUnsigned);
- info.setBit(true, TypeInfo.isLong);
- return info;
- }
- else if (
- ( lhs.checkBit(TypeInfo.isLong))
- || ( rhs.checkBit(TypeInfo.isLong))
- ){
- info.setBit(true, TypeInfo.isLong);
- return info;
- }
- else if (
- ( lhs.checkBit(TypeInfo.isUnsigned) )
- || ( rhs.checkBit(TypeInfo.isUnsigned) )
- ){
- info.setBit(true, TypeInfo.isUnsigned);
- return info;
- } else {
- // it should be both = int
- return info;
- }
- }
-
- private TypeInfo addToInfo(ASTExpression exp, boolean flag, int mask)
- throws ASTSemanticException{
- if(exp == null)
- throw new ASTSemanticException();
- TypeInfo info = (TypeInfo)((ASTExpression)exp).getResultType().getResult();
- info.setBit(flag, mask);
- return info;
- }
-
- protected ExpressionResult getExpressionResultType(
- Kind kind,
- IASTExpression lhs,
- IASTExpression rhs,
- IASTExpression thirdExpression,
- IASTTypeId typeId,
- String literal,
- ISymbol symbol)
- throws ASTSemanticException{
- ExpressionResult result = null;
- TypeInfo info = new TypeInfo();
- try {
- // types that resolve to void
- if ((kind == IASTExpression.Kind.PRIMARY_EMPTY)
- || (kind == IASTExpression.Kind.THROWEXPRESSION)
- || (kind == IASTExpression.Kind.POSTFIX_DOT_DESTRUCTOR)
- || (kind == IASTExpression.Kind.POSTFIX_ARROW_DESTRUCTOR)
- || (kind == IASTExpression.Kind.DELETE_CASTEXPRESSION)
- || (kind == IASTExpression.Kind.DELETE_VECTORCASTEXPRESSION)
- ){
- info.setType(TypeInfo.t_void);
- result = new ExpressionResult(info);
- return result;
- }
- // types that resolve to int
- if ((kind == IASTExpression.Kind.PRIMARY_INTEGER_LITERAL)
- || (kind == IASTExpression.Kind.POSTFIX_SIMPLETYPE_INT)
- ){
- info.setType(TypeInfo.t_int);
- result = new ExpressionResult(info);
- return result;
- }
- // size of is always unsigned int
- if ((kind == IASTExpression.Kind.UNARY_SIZEOF_TYPEID)
- || (kind == IASTExpression.Kind.UNARY_SIZEOF_UNARYEXPRESSION)
- ){
- info.setType(TypeInfo.t_int);
- info.setBit(true, TypeInfo.isUnsigned);
- result = new ExpressionResult(info);
- return result;
- }
- // types that resolve to char
- if( (kind == IASTExpression.Kind.PRIMARY_CHAR_LITERAL)
- || (kind == IASTExpression.Kind.POSTFIX_SIMPLETYPE_CHAR)){
- info.setType(TypeInfo.t_char);
- // check that this is really only one literal
- if(literal.length() > 1){
- // this is a string
- info.addPtrOperator(new TypeInfo.PtrOp(TypeInfo.PtrOp.t_pointer));
- }
- result = new ExpressionResult(info);
- return result;
- }
- // types that resolve to string
- if (kind == IASTExpression.Kind.PRIMARY_STRING_LITERAL){
- info.setType(TypeInfo.t_char);
- info.addPtrOperator(new TypeInfo.PtrOp(TypeInfo.PtrOp.t_pointer));
- result = new ExpressionResult(info);
- return result;
- }
- // types that resolve to float
- if( (kind == IASTExpression.Kind.PRIMARY_FLOAT_LITERAL)
- || (kind == IASTExpression.Kind.POSTFIX_SIMPLETYPE_FLOAT)){
- info.setType(TypeInfo.t_float);
- result = new ExpressionResult(info);
- return result;
- }
- // types that resolve to double
- if( kind == IASTExpression.Kind.POSTFIX_SIMPLETYPE_DOUBLE){
- info.setType(TypeInfo.t_double);
- result = new ExpressionResult(info);
- return result;
- }
- // types that resolve to wchar
- if(kind == IASTExpression.Kind.POSTFIX_SIMPLETYPE_WCHART){
- info.setType(TypeInfo.t_wchar_t);
- result = new ExpressionResult(info);
- return result;
- }
- // types that resolve to bool
- if( (kind == IASTExpression.Kind.PRIMARY_BOOLEAN_LITERAL)
- || (kind == IASTExpression.Kind.POSTFIX_SIMPLETYPE_BOOL)
- || (kind == IASTExpression.Kind.RELATIONAL_GREATERTHAN)
- || (kind == IASTExpression.Kind.RELATIONAL_GREATERTHANEQUALTO)
- || (kind == IASTExpression.Kind.RELATIONAL_LESSTHAN)
- || (kind == IASTExpression.Kind.RELATIONAL_LESSTHANEQUALTO)
- || (kind == IASTExpression.Kind.EQUALITY_EQUALS)
- || (kind == IASTExpression.Kind.EQUALITY_NOTEQUALS)
- || (kind == IASTExpression.Kind.LOGICALANDEXPRESSION)
- || (kind == IASTExpression.Kind.LOGICALOREXPRESSION)
- )
- {
- info.setType(TypeInfo.t_bool);
- result = new ExpressionResult(info);
- return result;
- }
- // short added to a type
- if (kind == IASTExpression.Kind.POSTFIX_SIMPLETYPE_SHORT ){
- info = addToInfo((ASTExpression)lhs, true, TypeInfo.isShort);
- result = new ExpressionResult(info);
- return result;
- }
- // long added to a type
- if (kind == IASTExpression.Kind.POSTFIX_SIMPLETYPE_LONG ){
- info = addToInfo((ASTExpression)lhs, true, TypeInfo.isLong);
- result = new ExpressionResult(info);
- return result;
- }
- // signed added to a type
- if (kind == IASTExpression.Kind.POSTFIX_SIMPLETYPE_SIGNED ){
- info = addToInfo((ASTExpression)lhs, false, TypeInfo.isUnsigned);
- result = new ExpressionResult(info);
- return result;
- }
- // unsigned added to a type
- if (kind == IASTExpression.Kind.POSTFIX_SIMPLETYPE_UNSIGNED ){
- info = addToInfo((ASTExpression)lhs, true, TypeInfo.isUnsigned);
- result = new ExpressionResult(info);
- return result;
- }
- // Id expressions resolve to t_type, symbol already looked up
- if( kind == IASTExpression.Kind.ID_EXPRESSION )
- {
- info.setType(TypeInfo.t_type);
- info.setTypeSymbol(symbol);
- result = new ExpressionResult(info);
- if (symbol == null)
- result.setFailedToDereference(true);
- return result;
- }
- // an ampersand implies a pointer operation of type reference
- if (kind == IASTExpression.Kind.UNARY_AMPSND_CASTEXPRESSION){
- ASTExpression left =(ASTExpression)lhs;
- if(left == null)
- throw new ASTSemanticException();
- info = (TypeInfo)left.getResultType().getResult();
- if ((info != null) && (info.getTypeSymbol() != null)){
- info.addOperatorExpression( TypeInfo.OperatorExpression.addressof );
- } else {
- throw new ASTSemanticException();
- }
- result = new ExpressionResult(info);
- return result;
- }
-
- // a star implies a pointer operation of type pointer
- if (kind == IASTExpression.Kind.UNARY_STAR_CASTEXPRESSION){
- ASTExpression left =(ASTExpression)lhs;
- if(left == null)
- throw new ASTSemanticException();
- info = (TypeInfo)left.getResultType().getResult();
- if ((info != null)&& (info.getTypeSymbol() != null)){
- info.addOperatorExpression( TypeInfo.OperatorExpression.indirection );
- }else {
- throw new ASTSemanticException();
- }
- result = new ExpressionResult(info);
- return result;
- }
- // subscript
- if (kind == IASTExpression.Kind.POSTFIX_SUBSCRIPT){
- ASTExpression left =(ASTExpression)lhs;
- if(left == null)
- throw new ASTSemanticException();
- info = (TypeInfo)left.getResultType().getResult();
- if ((info != null) && (info.getTypeSymbol() != null)){
- info.addOperatorExpression( TypeInfo.OperatorExpression.subscript );
- }else {
- throw new ASTSemanticException();
- }
- result = new ExpressionResult(info);
- return result;
- }
- // the dot and the arrow resolves to the type of the member
- if ((kind == IASTExpression.Kind.POSTFIX_DOT_IDEXPRESSION)
- || (kind == IASTExpression.Kind.POSTFIX_ARROW_IDEXPRESSION)
- || (kind == IASTExpression.Kind.POSTFIX_DOT_TEMPL_IDEXPRESS)
- || (kind == IASTExpression.Kind.POSTFIX_ARROW_TEMPL_IDEXP)
- ){
- if(symbol != null){
- info = new TypeInfo(symbol.getTypeInfo());
- }
-// else {
-// throw new ASTSemanticException();
-// }
- result = new ExpressionResult(info);
- return result;
- }
- // the dot* and the arrow* are the same as dot/arrow + unary star
- if ((kind == IASTExpression.Kind.PM_DOTSTAR)
- || (kind == IASTExpression.Kind.PM_ARROWSTAR)
- ){
- ASTExpression right =(ASTExpression)rhs;
- if (right == null)
- throw new ASTSemanticException();
- info = (TypeInfo)right.getResultType().getResult();
- if ((info != null) && (symbol != null)){
- info.addOperatorExpression( TypeInfo.OperatorExpression.indirection );
- info.setTypeSymbol(symbol);
- } else {
- throw new ASTSemanticException();
- }
- result = new ExpressionResult(info);
- return result;
- }
- // this
- if (kind == IASTExpression.Kind.PRIMARY_THIS){
- if(symbol != null)
- {
- info.setType(TypeInfo.t_type);
- info.setTypeSymbol(symbol);
- } else {
- throw new ASTSemanticException();
- }
- result = new ExpressionResult(info);
- return result;
- }
- // conditional
- if (kind == IASTExpression.Kind.CONDITIONALEXPRESSION){
- ASTExpression right = (ASTExpression)rhs;
- ASTExpression third = (ASTExpression)thirdExpression;
- if((right != null ) && (third != null)){
- TypeInfo rightType =(TypeInfo)right.getResultType().getResult();
- TypeInfo thirdType =(TypeInfo)third.getResultType().getResult();
- if((rightType != null) && (thirdType != null)){
- info = conditionalExpressionConversions(rightType, thirdType);
- } else {
- throw new ASTSemanticException();
- }
- } else {
- throw new ASTSemanticException();
- }
- result = new ExpressionResult(info);
- return result;
- }
- // new
- if( ( kind == IASTExpression.Kind.NEW_TYPEID )
- || ( kind == IASTExpression.Kind.NEW_NEWTYPEID ) )
- {
- try
- {
- info = typeId.getTypeSymbol().getTypeInfo();
- info.addPtrOperator( new TypeInfo.PtrOp(TypeInfo.PtrOp.t_pointer));
- }
- catch (ASTNotImplementedException e)
- {
- // will never happen
- }
- result = new ExpressionResult(info);
- return result;
- }
- // types that use the usual arithmetic conversions
- if((kind == IASTExpression.Kind.MULTIPLICATIVE_MULTIPLY)
- || (kind == IASTExpression.Kind.MULTIPLICATIVE_DIVIDE)
- || (kind == IASTExpression.Kind.MULTIPLICATIVE_MODULUS)
- || (kind == IASTExpression.Kind.ADDITIVE_PLUS)
- || (kind == IASTExpression.Kind.ADDITIVE_MINUS)
- || (kind == IASTExpression.Kind.ANDEXPRESSION)
- || (kind == IASTExpression.Kind.EXCLUSIVEOREXPRESSION)
- || (kind == IASTExpression.Kind.INCLUSIVEOREXPRESSION)
- ){
- ASTExpression left = (ASTExpression)lhs;
- ASTExpression right = (ASTExpression)rhs;
- if((left != null ) && (right != null)){
- TypeInfo leftType =(TypeInfo)left.getResultType().getResult();
- TypeInfo rightType =(TypeInfo)right.getResultType().getResult();
- info = usualArithmeticConversions(leftType, rightType);
- }
- else {
- throw new ASTSemanticException();
- }
- result = new ExpressionResult(info);
- return result;
- }
- // types that resolve to LHS types
- if ((kind == IASTExpression.Kind.PRIMARY_BRACKETED_EXPRESSION)
- || (kind == IASTExpression.Kind.POSTFIX_INCREMENT)
- || (kind == IASTExpression.Kind.POSTFIX_DECREMENT)
- || (kind == IASTExpression.Kind.POSTFIX_TYPEID_EXPRESSION)
- || (kind == IASTExpression.Kind.UNARY_INCREMENT)
- || (kind == IASTExpression.Kind.UNARY_DECREMENT)
- || (kind == IASTExpression.Kind.UNARY_PLUS_CASTEXPRESSION)
- || (kind == IASTExpression.Kind.UNARY_MINUS_CASTEXPRESSION)
- || (kind == IASTExpression.Kind.UNARY_NOT_CASTEXPRESSION)
- || (kind == IASTExpression.Kind.UNARY_TILDE_CASTEXPRESSION)
- || (kind == IASTExpression.Kind.SHIFT_LEFT)
- || (kind == IASTExpression.Kind.SHIFT_RIGHT)
- || (kind == IASTExpression.Kind.ASSIGNMENTEXPRESSION_NORMAL)
- || (kind == IASTExpression.Kind.ASSIGNMENTEXPRESSION_PLUS)
- || (kind == IASTExpression.Kind.ASSIGNMENTEXPRESSION_MINUS)
- || (kind == IASTExpression.Kind.ASSIGNMENTEXPRESSION_MULT)
- || (kind == IASTExpression.Kind.ASSIGNMENTEXPRESSION_DIV)
- || (kind == IASTExpression.Kind.ASSIGNMENTEXPRESSION_MOD)
- || (kind == IASTExpression.Kind.ASSIGNMENTEXPRESSION_LSHIFT)
- || (kind == IASTExpression.Kind.ASSIGNMENTEXPRESSION_RSHIFT)
- || (kind == IASTExpression.Kind.ASSIGNMENTEXPRESSION_AND)
- || (kind == IASTExpression.Kind.ASSIGNMENTEXPRESSION_OR)
- || (kind == IASTExpression.Kind.ASSIGNMENTEXPRESSION_XOR)
- ){
- ASTExpression left = (ASTExpression)lhs;
- if(left != null){
- info =(TypeInfo)left.getResultType().getResult();
- } else {
- throw new ASTSemanticException();
- }
- result = new ExpressionResult(info);
- return result;
- }
- // the cast changes the types to the type looked up in typeId = symbol
- if(( kind == IASTExpression.Kind.CASTEXPRESSION )
- || ( kind == IASTExpression.Kind.POSTFIX_DYNAMIC_CAST )
- || ( kind == IASTExpression.Kind.POSTFIX_STATIC_CAST )
- || ( kind == IASTExpression.Kind.POSTFIX_REINTERPRET_CAST )
- || ( kind == IASTExpression.Kind.POSTFIX_CONST_CAST )
- ){
- try{
- info = new TypeInfo(typeId.getTypeSymbol().getTypeInfo());
- }catch (ASTNotImplementedException e)
- {
- // will never happen
- }
- result = new ExpressionResult(info);
- return result;
- }
- // a list collects all types of left and right hand sides
- if(kind == IASTExpression.Kind.EXPRESSIONLIST){
- result = new ExpressionResultList();
- if(lhs != null){
- TypeInfo leftType = ((ASTExpression)lhs).getResultType().getResult();
- result.setResult(leftType);
- }
- if(rhs != null){
- TypeInfo rightType = ((ASTExpression)rhs).getResultType().getResult();
- result.setResult(rightType);
- }
- return result;
- }
- // a function call type is the return type of the function
- if(kind == IASTExpression.Kind.POSTFIX_FUNCTIONCALL){
- if(symbol != null){
- IParameterizedSymbol psymbol = (IParameterizedSymbol) symbol;
- ISymbol returnTypeSymbol = psymbol.getReturnType();
- if(returnTypeSymbol != null){
- info.setType(returnTypeSymbol.getType());
- info.setTypeSymbol(returnTypeSymbol);
- }else {
- // this is call to a constructor
- }
- }
- result = new ExpressionResult(info);
- if(symbol == null)
- result.setFailedToDereference(true);
- return result;
- }
- // typeid
- if( kind == IASTExpression.Kind.POSTFIX_TYPEID_TYPEID )
- {
- try
- {
- info = typeId.getTypeSymbol().getTypeInfo();
- }
- catch (ASTNotImplementedException e)
- {
- // will not ever happen from within CompleteParseASTFactory
- }
- result = new ExpressionResult(info);
- return result;
- }
- // typename
- if ( ( kind == IASTExpression.Kind.POSTFIX_TYPENAME_IDENTIFIER )
- || ( kind == IASTExpression.Kind.POSTFIX_TYPENAME_TEMPLATEID ) )
- {
- if(symbol != null){
- info.setType(TypeInfo.t_type);
- info.setTypeSymbol(symbol);
- } else {
- throw new ASTSemanticException();
- }
- result = new ExpressionResult(info);
- return result;
- }
- } catch (Exception e){
- throw new ASTSemanticException();
- }
- return null;
- }
-
- protected void getExpressionReferences(IASTExpression expression, List references)
- {
- if( expression != null )
- {
- references.addAll( ((ASTExpression)expression).getReferences() );
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNewDescriptor()
- */
- public IASTNewExpressionDescriptor createNewDescriptor(List newPlacementExpressions,List newTypeIdExpressions,List newInitializerExpressions)
- {
- return new ASTNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExceptionSpecification(java.util.List)
- */
- public IASTExceptionSpecification createExceptionSpecification(IASTScope scope, List typeIds) throws ASTSemanticException
- {
- List references = new ArrayList();
- List newTypeIds = new ArrayList();
- if( typeIds != null )
- {
- Iterator iter =typeIds.iterator();
- while( iter.hasNext() )
- {
- IASTTypeId duple = (IASTTypeId)iter.next();
- if( duple != null )
- {
- lookupQualifiedName( scopeToSymbol( scope ), ((ASTTypeId)duple).getTokenDuple(), references, false );
- newTypeIds.add( duple.toString() );
- }
- }
- }
- return new ASTExceptionSpecification( newTypeIds, references );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createConstructorMemberInitializer(org.eclipse.cdt.core.parser.ITokenDuple, org.eclipse.cdt.core.parser.ast.IASTExpression)
- */
- public IASTConstructorMemberInitializer createConstructorMemberInitializer(
- IASTScope scope,
- ITokenDuple duple, IASTExpression expressionList) throws ASTSemanticException
- {
- List references = new ArrayList();
-
- IContainerSymbol scopeSymbol = scopeToSymbol(scope);
-
- boolean requireReferenceResolution = false;
- if( duple != null )
- {
- try
- {
- lookupQualifiedName( scopeSymbol, duple, references, true );
- } catch( ASTSemanticException ase )
- {
- requireReferenceResolution = true;
- }
- }
-
- getExpressionReferences( expressionList, references );
- return new ASTConstructorMemberInitializer(
- expressionList,
- duple == null ? "" : duple.toString(),
- duple == null ? 0 : duple.getFirstToken().getOffset(),
- references, requireReferenceResolution );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createSimpleTypeSpecifier(org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type, org.eclipse.cdt.core.parser.ITokenDuple, boolean, boolean, boolean, boolean, boolean)
- */
- public IASTSimpleTypeSpecifier createSimpleTypeSpecifier(
- IASTScope scope,
- Type kind,
- ITokenDuple typeName,
- boolean isShort,
- boolean isLong,
- boolean isSigned,
- boolean isUnsigned, boolean isTypename, boolean isComplex, boolean isImaginary) throws ASTSemanticException
- {
- TypeInfo.eType type = null;
-
- if( kind == IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME )
- type = TypeInfo.t_type;
- else if( kind == IASTSimpleTypeSpecifier.Type.BOOL )
- type = TypeInfo.t_bool;
- else if( kind == IASTSimpleTypeSpecifier.Type.CHAR )
- type = TypeInfo.t_char;
- else if( kind == IASTSimpleTypeSpecifier.Type.DOUBLE ||kind == IASTSimpleTypeSpecifier.Type.FLOAT )
- type = TypeInfo.t_double;
- else if( kind == IASTSimpleTypeSpecifier.Type.INT )
- type = TypeInfo.t_int;
- else if( kind == IASTSimpleTypeSpecifier.Type.VOID )
- type = TypeInfo.t_void;
- else if( kind == IASTSimpleTypeSpecifier.Type.WCHAR_T)
- type = TypeInfo.t_wchar_t;
- else if( kind == IASTSimpleTypeSpecifier.Type._BOOL )
- type = TypeInfo.t__Bool;
-
- List references = new ArrayList();
- ISymbol s = pst.newSymbol( "", type );
- if( kind == IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME )
- {
- // lookup the duple
- Iterator i = typeName.iterator();
- IToken first = typeName.getFirstToken();
-
- ISymbol typeSymbol = getScopeToSearchUpon( scope, first, i );
-
- while( i.hasNext() )
- {
- IToken current = (IToken)i.next();
- if( current.getType() == IToken.tCOLONCOLON ) continue;
-
- try
- {
- if( current != typeName.getLastToken() )
- typeSymbol = ((IContainerSymbol)typeSymbol).lookupNestedNameSpecifier( current.getImage());
- else
- typeSymbol = ((IContainerSymbol)typeSymbol).lookup( current.getImage());
-
- if( typeSymbol != null )
- addReference( references, createReference( typeSymbol, current.getImage(), current.getOffset() ));
- else
- throw new ASTSemanticException();
- }
- catch (ParserSymbolTableException e)
- {
- throw new ASTSemanticException();
- }
- }
- s.setTypeSymbol( typeSymbol );
- }
-
- s.getTypeInfo().setBit( isLong, TypeInfo.isLong );
- s.getTypeInfo().setBit( isShort, TypeInfo.isShort);
- s.getTypeInfo().setBit( isUnsigned, TypeInfo.isUnsigned );
- s.getTypeInfo().setBit( isComplex, TypeInfo.isComplex );
- s.getTypeInfo().setBit( isImaginary, TypeInfo.isImaginary );
-
- return new ASTSimpleTypeSpecifier( s, false, typeName.toString(), references );
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createFunction(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplate)
- */
- public IASTFunction createFunction(
- IASTScope scope,
- ITokenDuple name,
- List parameters,
- IASTAbstractDeclaration returnType,
- IASTExceptionSpecification exception,
- boolean isInline,
- boolean isFriend,
- boolean isStatic,
- int startOffset,
- int nameOffset,
- int nameEndOffset,
- IASTTemplate ownerTemplate,
- boolean isConst,
- boolean isVolatile,
- boolean isVirtual,
- boolean isExplicit,
- boolean isPureVirtual,
- List constructorChain,
- boolean isFunctionDefinition, boolean hasFunctionTryBlock, boolean hasVariableArguments ) throws ASTSemanticException
- {
- List references = new ArrayList();
- IContainerSymbol ownerScope = scopeToSymbol( scope );
-
- // check if this is a method in a body file
- if(name.length() > 1){
- IContainerSymbol parentScope = (IContainerSymbol)
- lookupQualifiedName(
- ownerScope,
- name.getSubrange( 0, name.findLastTokenType( IToken.tCOLONCOLON ) - 1),
- references,
- false );
-
-
- if((parentScope != null) &&
- ( (parentScope.getType() == TypeInfo.t_class)
- || (parentScope.getType() == TypeInfo.t_struct)
- || (parentScope.getType() == TypeInfo.t_union))
- ){
- IASTScope methodParentScope = (IASTScope)parentScope.getASTExtension().getPrimaryDeclaration();
- ITokenDuple newName = name.getSubrange(
- name.findLastTokenType( IToken.tCOLONCOLON) + 1,
- name.length() - 1 );
- return createMethod(
- methodParentScope,
- newName,
- parameters,
- returnType,
- exception,
- isInline,
- isFriend,
- isStatic,
- startOffset,
- newName.getFirstToken().getOffset(),
- nameEndOffset,
- ownerTemplate,
- isConst,
- isVolatile,
- isVirtual,
- isExplicit,
- isPureVirtual,
- ASTAccessVisibility.PRIVATE,
- constructorChain,
- references,
- isFunctionDefinition, hasFunctionTryBlock, hasVariableArguments );
- }
- }
-
- IParameterizedSymbol symbol = pst.newParameterizedSymbol( name.getLastToken().getImage(), TypeInfo.t_function );
- setFunctionTypeInfoBits(isInline, isFriend, isStatic, symbol);
-
- symbol.setHasVariableArgs( hasVariableArguments );
-
- setParameter( symbol, returnType, false, references );
- setParameters( symbol, references, parameters.iterator() );
-
- symbol.setIsForwardDeclaration(!isFunctionDefinition);
- boolean previouslyDeclared = false;
- if( isFunctionDefinition )
- {
- List functionParameters = new LinkedList();
- // the lookup requires a list of type infos
- // instead of a list of IASTParameterDeclaration
- Iterator p = parameters.iterator();
- while (p.hasNext()){
- ASTParameterDeclaration param = (ASTParameterDeclaration)p.next();
- functionParameters.add(param.getSymbol().getTypeInfo());
- }
-
- IParameterizedSymbol functionDeclaration = null;
-
- functionDeclaration =
- (IParameterizedSymbol) lookupQualifiedName(ownerScope, name.getLastToken().getImage(), TypeInfo.t_function, functionParameters, 0, new ArrayList(), false, LookupType.UNQUALIFIED );
-
- if( functionDeclaration != null )
- {
- functionDeclaration.setTypeSymbol( symbol );
- previouslyDeclared = true;
- }
- }
-
- try
- {
- ownerScope.addSymbol( symbol );
- }
- catch (ParserSymbolTableException e)
- {
- throw new ASTSemanticException();
- }
- ASTFunction function = new ASTFunction( symbol, nameEndOffset, parameters, returnType, exception, startOffset, nameOffset, ownerTemplate, references, previouslyDeclared, hasFunctionTryBlock );
- try
- {
- attachSymbolExtension(symbol, function);
- }
- catch (ExtensionException e1)
- {
- throw new ASTSemanticException();
- }
- return function;
- }
-
- protected void setFunctionTypeInfoBits(
- boolean isInline,
- boolean isFriend,
- boolean isStatic,
- IParameterizedSymbol symbol)
- {
- symbol.getTypeInfo().setBit( isInline, TypeInfo.isInline );
- symbol.getTypeInfo().setBit( isFriend, TypeInfo.isFriend );
- symbol.getTypeInfo().setBit( isStatic, TypeInfo.isStatic );
- }
-
- /**
- * @param symbol
- * @param iterator
- */
- protected void setParameters(IParameterizedSymbol symbol, List references, Iterator iterator) throws ASTSemanticException
- {
- while( iterator.hasNext() )
- {
- setParameter( symbol, (IASTParameterDeclaration)iterator.next(), true, references );
- }
- }
-
- protected TypeInfo getParameterTypeInfo( IASTAbstractDeclaration absDecl)throws ASTSemanticException{
- TypeInfo type = new TypeInfo();
- if( absDecl.getTypeSpecifier() instanceof IASTSimpleTypeSpecifier )
- {
- IASTSimpleTypeSpecifier.Type kind = ((IASTSimpleTypeSpecifier)absDecl.getTypeSpecifier()).getType();
- if( kind == IASTSimpleTypeSpecifier.Type.BOOL )
- type.setType(TypeInfo.t_bool);
- else if( kind == IASTSimpleTypeSpecifier.Type.CHAR )
- type.setType(TypeInfo.t_char);
- else if( kind == IASTSimpleTypeSpecifier.Type.DOUBLE )
- type.setType(TypeInfo.t_double);
- else if( kind == IASTSimpleTypeSpecifier.Type.FLOAT )
- type.setType(TypeInfo.t_float);
- else if( kind == IASTSimpleTypeSpecifier.Type.INT )
- type.setType(TypeInfo.t_int);
- else if( kind == IASTSimpleTypeSpecifier.Type.VOID )
- type.setType(TypeInfo.t_void);
- else if( kind == IASTSimpleTypeSpecifier.Type.WCHAR_T)
- type.setType(TypeInfo.t_wchar_t);
- else if( kind == IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME )
- type.setType(TypeInfo.t_type);
- else
- throw new ASTSemanticException();
- }
- else if( absDecl.getTypeSpecifier() instanceof IASTClassSpecifier )
- {
- ASTClassKind kind = ((IASTClassSpecifier)absDecl.getTypeSpecifier()).getClassKind();
- if( kind == ASTClassKind.CLASS )
- type.setType(TypeInfo.t_class);
- else if( kind == ASTClassKind.STRUCT )
- type.setType(TypeInfo.t_struct);
- else if( kind == ASTClassKind.UNION )
- type.setType(TypeInfo.t_union);
- else
- throw new ASTSemanticException();
- }
- else if( absDecl.getTypeSpecifier() instanceof IASTEnumerationSpecifier )
- {
- type.setType(TypeInfo.t_enumeration);
- }
- else if( absDecl.getTypeSpecifier() instanceof IASTElaboratedTypeSpecifier )
- {
- ASTClassKind kind = ((IASTElaboratedTypeSpecifier)absDecl.getTypeSpecifier()).getClassKind();
- if( kind == ASTClassKind.CLASS )
- type.setType(TypeInfo.t_class);
- else if( kind == ASTClassKind.STRUCT )
- type.setType(TypeInfo.t_struct);
- else if( kind == ASTClassKind.UNION )
- type.setType(TypeInfo.t_union);
- else if( kind == ASTClassKind.ENUM )
- type.setType(TypeInfo.t_enumeration);
- else
- throw new ASTSemanticException();
- }
- else
- throw new ASTSemanticException();
- return type;
- }
- /**
- * @param symbol
- * @param returnType
- */
- protected void setParameter(IParameterizedSymbol symbol, IASTAbstractDeclaration absDecl, boolean isParameter, List references) throws ASTSemanticException
- {
- if (absDecl.getTypeSpecifier() == null)
- return;
-
- // now determined by another function
- TypeInfo.eType type = getParameterTypeInfo(absDecl).getType();
-
- ISymbol xrefSymbol = null;
- List newReferences = null;
- if( absDecl.getTypeSpecifier() instanceof IASTSimpleTypeSpecifier )
- {
- if( ((IASTSimpleTypeSpecifier)absDecl.getTypeSpecifier()).getType() == IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME )
- {
- xrefSymbol = ((ASTSimpleTypeSpecifier)absDecl.getTypeSpecifier()).getSymbol();
- newReferences = ((ASTSimpleTypeSpecifier)absDecl.getTypeSpecifier()).getReferences();
- }
- }
- else if( absDecl.getTypeSpecifier() instanceof ASTElaboratedTypeSpecifier )
- {
- ASTElaboratedTypeSpecifier elab = (ASTElaboratedTypeSpecifier)absDecl.getTypeSpecifier();
- xrefSymbol = elab.getSymbol();
- newReferences = new ArrayList();
- newReferences.addAll( elab.getReferences() );
- newReferences.add( createReference( xrefSymbol, elab.getName(), elab.getNameOffset()) );
- }
-
- String paramName = "";
- if(absDecl instanceof IASTParameterDeclaration){
- paramName = ((IASTParameterDeclaration)absDecl).getName();
- }
-
- ISymbol paramSymbol = pst.newSymbol( paramName, type );
- if( xrefSymbol != null )
- paramSymbol.setTypeSymbol( xrefSymbol.getTypeSymbol() );
-
- setPointerOperators( paramSymbol, absDecl.getPointerOperators(), absDecl.getArrayModifiers() );
-
- if( isParameter)
- symbol.addParameter( paramSymbol );
- else
- symbol.setReturnType( paramSymbol );
-
- if( newReferences != null )
- references.addAll( newReferences );
-
- if( absDecl instanceof ASTParameterDeclaration )
- {
- ASTParameterDeclaration parm = (ASTParameterDeclaration)absDecl;
- parm.setSymbol( paramSymbol );
- try
- {
- attachSymbolExtension( paramSymbol, parm );
- }
- catch (ExtensionException e)
- {
- throw new ASTSemanticException();
- }
- }
- }
-
- /**
- * @param paramSymbol
- * @param iterator
- */
- protected void setPointerOperators(ISymbol symbol, Iterator pointerOpsIterator, Iterator arrayModsIterator) throws ASTSemanticException
- {
- while( pointerOpsIterator.hasNext() )
- {
- ASTPointerOperator pointerOperator = (ASTPointerOperator)pointerOpsIterator.next();
- if( pointerOperator == ASTPointerOperator.REFERENCE )
- symbol.addPtrOperator( new TypeInfo.PtrOp( TypeInfo.PtrOp.t_reference ));
- else if( pointerOperator == ASTPointerOperator.POINTER )
- symbol.addPtrOperator( new TypeInfo.PtrOp( TypeInfo.PtrOp.t_pointer ));
- else if( pointerOperator == ASTPointerOperator.CONST_POINTER )
- symbol.addPtrOperator( new TypeInfo.PtrOp( TypeInfo.PtrOp.t_pointer, true, false ));
- else if( pointerOperator == ASTPointerOperator.VOLATILE_POINTER )
- symbol.addPtrOperator( new TypeInfo.PtrOp( TypeInfo.PtrOp.t_pointer, false, true));
- else
- throw new ASTSemanticException();
- }
-
- while( arrayModsIterator.hasNext() )
- {
- arrayModsIterator.next();
- symbol.addPtrOperator( new TypeInfo.PtrOp( TypeInfo.PtrOp.t_array ));
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createMethod(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplate, boolean, boolean, boolean, boolean, boolean, boolean, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
- */
-
- public IASTMethod createMethod(
- IASTScope scope,
- ITokenDuple name,
- List parameters,
- IASTAbstractDeclaration returnType,
- IASTExceptionSpecification exception,
- boolean isInline,
- boolean isFriend,
- boolean isStatic,
- int startOffset,
- int nameOffset,
- int nameEndOffset,
- IASTTemplate ownerTemplate,
- boolean isConst,
- boolean isVolatile,
- boolean isVirtual,
- boolean isExplicit,
- boolean isPureVirtual,
- ASTAccessVisibility visibility, List constructorChain, boolean isFunctionDefinition, boolean hasFunctionTryBlock, boolean hasVariableArguments ) throws ASTSemanticException
- {
- return createMethod(scope, name, parameters, returnType, exception,
- isInline, isFriend, isStatic, startOffset, nameOffset, nameEndOffset,
- ownerTemplate, isConst, isVolatile, isVirtual, isExplicit, isPureVirtual,
- visibility, constructorChain, null, isFunctionDefinition, hasFunctionTryBlock, hasVariableArguments );
- }
-
- public IASTMethod createMethod(
- IASTScope scope,
- ITokenDuple nameDuple,
- List parameters,
- IASTAbstractDeclaration returnType,
- IASTExceptionSpecification exception,
- boolean isInline,
- boolean isFriend,
- boolean isStatic,
- int startOffset,
- int nameOffset,
- int nameEndOffset,
- IASTTemplate ownerTemplate,
- boolean isConst,
- boolean isVolatile,
- boolean isVirtual,
- boolean isExplicit,
- boolean isPureVirtual,
- ASTAccessVisibility visibility,
- List constructorChain,
- List references, boolean isFunctionDefinition, boolean hasFunctionTryBlock, boolean hasVariableArguments ) throws ASTSemanticException
- {
- boolean isConstructor = false;
- boolean isDestructor = false;
-
- IContainerSymbol ownerScope = scopeToSymbol( scope );
- IParameterizedSymbol symbol = pst.newParameterizedSymbol( nameDuple.toString(), TypeInfo.t_function );
- setFunctionTypeInfoBits(isInline, isFriend, isStatic, symbol);
- setMethodTypeInfoBits( symbol, isConst, isVolatile, isVirtual, isExplicit );
- symbol.setHasVariableArgs( hasVariableArguments );
-
- if(references == null)
- references = new ArrayList();
-
- if( returnType.getTypeSpecifier() != null )
- setParameter( symbol, returnType, false, references );
- setParameters( symbol, references, parameters.iterator() );
-
- String parentName = ((IASTClassSpecifier)scope).getName();
-
- // check constructor / destructor if no return type
- if ( returnType.getTypeSpecifier() == null ){
- if(parentName.indexOf(DOUBLE_COLON) != -1){
- parentName = parentName.substring(parentName.lastIndexOf(DOUBLE_COLON) + DOUBLE_COLON.length());
- }
- if( parentName.equals(nameDuple.toString()) ){
- isConstructor = true;
- } else if(nameDuple.getFirstToken().getType() == IToken.tCOMPL && parentName.equals(nameDuple.getLastToken().getImage())){
- isDestructor = true;
- }
- }
-
- symbol.setIsForwardDeclaration(!isFunctionDefinition);
- boolean previouslyDeclared = false;
-
- IParameterizedSymbol functionDeclaration = null;
-
- if( isFunctionDefinition || isFriend )
- {
- List functionParameters = new LinkedList();
- // the lookup requires a list of type infos
- // instead of a list of IASTParameterDeclaration
- Iterator p = parameters.iterator();
- while (p.hasNext()){
- ASTParameterDeclaration param = (ASTParameterDeclaration)p.next();
- functionParameters.add(param.getSymbol().getTypeInfo());
- }
-
- List functionReferences = new ArrayList();
-
- if( isFriend )
- {
- functionDeclaration =
- (IParameterizedSymbol) lookupQualifiedName(ownerScope, nameDuple, isConstructor ? TypeInfo.t_constructor : TypeInfo.t_function, functionParameters, functionReferences, false, LookupType.FORFRIENDSHIP );
- } else {
- functionDeclaration =
- (IParameterizedSymbol) lookupQualifiedName(ownerScope, nameDuple.toString(), isConstructor ? TypeInfo.t_constructor : TypeInfo.t_function, functionParameters, 0, functionReferences, false, LookupType.FORDEFINITION );
- }
-
- previouslyDeclared = ( functionDeclaration != null );
-
- if( isFriend )
- {
- if( functionDeclaration != null )
- {
- symbol.setTypeSymbol( functionDeclaration );
- // friend declaration, has no real visibility, set private
- visibility = ASTAccessVisibility.PRIVATE;
- } else
- {
- //for a friend function declaration, if there is no prior declaration, the program is illformed
- throw new ASTSemanticException();
- }
-
- } else if( functionDeclaration != null )
- {
- functionDeclaration.setTypeSymbol( symbol );
- // set the definition visibility = declaration visibility
- ASTMethodReference reference = (ASTMethodReference) functionReferences.iterator().next();
- visibility = ((IASTMethod)reference.getReferencedElement()).getVisiblity();
- }
- }
-
- try
- {
- if( isFriend )
- {
- ((IDerivableContainerSymbol)ownerScope).addFriend( functionDeclaration );
- } else if( !isConstructor )
- ownerScope.addSymbol( symbol );
- else
- {
- symbol.setType( TypeInfo.t_constructor );
- ((IDerivableContainerSymbol)ownerScope).addConstructor( symbol );
- }
- }
- catch (ParserSymbolTableException e)
- {
- throw new ASTSemanticException();
- }
-
- resolveLeftoverConstructorInitializerMembers( symbol, constructorChain );
-
- ASTMethod method = new ASTMethod( symbol, nameEndOffset, parameters, returnType, exception, startOffset, nameOffset, ownerTemplate, references, previouslyDeclared, isConstructor, isDestructor, isPureVirtual, visibility, constructorChain, hasFunctionTryBlock );
- try
- {
- attachSymbolExtension( symbol, method );
- }
- catch (ExtensionException e1)
- {
- throw new ASTSemanticException();
- }
- return method;
- }
- /**
- * @param symbol
- * @param constructorChain
- */
- protected void resolveLeftoverConstructorInitializerMembers(IParameterizedSymbol symbol, List constructorChain)
- {
- if( constructorChain != null )
- {
- Iterator initializers = constructorChain.iterator();
- while( initializers.hasNext())
- {
- IASTConstructorMemberInitializer initializer = (IASTConstructorMemberInitializer)initializers.next();
- if( !initializer.getName().equals( "") &&
- initializer instanceof ASTConstructorMemberInitializer &&
- ((ASTConstructorMemberInitializer)initializer).requiresNameResolution() )
- {
- ASTConstructorMemberInitializer realInitializer = ((ASTConstructorMemberInitializer)initializer);
- try
- {
- IDerivableContainerSymbol container = (IDerivableContainerSymbol) symbol.getContainingSymbol();
- lookupQualifiedName(container, initializer.getName(), TypeInfo.t_any, null, realInitializer.getNameOffset(), realInitializer.getReferences(), false, LookupType.QUALIFIED);
- }
- catch( ASTSemanticException ase )
- {
- }
- }
-
- // TODO try and resolve parameter references now in the expression list
-
- }
- }
-
-
- }
-
- /**
- * @param symbol
- * @param isConst
- * @param isVolatile
- * @param isConstructor
- * @param isDestructor
- * @param isVirtual
- * @param isExplicit
- * @param isPureVirtual
- */
- protected void setMethodTypeInfoBits(IParameterizedSymbol symbol, boolean isConst, boolean isVolatile, boolean isVirtual, boolean isExplicit)
- {
- symbol.getTypeInfo().setBit( isConst, TypeInfo.isConst );
- symbol.getTypeInfo().setBit( isVolatile, TypeInfo.isConst );
- symbol.getTypeInfo().setBit( isVirtual, TypeInfo.isVirtual );
- symbol.getTypeInfo().setBit( isExplicit, TypeInfo.isExplicit );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createVariable(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, boolean, org.eclipse.cdt.core.parser.ast.IASTInitializerClause, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, boolean, boolean, boolean, boolean, int, int)
- */
- public IASTVariable createVariable(
- IASTScope scope,
- String name,
- boolean isAuto,
- IASTInitializerClause initializerClause,
- IASTExpression bitfieldExpression,
- IASTAbstractDeclaration abstractDeclaration,
- boolean isMutable,
- boolean isExtern,
- boolean isRegister,
- boolean isStatic,
- int startingOffset,
- int nameOffset, int nameEndOffset, IASTExpression constructorExpression) throws ASTSemanticException
- {
- List references = new ArrayList();
- IContainerSymbol ownerScope = scopeToSymbol( scope );
-
- // check if this is a scoped field, not a variable
- StringTokenizer tokenizer = new StringTokenizer(name,DOUBLE_COLON);
- int tokencount = tokenizer.countTokens();
- if(tokencount > 1){
- List tokens = new ArrayList();
- String oneToken = "";
- // This is NOT a function. This is a method definition
- while (tokenizer.hasMoreTokens()){
- oneToken = tokenizer.nextToken();
- tokens.add(oneToken);
- }
-
- String fieldName = oneToken;
-
- int numOfTokens = 1;
- int offset = nameOffset;
- IContainerSymbol parentScope = ownerScope;
- Iterator i = tokens.iterator();
- while (i.hasNext() && (numOfTokens++) < tokens.size()){
- String token = (String) i.next();
-
- IContainerSymbol parentSymbol = null;
- try {
- parentSymbol = (IContainerSymbol) parentScope.lookupNestedNameSpecifier( token );
- if( parentSymbol != null )
- addReference( references, createReference( parentSymbol, name, offset ));
- } catch (ParserSymbolTableException e1) {
- //do nothing
- }
-
- if(parentSymbol == null)
- break;
- else {
- parentScope = parentSymbol;
- offset += token.length()+ DOUBLE_COLON.length();
- }
- }
-
- if((parentScope != null) &&
- ( (parentScope.getType() == TypeInfo.t_class)
- || (parentScope.getType() == TypeInfo.t_struct)
- || (parentScope.getType() == TypeInfo.t_union))
- ){
- IASTScope fieldParentScope = (IASTScope)parentScope.getASTExtension().getPrimaryDeclaration();
- return createField(fieldParentScope, fieldName,isAuto, initializerClause, bitfieldExpression, abstractDeclaration, isMutable, isExtern,
- isRegister, isStatic, startingOffset, offset, nameEndOffset, constructorExpression, ASTAccessVisibility.PRIVATE, references);
- }
- }
-
- ISymbol newSymbol = cloneSimpleTypeSymbol(name, abstractDeclaration, references);
- setVariableTypeInfoBits(
- isAuto,
- abstractDeclaration,
- isMutable,
- isExtern,
- isRegister,
- isStatic,
- newSymbol);
- setPointerOperators( newSymbol, abstractDeclaration.getPointerOperators(), abstractDeclaration.getArrayModifiers() );
-
- newSymbol.setIsForwardDeclaration(isStatic);
- boolean previouslyDeclared = false;
- if(!isStatic){
- ISymbol variableDeclaration = (ISymbol) lookupQualifiedName(ownerScope, name, new ArrayList(), false, LookupType.UNQUALIFIED);
-
- if( variableDeclaration != null )
- {
- variableDeclaration.setTypeSymbol( newSymbol );
- previouslyDeclared = true;
- }
- }
- try
- {
- ownerScope.addSymbol( newSymbol );
- }
- catch (ParserSymbolTableException e)
- {
- // TODO Auto-generated catch block
- }
-
- ASTVariable variable = new ASTVariable( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, nameOffset, nameEndOffset, references, constructorExpression, previouslyDeclared );
- if( variable.getInitializerClause() != null )
- {
- variable.getInitializerClause().setOwnerVariableDeclaration(variable);
- addDesignatorReferences( (ASTInitializerClause)variable.getInitializerClause() );
- }
-
- try
- {
- attachSymbolExtension(newSymbol, variable );
- }
- catch (ExtensionException e)
- {
- throw new ASTSemanticException();
- }
- return variable;
- }
-
-
- /**
- * @param clause
- */
- protected void addDesignatorReferences( ASTInitializerClause clause )
- {
- if( clause.getKind() == IASTInitializerClause.Kind.DESIGNATED_INITIALIZER_LIST ||
- clause.getKind() == IASTInitializerClause.Kind.DESIGNATED_ASSIGNMENT_EXPRESSION )
- {
- ISymbol variableSymbol = ((ASTVariable)clause.getOwnerVariableDeclaration()).getSymbol();
- ISymbol currentSymbol = variableSymbol.getTypeSymbol();
-
- TypeInfo currentTypeInfo = new TypeInfo( currentSymbol.getTypeInfo() );
- Iterator designators = clause.getDesignators();
- while( designators.hasNext() )
- {
- IASTDesignator designator = (IASTDesignator)designators.next();
- if( designator.getKind() == IASTDesignator.DesignatorKind.FIELD )
- {
- ISymbol lookup = null;
- if( ! ( currentSymbol instanceof IContainerSymbol ) )
- break;
-
- try
- {
- lookup = ((IContainerSymbol)currentSymbol).lookup( designator.fieldName() );
- }
- catch (ParserSymbolTableException e){
- break;
- }
-
- if( lookup == null || lookup.getContainingSymbol() != currentSymbol )
- break;
-
- try
- {
- clause.getReferences().add( createReference( lookup, designator.fieldName(), designator.fieldOffset() ));
- }
- catch (ASTSemanticException e1)
- {
- // error
- }
-
- // we have found the correct field
- currentTypeInfo = new TypeInfo( lookup.getTypeInfo() );
- if( lookup.getTypeInfo() == null )
- break;
- currentSymbol = lookup.getTypeSymbol();
-
- }
- else if( designator.getKind() == IASTDesignator.DesignatorKind.SUBSCRIPT )
- currentTypeInfo.applyOperatorExpressions( SUBSCRIPT );
- }
-
- }
-
- if( clause.getKind() == IASTInitializerClause.Kind.DESIGNATED_INITIALIZER_LIST ||
- clause.getKind() == IASTInitializerClause.Kind.INITIALIZER_LIST )
- {
- Iterator subInitializers = clause.getInitializers();
- while( subInitializers.hasNext() )
- addDesignatorReferences( (ASTInitializerClause)subInitializers.next() );
- }
- }
-
- protected void setVariableTypeInfoBits(
- boolean isAuto,
- IASTAbstractDeclaration abstractDeclaration,
- boolean isMutable,
- boolean isExtern,
- boolean isRegister,
- boolean isStatic,
- ISymbol newSymbol)
- {
- newSymbol.getTypeInfo().setBit( isMutable, TypeInfo.isMutable );
- newSymbol.getTypeInfo().setBit( isAuto, TypeInfo.isAuto );
- newSymbol.getTypeInfo().setBit( isExtern, TypeInfo.isExtern );
- newSymbol.getTypeInfo().setBit( isRegister, TypeInfo.isRegister );
- newSymbol.getTypeInfo().setBit( isStatic, TypeInfo.isStatic );
- newSymbol.getTypeInfo().setBit( abstractDeclaration.isConst(), TypeInfo.isConst );
- }
-
- protected ISymbol cloneSimpleTypeSymbol(
- String name,
- IASTAbstractDeclaration abstractDeclaration,
- List references) throws ASTSemanticException
- {
- if( abstractDeclaration.getTypeSpecifier() == null )
- throw new ASTSemanticException();
- ISymbol newSymbol = null;
- ISymbol symbolToBeCloned = null;
- if( abstractDeclaration.getTypeSpecifier() instanceof ASTSimpleTypeSpecifier )
- {
- symbolToBeCloned = ((ASTSimpleTypeSpecifier)abstractDeclaration.getTypeSpecifier()).getSymbol();
- references.addAll( ((ASTSimpleTypeSpecifier)abstractDeclaration.getTypeSpecifier()).getReferences() );
- }
- else if( abstractDeclaration.getTypeSpecifier() instanceof ASTClassSpecifier )
- {
- symbolToBeCloned = pst.newSymbol(name, TypeInfo.t_type);
- symbolToBeCloned.setTypeSymbol(((ASTClassSpecifier)abstractDeclaration.getTypeSpecifier()).getSymbol());
- }
- else if( abstractDeclaration.getTypeSpecifier() instanceof ASTElaboratedTypeSpecifier )
- {
- ASTElaboratedTypeSpecifier elab = ((ASTElaboratedTypeSpecifier)abstractDeclaration.getTypeSpecifier());
- symbolToBeCloned = pst.newSymbol(name, TypeInfo.t_type);
- symbolToBeCloned.setTypeSymbol(elab.getSymbol());
- references.add( createReference( elab.getSymbol(), elab.getName(), elab.getNameOffset()) );
- }
- newSymbol = (ISymbol) symbolToBeCloned.clone();
- newSymbol.setName( name );
-
- return newSymbol;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createField(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, boolean, org.eclipse.cdt.core.parser.ast.IASTInitializerClause, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, boolean, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
- */
- public IASTField createField(
- IASTScope scope,
- String name,
- boolean isAuto,
- IASTInitializerClause initializerClause,
- IASTExpression bitfieldExpression,
- IASTAbstractDeclaration abstractDeclaration,
- boolean isMutable,
- boolean isExtern,
- boolean isRegister,
- boolean isStatic,
- int startingOffset,
- int nameOffset,
- int nameEndOffset, IASTExpression constructorExpression, ASTAccessVisibility visibility) throws ASTSemanticException
- {
- return createField(scope, name,isAuto, initializerClause, bitfieldExpression, abstractDeclaration, isMutable, isExtern,
- isRegister, isStatic, startingOffset, nameOffset, nameEndOffset, constructorExpression, visibility, null);
- }
-
- public IASTField createField(
- IASTScope scope,
- String name,
- boolean isAuto,
- IASTInitializerClause initializerClause,
- IASTExpression bitfieldExpression,
- IASTAbstractDeclaration abstractDeclaration,
- boolean isMutable,
- boolean isExtern,
- boolean isRegister,
- boolean isStatic,
- int startingOffset,
- int nameOffset,
- int nameEndOffset,
- IASTExpression constructorExpression,
- ASTAccessVisibility visibility,
- List references) throws ASTSemanticException
- {
- IContainerSymbol ownerScope = scopeToSymbol( scope );
-
- if(references == null)
- references = new ArrayList();
- ISymbol newSymbol = cloneSimpleTypeSymbol(name, abstractDeclaration, references);
- setVariableTypeInfoBits(
- isAuto,
- abstractDeclaration,
- isMutable,
- isExtern,
- isRegister,
- isStatic,
- newSymbol);
- setPointerOperators( newSymbol, abstractDeclaration.getPointerOperators(), abstractDeclaration.getArrayModifiers() );
-
- newSymbol.setIsForwardDeclaration(isStatic);
- boolean previouslyDeclared = false;
- if(!isStatic){
- List fieldReferences = new ArrayList();
- ISymbol fieldDeclaration = lookupQualifiedName(ownerScope, name, fieldReferences, false, LookupType.FORDEFINITION);
-
- if( fieldDeclaration != null )
- {
- previouslyDeclared = true;
- fieldDeclaration.setTypeSymbol( newSymbol );
- // set the definition visibility = declaration visibility
- ASTReference reference = (ASTReference) fieldReferences.iterator().next();
- visibility = ((IASTField)reference.getReferencedElement()).getVisiblity();
- }
- }
-
- try
- {
- ownerScope.addSymbol( newSymbol );
- }
- catch (ParserSymbolTableException e)
- {
- throw new ASTSemanticException();
- }
-
- ASTField field = new ASTField( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, nameOffset, nameEndOffset, references, previouslyDeclared, constructorExpression, visibility );
- try
- {
- attachSymbolExtension(newSymbol, field );
- }
- catch (ExtensionException e)
- {
- throw new ASTSemanticException();
- }
- return field;
-
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateDeclaration(org.eclipse.cdt.core.parser.ast.IASTScope, java.util.List, boolean, int)
- */
- public IASTTemplateDeclaration createTemplateDeclaration(
- IASTScope scope,
- List templateParameters,
- boolean exported,
- int startingOffset)
- {
- // TODO Auto-generated method stub
- return new ASTTemplateDeclaration();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateParameter(org.eclipse.cdt.core.parser.ast.IASTTemplateParameter.ParamKind, java.lang.String, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration, java.util.List)
- */
- public IASTTemplateParameter createTemplateParameter(
- ParamKind kind,
- String identifier,
- String defaultValue,
- IASTParameterDeclaration parameter,
- List parms)
- {
- // TODO Auto-generated method stub
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateInstantiation(org.eclipse.cdt.core.parser.ast.IASTScope, int)
- */
- public IASTTemplateInstantiation createTemplateInstantiation(
- IASTScope scope,
- int startingOffset)
- {
- // TODO Auto-generated method stub
- return new ASTTemplateInstantiation();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateSpecialization(org.eclipse.cdt.core.parser.ast.IASTScope, int)
- */
- public IASTTemplateSpecialization createTemplateSpecialization(
- IASTScope scope,
- int startingOffset)
- {
- // TODO Auto-generated method stub
- return new ASTTemplateSpecialization();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypedef(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, int, int)
- */
- public IASTTypedefDeclaration createTypedef(
- IASTScope scope,
- String name,
- IASTAbstractDeclaration mapping,
- int startingOffset,
- int nameOffset, int nameEndOffset) throws ASTSemanticException
- {
- IContainerSymbol containerSymbol = scopeToSymbol(scope);
- ISymbol newSymbol = pst.newSymbol( name, TypeInfo.t_type);
- newSymbol.getTypeInfo().setBit( true,TypeInfo.isTypedef );
-
-
- List references = new ArrayList();
- if( mapping.getTypeSpecifier() instanceof ASTSimpleTypeSpecifier )
- {
- references.addAll( ((ASTSimpleTypeSpecifier)mapping.getTypeSpecifier()).getReferences() );
- }
-
- try
- {
- containerSymbol.addSymbol( newSymbol );
- }
- catch (ParserSymbolTableException e)
- {
- throw new ASTSemanticException();
- }
- ASTTypedef d = new ASTTypedef( newSymbol, mapping, startingOffset, nameOffset, nameEndOffset, references );
- try
- {
- attachSymbolExtension(newSymbol, d );
- }
- catch (ExtensionException e1)
- {
- throw new ASTSemanticException();
- }
- return d;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypeSpecDeclaration(org.eclipse.cdt.core.parser.ast.IASTScope, org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier, org.eclipse.cdt.core.parser.ast.IASTTemplate, int, int)
- */
- public IASTAbstractTypeSpecifierDeclaration createTypeSpecDeclaration(
- IASTScope scope,
- IASTTypeSpecifier typeSpecifier,
- IASTTemplate template,
- int startingOffset,
- int endingOffset)
- {
- return new ASTAbstractTypeSpecifierDeclaration( scopeToSymbol(scope), typeSpecifier, template, startingOffset, endingOffset);
- }
-
-
- public IASTElaboratedTypeSpecifier createElaboratedTypeSpecifier(IASTScope scope, ASTClassKind kind, ITokenDuple name, int startingOffset, int endOffset, boolean isForewardDecl, boolean isFriend) throws ASTSemanticException
- {
- IContainerSymbol currentScopeSymbol = scopeToSymbol(scope);
- TypeInfo.eType pstType = classKindToTypeInfo(kind);
- List references = new ArrayList();
- IToken lastToken = name.getLastToken();
- if( name.length() != 1 ) // qualified name
- {
- ITokenDuple containerSymbolName =
- name.getSubrange( 0, name.length() - 3 ); // -1 for index, -2 for last hop of qualified name
- currentScopeSymbol = (IContainerSymbol)lookupQualifiedName( currentScopeSymbol,
- containerSymbolName, references, true);
- if( currentScopeSymbol == null )
- throw new ASTSemanticException();
- }
-
- ISymbol checkSymbol = null;
- try
- {
- if( isFriend ){
- if( !(currentScopeSymbol instanceof IDerivableContainerSymbol) ){
- throw new ASTSemanticException();
- }
- checkSymbol = ((IDerivableContainerSymbol)currentScopeSymbol).lookupForFriendship( lastToken.getImage() );
- } else {
- checkSymbol = currentScopeSymbol.elaboratedLookup( pstType, lastToken.getImage());
- }
- }
- catch (ParserSymbolTableException e)
- {
- throw new ASTSemanticException();
- }
-
-
- if( isForewardDecl )
- {
- if( checkSymbol == null )
- {
- checkSymbol = pst.newDerivableContainerSymbol( lastToken.getImage(), pstType );
- checkSymbol.setIsForwardDeclaration( true );
- try
- {
- if( isFriend ){
- ((IDerivableContainerSymbol)currentScopeSymbol).addFriend( checkSymbol );
- } else {
- currentScopeSymbol.addSymbol( checkSymbol );
- }
- }
- catch (ParserSymbolTableException e1)
- {
- throw new ASTSemanticException();
- }
-
- ASTElaboratedTypeSpecifier elab =
- new ASTElaboratedTypeSpecifier( checkSymbol, kind, startingOffset, name.getFirstToken().getOffset(), name.getLastToken().getEndOffset(), endOffset, references, isForewardDecl );
-
- try
- {
- attachSymbolExtension( checkSymbol, elab );
- }
- catch (ExtensionException e2)
- {
- throw new ASTSemanticException();
- }
- } else if( isFriend ){
- try {
- ((IDerivableContainerSymbol)currentScopeSymbol).addFriend( checkSymbol );
- } catch (ParserSymbolTableException e1) {
- throw new ASTSemanticException();
- }
-
- }
- }
-
- if( checkSymbol.getASTExtension().getPrimaryDeclaration() instanceof IASTClassSpecifier ||
- checkSymbol.getASTExtension().getPrimaryDeclaration() instanceof IASTEnumerationSpecifier
- )
- {
- ASTElaboratedTypeSpecifier elab = new ASTElaboratedTypeSpecifier( checkSymbol, kind, startingOffset, name.getFirstToken().getOffset(), name.getLastToken().getEndOffset(), endOffset, references, isForewardDecl );
- try
- {
- attachSymbolExtension( checkSymbol, elab );
- }
- catch (ExtensionException e2)
- {
- throw new ASTSemanticException();
- }
- return elab;
- }
-
- if( checkSymbol.getASTExtension().getPrimaryDeclaration() instanceof IASTElaboratedTypeSpecifier )
- return (IASTElaboratedTypeSpecifier)checkSymbol.getASTExtension().getPrimaryDeclaration();
-
-
- throw new ASTSemanticException();
- }
-
- protected ParserSymbolTable pst;
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNamespaceAlias(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, org.eclipse.cdt.core.parser.ITokenDuple, int, int, int)
- */
- public IASTNamespaceAlias createNamespaceAlias(IASTScope scope, String identifier, ITokenDuple alias, int startingOffset, int nameOffset, int nameEndOffset, int endOffset) throws ASTSemanticException
- {
- IContainerSymbol startingSymbol = scopeToSymbol(scope);
- List references = new ArrayList();
-
- ISymbol namespaceSymbol = lookupQualifiedName( startingSymbol, alias, references, true );
-
- if( namespaceSymbol.getType() != TypeInfo.t_namespace )
- throw new ASTSemanticException();
-
- ISymbol newSymbol = pst.newContainerSymbol( identifier, TypeInfo.t_namespace );
- newSymbol.setTypeSymbol( namespaceSymbol );
-
- try
- {
- startingSymbol.addSymbol( newSymbol );
- }
- catch (ParserSymbolTableException e)
- {
- throw new ASTSemanticException();
- }
-
- ASTNamespaceAlias astAlias = new ASTNamespaceAlias(
- newSymbol, alias.toString(), (IASTNamespaceDefinition)namespaceSymbol.getASTExtension().getPrimaryDeclaration(),
- startingOffset, nameOffset, nameEndOffset, endOffset, references );
- try
- {
- attachSymbolExtension( newSymbol, astAlias );
- }
- catch (ExtensionException e1)
- {
- throw new ASTSemanticException();
- }
- return astAlias;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNewCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope)
- */
- public IASTCodeScope createNewCodeBlock(IASTScope scope) {
- IContainerSymbol symbol = scopeToSymbol( scope );
-
- IContainerSymbol newScope = pst.newContainerSymbol("", TypeInfo.t_block);
- newScope.setContainingSymbol(symbol);
-
- ASTCodeScope codeScope = new ASTCodeScope( newScope );
- try
- {
- attachSymbolExtension( newScope, codeScope );
- }
- catch (ExtensionException e)
- {
- }
- return codeScope;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#queryIsTypeName(org.eclipse.cdt.core.parser.ITokenDuple)
- */
- public boolean queryIsTypeName(IASTScope scope, ITokenDuple nameInQuestion) {
- ISymbol lookupSymbol = null;
- try {
- lookupSymbol =
- lookupQualifiedName(
- scopeToSymbol(scope),
- nameInQuestion,
- new ArrayList(),
- false);
- } catch (ASTSemanticException e) {
- // won't get thrown
- }
- if( lookupSymbol == null ) return false;
- if( lookupSymbol.isType( TypeInfo.t_type, TypeInfo.t_enumeration ) ) return true;
- return false;
- }
-
- public IASTParameterDeclaration createParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int nameOffset, int nameEndOffset, int endingOffset)
- {
- return new ASTParameterDeclaration( null, isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp, parameterName, initializerClause, startingOffset, endingOffset, nameOffset, nameEndOffset );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypeId(org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type, org.eclipse.cdt.core.parser.ITokenDuple, java.util.List, java.util.List)
- */
- public IASTTypeId createTypeId(IASTScope scope, Type kind, boolean isConst, boolean isVolatile, boolean isShort,
- boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, ITokenDuple name, List pointerOps, List arrayMods) throws ASTSemanticException
- {
- ASTTypeId result =
- new ASTTypeId( kind, name, pointerOps, arrayMods, "", //TODO
- isConst, isVolatile, isUnsigned, isSigned, isShort, isLong, isTypename );
- result.setTypeSymbol( createSymbolForTypeId( scope, result ) );
- return result;
- }
-
- /**
- * @param id
- * @return
- */
- public static TypeInfo.eType getTypeKind(IASTTypeId id)
- {
- IASTSimpleTypeSpecifier.Type type = id.getKind();
- if( type == IASTSimpleTypeSpecifier.Type.BOOL )
- return TypeInfo.t_bool;
- else if( type == IASTSimpleTypeSpecifier.Type.CHAR )
- return TypeInfo.t_char;
- else if( type == IASTSimpleTypeSpecifier.Type.DOUBLE )
- return TypeInfo.t_double;
- else if( type == IASTSimpleTypeSpecifier.Type.FLOAT )
- return TypeInfo.t_float;
- else if( type == IASTSimpleTypeSpecifier.Type.INT )
- return TypeInfo.t_int;
- else if( type == IASTSimpleTypeSpecifier.Type.VOID )
- return TypeInfo.t_void;
- else if( id.isShort() || id.isLong() || id.isUnsigned() || id.isSigned() )
- return TypeInfo.t_int;
- else
- return TypeInfo.t_type;
- }
-
- protected ISymbol createSymbolForTypeId( IASTScope scope, IASTTypeId id ) throws ASTSemanticException
- {
- if( id == null ) return null;
-
- ASTTypeId typeId = (ASTTypeId)id;
- ISymbol result = pst.newSymbol( "", CompleteParseASTFactory.getTypeKind(id));
-
- result.getTypeInfo().setBit( id.isConst(), TypeInfo.isConst );
- result.getTypeInfo().setBit( id.isVolatile(), TypeInfo.isVolatile );
-
- result.getTypeInfo().setBit( id.isShort(), TypeInfo.isShort);
- result.getTypeInfo().setBit( id.isLong(), TypeInfo.isLong);
- result.getTypeInfo().setBit( id.isUnsigned(), TypeInfo.isUnsigned);
-
- List refs = new ArrayList();
- if( result.getType() == TypeInfo.t_type )
- {
- ISymbol typeSymbol = lookupQualifiedName( scopeToSymbol(scope), typeId.getTokenDuple(), refs, true );
- if( typeSymbol.getType() == TypeInfo.t_type )
- throw new ASTSemanticException();
- result.setTypeSymbol( typeSymbol );
- typeId.addReferences( refs );
- }
-
- setPointerOperators( result, id.getPointerOperators(), id.getArrayModifiers() );
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#signalEndOfClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier)
- */
- public void signalEndOfClassSpecifier(IASTClassSpecifier astClassSpecifier)
- {
- if( astClassSpecifier == null ) return;
- try
- {
- ((IDerivableContainerSymbol)((ASTClassSpecifier)astClassSpecifier).getSymbol()).addCopyConstructor();
- }
- catch (ParserSymbolTableException e)
- {
- // do nothing, this is best effort
- }
- }
-
- public IASTInitializerClause createInitializerClause(IASTScope scope, IASTInitializerClause.Kind kind, IASTExpression assignmentExpression, List initializerClauses, List designators)
- {
- return new ASTInitializerClause( kind, assignmentExpression, initializerClauses, designators );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#getCompletionContext(org.eclipse.cdt.core.parser.ast.IASTExpression.Kind, org.eclipse.cdt.core.parser.ast.IASTExpression)
- */
- public IASTNode getCompletionContext(Kind kind, IASTExpression expression) {
- IContainerSymbol context = null;
- try {
- context = getSearchScope( kind, expression, null );
- } catch (ASTSemanticException e) {
- return null;
- }
-
- if( context != null ){
- ISymbolASTExtension extension = context.getASTExtension();
- return ( extension != null ) ? extension.getPrimaryDeclaration() : null;
- }
-
- return null;
-
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ExpressionResult.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ExpressionResult.java
deleted file mode 100644
index 90af18f10e7..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ExpressionResult.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-
-import org.eclipse.cdt.internal.core.parser.pst.TypeInfo;
-
-/**
- * @author hamer
- *
- */
-public class ExpressionResult {
-
-
- private TypeInfo result;
- private boolean failedToDereference = false;
-
- ExpressionResult(){
- result = new TypeInfo();
- }
- ExpressionResult(TypeInfo result){
- this.result = result;
- }
-/**
- * @return
- */
-public TypeInfo getResult() {
- return result;
-}
-
-/**
- * @param info
- */
-public void setResult(TypeInfo info) {
- result = info;
-}
-
-/**
- * @return
- */
-public boolean isFailedToDereference() {
- return failedToDereference;
-}
-
-/**
- * @param b
- */
-public void setFailedToDereference(boolean b) {
- failedToDereference = b;
-}
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ExpressionResultList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ExpressionResultList.java
deleted file mode 100644
index 1531f0cac41..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ExpressionResultList.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**********************************************************************
- * 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.ast.complete;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.cdt.internal.core.parser.pst.TypeInfo;
-
-/**
- * @author hamer
- *
- */
-public class ExpressionResultList extends ExpressionResult {
- private List resultList = new ArrayList();
- ExpressionResultList(){
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.complete.ExpressionResult#getResult()
- */
- public TypeInfo getResult() {
- // TODO Auto-generated method stub
- return (TypeInfo)resultList.get(0);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.complete.ExpressionResult#setResult(org.eclipse.cdt.internal.core.parser.pst.TypeInfo)
- */
- public void setResult(TypeInfo info) {
- // TODO Auto-generated method stub
- resultList.add(info);
- }
-
- /**
- * @return
- */
- public List getResultList() {
- return resultList;
- }
-
- /**
- * @param list
- */
- public void setResultList(List list) {
- resultList = list;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTASMDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTASMDefinition.java
deleted file mode 100644
index cfebd6dc257..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTASMDefinition.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.internal.core.parser.ast.Offsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTASMDefinition
- extends ASTDeclaration
- implements IASTASMDefinition {
-
- private Offsets offsets = new Offsets();
- private final String assembly;
- /**
- * @param scope
- */
- public ASTASMDefinition(IASTScope scope, String assembly) {
- super(scope);
- this.assembly = assembly;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTASMDefinition#getBody()
- */
- public String getBody() {
- return assembly;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o) {
- offsets.setStartingOffset(o);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o) {
- offsets.setEndingOffset( o );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset() {
- return offsets.getStartingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset() {
- return offsets.getEndingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptASMDefinition(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTAbstractTypeSpecifierDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTAbstractTypeSpecifierDeclaration.java
deleted file mode 100644
index c6560c635e0..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTAbstractTypeSpecifierDeclaration.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTTemplate;
-import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
-import org.eclipse.cdt.internal.core.parser.ast.Offsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTAbstractTypeSpecifierDeclaration
- extends ASTDeclaration
- implements IASTAbstractTypeSpecifierDeclaration
-{
- private final IASTTemplate ownerTemplate;
- private final IASTTypeSpecifier typeSpecifier;
- /**
- * @param scope
- * @param typeSpecifier
- */
- public ASTAbstractTypeSpecifierDeclaration(IASTScope scope, IASTTypeSpecifier typeSpecifier, IASTTemplate ownerTemplate, int startingOffset, int endingOffset)
- {
- super( ownerTemplate != null ? null : scope );
- this.typeSpecifier = typeSpecifier;
- this.ownerTemplate = ownerTemplate;
- if( ownerTemplate != null )
- ownerTemplate.setOwnedDeclaration( this );
- setStartingOffset(startingOffset);
- setEndingOffset(endingOffset);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getTypeSpecifier()
- */
- public IASTTypeSpecifier getTypeSpecifier()
- {
- return typeSpecifier;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplatedDeclaration#getOwnerTemplateDeclaration()
- */
- public IASTTemplate getOwnerTemplateDeclaration()
- {
- return ownerTemplate;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
- private Offsets offsets = new Offsets();
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptAbstractTypeSpecDeclaration(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTBaseSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTBaseSpecifier.java
deleted file mode 100644
index ea16a768b25..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTBaseSpecifier.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTReference;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTBaseSpecifier implements IASTBaseSpecifier {
-
- private final int offset;
- private final ASTAccessVisibility visibility;
- private final boolean isVirtual;
- private final String parentClassName;
-
- public ASTBaseSpecifier( String className, boolean v, ASTAccessVisibility a, int o )
- {
- parentClassName = className;
- isVirtual = v;
- visibility = a;
- offset = o;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#getAccess()
- */
- public ASTAccessVisibility getAccess() {
- return visibility;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#isVirtual()
- */
- public boolean isVirtual() {
- return isVirtual;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#getParent()
- */
- public String getParentClassName() {
- return parentClassName;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#getParentClassSpecifier()
- */
- public IASTClassSpecifier getParentClassSpecifier() throws ASTNotImplementedException
- {
- throw new ASTNotImplementedException();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#getNameOffset()
- */
- public int getNameOffset()
- {
- return offset;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTReferenceStore#addReference(org.eclipse.cdt.core.parser.ast.IASTReference)
- */
- public void addReference(IASTReference reference) throws ASTNotImplementedException
- {
- throw new ASTNotImplementedException();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTReferenceStore#processReferences()
- */
- public void processReferences(ISourceElementRequestor requestor)throws ASTNotImplementedException
- {
- throw new ASTNotImplementedException();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- // no references to process
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTClassSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTClassSpecifier.java
deleted file mode 100644
index 0be206ae74f..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTClassSpecifier.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.core.parser.ast.ASTClassKind;
-import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-/**
- * @author jcamelon
- *
- */
-public class ASTClassSpecifier extends ASTScopedTypeSpecifier implements IASTQClassSpecifier, IASTQScope
-{
-
- private final IASTScope scope;
- public ASTClassSpecifier(
- IASTScope scope,
- String name,
- ASTClassKind kind,
- ClassNameType type,
- int startingOffset,
- int nameOffset,
- int nameEndOffset,
- ASTAccessVisibility access)
- {
- super( scope, name );
- this.scope = scope;
- qualifiedNameElement = new ASTQualifiedNamedElement( scope, name );
- classNameType = type;
- classKind = kind;
- offsets.setStartingOffset(startingOffset);
- offsets.setNameOffset(nameOffset);
- offsets.setNameEndOffset(nameEndOffset);
- this.access = access;
- this.name = name;
- }
-
- private final ASTQualifiedNamedElement qualifiedNameElement;
- private final String name;
- private List declarations = new ArrayList();
- private List baseClauses = new ArrayList();
- private ASTAccessVisibility access;
- private NamedOffsets offsets = new NamedOffsets();
- private final ClassNameType classNameType;
- private final ASTClassKind classKind;
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getClassNameType()
- */
- public ClassNameType getClassNameType()
- {
- return classNameType;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getClassKind()
- */
- public ASTClassKind getClassKind()
- {
- return classKind;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getBaseClauses()
- */
- public Iterator getBaseClauses()
- {
- return baseClauses.iterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getCurrentVisiblity()
- */
- public ASTAccessVisibility getCurrentVisibilityMode()
- {
- return access;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
- */
- public Iterator getDeclarations()
- {
- return declarations.iterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
- */
- public String getName()
- {
- return name;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
- */
- public int getNameOffset()
- {
- return offsets.getNameOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- offsets.setNameOffset(o);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.quick.IASTQScope#addDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
- */
- public void addDeclaration(IASTDeclaration declaration)
- {
- declarations.add(declaration);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.quick.IASTQClassSpecifier#addBaseClass(org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier)
- */
- public void addBaseClass(IASTBaseSpecifier baseSpecifier)
- {
- baseClauses.add(baseSpecifier);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#setCurrentVisibility(org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
- */
- public void setCurrentVisibility(ASTAccessVisibility visibility)
- {
- this.access = visibility;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.enterClassSpecifier(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.exitClassSpecifier(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTCompilationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTCompilationUnit.java
deleted file mode 100644
index 264c0a451b9..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTCompilationUnit.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTCompilationUnit extends ASTNode implements IASTCompilationUnit, IASTQScope {
-
- private List declarations = new ArrayList();
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
- */
- public Iterator getDeclarations() {
- return declarations.iterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.quick.IASTQScope#addDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
- */
- public void addDeclaration(IASTDeclaration declaration) {
- declarations.add( declaration );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.enterCompilationUnit(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.exitCompilationUnit(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTConstructorMemberInitializer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTConstructorMemberInitializer.java
deleted file mode 100644
index 3ab19d0c67d..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTConstructorMemberInitializer.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTConstructorMemberInitializer
- implements IASTConstructorMemberInitializer
-{
- /**
- * @param string
- * @param expressionList
- */
- public ASTConstructorMemberInitializer(String name, IASTExpression expressionList)
- {
- this.name = name;
- this.expressionList = expressionList;
- }
-
- private final IASTExpression expressionList;
- private final String name;
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer#getExpressionList()
- */
- public IASTExpression getExpressionList()
- {
- return expressionList;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer#getName()
- */
- public String getName()
- {
- return name;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTDeclaration.java
deleted file mode 100644
index d4588e6b461..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTDeclaration.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-
-/**
- * @author jcamelon
- *
- */
-public abstract class ASTDeclaration extends ASTNode implements IASTDeclaration {
-
- private final IASTScope scope;
- public ASTDeclaration( IASTScope scope )
- {
- this.scope = scope;
- if( scope != null && scope instanceof IASTQScope )
- ((IASTQScope)scope).addDeclaration(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTDeclaration#getOwnerScope()
- */
- public IASTScope getOwnerScope() {
- return scope;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTElaboratedTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTElaboratedTypeSpecifier.java
deleted file mode 100644
index 9eb8e6cec67..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTElaboratedTypeSpecifier.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTClassKind;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTElaboratedTypeSpecifier extends ASTNode implements IASTElaboratedTypeSpecifier
-{
-
- private NamedOffsets offsets = new NamedOffsets();
- private final String typeName;
- private final ASTClassKind classKind;
- private final ASTQualifiedNamedElement qualifiedName;
- /**
- * @param elaboratedClassKind
- * @param typeName
- * @param startingOffset
- * @param endOffset
- */
- public ASTElaboratedTypeSpecifier(IASTScope scope, ASTClassKind elaboratedClassKind, String typeName, int startingOffset, int nameOffset, int nameEndOffset, int endOffset)
- {
- classKind = elaboratedClassKind;
- this.typeName = typeName;
- setStartingOffset( startingOffset );
- setNameOffset( nameOffset );
- setNameEndOffset( nameEndOffset );
- setEndingOffset( endOffset );
- qualifiedName = new ASTQualifiedNamedElement( scope, typeName );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier#getTypeName()
- */
- public String getName()
- {
- return typeName;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier#getClassKind()
- */
- public ASTClassKind getClassKind()
- {
- return classKind;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier#isResolved()
- */
- public boolean isResolved() throws ASTNotImplementedException
- {
- throw new ASTNotImplementedException();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
- */
- public String[] getFullyQualifiedName()
- {
- return qualifiedName.getFullyQualifiedName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptElaboratedForewardDeclaration(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
- */
- public int getNameOffset() {
- return offsets.getNameOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o) {
- offsets.setNameOffset(o);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerationSpecifier.java
deleted file mode 100644
index 8fad20630aa..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerationSpecifier.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
-import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTEnumerationSpecifier extends ASTScopedTypeSpecifier
- implements IASTEnumerationSpecifier, IASTOffsetableNamedElement
-{
- private final String name;
- private NamedOffsets offsets = new NamedOffsets();
-
- /**
- * @param name
- * @param startingOffset
- */
- public ASTEnumerationSpecifier(IASTScope scope, String name, int startingOffset, int nameOffset, int nameEndOffset )
- {
- super( scope, name );
- this.name = name;
- offsets.setNameOffset( nameOffset );
- offsets.setStartingOffset( startingOffset);
- setNameEndOffset(nameEndOffset);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
- */
- public String getName()
- {
- return name;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
- */
- public int getNameOffset()
- {
- return offsets.getNameOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- offsets.setNameOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
-
- private List enumerators = new ArrayList();
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier#getEnumerators()
- */
- public Iterator getEnumerators()
- {
- return Collections.unmodifiableList( enumerators ).iterator();
- }
-
- public void addEnumerator(IASTEnumerator enumerator)
- {
- enumerators.add(enumerator);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptEnumerationSpecifier(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerator.java
deleted file mode 100644
index 776ec65bb53..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerator.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTEnumerator
- implements IASTEnumerator, IASTOffsetableNamedElement
-{
- private final IASTExpression initialValue;
- private final String name;
- private final IASTEnumerationSpecifier enumeration;
- private final NamedOffsets offsets = new NamedOffsets();
-
- /**
- * @param enumeration
- * @param string
- * @param startingOffset
- * @param endingOffset
- */
- public ASTEnumerator(IASTEnumerationSpecifier enumeration, String string, int startingOffset, int nameOffset, int nameEndOffset, int endingOffset, IASTExpression initialValue)
- {
- this.enumeration = enumeration;
- name = string;
- offsets.setStartingOffset( startingOffset );
- offsets.setNameOffset( nameOffset );
- offsets.setNameEndOffset( nameEndOffset );
- offsets.setEndingOffset( endingOffset );
- this.initialValue = initialValue;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
- */
- public String getName()
- {
- return name;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
- */
- public int getNameOffset()
- {
- return offsets.getNameOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- offsets.setNameOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTEnumerator#getOwnerEnumerationSpecifier()
- */
- public IASTEnumerationSpecifier getOwnerEnumerationSpecifier()
- {
- return enumeration;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTEnumerator#getInitialValue()
- */
- public IASTExpression getInitialValue()
- {
- return initialValue;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTExceptionSpecification.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTExceptionSpecification.java
deleted file mode 100644
index d7930d9203c..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTExceptionSpecification.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
-import org.eclipse.cdt.core.parser.ast.IASTTypeId;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTExceptionSpecification implements IASTExceptionSpecification
-{
- private final List typeIds;
- /**
- * @param typeIds
- */
- public ASTExceptionSpecification(List typeIds)
- {
- Iterator i = typeIds.iterator();
- this.typeIds = new ArrayList();
- while( i.hasNext() )
- this.typeIds.add( ((IASTTypeId)i.next()).getTypeOrClassName());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification#getTypeIds()
- */
- public Iterator getTypeIds()
- {
- return typeIds.iterator();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTExpression.java
deleted file mode 100644
index 018d72bda84..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTExpression.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Created on Jun 26, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.cdt.internal.core.parser.ast.quick;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.ExpressionEvaluationException;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.core.parser.ast.IASTTypeId;
-
-
-
-/**
- * @author jcamelon
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class ASTExpression implements IASTExpression {
-
- private final Kind kind;
- private final IASTExpression lhs, rhs, third;
- private final IASTTypeId typeId;
- private final String literal, idExpression;
- private final IASTNewExpressionDescriptor newDescriptor;
-
- /**
- * @param kind
- * @param lhs
- * @param rhs
- * @param id
- * @param typeId
- * @param literal
- */
- public ASTExpression(Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression third, IASTTypeId typeId, String idExpression, String literal, IASTNewExpressionDescriptor newDescriptor) {
- this.kind = kind;
- this.lhs =lhs;
- this.rhs = rhs;
- this.third = third;
- this.typeId = typeId;
- this.literal = literal;
- this.newDescriptor = newDescriptor;
- this.idExpression = idExpression;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getExpressionKind()
- */
- public Kind getExpressionKind() {
- return kind;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getLHSExpression()
- */
- public IASTExpression getLHSExpression() {
- return lhs;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getRHSExpression()
- */
- public IASTExpression getRHSExpression() {
- return rhs;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getLiteralString()
- */
- public String getLiteralString() {
- return literal;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getTypeId()
- */
- public IASTTypeId getTypeId() {
- return typeId;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getNewExpressionDescriptor()
- */
- public IASTNewExpressionDescriptor getNewExpressionDescriptor() {
- return newDescriptor;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getThirdExpression()
- */
- public IASTExpression getThirdExpression() {
- return third;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#evaluateExpression()
- */
- public int evaluateExpression() throws ExpressionEvaluationException {
- // primary expressions
- if( getExpressionKind() == IASTExpression.Kind.PRIMARY_INTEGER_LITERAL )
- {
- try
- {
- if( getLiteralString().startsWith( "0x") || getLiteralString().startsWith( "0x") )
- {
- return Integer.parseInt( getLiteralString().substring(2), 16 );
- }
- if( getLiteralString().startsWith( "0") && getLiteralString().length() > 1 )
- return Integer.parseInt( getLiteralString().substring(1), 8 );
- return Integer.parseInt( getLiteralString() );
- }
- catch( NumberFormatException nfe )
- {
- throw new ExpressionEvaluationException();
- }
- }
- if( getExpressionKind() == IASTExpression.Kind.PRIMARY_BRACKETED_EXPRESSION )
- return getLHSExpression().evaluateExpression();
- // unary not
- if( getExpressionKind() == IASTExpression.Kind.UNARY_NOT_CASTEXPRESSION )
- return ( ( getLHSExpression().evaluateExpression() == 0 ) ? 1 : 0 );
-
- // multiplicative expressions
- if( getExpressionKind() == IASTExpression.Kind.MULTIPLICATIVE_MULTIPLY )
- return ( getLHSExpression().evaluateExpression() * getRHSExpression().evaluateExpression()) ;
- if( getExpressionKind() == IASTExpression.Kind.MULTIPLICATIVE_DIVIDE )
- return ( getLHSExpression().evaluateExpression() / getRHSExpression().evaluateExpression()) ;
- if( getExpressionKind() == IASTExpression.Kind.MULTIPLICATIVE_MODULUS )
- return ( getLHSExpression().evaluateExpression() % getRHSExpression().evaluateExpression()) ;
- // additives
- if( getExpressionKind() == IASTExpression.Kind.ADDITIVE_PLUS )
- return ( getLHSExpression().evaluateExpression() + getRHSExpression().evaluateExpression()) ;
- if( getExpressionKind() == IASTExpression.Kind.ADDITIVE_MINUS )
- return ( getLHSExpression().evaluateExpression() - getRHSExpression().evaluateExpression()) ;
- // shift expression
- if( getExpressionKind() == IASTExpression.Kind.SHIFT_LEFT )
- return ( getLHSExpression().evaluateExpression() << getRHSExpression().evaluateExpression()) ;
- if( getExpressionKind() == IASTExpression.Kind.SHIFT_RIGHT )
- return ( getLHSExpression().evaluateExpression() >> getRHSExpression().evaluateExpression()) ;
- // relational
- if( getExpressionKind() == IASTExpression.Kind.RELATIONAL_LESSTHAN )
- return ( getLHSExpression().evaluateExpression() < getRHSExpression().evaluateExpression() ? 1 : 0 ) ;
- if( getExpressionKind() == IASTExpression.Kind.RELATIONAL_GREATERTHAN )
- return ( getLHSExpression().evaluateExpression() > getRHSExpression().evaluateExpression() ? 1 : 0 ) ;
- if( getExpressionKind() == IASTExpression.Kind.RELATIONAL_LESSTHANEQUALTO )
- return ( getLHSExpression().evaluateExpression() <= getRHSExpression().evaluateExpression() ? 1 : 0 ) ;
- if( getExpressionKind() == IASTExpression.Kind.RELATIONAL_GREATERTHANEQUALTO )
- return ( getLHSExpression().evaluateExpression() >= getRHSExpression().evaluateExpression() ? 1 : 0 ) ;
- // equality
- if( getExpressionKind() == IASTExpression.Kind.EQUALITY_EQUALS )
- return ( getLHSExpression().evaluateExpression() == getRHSExpression().evaluateExpression() ? 1 : 0 ) ;
- if( getExpressionKind() == IASTExpression.Kind.EQUALITY_NOTEQUALS )
- return ( getLHSExpression().evaluateExpression() != getRHSExpression().evaluateExpression() ? 1 : 0 ) ;
- // and
- if( getExpressionKind() == IASTExpression.Kind.ANDEXPRESSION )
- return ( getLHSExpression().evaluateExpression() & getRHSExpression().evaluateExpression() ) ;
- // xor
- if( getExpressionKind() == IASTExpression.Kind.EXCLUSIVEOREXPRESSION )
- return ( getLHSExpression().evaluateExpression() ^ getRHSExpression().evaluateExpression() ) ;
- // or
- if( getExpressionKind() == IASTExpression.Kind.INCLUSIVEOREXPRESSION )
- return ( getLHSExpression().evaluateExpression() | getRHSExpression().evaluateExpression() ) ;
- // logical and
- if( getExpressionKind() == IASTExpression.Kind.LOGICALANDEXPRESSION )
- return( ( getLHSExpression().evaluateExpression() != 0 ) && ( getRHSExpression().evaluateExpression() != 0 ) ) ? 1 : 0 ;
- // logical or
- if( getExpressionKind() == IASTExpression.Kind.LOGICALOREXPRESSION )
- return( ( getLHSExpression().evaluateExpression() != 0 ) || ( getRHSExpression().evaluateExpression() != 0 ) ) ? 1 : 0 ;
-
- throw new ExpressionEvaluationException();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getIdExpression()
- */
- public String getIdExpression()
- {
- return idExpression;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#reconcileReferences()
- */
- public void reconcileReferences() throws ASTNotImplementedException
- {
- throw new ASTNotImplementedException();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression#purgeReferences()
- */
- public void purgeReferences() throws ASTNotImplementedException
- {
- throw new ASTNotImplementedException();
- }
-
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTField.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTField.java
deleted file mode 100644
index f2112cda9cc..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTField.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.core.parser.ast.IASTField;
-import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTField extends ASTVariable implements IASTField
-{
- private final ASTAccessVisibility visibility;
-
- /**
- * @param scope
- * @param name
- * @param isAuto
- * @param initializerClause
- * @param bitfieldExpression
- * @param abstractDeclaration
- * @param isMutable
- * @param isExtern
- * @param isRegister
- * @param isStatic
- */
- public ASTField(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, int nameEndOffset, IASTExpression constructorExpression, ASTAccessVisibility visibility)
- {
- super(
- scope,
- name,
- isAuto,
- initializerClause,
- bitfieldExpression,
- abstractDeclaration,
- isMutable,
- isExtern,
- isRegister,
- isStatic, startingOffset, nameOffset, nameEndOffset, constructorExpression );
- this.visibility = visibility;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMember#getVisiblity()
- */
- public ASTAccessVisibility getVisiblity()
- {
- return visibility;
- }
-
- public void acceptElement( ISourceElementRequestor requestor )
- {
- try
- {
- requestor.acceptField( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
- public void enterScope( ISourceElementRequestor requestor )
- {
- }
-
- public void exitScope( ISourceElementRequestor requestor )
- {
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java
deleted file mode 100644
index d96d63e4545..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTCodeScope;
-import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
-import org.eclipse.cdt.core.parser.ast.IASTFunction;
-import org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTTemplate;
-import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTFunction extends ASTDeclaration implements IASTFunction
-{
- /**
- * @param scope
- */
- public ASTFunction(IASTScope scope, String name, int nameEndOffset, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception,
- boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate, boolean hasFunctionTryBlock, boolean hasVarArgs )
- {
- super(ownerTemplate != null ? null : scope );
- this.name = name;
- this.parms = parameters;
- this.returnType = returnType;
- this.exceptionSpec = exception;
- this.isInline = isInline;
- this.isFriend = isFriend;
- this.isStatic = isStatic;
- this.ownerTemplateDeclaration = ownerTemplate;
- if( ownerTemplate != null )
- ownerTemplate.setOwnedDeclaration( this );
- offsets.setStartingOffset( startOffset );
- offsets.setNameOffset( nameOffset );
- qualifiedName = new ASTQualifiedNamedElement( scope, name );
- setNameEndOffset(nameEndOffset);
- this.hasFunctionTryBlock = hasFunctionTryBlock;
- this.varArgs = hasVarArgs;
- }
-
- private boolean previouslyDeclared;
- private boolean hasFunctionBody = false;
- private final IASTQualifiedNameElement qualifiedName;
- private final IASTTemplate ownerTemplateDeclaration;
- private NamedOffsets offsets = new NamedOffsets();
- private List declarations = new ArrayList();
- private final IASTExceptionSpecification exceptionSpec;
- private final String name;
- private final List parms;
- private final IASTAbstractDeclaration returnType;
- private final boolean isInline, isFriend, isStatic;
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#isInline()
- */
- public boolean isInline()
- {
- return isInline;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#isFriend()
- */
- public boolean isFriend()
- {
- return isFriend;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#isStatic()
- */
- public boolean isStatic()
- {
- return isStatic;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
- */
- public String getName()
- {
- return name;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#getReturnType()
- */
- public IASTAbstractDeclaration getReturnType()
- {
- return returnType;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#getParameters()
- */
- public Iterator getParameters()
- {
- return parms.iterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#getExceptionSpec()
- */
- public IASTExceptionSpecification getExceptionSpec()
- {
- return exceptionSpec;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
- */
- public int getNameOffset()
- {
- return offsets.getNameOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- offsets.setNameOffset( o );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplatedDeclaration#getOwnerTemplateDeclaration()
- */
- public IASTTemplate getOwnerTemplateDeclaration()
- {
- return ownerTemplateDeclaration;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
- */
- public Iterator getDeclarations()
- {
- return declarations.iterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
- */
- public String[] getFullyQualifiedName()
- {
- return qualifiedName.getFullyQualifiedName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptFunctionDeclaration(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.enterFunctionBody( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.exitFunctionBody( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#setHasFunctionBody(boolean)
- */
- public void setHasFunctionBody(boolean b) {
- hasFunctionBody = true;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#hasFunctionBody()
- */
- public boolean hasFunctionBody() {
- return hasFunctionBody;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTCodeScope#getOwnerCodeScope()
- */
- public IASTCodeScope getOwnerCodeScope()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#previouslyDeclared()
- */
- public boolean previouslyDeclared()
- {
- return previouslyDeclared;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-
- private boolean hasFunctionTryBlock = false;
- private final boolean varArgs;
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#setHasFunctionTryBlock(boolean)
- */
- public void setHasFunctionTryBlock(boolean b)
- {
- hasFunctionTryBlock = b;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#hasFunctionTryBlock()
- */
- public boolean hasFunctionTryBlock()
- {
- return hasFunctionTryBlock;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFunction#takesVarArgs()
- */
- public boolean takesVarArgs() {
- return varArgs;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTInitializerClause.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTInitializerClause.java
deleted file mode 100644
index 59a0997b21f..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTInitializerClause.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
-import org.eclipse.cdt.core.parser.ast.IASTVariable;
-import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
-
-/**
- * @author jcamelon
- */
-public class ASTInitializerClause implements IASTInitializerClause {
-
- private final IASTInitializerClause.Kind kind;
- private final IASTExpression assignmentExpression;
- private final List initializerClauses;
- private final List designators;
- private IASTVariable ownerDeclaration = null;
- /**
- * @param kind
- * @param assignmentExpression
- * @param initializerClauses
- */
- public ASTInitializerClause(Kind kind, IASTExpression assignmentExpression, List initializerClauses, List designators ) {
- this.kind = kind;
- this.assignmentExpression = assignmentExpression;
- this.initializerClauses = initializerClauses;
- this.designators = designators;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getKind()
- */
- public Kind getKind() {
- return kind;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getInitializerList()
- */
- public Iterator getInitializers() {
- if( initializerClauses == null )
- return new EmptyIterator();
- return initializerClauses.iterator();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getAssigmentExpression()
- */
- public IASTExpression getAssigmentExpression() {
- return assignmentExpression;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getDesignators()
- */
- public Iterator getDesignators()
- {
- return designators.iterator();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#setOwnerDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
- */
- public void setOwnerVariableDeclaration(IASTVariable declaration)
- {
- ownerDeclaration = declaration;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getOwnerDeclaration()
- */
- public IASTVariable getOwnerVariableDeclaration()
- {
- return ownerDeclaration;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTLinkageSpecification.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTLinkageSpecification.java
deleted file mode 100644
index 1bd65a51802..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTLinkageSpecification.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.internal.core.parser.ast.Offsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTLinkageSpecification
- extends ASTDeclaration
- implements IASTDeclaration, IASTLinkageSpecification, IASTQScope {
-
- private final String linkage;
-
- public ASTLinkageSpecification( IASTScope scope, String linkage, int startingOffset )
- {
- super( scope );
- this.linkage = linkage;
- setStartingOffset(startingOffset);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification#getLinkageString()
- */
- public String getLinkageString() {
- return linkage;
- }
-
- private List declarations = new ArrayList();
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
- */
- public Iterator getDeclarations() {
- return declarations.iterator();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.quick.IASTQScope#addDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
- */
- public void addDeclaration(IASTDeclaration declaration) {
- declarations.add( declaration );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
- private Offsets offsets = new Offsets();
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.enterLinkageSpecification(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.exitLinkageSpecification(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java
deleted file mode 100644
index eca84f1c592..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
-import org.eclipse.cdt.core.parser.ast.IASTMethod;
-import org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTTemplate;
-import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
-import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
-/**
- * @author jcamelon
- *
- */
-public class ASTMethod extends ASTFunction implements IASTMethod
-{
- private final List constructorChainElements;
- private final boolean isConst;
- private final boolean isDestructor;
- private final boolean isConstructor;
- private final boolean isExplicit;
- private final boolean isPureVirtual;
- private final boolean isVirtual;
- private final boolean isVolatile;
- private final ASTAccessVisibility visibility;
- private final IASTQualifiedNameElement qualifiedName;
- /**
- * @param scope
- * @param name
- * @param parameters
- * @param returnType
- * @param exception
- * @param isInline
- * @param isFriend
- * @param isStatic
- * @param startOffset
- * @param nameOffset
- * @param ownerTemplate
- */
- public ASTMethod(
- IASTScope scope,
- String name,
- int nameEndOffset,
- List parameters,
- IASTAbstractDeclaration returnType,
- IASTExceptionSpecification exception,
- boolean isInline,
- boolean isFriend,
- boolean isStatic,
- int startOffset,
- int nameOffset,
- IASTTemplate ownerTemplate,
- boolean isConst,
- boolean isVolatile,
- boolean isConstructor,
- boolean isDestructor,
- boolean isVirtual,
- boolean isExplicit,
- boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChainElements,
- boolean hasFunctionTryBlock, boolean hasVarArgs )
- {
- super(
- scope,
- name,
- nameEndOffset,
- parameters,
- returnType,
- exception,
- isInline,
- isFriend,
- isStatic,
- startOffset,
- nameOffset,
- ownerTemplate, hasFunctionTryBlock, hasVarArgs);
- this.isVirtual = isVirtual;
- this.isPureVirtual = isPureVirtual;
- this.isConstructor = isConstructor;
- this.isDestructor = isDestructor;
- this.isExplicit = isExplicit;
- this.isConst = isConst;
- this.isVolatile = isVolatile;
- this.visibility = visibility;
- this.constructorChainElements = constructorChainElements;
- qualifiedName = new ASTQualifiedNamedElement( scope, name );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMethod#isVirtual()
- */
- public boolean isVirtual()
- {
- return isVirtual;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMethod#isExplicit()
- */
- public boolean isExplicit()
- {
- // TODO Auto-generated method stub
- return isExplicit;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMethod#isConstructor()
- */
- public boolean isConstructor()
- {
- return isConstructor;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMethod#isDestructor()
- */
- public boolean isDestructor()
- {
- return isDestructor;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMethod#isConst()
- */
- public boolean isConst()
- {
- return isConst;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMethod#isVolatile()
- */
- public boolean isVolatile()
- {
- return isVolatile;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMethod#isPureVirtual()
- */
- public boolean isPureVirtual()
- {
- return isPureVirtual;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMember#getVisiblity()
- */
- public ASTAccessVisibility getVisiblity()
- {
- return visibility;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
- */
- public String[] getFullyQualifiedName()
- {
- return qualifiedName.getFullyQualifiedName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMember#getOwnerClassSpecifier()
- */
-
-
- public void acceptElement( ISourceElementRequestor requestor )
- {
- try
- {
- requestor.acceptMethodDeclaration( this );
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
- public void enterScope( ISourceElementRequestor requestor )
- {
- try
- {
- requestor.enterMethodBody(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
- public void exitScope( ISourceElementRequestor requestor )
- {
- try
- {
- requestor.exitMethodBody(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTMethod#getConstructorChainInitializers()
- */
- public Iterator getConstructorChainInitializers()
- {
- if( constructorChainElements == null )
- return new EmptyIterator();
- return constructorChainElements.iterator();
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceAlias.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceAlias.java
deleted file mode 100644
index 34e5017885e..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceAlias.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceAlias;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTNamespaceAlias extends ASTDeclaration implements IASTNamespaceAlias
-{
-
- private final String alias;
- private final String identifier;
- private NamedOffsets offsets = new NamedOffsets();
- /**
- * @param scope
- * @param identifier
- * @param string
- * @param startingOffset
- * @param nameOffset
- * @param endOffset
- */
- public ASTNamespaceAlias(IASTScope scope, String identifier, String string, int startingOffset, int nameOffset, int nameEndOffset, int endOffset)
- {
- super( scope );
- setStartingOffset(startingOffset);
- setNameOffset(nameOffset);
- setNameEndOffset( nameEndOffset );
- setEndingOffset(endOffset);
- this.identifier = identifier;
- this.alias = string;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTNamespaceAlias#getAlias()
- */
- public String getAlias()
- {
- return alias;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTNamespaceAlias#getNamespace()
- */
- public IASTNamespaceDefinition getNamespace() throws ASTNotImplementedException
- {
- throw new ASTNotImplementedException();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
- */
- public String getName()
- {
- return identifier;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
- */
- public int getNameOffset()
- {
- return offsets.getNameOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- offsets.setNameOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java
deleted file mode 100644
index 12ed9c28859..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTNamespaceDefinition extends ASTDeclaration implements IASTNamespaceDefinition, IASTQScope {
-
- private final String name;
- private NamedOffsets offsets = new NamedOffsets();
- private final ASTQualifiedNamedElement qualifiedNameElement;
-
- public ASTNamespaceDefinition( IASTScope scope, String name, int startOffset, int nameOffset, int nameEndOffset )
- {
- super( scope );
- qualifiedNameElement = new ASTQualifiedNamedElement( scope, name );
- this.name = name;
- setStartingOffset(startOffset);
- setNameOffset(nameOffset);
- setNameEndOffset(nameEndOffset);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
- */
- public String getName() {
- return name;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
- */
- public int getNameOffset() {
- return offsets.getNameOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o) {
- offsets.setNameOffset( o );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o) {
- offsets.setStartingOffset(o);
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o) {
- offsets.setEndingOffset(o);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset() {
- return offsets.getStartingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset() {
- return offsets.getEndingOffset();
- }
-
- private List declarations = new ArrayList();
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
- */
- public Iterator getDeclarations() {
- return declarations.iterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.quick.IASTQScope#addDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
- */
- public void addDeclaration(IASTDeclaration declaration) {
- declarations.add( declaration );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
- */
- public String[] getFullyQualifiedName()
- {
- return qualifiedNameElement.getFullyQualifiedName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.enterNamespaceDefinition(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.exitNamespaceDefinition(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNewDescriptor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNewDescriptor.java
deleted file mode 100644
index 47973901ccd..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNewDescriptor.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import java.util.Iterator;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
-
-/**
- * @author jcamelon
- */
-public class ASTNewDescriptor implements IASTNewExpressionDescriptor {
-
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor#getNewInitializerExpressions()
- */
- public Iterator getNewInitializerExpressions() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor#getNewPlacementExpressions()
- */
- public Iterator getNewPlacementExpressions() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor#getTypeIdExpressions()
- */
- public Iterator getNewTypeIdExpressions() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNode.java
deleted file mode 100644
index 30f9933ef09..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNode.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Created on 17/12/2003
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.cdt.internal.core.parser.ast.quick;
-
-import org.eclipse.cdt.core.parser.ast.IASTNode;
-
-/**
- * @author hamer
- *
- * To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-public class ASTNode implements IASTNode {
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTNode#lookup(java.lang.String, org.eclipse.cdt.core.parser.ast.IASTNode.LookupKind[], org.eclipse.cdt.core.parser.ast.IASTNode)
- */
- public LookupResult lookup(
- String prefix,
- LookupKind[] kind,
- IASTNode context)
- throws LookupException {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTParameterDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTParameterDeclaration.java
deleted file mode 100644
index aecd00e5fa5..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTParameterDeclaration.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
-import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
-import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
-import org.eclipse.cdt.internal.core.parser.ast.ASTAbstractDeclaration;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTParameterDeclaration extends ASTAbstractDeclaration implements IASTParameterDeclaration
-{
- private final NamedOffsets offsets = new NamedOffsets();
- private final String parameterName;
- private final IASTInitializerClause initializerClause;
- /**
- * @param isConst
- * @param typeSpecifier
- * @param pointerOperators
- * @param arrayModifiers
- * @param parameterName
- * @param initializerClause
- */
- public ASTParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int endingOffset, int nameOffset, int nameEndOffset )
- {
- super( isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp );
- this.parameterName = parameterName;
- this.initializerClause = initializerClause;
- setStartingOffset( startingOffset );
- setEndingOffset( endingOffset );
- setNameOffset( nameOffset );
- setNameEndOffset(nameEndOffset);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration#getName()
- */
- public String getName()
- {
- return parameterName;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration#getDefaultValue()
- */
- public IASTInitializerClause getDefaultValue()
- {
- return initializerClause;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
- */
- public int getNameOffset()
- {
- return offsets.getNameOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- offsets.setNameOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTScopedTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTScopedTypeSpecifier.java
deleted file mode 100644
index 535ad6c7928..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTScopedTypeSpecifier.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ast.IASTNode;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTScopedTypeSpecifier;
-import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTScopedTypeSpecifier extends ASTQualifiedNamedElement implements IASTScopedTypeSpecifier
-{
- private final IASTScope scope;
-
- public ASTScopedTypeSpecifier( IASTScope scope, String name )
- {
- super( scope, name );
- this.scope = scope;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
- */
- public IASTScope getOwnerScope()
- {
- return scope;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTNode#lookup(java.lang.String, org.eclipse.cdt.core.parser.ast.IASTNode.LookupKind[], org.eclipse.cdt.core.parser.ast.IASTNode)
- */
- public LookupResult lookup(
- String prefix,
- LookupKind[] kind,
- IASTNode context)
- throws LookupException {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTSimpleTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTSimpleTypeSpecifier.java
deleted file mode 100644
index 6cd92feeef5..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTSimpleTypeSpecifier.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import java.util.Hashtable;
-import java.util.Map;
-
-import org.eclipse.cdt.core.parser.ITokenDuple;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTSimpleTypeSpecifier extends ASTNode implements IASTSimpleTypeSpecifier
-{
- private final boolean imaginary;
- private final boolean complex;
- private final boolean isTypename;
- private final Type kind;
- private final String typeName;
- private final boolean isLong, isShort, isSigned, isUnsigned;
-
- private static final Map nameMap;
- static
- {
- nameMap = new Hashtable();
- nameMap.put( Type.BOOL, "bool");
- nameMap.put( Type.CHAR, "char");
- nameMap.put( Type.DOUBLE, "double");
- nameMap.put( Type.FLOAT, "float");
- nameMap.put( Type.INT, "int");
- nameMap.put( Type.VOID, "void" );
- nameMap.put( Type.WCHAR_T, "wchar_t" );
- nameMap.put( Type._BOOL, "_Bool");
- }
- /**
- * @param kind
- * @param typeName
- */
- public ASTSimpleTypeSpecifier(Type kind, ITokenDuple typeName, boolean isShort, boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, boolean isComplex, boolean isImaginary )
- {
- this.kind = kind;
- this.isLong = isLong;
- this.isShort = isShort;
- this.isSigned = isSigned;
- this.isUnsigned = isUnsigned;
- this.isTypename = isTypename;
- this.complex = isComplex;
- this.imaginary = isImaginary;
-
- StringBuffer type = new StringBuffer();
- if( this.kind == IASTSimpleTypeSpecifier.Type.CHAR || this.kind == IASTSimpleTypeSpecifier.Type.WCHAR_T )
- {
- if (isUnsigned())
- type.append("unsigned ");
- type.append( (String)nameMap.get( this.kind ));
- }
- else if( this.kind == Type.BOOL || this.kind == Type.VOID || this.kind == Type._BOOL )
- {
- type.append( (String) nameMap.get( this.kind ));
- }
- else if( this.kind == Type.INT )
- {
- if (isUnsigned())
- type.append("unsigned ");
- if (isShort())
- type.append("short ");
- if (isLong())
- type.append("long ");
- type.append( (String)nameMap.get( this.kind ));
- }
- else if( this.kind == Type.FLOAT )
- {
- type.append( (String)nameMap.get( this.kind ));
- if( isComplex() )
- type.append( "_Complex" );
- else if( isImaginary() )
- type.append( "_Imaginary" );
- }
- else if( this.kind == Type.DOUBLE )
- {
- if (isLong())
- type.append("long ");
- type.append( (String)nameMap.get( this.kind ));
- if( isComplex() )
- type.append( "_Complex" );
- else if( isImaginary() )
- type.append( "_Imaginary" );
- }
- else if( this.kind == Type.CLASS_OR_TYPENAME || this.kind == Type.TEMPLATE )
- {
- if (isTypename() )
- type.append("typename ");
- type.append(typeName.toString());
- }
- else if( this.kind == Type.UNSPECIFIED )
- {
- if (isUnsigned())
- type.append("unsigned ");
- if (isShort())
- type.append("short ");
- if (isLong())
- type.append("long ");
- if (isSigned())
- type.append("signed ");
- }
- this.typeName = type.toString();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#getType()
- */
- public Type getType()
- {
- return kind;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#getTypename()
- */
- public String getTypename()
- {
- return typeName;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isLong()
- */
- public boolean isLong()
- {
- return isLong;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isShort()
- */
- public boolean isShort()
- {
- return isShort;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isSigned()
- */
- public boolean isSigned()
- {
- return isSigned;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isUnsigned()
- */
- public boolean isUnsigned()
- {
- return isUnsigned;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isTypename()
- */
- public boolean isTypename()
- {
- return isTypename;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#getTypeSpecifier()
- */
- public IASTTypeSpecifier getTypeSpecifier() throws ASTNotImplementedException
- {
- throw new ASTNotImplementedException();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isComplex()
- */
- public boolean isComplex()
- {
- return complex;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier#isImaginary()
- */
- public boolean isImaginary()
- {
- return imaginary;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateDeclaration.java
deleted file mode 100644
index 207ce880c2c..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateDeclaration.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
-import org.eclipse.cdt.internal.core.parser.ast.Offsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTTemplateDeclaration extends ASTDeclaration implements IASTTemplateDeclaration
-{
- private IASTDeclaration ownedDeclaration;
- private List templateParameters;
- private Offsets offsets = new Offsets();
- private final boolean isExported;
- /**
- * @param templateParameters
- */
- public ASTTemplateDeclaration(IASTScope scope, List templateParameters, int startingOffset, boolean isExported)
- {
- super( scope );
- this.templateParameters = templateParameters;
- setStartingOffset(startingOffset);
- this.isExported = isExported;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration#getTemplateParameters()
- */
- public Iterator getTemplateParameters()
- {
- return templateParameters.iterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration#getOwnedDeclaration()
- */
- public IASTDeclaration getOwnedDeclaration()
- {
- return ownedDeclaration;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplate#setOwnedDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
- */
- public void setOwnedDeclaration(IASTDeclaration declaration)
- {
- ownedDeclaration = declaration;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration#isExported()
- */
- public boolean isExported()
- {
- return isExported;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.enterTemplateDeclaration(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.exitTemplateDeclaration(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateInstantiation.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateInstantiation.java
deleted file mode 100644
index 6287b6a8420..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateInstantiation.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
-import org.eclipse.cdt.internal.core.parser.ast.Offsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTTemplateInstantiation extends ASTDeclaration implements IASTTemplateInstantiation
-{
- private IASTDeclaration declaration;
- private Offsets offsets = new Offsets();
-
- /**
- * @param scope
- */
- public ASTTemplateInstantiation(IASTScope scope, int startingOffset)
- {
- super( scope );
- setStartingOffset(startingOffset);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplate#getOwnedDeclaration()
- */
- public IASTDeclaration getOwnedDeclaration()
- {
- return declaration;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplate#setOwnedDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
- */
- public void setOwnedDeclaration(IASTDeclaration declaration)
- {
- this.declaration = declaration;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset( o );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.enterTemplateInstantiation(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.exitTemplateExplicitInstantiation(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateParameter.java
deleted file mode 100644
index 93886eefea0..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateParameter.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateParameter;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTTemplateParameter implements IASTTemplateParameter
-{
- private final List templateParms;
- private final IASTParameterDeclaration parameter;
- private final ParamKind kind;
- private final String identifier;
- private final String defaultValue;
- /**
- * @param kind
- * @param identifier
- * @param defaultValue
- * @param parameter
- */
- public ASTTemplateParameter(ParamKind kind, String identifier, String defaultValue, IASTParameterDeclaration parameter, List templateParms)
- {
- this.kind = kind;
- this.identifier = identifier;
- this.defaultValue = defaultValue;
- this.parameter = parameter;
- this.templateParms = templateParms;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplateParameter#getTemplateParameterKind()
- */
- public ParamKind getTemplateParameterKind()
- {
- return kind;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplateParameter#getIdentifier()
- */
- public String getIdentifier()
- {
- return identifier;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplateParameter#getDefaultValueIdExpression()
- */
- public String getDefaultValueIdExpression()
- {
- return defaultValue;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplateParameterList#getTemplateParameters()
- */
- public Iterator getTemplateParameters()
- {
- return templateParms.iterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplateParameter#getParameterDeclaration()
- */
- public IASTParameterDeclaration getParameterDeclaration()
- {
- return parameter;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateSpecialization.java
deleted file mode 100644
index 9ff0d909120..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateSpecialization.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
-import org.eclipse.cdt.internal.core.parser.ast.Offsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTTemplateSpecialization extends ASTDeclaration implements IASTTemplateSpecialization
-{
- private Offsets offsets = new Offsets();
- private IASTDeclaration ownedDeclaration;
- /**
- * @param scope
- */
- public ASTTemplateSpecialization(IASTScope scope, int startingOffset )
- {
- super(scope);
- setStartingOffset(startingOffset);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplate#getOwnedDeclaration()
- */
- public IASTDeclaration getOwnedDeclaration()
- {
- return ownedDeclaration;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTemplate#setOwnedDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
- */
- public void setOwnedDeclaration(IASTDeclaration declaration)
- {
- ownedDeclaration = declaration;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.enterTemplateSpecialization(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.exitTemplateSpecialization(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypeId.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypeId.java
deleted file mode 100644
index b8ad5bbff5d..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypeId.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTTypeId;
-import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTTypeId implements IASTTypeId
-{
- private final boolean isVolatile;
- private final boolean isUnsigned;
- private final boolean isTypeName;
- private final boolean isSigned;
- private final boolean isShort;
- private final boolean isLong;
- private final boolean isConst;
- private final Type kind;
- private final String name;
- private final List pointerOps;
- private final List arrayMods;
- /**
- * @param kind
- * @param string
- * @param pointerOps
- * @param arrayMods
- */
- public ASTTypeId(Type kind, String string, List pointerOps, List arrayMods, boolean isConst, boolean isVolatile,
- boolean isUnsigned, boolean isSigned, boolean isShort, boolean isLong, boolean isTypeName)
- {
- this.kind = kind;
- this.name = string;
- this.pointerOps = pointerOps;
- this.arrayMods = arrayMods;
- this.isVolatile =isVolatile;
- this.isUnsigned =isUnsigned;
- this.isTypeName =isTypeName;
- this.isSigned =isSigned;
- this.isShort =isShort;
- this.isLong =isLong;
- this.isConst =isConst;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#getKind()
- */
- public Type getKind()
- {
- return kind;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#getType()
- */
- public String getTypeOrClassName()
- {
- return name;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#getPointerOperators()
- */
- public Iterator getPointerOperators()
- {
- return pointerOps.iterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#getArrayModifiers()
- */
- public Iterator getArrayModifiers()
- {
- return arrayMods.iterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#getFullSignature()
- */
- public String getFullSignature() throws ASTNotImplementedException
- {
- throw new ASTNotImplementedException();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#createTypeSymbol(org.eclipse.cdt.core.parser.ast.IASTFactory)
- */
- public ISymbol getTypeSymbol() throws ASTNotImplementedException
- {
- throw new ASTNotImplementedException();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#isConst()
- */
- public boolean isConst()
- {
- return isConst;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#isVolatile()
- */
- public boolean isVolatile()
- {
- return isVolatile;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#isLong()
- */
- public boolean isLong()
- {
- return isLong;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#isShort()
- */
- public boolean isShort()
- {
- return isShort;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#isSigned()
- */
- public boolean isSigned()
- {
- return isSigned;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#isUnsigned()
- */
- public boolean isUnsigned()
- {
- return isUnsigned;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypeId#isTypename()
- */
- public boolean isTypename()
- {
- return isTypeName;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypedefDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypedefDeclaration.java
deleted file mode 100644
index 2625f158845..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypedefDeclaration.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
-import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTTypedefDeclaration extends ASTDeclaration implements IASTTypedefDeclaration
-{
- private final String name;
- private final IASTAbstractDeclaration mapping;
- private NamedOffsets offsets = new NamedOffsets();
- private final ASTQualifiedNamedElement qualifiedName;
- /**
- * @param scope
- * @param name
- * @param mapping
- */
- public ASTTypedefDeclaration(IASTScope scope, String name, IASTAbstractDeclaration mapping, int startingOffset, int nameOffset, int nameEndOffset )
- {
- super( scope );
- this.name = name;
- this.mapping = mapping;
- setStartingOffset(startingOffset);
- setNameOffset(nameOffset);
- setNameEndOffset(nameEndOffset);
- qualifiedName = new ASTQualifiedNamedElement( scope, name );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypedef#getName()
- */
- public String getName()
- {
- return name;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTTypedef#getAbstractDeclarator()
- */
- public IASTAbstractDeclaration getAbstractDeclarator()
- {
- return mapping;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
- */
- public int getNameOffset()
- {
- return offsets.getNameOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- offsets.setNameOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
- */
- public String[] getFullyQualifiedName()
- {
- return qualifiedName.getFullyQualifiedName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptTypedefDeclaration(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDeclaration.java
deleted file mode 100644
index a4c80cb17cf..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDeclaration.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
-import org.eclipse.cdt.internal.core.parser.ast.Offsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTUsingDeclaration
- extends ASTDeclaration
- implements IASTUsingDeclaration {
-
- private final boolean isTypename;
- private final String mappingName;
-
- public ASTUsingDeclaration( IASTScope scope, boolean isTypeName, String mappingName, int startingOffset, int endingOffset )
- {
- super( scope );
- isTypename = isTypeName;
- this.mappingName = mappingName;
- setStartingOffset(startingOffset);
- setEndingOffset(endingOffset);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration#isTypename()
- */
- public boolean isTypename() {
- return isTypename;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration#usingTypeName()
- */
- public String usingTypeName() {
- return mappingName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
- private Offsets offsets = new Offsets();
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptUsingDeclaration(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration#getUsingType()
- */
- public IASTDeclaration getUsingType() throws ASTNotImplementedException
- {
- throw new ASTNotImplementedException();
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDirective.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDirective.java
deleted file mode 100644
index 27b691292b5..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDirective.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
-import org.eclipse.cdt.internal.core.parser.ast.Offsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTUsingDirective
- extends ASTDeclaration
- implements IASTUsingDirective {
-
-
- public ASTUsingDirective( IASTScope scope, String name, int startingOffset, int endingOffset )
- {
- super( scope );
- this.namespaceName = name;
- setStartingOffset(startingOffset);
- setEndingOffset(endingOffset);
-
- }
- private final String namespaceName;
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTUsingDirective#getNamespaceName()
- */
- public String getNamespaceName() {
- return namespaceName;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
- private Offsets offsets = new Offsets();
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptUsingDirective(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTUsingDirective#getNamespaceDefinition()
- */
- public IASTNamespaceDefinition getNamespaceDefinition() throws ASTNotImplementedException
- {
- throw new ASTNotImplementedException();
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java
deleted file mode 100644
index 44ff158a80c..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTVariable;
-import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
-import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTVariable extends ASTDeclaration implements IASTVariable
-{
- private IASTExpression constructorExpression;
- private final boolean isAuto;
- private final IASTInitializerClause initializerClause;
- private final IASTExpression bitfieldExpression;
- private final IASTAbstractDeclaration abstractDeclaration;
- private final boolean isMutable;
- private final boolean isExtern;
- private final boolean isRegister;
- private final boolean isStatic;
- private final String name;
- private NamedOffsets offsets = new NamedOffsets();
- private final ASTQualifiedNamedElement qualifiedName;
- /**
- * @param scope
- */
- public ASTVariable(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression,
- IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, int nameEndOffset, IASTExpression constructorExpression )
- {
- super(scope);
- this.isAuto = isAuto;
- this.initializerClause = initializerClause;
- this.bitfieldExpression = bitfieldExpression;
- this.abstractDeclaration = abstractDeclaration;
- this.isMutable= isMutable;
- this.isExtern = isExtern;
- this.isRegister = isRegister;
- this.isStatic = isStatic;
- this.name = name;
- this.constructorExpression = constructorExpression;
- qualifiedName = new ASTQualifiedNamedElement( scope, name );
- setStartingOffset(startingOffset);
- setNameOffset(nameOffset);
- setNameEndOffset( nameEndOffset );
- if( initializerClause != null )
- initializerClause.setOwnerVariableDeclaration(this);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#isAuto()
- */
- public boolean isAuto()
- {
- return isAuto;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#isRegister()
- */
- public boolean isRegister()
- {
- return isRegister;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#isStatic()
- */
- public boolean isStatic()
- {
- return isStatic;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#isExtern()
- */
- public boolean isExtern()
- {
- return isExtern;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#isMutable()
- */
- public boolean isMutable()
- {
- return isMutable;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#getAbstractDeclaration()
- */
- public IASTAbstractDeclaration getAbstractDeclaration()
- {
- return abstractDeclaration;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#getName()
- */
- public String getName()
- {
- return name;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#getInitializerClause()
- */
- public IASTInitializerClause getInitializerClause()
- {
- return initializerClause;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#isBitfield()
- */
- public boolean isBitfield()
- {
- return ( bitfieldExpression != null );
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#getBitfieldExpression()
- */
- public IASTExpression getBitfieldExpression()
- {
- return bitfieldExpression;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
- */
- public void setStartingOffset(int o)
- {
- offsets.setStartingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
- */
- public void setEndingOffset(int o)
- {
- offsets.setEndingOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
- */
- public int getStartingOffset()
- {
- return offsets.getStartingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
- */
- public int getEndingOffset()
- {
- return offsets.getEndingOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
- */
- public int getNameOffset()
- {
- return offsets.getNameOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- offsets.setNameOffset(o);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
- */
- public String[] getFullyQualifiedName()
- {
- return qualifiedName.getFullyQualifiedName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void acceptElement(ISourceElementRequestor requestor)
- {
- try
- {
- requestor.acceptVariable(this);
- }
- catch (Exception e)
- {
- /* do nothing */
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void enterScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
- */
- public void exitScope(ISourceElementRequestor requestor)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTVariable#getConstructorExpression()
- */
- public IASTExpression getConstructorExpression()
- {
- return constructorExpression;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameEndOffset()
- */
- public int getNameEndOffset()
- {
- return offsets.getNameEndOffset();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameEndOffset(int)
- */
- public void setNameEndOffset(int o)
- {
- offsets.setNameEndOffset(o);
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/IASTQClassSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/IASTQClassSpecifier.java
deleted file mode 100644
index 0d28deb31e8..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/IASTQClassSpecifier.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
-
-/**
- * @author jcamelon
- *
- */
-public interface IASTQClassSpecifier extends IASTClassSpecifier {
-
- public void addBaseClass( IASTBaseSpecifier baseSpecifier );
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/IASTQScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/IASTQScope.java
deleted file mode 100644
index a0ce2007e5e..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/IASTQScope.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-
-/**
- * @author jcamelon
- *
- */
-public interface IASTQScope extends IASTScope {
-
- public void addDeclaration( IASTDeclaration declaration );
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java
deleted file mode 100644
index c2cce2f696e..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/**********************************************************************
- * 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.ast.quick;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ITokenDuple;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.core.parser.ast.ASTClassKind;
-import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
-import org.eclipse.cdt.core.parser.ast.ASTSemanticException;
-import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTCodeScope;
-import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
-import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
-import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
-import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.core.parser.ast.IASTFactory;
-import org.eclipse.cdt.core.parser.ast.IASTField;
-import org.eclipse.cdt.core.parser.ast.IASTFunction;
-import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
-import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
-import org.eclipse.cdt.core.parser.ast.IASTMethod;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceAlias;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
-import org.eclipse.cdt.core.parser.ast.IASTNode;
-import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTTemplate;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateParameter;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
-import org.eclipse.cdt.core.parser.ast.IASTTypeId;
-import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
-import org.eclipse.cdt.core.parser.ast.IASTVariable;
-import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType;
-import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
-import org.eclipse.cdt.core.parser.ast.IASTExpression.Kind;
-import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type;
-import org.eclipse.cdt.internal.core.parser.ast.BaseASTFactory;
-
-/**
-
- * @author jcamelon
- *
- */
-public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory {
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createUsingDirective(org.eclipse.cdt.internal.core.parser.ast.IASTScope, org.eclipse.cdt.internal.core.parser.TokenDuple)
- */
- public IASTUsingDirective createUsingDirective(IASTScope scope, ITokenDuple duple, int startingOffset, int endingOffset) throws ASTSemanticException {
- return new ASTUsingDirective( scope, duple.toString(), startingOffset, endingOffset );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createASMDefinition(org.eclipse.cdt.internal.core.parser.ast.IASTScope, java.lang.String, int, int)
- */
- public IASTASMDefinition createASMDefinition(IASTScope scope, String assembly, int first, int last) {
- IASTASMDefinition definition = new ASTASMDefinition( scope, assembly );
- definition.setStartingOffset( first );
- definition.setEndingOffset( last );
- return definition;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createNamespaceDefinition(int, java.lang.String, int)
- */
- public IASTNamespaceDefinition createNamespaceDefinition(IASTScope scope, String identifier, int first, int nameOffset, int nameEndOffset) {
- IASTNamespaceDefinition definition = new ASTNamespaceDefinition( scope, identifier, first, nameOffset, nameEndOffset );
- return definition;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createCompilationUnit()
- */
- public IASTCompilationUnit createCompilationUnit() {
- return new ASTCompilationUnit();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createLinkageSpecification(java.lang.String)
- */
- public IASTLinkageSpecification createLinkageSpecification(IASTScope scope, String spec, int startingOffset) {
- return new ASTLinkageSpecification( scope, spec, startingOffset );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createUsingDeclaration(org.eclipse.cdt.core.parser.ast.IASTScope, boolean, org.eclipse.cdt.internal.core.parser.TokenDuple)
- */
- public IASTUsingDeclaration createUsingDeclaration(IASTScope scope, boolean isTypeName, ITokenDuple name, int startingOffset, int endingOffset) {
- return new ASTUsingDeclaration( scope, isTypeName, name.toString(), startingOffset, endingOffset );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, org.eclipse.cdt.core.parser.ast.ClassKind, org.eclipse.cdt.core.parser.ast.ClassNameType, org.eclipse.cdt.core.parser.ast.AccessVisibility, org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration)
- */
- public IASTClassSpecifier createClassSpecifier(IASTScope scope, ITokenDuple name, ASTClassKind kind, ClassNameType type, ASTAccessVisibility access, int startingOffset, int nameOffset, int nameEndOffset ) throws ASTSemanticException {
- return new ASTClassSpecifier( scope, name == null ? "" : name.toString() , kind, type, startingOffset, nameOffset, nameEndOffset, access );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#addBaseSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier, boolean, org.eclipse.cdt.core.parser.ast.AccessVisibility, java.lang.String)
- */
- public void addBaseSpecifier(IASTClassSpecifier astClassSpec, boolean isVirtual, ASTAccessVisibility visibility, ITokenDuple parentClassName) {
- IASTBaseSpecifier baseSpecifier = new ASTBaseSpecifier( parentClassName.toString(), isVirtual, visibility, parentClassName.getFirstToken().getOffset() );
- ((IASTQClassSpecifier)astClassSpec).addBaseClass(baseSpecifier);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createEnumerationSpecifier(java.lang.String, int)
- */
- public IASTEnumerationSpecifier createEnumerationSpecifier(IASTScope scope, String name, int startingOffset, int nameOffset, int nameEndOffset)
- {
- return new ASTEnumerationSpecifier( scope, name, startingOffset, nameOffset, nameEndOffset );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#addEnumerator(org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier, java.lang.String, int, int)
- */
- public void addEnumerator(IASTEnumerationSpecifier enumeration, String string, int startingOffset, int nameOffset, int nameEndOffset, int endingOffset, IASTExpression initialValue)
- {
- IASTEnumerator enumerator = new ASTEnumerator( enumeration, string, startingOffset, nameOffset, nameEndOffset, endingOffset, initialValue );
- ((ASTEnumerationSpecifier)enumeration).addEnumerator( enumerator );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExpression(org.eclipse.cdt.core.parser.ast.IASTExpression.ExpressionKind, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTExpression, java.lang.String, java.lang.String, java.lang.String)
- */
- public IASTExpression createExpression(IASTScope scope, Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IASTTypeId typeId, ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor) {
- return new ASTExpression( kind, lhs, rhs, thirdExpression, typeId, idExpression == null ? "" : idExpression.toString(), literal, newDescriptor );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNewDescriptor()
- */
- public IASTNewExpressionDescriptor createNewDescriptor(List newPlacementEpressions, List newTypeIdExpressions, List newInitializerExpressions) {
- return new ASTNewDescriptor();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExceptionSpecification(java.util.List)
- */
- public IASTExceptionSpecification createExceptionSpecification(IASTScope scope, List typeIds)
- {
- return new ASTExceptionSpecification( typeIds );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createConstructorMemberInitializer(org.eclipse.cdt.core.parser.ITokenDuple, org.eclipse.cdt.core.parser.ast.IASTExpression)
- */
- public IASTConstructorMemberInitializer createConstructorMemberInitializer(IASTScope scope, ITokenDuple duple, IASTExpression expressionList )
- {
- return new ASTConstructorMemberInitializer( duple.toString(), expressionList );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createSimpleTypeSpecifier(org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.SimpleType, org.eclipse.cdt.core.parser.ITokenDuple)
- */
- public IASTSimpleTypeSpecifier createSimpleTypeSpecifier(IASTScope scope, Type kind, ITokenDuple typeName, boolean isShort, boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, boolean isComplex, boolean isImaginary )
- {
- return new ASTSimpleTypeSpecifier( kind, typeName, isShort, isLong, isSigned, isUnsigned, isTypename, isComplex, isImaginary);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createFunction(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration)
- */
- public IASTFunction createFunction(IASTScope scope, ITokenDuple name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, int nameEndOffset, IASTTemplate ownerTemplate, boolean isConst, boolean isVolatile, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, List constructorChain, boolean isFunctionDefinition, boolean hasFunctionTryBlock, boolean hasVariableArguments )
- {
- return new ASTFunction(scope, name.toString(), nameEndOffset, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate, hasFunctionTryBlock, hasVariableArguments );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createMethod(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration, boolean, boolean, boolean, boolean, boolean, boolean, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
- */
- public IASTMethod createMethod(IASTScope scope, ITokenDuple name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, int nameEndOffset, IASTTemplate ownerTemplate, boolean isConst, boolean isVolatile, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChain, boolean isFunctionDefinition, boolean hasFunctionTryBlock, boolean hasVariableArguments )
- {
- return new ASTMethod(scope, name.toString(), nameEndOffset, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate, isConst, isVolatile, false, false, isVirtual, isExplicit, isPureVirtual, visibility, constructorChain, hasFunctionTryBlock, hasVariableArguments);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createVariable(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, boolean, org.eclipse.cdt.core.parser.ast.IASTInitializerClause, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, boolean, boolean, boolean, boolean)
- */
- public IASTVariable createVariable(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, int nameEndOffset, IASTExpression constructorExpression)
- {
- return new ASTVariable(scope, name, isAuto, initializerClause, bitfieldExpression, abstractDeclaration, isMutable, isExtern, isRegister, isStatic, startingOffset, nameOffset, nameEndOffset, constructorExpression);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createField(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, boolean, org.eclipse.cdt.core.parser.ast.IASTInitializerClause, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, boolean, boolean, boolean, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
- */
- public IASTField createField(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, int nameEndOffset, IASTExpression constructorExpression, ASTAccessVisibility visibility)
- {
- final ASTField field = new ASTField(scope, name, isAuto, initializerClause, bitfieldExpression, abstractDeclaration, isMutable, isExtern, isRegister, isStatic, startingOffset, nameOffset, nameEndOffset, constructorExpression, visibility);
- return field;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateDeclaration(java.util.List)
- */
- public IASTTemplateDeclaration createTemplateDeclaration(IASTScope scope, List templateParameters, boolean exported, int startingOffset)
- {
- return new ASTTemplateDeclaration( scope, templateParameters, startingOffset, exported );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateParameter(org.eclipse.cdt.core.parser.ast.IASTTemplateParameter.ParameterKind, org.eclipse.cdt.core.parser.IToken, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration)
- */
- public IASTTemplateParameter createTemplateParameter(IASTTemplateParameter.ParamKind kind, String identifier, String defaultValue, IASTParameterDeclaration parameter, List parms)
- {
- return new ASTTemplateParameter( kind, identifier, defaultValue, parameter, parms );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateInstantiation()
- */
- public IASTTemplateInstantiation createTemplateInstantiation(IASTScope scope, int startingOffset)
- {
- return new ASTTemplateInstantiation(scope, startingOffset);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateSpecialization()
- */
- public IASTTemplateSpecialization createTemplateSpecialization(IASTScope scope, int startingOffset)
- {
- return new ASTTemplateSpecialization(scope, startingOffset );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypedef(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration)
- */
- public IASTTypedefDeclaration createTypedef(IASTScope scope, String name, IASTAbstractDeclaration mapping, int startingOffset, int nameOffset, int nameEndOffset)
- {
- return new ASTTypedefDeclaration( scope, name, mapping, startingOffset, nameOffset, nameEndOffset);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypeSpecDeclaration(org.eclipse.cdt.core.parser.ast.IASTScope, boolean, org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier, java.util.List, java.util.List)
- */
- public IASTAbstractTypeSpecifierDeclaration createTypeSpecDeclaration(IASTScope scope, IASTTypeSpecifier typeSpecifier, IASTTemplate template, int startingOffset, int endingOffset)
- {
- return new ASTAbstractTypeSpecifierDeclaration( scope, typeSpecifier, template, startingOffset, endingOffset );
- }
-
- public IASTElaboratedTypeSpecifier createElaboratedTypeSpecifier(IASTScope scope, ASTClassKind elaboratedClassKind, ITokenDuple typeName, int startingOffset, int endOffset, boolean isForewardDecl, boolean isFriend)
- {
- return new ASTElaboratedTypeSpecifier( scope, elaboratedClassKind, typeName.toString(), startingOffset, typeName.getFirstToken().getOffset(), typeName.getLastToken().getEndOffset(), endOffset );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNamespaceAlias(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, org.eclipse.cdt.core.parser.ITokenDuple, int, int, int)
- */
- public IASTNamespaceAlias createNamespaceAlias(IASTScope scope, String identifier, ITokenDuple alias, int startingOffset, int nameOffset, int nameEndOffset, int endOffset)
- {
- return new ASTNamespaceAlias( scope, identifier, alias.toString(), startingOffset, nameOffset, nameEndOffset, endOffset );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNewCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope)
- */
- public IASTCodeScope createNewCodeBlock(IASTScope scope) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#queryIsTypeName(org.eclipse.cdt.core.parser.ITokenDuple)
- */
- public boolean queryIsTypeName(IASTScope scope, ITokenDuple nameInQuestion) {
- return true; // we have no information to say that it is not
- }
-
- public IASTParameterDeclaration createParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int nameOffset, int nameEndOffset, int endingOffset)
- {
- return new ASTParameterDeclaration( isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp, parameterName, initializerClause, startingOffset, endingOffset, nameOffset, nameEndOffset );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypeId(org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type, org.eclipse.cdt.core.parser.ITokenDuple, java.util.List, java.util.List)
- */
- public IASTTypeId createTypeId(IASTScope scope, Type kind, boolean isConst, boolean isVolatile, boolean isShort,
- boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, ITokenDuple name, List pointerOps, List arrayMods)
- {
- return new ASTTypeId( kind, name == null ? "" : name.toString(), pointerOps, arrayMods, isConst,
- isVolatile, isUnsigned, isSigned, isShort, isLong, isTypename );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#signalEndOfClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier)
- */
- public void signalEndOfClassSpecifier(IASTClassSpecifier astClassSpecifier)
- {
- }
-
- public IASTInitializerClause createInitializerClause(IASTScope scope, IASTInitializerClause.Kind kind, IASTExpression assignmentExpression, List initializerClauses, List designators)
- {
- return new ASTInitializerClause( kind, assignmentExpression, initializerClauses, designators );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#getCompletionContext(org.eclipse.cdt.core.parser.ast.IASTExpression.Kind, org.eclipse.cdt.core.parser.ast.IASTExpression)
- */
- public IASTNode getCompletionContext(Kind kind, IASTExpression expression) {
- //we have no cross-reference information about the type of the expression
- return null;
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/AbstractSymbolExtension.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/AbstractSymbolExtension.java
deleted file mode 100644
index 582a3535e3c..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/AbstractSymbolExtension.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**********************************************************************
- * 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.pst;
-
-import org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol;
-
-/**
- * @author jcamelon
- *
- */
-public abstract class AbstractSymbolExtension implements ISymbolASTExtension
-{
- protected final ISymbol symbol;
- protected final ASTSymbol primaryDeclaration;
-
- /**
- *
- */
- public AbstractSymbolExtension( ISymbol symbol, ASTSymbol primaryDeclaration )
- {
- this.symbol = symbol;
- this.primaryDeclaration = primaryDeclaration;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolOwner#getSymbol()
- */
- public ISymbol getSymbol()
- {
- return symbol;
- }
-
- public ASTSymbol getPrimaryDeclaration()
- {
- return primaryDeclaration;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/BasicSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/BasicSymbol.java
deleted file mode 100644
index 00521aecc7e..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/BasicSymbol.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Created on Nov 4, 2003
- *
- * To change the template for this generated file go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-package org.eclipse.cdt.internal.core.parser.pst;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-
-
-public class BasicSymbol implements Cloneable, ISymbol
-{
- private final ParserSymbolTable _table;
- public BasicSymbol( ParserSymbolTable table, String name ){
- super();
- this._table = table;
- _name = name;
- _typeInfo = new TypeInfo();
- }
-
- public BasicSymbol( ParserSymbolTable table, String name, ISymbolASTExtension obj ){
- super();
- this._table = table;
- _name = name;
- _object = obj;
- _typeInfo = new TypeInfo();
- }
-
- public BasicSymbol( ParserSymbolTable table, String name, TypeInfo.eType typeInfo )
- {
- super();
- this._table = table;
- _name = name;
- _typeInfo = new TypeInfo( typeInfo, 0, null );
- }
-
- public ParserSymbolTable getSymbolTable(){
- return _table;
- }
-
- public Object clone(){
- BasicSymbol copy = null;
- try{
- copy = (BasicSymbol)super.clone();
- } catch ( CloneNotSupportedException e ){
- //should not happen
- return null;
- }
- copy._object = null;
- return copy;
- }
-
- public String getName() { return _name; }
- public void setName(String name) { _name = name; }
-
- public ISymbolASTExtension getASTExtension() { return _object; }
- public void setASTExtension( ISymbolASTExtension obj ) { _object = obj; }
-
- public IContainerSymbol getContainingSymbol() { return _containingScope; }
- public void setContainingSymbol( IContainerSymbol scope ){
- _containingScope = scope;
- _depth = scope.getDepth() + 1;
- }
-
- public void setType(TypeInfo.eType t){
- getTypeInfo().setType( t );
- }
-
- public TypeInfo.eType getType(){
- return getTypeInfo().getType();
- }
-
- public boolean isType( TypeInfo.eType type ){
- return getTypeInfo().isType( type, TypeInfo.t_undef );
- }
-
- public boolean isType( TypeInfo.eType type, TypeInfo.eType upperType ){
- return getTypeInfo().isType( type, upperType );
- }
-
- public ISymbol getTypeSymbol(){
- ISymbol symbol = getTypeInfo().getTypeSymbol();
-
- if( symbol != null && symbol.getTypeInfo().isForwardDeclaration() && symbol.getTypeSymbol() != null ){
- return symbol.getTypeSymbol();
- }
-
- return symbol;
- }
-
- public void setTypeSymbol( ISymbol type ){
- getTypeInfo().setTypeSymbol( type );
- }
-
- public TypeInfo getTypeInfo(){
- return _typeInfo;
- }
-
- public void setTypeInfo( TypeInfo info ) {
- _typeInfo = info;
- }
-
- public boolean isForwardDeclaration(){
- return getTypeInfo().isForwardDeclaration();
- }
-
- public void setIsForwardDeclaration( boolean forward ){
- getTypeInfo().setIsForwardDeclaration( forward );
- }
-
- /**
- * returns 0 if same, non zero otherwise
- */
- public int compareCVQualifiersTo( ISymbol symbol ){
- int size = symbol.getTypeInfo().hasPtrOperators() ? symbol.getTypeInfo().getPtrOperators().size() : 0;
- int size2 = getTypeInfo().hasPtrOperators() ? getTypeInfo().getPtrOperators().size() : 0;
-
- if( size != size2 ){
- return size2 - size;
- } else if( size == 0 )
- return 0;
- else {
-
- Iterator iter1 = symbol.getTypeInfo().getPtrOperators().iterator();
- Iterator iter2 = getTypeInfo().getPtrOperators().iterator();
-
- TypeInfo.PtrOp op1 = null, op2 = null;
-
- for( int i = size; i > 0; i-- ){
- op1 = (TypeInfo.PtrOp)iter1.next();
- op2 = (TypeInfo.PtrOp)iter2.next();
-
- if( op1.compareCVTo( op2 ) != 0 ){
- return -1;
- }
- }
- }
-
- return 0;
- }
-
- public List getPtrOperators(){
- return getTypeInfo().getPtrOperators();
- }
- public void addPtrOperator( TypeInfo.PtrOp ptrOp ){
- getTypeInfo().addPtrOperator( ptrOp );
- }
-
- public int getDepth(){
- return _depth;
- }
-
- public boolean isTemplateMember(){
- return _isTemplateMember;
- }
- public void setIsTemplateMember( boolean isMember ){
- _isTemplateMember = isMember;
- }
- public ISymbol getTemplateInstance(){
- return _templateInstance;
- }
- public void setTemplateInstance( TemplateInstance instance ){
- _templateInstance = instance;
- }
- public Map getArgumentMap(){
- return null;
- }
-
- public boolean getIsInvisible(){
- return _isInvisible;
- }
- public void setIsInvisible( boolean invisible ){
- _isInvisible = invisible ;
- }
-
- private String _name; //our name
- private ISymbolASTExtension _object; //the object associated with us
- private TypeInfo _typeInfo; //our type info
- private IContainerSymbol _containingScope; //the scope that contains us
- private int _depth; //how far down the scope stack we are
-
- private boolean _isInvisible = false; //used by friend declarations (11.4-9)
- private boolean _isTemplateMember = false;
- private TemplateInstance _templateInstance;
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ContainerSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ContainerSymbol.java
deleted file mode 100644
index 59753458afe..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ContainerSymbol.java
+++ /dev/null
@@ -1,793 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 IBM 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 Corp. - Rational Software - initial implementation
- ******************************************************************************/
-/*
- * Created on Nov 4, 2003
- */
-
-package org.eclipse.cdt.internal.core.parser.pst;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.core.parser.ast.IASTMember;
-import org.eclipse.cdt.core.parser.ast.IASTNode;
-import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.Command;
-import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.LookupData;
-
-/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-public class ContainerSymbol extends BasicSymbol implements IContainerSymbol {
-
- protected ContainerSymbol( ParserSymbolTable table, String name ){
- super( table, name );
- }
-
- protected ContainerSymbol( ParserSymbolTable table, String name, ISymbolASTExtension obj ){
- super( table, name, obj );
- }
-
- protected ContainerSymbol( ParserSymbolTable table, String name, TypeInfo.eType typeInfo ){
- super( table, name, typeInfo );
- }
-
- public Object clone(){
- ContainerSymbol copy = (ContainerSymbol)super.clone();
-
- copy._usingDirectives = ( _usingDirectives != null ) ? (LinkedList) _usingDirectives.clone() : null;
- copy._containedSymbols = ( _containedSymbols != null )? (HashMap) _containedSymbols.clone() : null;
-
- return copy;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#addSymbol(org.eclipse.cdt.internal.core.parser.pst.ISymbol)
- */
- public void addSymbol( ISymbol obj ) throws ParserSymbolTableException{
- IContainerSymbol containing = this;
-
- //handle enumerators
- if( obj.getType() == TypeInfo.t_enumerator ){
- //a using declaration of an enumerator will not be contained in a
- //enumeration.
- if( containing.getType() == TypeInfo.t_enumeration ){
- //Following the closing brace of an enum-specifier, each enumerator has the type of its
- //enumeration
- obj.setTypeSymbol( containing );
- //Each enumerator is declared in the scope that immediately contains the enum-specifier
- containing = containing.getContainingSymbol();
- }
- }
-
- //Templates contain 1 declaration
- if( getType() == TypeInfo.t_template ){
- //declaration must be a class or a function
- if( ( obj.getType() != TypeInfo.t_class && obj.getType() != TypeInfo.t_function ) ||
- ( getContainedSymbols() != null && getContainedSymbols().size() == 1 ) )
- {
- //throw new ParserSymbolTableException( ParserSymbolTableException.r_BadTemplate );
- }
- }
-
- Map declarations = containing.getContainedSymbols();
-
- boolean unnamed = obj.getName().equals( ParserSymbolTable.EMPTY_NAME );
-
- Object origObj = null;
-
- obj.setContainingSymbol( containing );
-
- //does this name exist already?
- origObj = declarations.get( obj.getName() );
-
- if( origObj != null )
- {
- ISymbol origDecl = null;
- LinkedList origList = null;
-
- if( origObj instanceof ISymbol ){
- origDecl = (ISymbol)origObj;
- } else if( origObj.getClass() == LinkedList.class ){
- origList = (LinkedList)origObj;
- } else {
- throw new ParserSymbolTableException( ParserSymbolTableException.r_InternalError );
- }
-
- boolean validOverride = ((origList == null) ? ParserSymbolTable.isValidOverload( origDecl, obj ) : ParserSymbolTable.isValidOverload( origList, obj ) );
- if( unnamed || validOverride )
- {
- if( origList == null ){
- origList = new LinkedList();
- origList.add( origDecl );
- origList.add( obj );
-
- declarations.remove( origDecl );
- declarations.put( obj.getName(), origList );
- } else {
- origList.add( obj );
- //origList is already in _containedDeclarations
- }
- } else {
- throw new ParserSymbolTableException( ParserSymbolTableException.r_InvalidOverload );
- }
- } else {
- declarations.put( obj.getName(), obj );
- }
-
- obj.setIsTemplateMember( isTemplateMember() || getType() == TypeInfo.t_template );
-
- Command command = new AddSymbolCommand( (ISymbol) obj, containing );
- getSymbolTable().pushCommand( command );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#hasUsingDirectives()
- */
- public boolean hasUsingDirectives(){
- return ( _usingDirectives != null && !_usingDirectives.isEmpty() );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#getUsingDirectives()
- */
- public List getUsingDirectives(){
- if( _usingDirectives == null ){
- _usingDirectives = new LinkedList();
- }
-
- return _usingDirectives;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#addUsingDirective(org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol)
- */
- public void addUsingDirective( IContainerSymbol namespace ) throws ParserSymbolTableException{
- if( namespace.getType() != TypeInfo.t_namespace ){
- throw new ParserSymbolTableException( ParserSymbolTableException.r_InvalidUsing );
- }
- //7.3.4 A using-directive shall not appear in class scope
- if( isType( TypeInfo.t_class, TypeInfo.t_union ) ){
- throw new ParserSymbolTableException( ParserSymbolTableException.r_InvalidUsing );
- }
-
- //handle namespace aliasing
- ISymbol alias = namespace.getTypeSymbol();
- if( alias != null && alias.isType( TypeInfo.t_namespace ) ){
- namespace = (IContainerSymbol) alias;
- }
-
- List usingDirectives = getUsingDirectives();
-
- usingDirectives.add( namespace );
-
- Command command = new AddUsingDirectiveCommand( this, namespace );
- getSymbolTable().pushCommand( command );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#addUsingDeclaration(java.lang.String)
- */
- /**
- * addUsingDeclaration
- * @param obj
- * @throws ParserSymbolTableException
- *
- * 7.3.3-9 The entity declared by a using-declaration shall be known in the
- * context using it according to its definition at the point of the using-
- * declaration. Definitions added to the namespace after the using-
- * declaration are not considered when a use of the name is made.
- *
- * 7.3.3-4 A using-declaration used as a member-declaration shall refer to a
- * member of a base class of the class being defined, shall refer to a
- * member of an anonymous union that is a member of a base class of the
- * class being defined, or shall refer to an enumerator for an enumeration
- * type that is a member of a base class of the class being defined.
- */
- public ISymbol addUsingDeclaration( String name ) throws ParserSymbolTableException {
- return addUsingDeclaration( name, null );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#addUsingDeclaration(java.lang.String, org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol)
- */
- public ISymbol addUsingDeclaration( String name, IContainerSymbol declContext ) throws ParserSymbolTableException{
- LookupData data = new LookupData( name, TypeInfo.t_any, null );
-
- if( declContext != null ){
- data.qualified = true;
- data.templateInstance = declContext.getTemplateInstance();
- ParserSymbolTable.lookup( data, declContext );
- } else {
- ParserSymbolTable.lookup( data, this );
- }
-
- //figure out which declaration we are talking about, if it is a set of functions,
- //then they will be in data.foundItems (since we provided no parameter info);
- ISymbol symbol = null;
- ISymbol clone = null;
- Iterator iter = null;
-
- try{
- symbol = ParserSymbolTable.resolveAmbiguities( data );
- } catch ( ParserSymbolTableException e ) {
- if( e.reason != ParserSymbolTableException.r_UnableToResolveFunction ){
- throw e;
- }
- }
-
- if( symbol == null && (data.foundItems == null || data.foundItems.isEmpty()) ){
- throw new ParserSymbolTableException( ParserSymbolTableException.r_InvalidUsing );
- }
-
- if( symbol == null ){
- Object object = data.foundItems.get( data.name );
- iter = ( object instanceof List ) ? ((List) object).iterator() : null;
- symbol = ( iter != null && iter.hasNext() ) ? (ISymbol)iter.next() : null;
- }
-
- while( symbol != null ){
- if( ParserSymbolTable.okToAddUsingDeclaration( symbol, this ) ){
- clone = (ISymbol) symbol.clone(); //7.3.3-9
- addSymbol( clone );
- } else {
- throw new ParserSymbolTableException( ParserSymbolTableException.r_InvalidUsing );
- }
-
- if( iter != null && iter.hasNext() ){
- symbol = (ISymbol) iter.next();
- } else {
- symbol = null;
- }
- }
-
- return clone;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#getContainedSymbols()
- */
- public Map getContainedSymbols(){
- if( _containedSymbols == null ){
- _containedSymbols = new HashMap();
- }
- return _containedSymbols;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#elaboratedLookup(org.eclipse.cdt.internal.core.parser.pst.TypeInfo.eType, java.lang.String)
- */
- public ISymbol elaboratedLookup( TypeInfo.eType type, String name ) throws ParserSymbolTableException{
- LookupData data = new LookupData( name, type, getTemplateInstance() );
-
- ParserSymbolTable.lookup( data, this );
-
- return ParserSymbolTable.resolveAmbiguities( data );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#lookup(java.lang.String)
- */
- public ISymbol lookup( String name ) throws ParserSymbolTableException {
- LookupData data = new LookupData( name, TypeInfo.t_any, getTemplateInstance() );
-
- ParserSymbolTable.lookup( data, this );
-
- return ParserSymbolTable.resolveAmbiguities( data );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#lookupMemberForDefinition(java.lang.String)
- */
- /**
- * LookupMemberForDefinition
- * @param name
- * @return Declaration
- * @throws ParserSymbolTableException
- *
- * In a definition for a namespace member in which the declarator-id is a
- * qualified-id, given that the qualified-id for the namespace member has
- * the form "nested-name-specifier unqualified-id", the unqualified-id shall
- * name a member of the namespace designated by the nested-name-specifier.
- *
- * ie:
- * you have this:
- * namespace A{
- * namespace B{
- * void f1(int);
- * }
- * using namespace B;
- * }
- *
- * if you then do this
- * void A::f1(int) { ... } //ill-formed, f1 is not a member of A
- * but, you can do this (Assuming f1 has been defined elsewhere)
- * A::f1( 1 ); //ok, finds B::f1
- *
- * ie, We need a seperate lookup function for looking up the member names
- * for a definition.
- */
- public ISymbol lookupMemberForDefinition( String name ) throws ParserSymbolTableException{
- LookupData data = new LookupData( name, TypeInfo.t_any, getTemplateInstance() );
- data.qualified = true;
-
- IContainerSymbol container = this;
-
- //handle namespace aliases
- if( container.isType( TypeInfo.t_namespace ) ){
- ISymbol symbol = container.getTypeSymbol();
- if( symbol != null && symbol.isType( TypeInfo.t_namespace ) ){
- container = (IContainerSymbol) symbol;
- }
- }
-
- data.foundItems = ParserSymbolTable.lookupInContained( data, container );
-
- return ParserSymbolTable.resolveAmbiguities( data );
- }
-
- public IParameterizedSymbol lookupMethodForDefinition( String name, List parameters ) throws ParserSymbolTableException{
- LookupData data = new LookupData( name, TypeInfo.t_any, getTemplateInstance() );
- data.qualified = true;
- data.parameters = ( parameters == null ) ? new LinkedList() : parameters;
-
- IContainerSymbol container = this;
-
- //handle namespace aliases
- if( container.isType( TypeInfo.t_namespace ) ){
- ISymbol symbol = container.getTypeSymbol();
- if( symbol != null && symbol.isType( TypeInfo.t_namespace ) ){
- container = (IContainerSymbol) symbol;
- }
- }
-
- data.foundItems = ParserSymbolTable.lookupInContained( data, container );
-
- ISymbol symbol = ParserSymbolTable.resolveAmbiguities( data );
- return (IParameterizedSymbol) (( symbol instanceof IParameterizedSymbol ) ? symbol : null);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#lookupNestedNameSpecifier(java.lang.String)
- */
- /**
- * Method LookupNestedNameSpecifier.
- * @param name
- * @return Declaration
- * The name of a class or namespace member can be referred to after the ::
- * scope resolution operator applied to a nested-name-specifier that
- * nominates its class or namespace. During the lookup for a name preceding
- * the ::, object, function and enumerator names are ignored. If the name
- * is not a class-name or namespace-name, the program is ill-formed
- */
- public IContainerSymbol lookupNestedNameSpecifier( String name ) throws ParserSymbolTableException {
- return lookupNestedNameSpecifier( name, this );
- }
- private IContainerSymbol lookupNestedNameSpecifier(String name, IContainerSymbol inSymbol ) throws ParserSymbolTableException{
- ISymbol foundSymbol = null;
-
- LookupData data = new LookupData( name, TypeInfo.t_namespace, getTemplateInstance() );
- data.filter.addAcceptedType( TypeInfo.t_class );
- data.filter.addAcceptedType( TypeInfo.t_struct );
- data.filter.addAcceptedType( TypeInfo.t_union );
-
- data.foundItems = ParserSymbolTable.lookupInContained( data, inSymbol );
-
- if( data.foundItems != null ){
- foundSymbol = (ISymbol) ParserSymbolTable.resolveAmbiguities( data );//, data.foundItems );
- }
-
- if( foundSymbol == null && inSymbol.getContainingSymbol() != null ){
- foundSymbol = lookupNestedNameSpecifier( name, inSymbol.getContainingSymbol() );
- }
-
- if( foundSymbol instanceof IContainerSymbol )
- return (IContainerSymbol) foundSymbol;
- else
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#qualifiedLookup(java.lang.String)
- */
- public ISymbol qualifiedLookup( String name ) throws ParserSymbolTableException{
-
- return qualifiedLookup(name, TypeInfo.t_any);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#qualifiedLookup(java.lang.String, org.eclipse.cdt.internal.core.parser.pst.TypeInfo.eType)
- */
- public ISymbol qualifiedLookup( String name, TypeInfo.eType t ) throws ParserSymbolTableException{
- LookupData data = new LookupData( name, t, getTemplateInstance() );
- data.qualified = true;
- ParserSymbolTable.lookup( data, this );
-
- return ParserSymbolTable.resolveAmbiguities( data );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#unqualifiedFunctionLookup(java.lang.String, java.util.List)
- */
- /**
- * UnqualifiedFunctionLookup
- * @param name
- * @param parameters
- * @return Declaration
- * @throws ParserSymbolTableException
- *
- * 3.4.2-1 When an unqualified name is used as the post-fix expression in a
- * function call, other namespaces not consdiered during the usual
- * unqualified lookup may be searched.
- *
- * 3.4.2-2 For each argument type T in the function call, there is a set of
- * zero or more associated namespaces and a set of zero or more associated
- * classes to be considered.
- *
- * If the ordinary unqualified lookup of the name find the declaration of a
- * class member function, the associated namespaces and classes are not
- * considered. Otherwise, the set of declarations found by the lookup of
- * the function name is the union of the set of declarations found using
- * ordinary unqualified lookup and the set of declarations found in the
- * namespaces and classes associated with the argument types.
- */
- public IParameterizedSymbol unqualifiedFunctionLookup( String name, List parameters ) throws ParserSymbolTableException{
- //figure out the set of associated scopes first, so we can remove those that are searched
- //during the normal lookup to avoid doing them twice
- HashSet associated = new HashSet();
-
- //collect associated namespaces & classes.
- int size = ( parameters == null ) ? 0 : parameters.size();
- Iterator iter = ( parameters == null ) ? null : parameters.iterator();
-
- TypeInfo param = null;
- ISymbol paramType = null;
- for( int i = size; i > 0; i-- ){
- param = (TypeInfo) iter.next();
- paramType = ParserSymbolTable.getFlatTypeInfo( param ).getTypeSymbol();
-
- if( paramType == null ){
- continue;
- }
-
- ParserSymbolTable.getAssociatedScopes( paramType, associated );
-
- //if T is a pointer to a data member of class X, its associated namespaces and classes
- //are those associated with the member type together with those associated with X
- if( param.hasPtrOperators() && param.getPtrOperators().size() == 1 ){
- TypeInfo.PtrOp op = (TypeInfo.PtrOp)param.getPtrOperators().iterator().next();
- if( op.getType() == TypeInfo.PtrOp.t_pointer &&
- paramType.getContainingSymbol().isType( TypeInfo.t_class, TypeInfo.t_union ) )
- {
- ParserSymbolTable.getAssociatedScopes( paramType.getContainingSymbol(), associated );
- }
- }
- }
-
- LookupData data = new LookupData( name, TypeInfo.t_function, getTemplateInstance() );
- //if parameters == null, thats no parameters, but we need to distinguish that from
- //no parameter information at all, so make an empty list.
- data.parameters = ( parameters == null ) ? new LinkedList() : parameters;
- data.associated = associated;
-
- ParserSymbolTable.lookup( data, this );
-
- ISymbol found = ParserSymbolTable.resolveAmbiguities( data );
-
- //if we haven't found anything, or what we found is not a class member, consider the
- //associated scopes
- if( found == null || found.getContainingSymbol().getType() != TypeInfo.t_class ){
-// if( found != null ){
-// data.foundItems.add( found );
-// }
-
- IContainerSymbol associatedScope;
- //dump the hash to an array and iterate over the array because we
- //could be removing items from the collection as we go and we don't
- //want to get ConcurrentModificationExceptions
- Object [] scopes = associated.toArray();
-
- size = associated.size();
-
- for( int i = 0; i < size; i++ ){
- associatedScope = (IContainerSymbol) scopes[ i ];
- if( associated.contains( associatedScope ) ){
- data.qualified = true;
- data.ignoreUsingDirectives = true;
- data.usingDirectivesOnly = false;
- ParserSymbolTable.lookup( data, associatedScope );
- }
- }
-
- found = ParserSymbolTable.resolveAmbiguities( data );
- }
-
- if( found instanceof IParameterizedSymbol )
- return (IParameterizedSymbol) found;
- else
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#memberFunctionLookup(java.lang.String, java.util.List)
- */
- /**
- * MemberFunctionLookup
- * @param name
- * @param parameters
- * @return Declaration
- * @throws ParserSymbolTableException
- *
- * Member lookup really proceeds as an unqualified lookup, but doesn't
- * include argument dependant scopes
- */
- public IParameterizedSymbol memberFunctionLookup( String name, List parameters ) throws ParserSymbolTableException{
- LookupData data = new LookupData( name, TypeInfo.t_function, getTemplateInstance() );
- //if parameters == null, thats no parameters, but we need to distinguish that from
- //no parameter information at all, so make an empty list.
- data.parameters = ( parameters == null ) ? new LinkedList() : parameters;
-
- ParserSymbolTable.lookup( data, (IContainerSymbol) this );
- return (IParameterizedSymbol) ParserSymbolTable.resolveAmbiguities( data );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#qualifiedFunctionLookup(java.lang.String, java.util.List)
- */
- public IParameterizedSymbol qualifiedFunctionLookup( String name, List parameters ) throws ParserSymbolTableException{
- LookupData data = new LookupData( name, TypeInfo.t_function, getTemplateInstance() );
- data.qualified = true;
- //if parameters == null, thats no parameters, but we need to distinguish that from
- //no parameter information at all, so make an empty list.
- data.parameters = ( parameters == null ) ? new LinkedList() : parameters;
-
- ParserSymbolTable.lookup( data, (IContainerSymbol)this );
-
- return (IParameterizedSymbol) ParserSymbolTable.resolveAmbiguities( data );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#templateLookup(java.lang.String, java.util.List)
- */
- public TemplateInstance templateLookup( String name, List arguments ) throws ParserSymbolTableException
- {
- LookupData data = new LookupData( name, TypeInfo.t_any, getTemplateInstance() );
- data.parameters = arguments;
-
- ParserSymbolTable.lookup( data, (IContainerSymbol) this );
- ISymbol found = ParserSymbolTable.resolveAmbiguities( data );
- if( found.isType( TypeInfo.t_template ) ){
- return ((IParameterizedSymbol) found).instantiate( arguments );
- }
- return null;
- }
-
- public List prefixLookup( TypeFilter filter, String prefix, boolean qualified ) throws ParserSymbolTableException{
- LookupData data = new LookupData( prefix, filter, getTemplateInstance() );
- data.qualified = qualified;
- data.mode = ParserSymbolTable.LookupMode.PREFIX;
-
- ParserSymbolTable.lookup( data, this );
-
- if( data.foundItems == null || data.foundItems.isEmpty() ){
- return null;
- } else {
- //remove any ambiguous symbols
- if( data.ambiguities != null && !data.ambiguities.isEmpty() ){
- Iterator iter = data.ambiguities.iterator();
- while( iter.hasNext() ){
- data.foundItems.remove( iter.next() );
- }
- }
-
- List list = new LinkedList();
-
- Iterator iter = data.foundItems.keySet().iterator();
- Object obj = null;
- while( iter.hasNext() ){
- obj = data.foundItems.get( iter.next() );
-
- if( obj instanceof List ){
- list.addAll( (List) obj );
- } else{
- list.add( obj );
- }
- }
-
- return list;
- }
- }
-
- public boolean isVisible( ISymbol symbol, IContainerSymbol qualifyingSymbol ){
- ISymbolASTExtension extension = symbol.getASTExtension();
- IASTNode node = extension.getPrimaryDeclaration();
-
- if( node instanceof IASTMember ){
- ASTAccessVisibility visibility;
- try {
- visibility = ParserSymbolTable.getVisibility( symbol, qualifyingSymbol );
- } catch (ParserSymbolTableException e) {
- return false;
- }
- if( visibility == ASTAccessVisibility.PUBLIC ){
- return true;
- }
-
- IContainerSymbol container = getContainingSymbol();
- IContainerSymbol symbolContainer = ( qualifyingSymbol != null ) ? qualifyingSymbol : symbol.getContainingSymbol();
-
- if( !symbolContainer.isType( TypeInfo.t_class, TypeInfo.t_union ) ||
- symbolContainer.equals( container ) )
- {
- return true;
- }
-
- //if this is a friend of the symbolContainer, then we are good
- if( isFriendOf( symbolContainer ) ){
- return true;
- }
-
- if( visibility == ASTAccessVisibility.PROTECTED )
- {
- try {
- return ( ParserSymbolTable.hasBaseClass( container, symbolContainer ) >= 0 );
- } catch (ParserSymbolTableException e) {
- return false;
- }
- } else { //PRIVATE
- return false;
- }
- }
- return true;
- }
-
- protected boolean isFriendOf( IContainerSymbol symbol ){
- if( symbol instanceof IDerivableContainerSymbol ){
- IContainerSymbol container = this.getContainingSymbol();
-
- while( container != null && container.isType( TypeInfo.t_block ) ){
- container = container.getContainingSymbol();
- }
- if( container != null && !container.isType( TypeInfo.t_class, TypeInfo.t_union ) ){
- container = null;
- }
-
- IDerivableContainerSymbol derivable = (IDerivableContainerSymbol) symbol;
-
- Iterator iter = derivable.getFriends().iterator();
- while( iter.hasNext() ){
- ISymbol friend = (ISymbol) iter.next();
- ISymbol typeSymbol = friend.getTypeSymbol();
- if( friend == this || typeSymbol == this ||
- friend == container || ( container != null && typeSymbol == container ) )
- {
- return true;
- }
- }
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol#instantiate(java.util.List)
- */
- public TemplateInstance instantiate( List arguments ) throws ParserSymbolTableException{
- if( getType() != TypeInfo.t_template ){
- return null;
- }
-
- //TODO uncomment when template specialization matching & ordering is working
- //IParameterizedSymbol template = ParserSymbolTable.matchTemplatePartialSpecialization( this, arguments );
- IParameterizedSymbol template = null;
-
- if( template == null ){
- template = (IParameterizedSymbol) this;
- }
-
- List paramList = template.getParameterList();
- int numParams = ( paramList != null ) ? paramList.size() : 0;
-
- if( numParams == 0 ){
- return null;
- }
-
- HashMap map = new HashMap();
- Iterator paramIter = paramList.iterator();
- Iterator argIter = arguments.iterator();
-
- ISymbol param = null;
- TypeInfo arg = null;
- for( int i = 0; i < numParams; i++ ){
- param = (ISymbol) paramIter.next();
-
- if( argIter.hasNext() ){
- arg = (TypeInfo) argIter.next();
- map.put( param, arg );
- } else {
- Object obj = param.getTypeInfo().getDefault();
- if( obj != null && obj instanceof TypeInfo ){
- map.put( param, obj );
- } else {
- throw new ParserSymbolTableException( ParserSymbolTableException.r_BadTemplate );
- }
- }
- }
-
- if( template.getContainedSymbols().size() != 1 ){
- throw new ParserSymbolTableException( ParserSymbolTableException.r_BadTemplate );
- }
-
- Iterator iter = template.getContainedSymbols().keySet().iterator();
- IContainerSymbol symbol = (IContainerSymbol) template.getContainedSymbols().get( iter.next() );
-
- TemplateInstance instance = new TemplateInstance( getSymbolTable(), symbol, map );
- return instance;
- }
-
- static private class AddSymbolCommand extends Command{
- AddSymbolCommand( ISymbol newDecl, IContainerSymbol context ){
- _symbol = newDecl;
- _context = context;
- }
-
- public void undoIt(){
- Object obj = _context.getContainedSymbols().get( _symbol.getName() );
-
- if( obj instanceof LinkedList ){
- LinkedList list = (LinkedList)obj;
- ListIterator iter = list.listIterator();
- int size = list.size();
- ISymbol item = null;
- for( int i = 0; i < size; i++ ){
- item = (ISymbol)iter.next();
- if( item == _symbol ){
- iter.remove();
- break;
- }
- }
- if( list.size() == 1 ){
- _context.getContainedSymbols().remove( _symbol.getName() );
- _context.getContainedSymbols().put( _symbol.getName(), list.getFirst() );
- }
- } else if( obj instanceof BasicSymbol ){
- _context.getContainedSymbols().remove( _symbol.getName() );
- }
-// if( _removeThis && _symbol instanceof IParameterizedSymbol ){
-// ((IParameterizedSymbol)_symbol).getContainedSymbols().remove( ParserSymbolTable.THIS );
-// }
- }
-
- private ISymbol _symbol;
- private IContainerSymbol _context;
- }
-
- static private class AddUsingDirectiveCommand extends Command{
- public AddUsingDirectiveCommand( IContainerSymbol container, IContainerSymbol namespace ){
- _decl = container;
- _namespace = namespace;
- }
- public void undoIt(){
- _decl.getUsingDirectives().remove( _namespace );
- }
- private IContainerSymbol _decl;
- private IContainerSymbol _namespace;
- }
-
- private LinkedList _usingDirectives; //collection of nominated namespaces
- private HashMap _containedSymbols; //declarations contained by us.
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/DerivableContainerSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/DerivableContainerSymbol.java
deleted file mode 100644
index 003b9830f7c..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/DerivableContainerSymbol.java
+++ /dev/null
@@ -1,388 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 IBM 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 Corp. - Rational Software - initial implementation
- ******************************************************************************/
-/*
- * Created on Nov 6, 2003
- */
-
-package org.eclipse.cdt.internal.core.parser.pst;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.Command;
-import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.LookupData;
-
-/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-public class DerivableContainerSymbol extends ContainerSymbol implements IDerivableContainerSymbol {
-
- protected DerivableContainerSymbol( ParserSymbolTable table, String name ){
- super( table, name );
- }
-
- protected DerivableContainerSymbol( ParserSymbolTable table, String name, ISymbolASTExtension obj ){
- super( table, name, obj );
- }
-
- protected DerivableContainerSymbol( ParserSymbolTable table, String name, TypeInfo.eType typeInfo ){
- super( table, name, typeInfo );
- }
-
-
- public Object clone(){
- DerivableContainerSymbol copy = (DerivableContainerSymbol)super.clone();
-
- copy._parentScopes = ( _parentScopes != null ) ? (LinkedList) _parentScopes.clone() : null;
- copy._constructors = ( _constructors != null ) ? (LinkedList) _constructors.clone() : null;
-
- return copy;
- }
-
- public void addSymbol(ISymbol symbol) throws ParserSymbolTableException {
- super.addSymbol( symbol );
-
- //take care of the this pointer
- if( symbol instanceof IParameterizedSymbol ){
- addThis( (IParameterizedSymbol) symbol );
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol#addParent(org.eclipse.cdt.internal.core.parser.pst.ISymbol)
- */
- public void addParent( ISymbol parent ){
- addParent( parent, false, ASTAccessVisibility.PUBLIC, -1, null );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol#addParent(org.eclipse.cdt.internal.core.parser.pst.ISymbol, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility, int, java.util.List)
- */
- public void addParent( ISymbol parent, boolean virtual, ASTAccessVisibility visibility, int offset, List references ){
- if( _parentScopes == null ){
- _parentScopes = new LinkedList();
- }
-
- ParentWrapper wrapper = new ParentWrapper( parent, virtual, visibility, offset, references );
- _parentScopes.add( wrapper );
-
- Command command = new AddParentCommand( this, wrapper );
- getSymbolTable().pushCommand( command );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol#getParents()
- */
- public List getParents(){
- if( _parentScopes == null ){
- _parentScopes = new LinkedList();
- }
- return _parentScopes;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol#hasParents()
- */
- public boolean hasParents(){
- return ( _parentScopes != null && !_parentScopes.isEmpty() );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol#addConstructor(org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol)
- */
- public void addConstructor(IParameterizedSymbol constructor) throws ParserSymbolTableException {
- if( !constructor.isType( TypeInfo.t_constructor ) )
- throw new ParserSymbolTableException( ParserSymbolTableException.r_BadTypeInfo );
-
- List constructors = getConstructors();
-
- if( constructors.size() == 0 || ParserSymbolTable.isValidOverload( constructors, constructor ) ){
- constructors.add( constructor );
- } else {
- throw new ParserSymbolTableException( ParserSymbolTableException.r_InvalidOverload );
- }
-
- constructor.setContainingSymbol( this );
- addThis( constructor );
-
- Command command = new AddConstructorCommand( constructor, this );
- getSymbolTable().pushCommand( command );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol#addCopyConstructor()
- */
- public void addCopyConstructor() throws ParserSymbolTableException{
- List parameters = new LinkedList();
-
- TypeInfo param = new TypeInfo( TypeInfo.t_type, 0, this, new TypeInfo.PtrOp( TypeInfo.PtrOp.t_reference, true, false ), false );
- parameters.add( param );
-
- IParameterizedSymbol constructor = lookupConstructor( parameters );
-
- if( constructor == null ){
- constructor = getSymbolTable().newParameterizedSymbol( getName(), TypeInfo.t_constructor );
- constructor.addParameter( this, new TypeInfo.PtrOp( TypeInfo.PtrOp.t_reference, true, false ), false );
- addConstructor( constructor );
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol#lookupConstructor(java.util.List)
- */
- public IParameterizedSymbol lookupConstructor( List parameters ) throws ParserSymbolTableException
- {
- LookupData data = new LookupData( ParserSymbolTable.EMPTY_NAME, TypeInfo.t_constructor, null );
- data.parameters = parameters;
-
- List constructors = new LinkedList();
- if( !getConstructors().isEmpty() )
- constructors.addAll( getConstructors() );
-
- return ParserSymbolTable.resolveFunction( data, constructors );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol#getConstructors()
- */
- public List getConstructors(){
- if( _constructors == null ){
- _constructors = new LinkedList();
- }
- return _constructors;
- }
-
- /**
- *
- * @param obj
- * @throws ParserSymbolTableException
- * 9.3.2-1 In the body of a nonstatic member function... the type of this of
- * a class X is X*. If the member function is declared const, the type of
- * this is const X*, if the member function is declared volatile, the type
- * of this is volatile X*....
- */
- private boolean addThis( IParameterizedSymbol obj ){
- if( getSymbolTable().getLanguage() != ParserLanguage.CPP ){
- return false;
- }
-
- TypeInfo type = obj.getTypeInfo();
- if( ( !type.isType( TypeInfo.t_function ) && !type.isType( TypeInfo.t_constructor) ) ||
- type.checkBit( TypeInfo.isStatic ) ){
- return false;
- }
-
- if( obj.getContainingSymbol().isType( TypeInfo.t_class, TypeInfo.t_union ) ){
- //check to see if there is already a this object, since using declarations
- //of function will have them from the original declaration
- boolean foundThis = false;
-
- LookupData data = new LookupData( ParserSymbolTable.THIS, TypeInfo.t_any, null );
- try {
- Map map = ParserSymbolTable.lookupInContained( data, obj );
- foundThis = map.containsKey( data.name );
- } catch (ParserSymbolTableException e) {
- return false;
- }
-
- //if we didn't find "this" then foundItems will still be null, no need to actually
- //check its contents
- if( !foundThis ){
- ISymbol thisObj = getSymbolTable().newSymbol( ParserSymbolTable.THIS, TypeInfo.t_type );
- thisObj.setTypeSymbol( obj.getContainingSymbol() );
- //thisObj.setCVQualifier( obj.getCVQualifier() );
- TypeInfo.PtrOp ptr = new TypeInfo.PtrOp();
- ptr.setType( TypeInfo.PtrOp.t_pointer );
- if( obj.getTypeInfo().hasPtrOperators() ){
- ptr.setConst( ((TypeInfo.PtrOp) obj.getPtrOperators().iterator().next()).isConst() );
- ptr.setVolatile( ((TypeInfo.PtrOp) obj.getPtrOperators().iterator().next()).isVolatile() );
- }
-
- thisObj.addPtrOperator(ptr);
-
- try{
- obj.addSymbol( thisObj );
- } catch ( ParserSymbolTableException e ) {
- //shouldn't happen because we checked that "this" didn't exist already
- return false;
- }
-
- }
- }
- return true;
- }
-
-
- /**
- *
- * @param name
- * @return Declaration
- * @throws ParserSymbolTableException
- *
- * 7.3.1.2-3 If a friend declaration in a non-local class first declares a
- * class or function, the friend class or function is a member of the
- * innermost enclosing namespace.
- *
- * TODO: if/when the parser symbol table starts caring about visibility
- * (public/protected/private) we will need to do more to record friendship.
- */
- public void addFriend( ISymbol friend ) throws ParserSymbolTableException{
- //is this symbol already in the table?
- IContainerSymbol containing = friend.getContainingSymbol();
- if( containing == null ){
- //its not, it goes in the innermost enclosing namespace
- IContainerSymbol enclosing = getContainingSymbol();
- while( enclosing != null && !enclosing.isType( TypeInfo.t_namespace ) ){
- enclosing = enclosing.getContainingSymbol();
- }
-
- friend.setIsInvisible( true );
- friend.setIsForwardDeclaration( true );
- enclosing.addSymbol( friend );
- }
-
- getFriends().add( friend );
- }
-
- /**
- * LookupForFriendship
- * @param name
- * @return Declaration
- * 7.3.1.2-3 When looking for a prior declaration of a class or a function
- * declared as a friend, scopes outside the innermost enclosing namespace
- * scope are not considered.
- * 11.4-9 If a friend declaration appears in a local class and the name
- * specified is an unqualified name, a prior declaration is looked up
- * without considering scopes that are outside the innermost enclosing non-
- * class scope.
- */
- public ISymbol lookupForFriendship( String name ) throws ParserSymbolTableException{
- LookupData data = new LookupData( name, TypeInfo.t_any, getTemplateInstance() );
-
- IContainerSymbol enclosing = getContainingSymbol();
- if( enclosing != null && enclosing.isType( TypeInfo.t_namespace, TypeInfo.t_union ) ){
- while( enclosing != null && ( enclosing.getType() != TypeInfo.t_namespace) )
- {
- enclosing = enclosing.getContainingSymbol();
- }
- }
- data.stopAt = enclosing;
-
- ParserSymbolTable.lookup( data, this );
- return ParserSymbolTable.resolveAmbiguities( data );
- }
-
- public IParameterizedSymbol lookupFunctionForFriendship( String name, List parameters ) throws ParserSymbolTableException{
- LookupData data = new LookupData( name, TypeInfo.t_any, getTemplateInstance() );
-
- data.parameters = parameters;
-
- IContainerSymbol enclosing = getContainingSymbol();
- if( enclosing != null && enclosing.isType( TypeInfo.t_namespace, TypeInfo.t_union ) ){
- while( enclosing != null && ( enclosing.getType() != TypeInfo.t_namespace) )
- {
- enclosing = enclosing.getContainingSymbol();
- }
- }
- data.stopAt = enclosing;
-
- ParserSymbolTable.lookup( data, this );
- return (IParameterizedSymbol) ParserSymbolTable.resolveAmbiguities( data );
- }
-
-
- public List getFriends(){
- if( _friends == null ){
- _friends = new LinkedList();
- }
- return _friends;
- }
-
- static private class AddParentCommand extends Command{
- public AddParentCommand( IDerivableContainerSymbol container, ParentWrapper wrapper ){
- _decl = container;
- _wrapper = wrapper;
- }
-
- public void undoIt(){
- List parents = _decl.getParents();
- parents.remove( _wrapper );
- }
-
- private IDerivableContainerSymbol _decl;
- private ParentWrapper _wrapper;
- }
-
- static private class AddConstructorCommand extends Command{
- AddConstructorCommand( IParameterizedSymbol newConstr, IDerivableContainerSymbol context ){
- _constructor = newConstr;
- _context = context;
- }
- public void undoIt(){
- List constructors = _context.getConstructors();
- ListIterator iter = constructors.listIterator();
-
- int size = constructors.size();
- IParameterizedSymbol item = null;
- for( int i = 0; i < size; i++ ){
- item = (IParameterizedSymbol)iter.next();
- if( item == _constructor ){
- iter.remove();
- break;
- }
- }
- }
-
- private IParameterizedSymbol _constructor;
- private IDerivableContainerSymbol _context;
- }
-
- public class ParentWrapper implements IDerivableContainerSymbol.IParentSymbol
- {
- public ParentWrapper( ISymbol p, boolean v, ASTAccessVisibility s, int offset, List r ){
- parent = p;
- isVirtual = v;
- access = s;
- this.offset = offset;
- this.references = r;
- }
-
- public void setParent( ISymbol parent ){ this.parent = parent; }
-
- public ISymbol getParent() { return parent; }
- public boolean isVirtual() { return isVirtual; }
-
- public void setVirtual( boolean virtual ){ isVirtual = virtual; }
-
- public ASTAccessVisibility getVisibility(){ return access; }
- public ASTAccessVisibility getAccess() { return access; }
-
- public int getOffset() { return offset; }
- public List getReferences() { return references; }
-
- private boolean isVirtual = false;
- protected ISymbol parent = null;
- private final ASTAccessVisibility access;
- private final int offset;
- private final List references;
- }
-
- private LinkedList _constructors; //constructor list
- private LinkedList _parentScopes; //inherited scopes (is base classes)
- private LinkedList _friends;
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ForewardDeclaredSymbolExtension.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ForewardDeclaredSymbolExtension.java
deleted file mode 100644
index c18052d3d00..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ForewardDeclaredSymbolExtension.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/**********************************************************************
- * 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.pst;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-import org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class ForewardDeclaredSymbolExtension extends AbstractSymbolExtension
-{
- /**
- * @author jcamelon
- *
- */
- private class DualIterator implements Iterator
- {
- private int state = 0;
- /**
- *
- */
- public DualIterator()
- {
- super();
- }
-
- /* (non-Javadoc)
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext()
- {
- if( state == 0 ) return true;
- if( state == 1 && definitionSymbol != null ) return true;
- return false;
- }
-
- /* (non-Javadoc)
- * @see java.util.Iterator#next()
- */
- public Object next()
- {
- switch( state )
- {
- case 0:
- state = 1;
- return primaryDeclaration;
- case 1:
- if( definitionSymbol != null )
- {
- state = 2;
- return definitionSymbol;
- }
- break;
- }
- throw new NoSuchElementException();
-
- }
-
- /* (non-Javadoc)
- * @see java.util.Iterator#remove()
- */
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- }
-
- protected ASTSymbol definitionSymbol = null;
- /**
- * @param symbol
- * @param primaryDeclaration
- */
- public ForewardDeclaredSymbolExtension(
- ISymbol symbol,
- ASTSymbol primaryDeclaration)
- {
- super(symbol, primaryDeclaration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension#getAllDefinitions()
- */
- public Iterator getAllDefinitions()
- {
- return new DualIterator();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension#addDefinition(org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol)
- */
- public void addDefinition(ASTSymbol definition) throws ExtensionException
- {
- if( definitionSymbol != null )
- throw new ExtensionException();
- definitionSymbol = definition;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IContainerSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IContainerSymbol.java
deleted file mode 100644
index 3aa91e4c59c..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IContainerSymbol.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 IBM 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 Corp. - Rational Software - initial implementation
- ******************************************************************************/
-/*
- * Created on May 9, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.cdt.internal.core.parser.pst;
-
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public interface IContainerSymbol extends ISymbol {
-
- public void addSymbol( ISymbol symbol ) throws ParserSymbolTableException;
-
- public boolean hasUsingDirectives();
- public List getUsingDirectives();
- public void addUsingDirective( IContainerSymbol namespace ) throws ParserSymbolTableException;
-
- public ISymbol addUsingDeclaration( String name ) throws ParserSymbolTableException;
- public ISymbol addUsingDeclaration( String name, IContainerSymbol declContext ) throws ParserSymbolTableException;
-
- public Map getContainedSymbols();
-
- public List prefixLookup( TypeFilter filter, String prefix, boolean qualified ) throws ParserSymbolTableException;
-
- public ISymbol elaboratedLookup( TypeInfo.eType type, String name ) throws ParserSymbolTableException;
- public ISymbol lookup( String name ) throws ParserSymbolTableException;
- public ISymbol lookupMemberForDefinition( String name ) throws ParserSymbolTableException;
- public IParameterizedSymbol lookupMethodForDefinition( String name, List parameters ) throws ParserSymbolTableException;
- public IContainerSymbol lookupNestedNameSpecifier( String name ) throws ParserSymbolTableException;
- public ISymbol qualifiedLookup( String name ) throws ParserSymbolTableException;
- public ISymbol qualifiedLookup( String name, TypeInfo.eType t ) throws ParserSymbolTableException;
- public IParameterizedSymbol unqualifiedFunctionLookup( String name, List parameters ) throws ParserSymbolTableException;
- public IParameterizedSymbol memberFunctionLookup( String name, List parameters ) throws ParserSymbolTableException;
- public IParameterizedSymbol qualifiedFunctionLookup( String name, List parameters ) throws ParserSymbolTableException;
- public TemplateInstance templateLookup( String name, List arguments ) throws ParserSymbolTableException;
- public TemplateInstance instantiate( List arguments ) throws ParserSymbolTableException;
-
- public boolean isVisible( ISymbol symbol, IContainerSymbol qualifyingSymbol );
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IDerivableContainerSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IDerivableContainerSymbol.java
deleted file mode 100644
index 985acc6bd73..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IDerivableContainerSymbol.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 IBM 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 Corp. - Rational Software - initial implementation
- ******************************************************************************/
-/*
- * Created on May 9, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.cdt.internal.core.parser.pst;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-
-/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public interface IDerivableContainerSymbol extends IContainerSymbol {
-
- public void addParent( ISymbol parent );
- public void addParent( ISymbol parent, boolean virtual, ASTAccessVisibility visibility, int offset, List references );
- public List getParents();
- public boolean hasParents();
-
- public void addConstructor( IParameterizedSymbol constructor ) throws ParserSymbolTableException;
- public void addCopyConstructor() throws ParserSymbolTableException;
- public IParameterizedSymbol lookupConstructor( List parameters ) throws ParserSymbolTableException;
- public List getConstructors();
-
- public void addFriend( ISymbol friend ) throws ParserSymbolTableException;
- public ISymbol lookupForFriendship( String name ) throws ParserSymbolTableException;
- public IParameterizedSymbol lookupFunctionForFriendship( String name, List parameters ) throws ParserSymbolTableException;
-
- public List getFriends();
-
- public interface IParentSymbol{
- public void setParent( ISymbol parent );
- public ISymbol getParent();
- public boolean isVirtual();
- public void setVirtual( boolean virtual );
-
- public ASTAccessVisibility getVisibility();
- public ASTAccessVisibility getAccess();
- public int getOffset();
- public List getReferences();
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IParameterizedSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IParameterizedSymbol.java
deleted file mode 100644
index 4dd4ca86c74..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IParameterizedSymbol.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 IBM 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 Corp. - Rational Software - initial implementation
- ******************************************************************************/
-/*
- * Created on May 9, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.cdt.internal.core.parser.pst;
-
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public interface IParameterizedSymbol extends IContainerSymbol {
-
- public void addParameter( ISymbol param );
- public void addParameter( TypeInfo.eType type, int info, TypeInfo.PtrOp ptrOp, boolean hasDefault );
- public void addParameter( ISymbol typeSymbol, TypeInfo.PtrOp ptrOp, boolean hasDefault );
-
- public void addArgument( ISymbol arg );
- public List getArgumentList();
- //public void setArgumentList( List list );
-
- public Map getParameterMap();
- public List getParameterList();
- //public void setParameterList( List list );
-
- public boolean hasSameParameters(IParameterizedSymbol newDecl);
-
- public void setReturnType( ISymbol type );
- public ISymbol getReturnType();
-
- public void setHasVariableArgs( boolean var );
- public boolean hasVariableArgs( );
-
- public boolean hasSpecializations();
- public void addSpecialization( IParameterizedSymbol spec );
- public List getSpecializations();
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISpecializedSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISpecializedSymbol.java
deleted file mode 100644
index cf44c75eb69..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISpecializedSymbol.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 IBM 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 Corp. - Rational Software - initial implementation
- ******************************************************************************/
-/*
- * Created on May 9, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.cdt.internal.core.parser.pst;
-
-/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public interface ISpecializedSymbol extends IParameterizedSymbol {
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbol.java
deleted file mode 100644
index d51184d6bca..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbol.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**********************************************************************
- * 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.pst;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author jcamelon
- *
- */
-public interface ISymbol extends Cloneable {
-
- public ParserSymbolTable getSymbolTable();
-
- public Object clone();
-
- public ISymbolASTExtension getASTExtension();
- public void setASTExtension( ISymbolASTExtension obj );
-
- public String getName();
-
- public IContainerSymbol getContainingSymbol();
- public void setContainingSymbol( IContainerSymbol containing );
-
- public boolean isType( TypeInfo.eType type );
- public boolean isType( TypeInfo.eType type, TypeInfo.eType upperType );
- public TypeInfo.eType getType();
- public void setType(TypeInfo.eType t);
- public TypeInfo getTypeInfo();
- public void setTypeInfo( TypeInfo info );
- public ISymbol getTypeSymbol();
- public void setTypeSymbol( ISymbol type );
-
- public boolean isForwardDeclaration();
- public void setIsForwardDeclaration( boolean forward );
-
- public int compareCVQualifiersTo( ISymbol symbol );
- public List getPtrOperators();
- public void addPtrOperator( TypeInfo.PtrOp ptrOp );
-
- public boolean isTemplateMember();
- public void setIsTemplateMember( boolean isMember );
- public ISymbol getTemplateInstance();
- public Map getArgumentMap();
- public void setTemplateInstance( TemplateInstance instance );
-
- public int getDepth();
- public boolean getIsInvisible();
- public void setIsInvisible( boolean invisible );
-
- /**
- * @param name
- */
- public void setName(String name);
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbolASTExtension.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbolASTExtension.java
deleted file mode 100644
index 9555a4d633d..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbolASTExtension.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**********************************************************************
- * 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.pst;
-
-import java.util.Iterator;
-
-import org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol;
-
-/**
- * @author jcamelon
- *
- */
-public interface ISymbolASTExtension extends ISymbolOwner
-{
- public class ExtensionException extends Exception
- {
- }
-
-
- public ASTSymbol getPrimaryDeclaration();
- public Iterator getAllDefinitions();
- public void addDefinition( ASTSymbol definition ) throws ExtensionException;
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbolOwner.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbolOwner.java
deleted file mode 100644
index 3f89e8b49b3..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbolOwner.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**********************************************************************
- * 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.pst;
-
-/**
- * @author jcamelon
- *
- */
-public interface ISymbolOwner
-{
- public ISymbol getSymbol();
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/NamespaceSymbolExtension.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/NamespaceSymbolExtension.java
deleted file mode 100644
index aafefa1092d..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/NamespaceSymbolExtension.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**********************************************************************
- * 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.pst;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-
-import org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class NamespaceSymbolExtension extends AbstractSymbolExtension
-{
- /**
- * @author jcamelon
- *
- */
- private class LocalIterator implements Iterator
- {
- private boolean donePrimary = false;
- private Iterator secondaries = otherDefinitions.iterator();
- /**
- *
- */
- public LocalIterator()
- {
- super();
- }
- /* (non-Javadoc)
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext()
- {
- if( ! donePrimary ) return true;
- return secondaries.hasNext();
- }
- /* (non-Javadoc)
- * @see java.util.Iterator#next()
- */
- public Object next()
- {
- if( ! hasNext() )
- throw new NoSuchElementException();
-
- if( ! donePrimary )
- {
- donePrimary = true;
- return primaryDeclaration;
- }
-
- return secondaries.next();
- }
- /* (non-Javadoc)
- * @see java.util.Iterator#remove()
- */
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- }
- protected List otherDefinitions = new ArrayList();
- /**
- * @param symbol
- * @param primaryDeclaration
- */
- public NamespaceSymbolExtension(
- ISymbol symbol,
- ASTSymbol primaryDeclaration)
- {
- super(symbol, primaryDeclaration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension#getAllDefinitions()
- */
- public Iterator getAllDefinitions()
- {
- return new LocalIterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension#addDefinition(org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol)
- */
- public void addDefinition(ASTSymbol definition) throws ExtensionException
- {
- otherDefinitions.add( definition );
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParameterizedSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParameterizedSymbol.java
deleted file mode 100644
index 076c65eb904..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParameterizedSymbol.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 IBM 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 Corp. - Rational Software - initial implementation
- ******************************************************************************/
-/*
- * Created on Nov 6, 2003
- */
-package org.eclipse.cdt.internal.core.parser.pst;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.Command;
-
-/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-public class ParameterizedSymbol extends ContainerSymbol implements IParameterizedSymbol {
-
- protected ParameterizedSymbol( ParserSymbolTable table, String name ){
- super( table, name );
- }
-
- protected ParameterizedSymbol( ParserSymbolTable table, String name, ISymbolASTExtension obj ){
- super( table, name, obj );
- }
-
- protected ParameterizedSymbol( ParserSymbolTable table, String name, TypeInfo.eType typeInfo ){
- super( table, name, typeInfo );
- }
-
- public Object clone(){
- ParameterizedSymbol copy = (ParameterizedSymbol)super.clone();
-
- copy._parameterList = ( _parameterList != null ) ? (LinkedList) _parameterList.clone() : null;
- copy._parameterMap = ( _parameterMap != null ) ? (HashMap) _parameterMap.clone() : null;
-
- copy._argumentList = ( _argumentList != null ) ? (LinkedList) _argumentList.clone() : null;
- copy._specializations = ( _specializations != null ) ? (LinkedList) _specializations.clone() : null;
-
- return copy;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#addParameter(org.eclipse.cdt.internal.core.parser.pst.ISymbol)
- */
- public void addParameter( ISymbol param ){
- List paramList = getParameterList();
-
- paramList.add( param );
-
- String name = param.getName();
- if( name != null && !name.equals(ParserSymbolTable.EMPTY_NAME) )
- {
- Map paramMap = getParameterMap();
-
- if( !paramMap.containsKey( name ) )
- paramMap.put( name, param );
- }
-
- param.setContainingSymbol( this );
- param.setIsTemplateMember( isTemplateMember() || getType() == TypeInfo.t_template );
-
- Command command = new AddParameterCommand( this, (BasicSymbol)param );
- getSymbolTable().pushCommand( command );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#addParameter(org.eclipse.cdt.internal.core.parser.pst.TypeInfo.eType, int, org.eclipse.cdt.internal.core.parser.pst.TypeInfo.PtrOp, boolean)
- */
- public void addParameter( TypeInfo.eType type, int info, TypeInfo.PtrOp ptrOp, boolean hasDefault ){
- BasicSymbol param = new BasicSymbol(getSymbolTable(), ParserSymbolTable.EMPTY_NAME);
-
- TypeInfo t = param.getTypeInfo();
- t.setTypeInfo( info );
- t.setType( type );
- t.addPtrOperator( ptrOp );
- t.setHasDefault( hasDefault );
-
- addParameter( param );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#addParameter(org.eclipse.cdt.internal.core.parser.pst.ISymbol, org.eclipse.cdt.internal.core.parser.pst.TypeInfo.PtrOp, boolean)
- */
- public void addParameter( ISymbol typeSymbol, TypeInfo.PtrOp ptrOp, boolean hasDefault ){
- BasicSymbol param = new BasicSymbol(getSymbolTable(), ParserSymbolTable.EMPTY_NAME);
-
- TypeInfo info = param.getTypeInfo();
- info.setType( TypeInfo.t_type );
- info.setTypeSymbol( typeSymbol );
- info.addPtrOperator( ptrOp );
- info.setHasDefault( hasDefault );
-
- addParameter( param );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#addArgument(org.eclipse.cdt.internal.core.parser.pst.ISymbol)
- */
- public void addArgument( ISymbol arg ){
- List argumentList = getArgumentList();
- argumentList.add( arg );
-
- arg.setIsTemplateMember( isTemplateMember() || getType() == TypeInfo.t_template );
-
- Command command = new AddArgumentCommand( this, (BasicSymbol) arg );
- getSymbolTable().pushCommand( command );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#getArgumentList()
- */
- public List getArgumentList(){
- if( _argumentList == null ){
- _argumentList = new LinkedList();
- }
- return _argumentList;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#setArgumentList(java.util.List)
- */
-// public void setArgumentList( List list ){
-// _argumentList = new LinkedList( list );
-// }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#getParameterMap()
- */
- public Map getParameterMap(){
- if( _parameterMap == null ){
- _parameterMap = new HashMap();
- }
- return _parameterMap;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#getParameterList()
- */
- public List getParameterList(){
- if( _parameterList == null ){
- _parameterList = new LinkedList();
- }
- return _parameterList;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#setParameterList(java.util.List)
- */
-// public void setParameterList( List list ){
-// _parameterList = new LinkedList( list );
-// }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#hasSameParameters(org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol)
- */
- public boolean hasSameParameters( IParameterizedSymbol function ){
- if( function.getType() != getType() ){
- return false;
- }
-
- int size = ( getParameterList() == null ) ? 0 : getParameterList().size();
- int fsize = ( function.getParameterList() == null ) ? 0 : function.getParameterList().size();
- if( fsize != size ){
- return false;
- }
- if( fsize == 0 )
- return true;
-
- Iterator iter = getParameterList().iterator();
- Iterator fIter = function.getParameterList().iterator();
-
- TypeInfo info = null;
- TypeInfo fInfo = null;
-
- for( int i = size; i > 0; i-- ){
- info = ((BasicSymbol)iter.next()).getTypeInfo();
- fInfo = ((BasicSymbol) fIter.next()).getTypeInfo();
-
- if( !info.equals( fInfo ) ){
- return false;
- }
- }
-
-
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#setReturnType(org.eclipse.cdt.internal.core.parser.pst.ISymbol)
- */
- public void setReturnType( ISymbol type ){
- _returnType = type;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#getReturnType()
- */
- public ISymbol getReturnType(){
- return _returnType;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#hasSpecializations()
- */
- public boolean hasSpecializations(){
- return ( _specializations != null && !_specializations.isEmpty() );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#addSpecialization(org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol)
- */
- public void addSpecialization( IParameterizedSymbol spec ){
- List specializationList = getSpecializations();
- specializationList.add( spec );
-
- spec.setContainingSymbol( getContainingSymbol() );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol#getSpecializations()
- */
- public List getSpecializations() {
- if( _specializations == null ){
- _specializations = new LinkedList();
- }
- return _specializations;
- }
-
- public void setHasVariableArgs( boolean var ){
- _hasVarArgs = var;
- }
-
- public boolean hasVariableArgs( ){
- return _hasVarArgs;
- }
-
- static private class AddParameterCommand extends Command{
- public AddParameterCommand( IParameterizedSymbol container, ISymbol parameter ){
- _decl = container;
- _param = parameter;
- }
-
- public void undoIt(){
- _decl.getParameterList().remove( _param );
-
- String name = _param.getName();
- if( name != null && !name.equals( ParserSymbolTable.EMPTY_NAME) )
- {
- _decl.getParameterMap().remove( name );
- }
- }
-
- private IParameterizedSymbol _decl;
- private ISymbol _param;
- }
-
- static private class AddArgumentCommand extends Command{
- public AddArgumentCommand( IParameterizedSymbol container, ISymbol arg ){
- _decl = container;
- _arg = arg;
- }
- public void undoIt(){
- _decl.getArgumentList().remove( _arg );
- }
-
- private IParameterizedSymbol _decl;
- private ISymbol _arg;
- }
-
- private LinkedList _parameterList; //have my cake
- private HashMap _parameterMap; //and eat it too
- private LinkedList _specializations; //template specializations
- private LinkedList _argumentList; //template specialization arguments
- private ISymbol _returnType;
- private boolean _hasVarArgs = false; //whether or not this function has variable arguments
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java
deleted file mode 100644
index 891b65e8874..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java
+++ /dev/null
@@ -1,2481 +0,0 @@
-/**********************************************************************
- * 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.parser.pst;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.cdt.core.parser.Enum;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.core.parser.ast.IASTMember;
-import org.eclipse.cdt.core.parser.ast.IASTNode;
-import org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol.IParentSymbol;
-import org.eclipse.cdt.internal.core.parser.pst.TypeInfo.PtrOp;
-
-/**
- * @author aniefer
- */
-
-public class ParserSymbolTable {
-
- public static final String EMPTY_NAME = ""; //$NON-NLS-1$
- public static final String THIS = "this"; //$NON-NLS-1$
-
- /**
- * Constructor for ParserSymbolTable.
- */
- public ParserSymbolTable( ParserLanguage language ) {
- super();
- _compilationUnit = newContainerSymbol( EMPTY_NAME, TypeInfo.t_namespace );
- _language = language;
- }
-
- public IContainerSymbol getCompilationUnit(){
- return _compilationUnit;
- }
-
- public IContainerSymbol newContainerSymbol( String name ){
- return new ContainerSymbol( this, name );
- }
- public IContainerSymbol newContainerSymbol( String name, TypeInfo.eType type ){
- return new ContainerSymbol( this, name, type );
- }
-
- public ISymbol newSymbol( String name ){
- return new BasicSymbol( this, name );
- }
- public ISymbol newSymbol( String name, TypeInfo.eType type ){
- return new BasicSymbol( this, name, type );
- }
-
- public IDerivableContainerSymbol newDerivableContainerSymbol( String name ){
- return new DerivableContainerSymbol( this, name );
- }
- public IDerivableContainerSymbol newDerivableContainerSymbol( String name, TypeInfo.eType type ){
- return new DerivableContainerSymbol( this, name, type );
- }
- public IParameterizedSymbol newParameterizedSymbol( String name ){
- return new ParameterizedSymbol( this, name );
- }
- public IParameterizedSymbol newParameterizedSymbol( String name, TypeInfo.eType type ){
- return new ParameterizedSymbol( this, name, type );
- }
- public ISpecializedSymbol newSpecializedSymbol( String name ){
- return new SpecializedSymbol( this, name );
- }
-// public ISpecializedSymbol newSpecializedSymbol( String name, TypeInfo.eType type ){
-// return new Declaration( this, name, type );
-// }
- /**
- * Lookup the name from LookupData starting in the inDeclaration
- * @param data
- * @param inDeclaration
- * @return Declaration
- * @throws ParserSymbolTableException
- */
- static protected void lookup( LookupData data, IContainerSymbol inSymbol ) throws ParserSymbolTableException
- {
-// if( data.type != TypeInfo.t_any && data.type.compareTo(TypeInfo.t_class) < 0 && data.upperType.compareTo(TypeInfo.t_union) > 0 ){
-// throw new ParserSymbolTableException( ParserSymbolTableException.r_BadTypeInfo );
-// }
-
- //handle namespace aliases
- if( inSymbol.isType( TypeInfo.t_namespace ) ){
- ISymbol symbol = inSymbol.getTypeSymbol();
- if( symbol != null && symbol.isType( TypeInfo.t_namespace ) ){
- inSymbol = (IContainerSymbol) symbol;
- }
- }
-
- ISymbol symbol = null; //the return value
- LinkedList transitives = new LinkedList(); //list of transitive using directives
-
- //if this name define in this scope?
- Map map = null;
- if( !data.usingDirectivesOnly ){
- map = lookupInContained( data, inSymbol );
- if( data.foundItems == null || data.foundItems.isEmpty() ){
- data.foundItems = map;
- } else {
- mergeResults( data, data.foundItems, map );
- }
- }
-
- if( inSymbol.getSymbolTable().getLanguage() == ParserLanguage.CPP &&
- !data.ignoreUsingDirectives )
- {
- //check nominated namespaces
- //the transitives list is populated in LookupInNominated, and then
- //processed in ProcessDirectives
-
- data.visited.clear(); //each namesapce is searched at most once, so keep track
-
- lookupInNominated( data, inSymbol, transitives );
-
- //if we are doing a qualified lookup, only process using directives if
- //we haven't found the name yet (and if we aren't ignoring them).
- if( !data.qualified || data.foundItems == null || data.foundItems.isEmpty() ){
- processDirectives( inSymbol, data, transitives );
-
- if( inSymbol.hasUsingDirectives() ){
- processDirectives( inSymbol, data, inSymbol.getUsingDirectives() );
- }
-
- while( data.usingDirectives != null && data.usingDirectives.get( inSymbol ) != null ){
- transitives.clear();
-
- lookupInNominated( data, inSymbol, transitives );
-
- if( !data.qualified || data.foundItems == null ){
- processDirectives( inSymbol, data, transitives );
- }
- }
- }
- }
-
- if( data.mode == LookupMode.NORMAL && ( !data.foundItems.isEmpty() || data.stopAt == inSymbol ) ){
- return;
- }
-
- if( !data.usingDirectivesOnly && inSymbol instanceof IDerivableContainerSymbol ){
- //if we still havn't found it, check any parents we have
- data.visited.clear(); //each virtual base class is searched at most once
- map = lookupInParents( data, (IDerivableContainerSymbol)inSymbol );
-
- if( data.foundItems == null || data.foundItems.isEmpty() ){
- data.foundItems = map;
- } else {
- mergeInheritedResults( data.foundItems, map );
- }
- }
-
- //if still not found, check our containing scope.
- if( ( data.foundItems == null || data.foundItems.isEmpty() || data.mode == LookupMode.PREFIX )
- && inSymbol.getContainingSymbol() != null )
- {
- if( data.qualified ){
- if( data.usingDirectives != null && !data.usingDirectives.isEmpty() ){
- data.usingDirectivesOnly = true;
- lookup( data, inSymbol.getContainingSymbol() );
-
- }
- } else {
- lookup( data, inSymbol.getContainingSymbol() );
- }
-
- }
-
- return;
- }
-
- /**
- * function LookupInNominated
- * @param data
- * @param transitiveDirectives
- * @return List
- *
- * for qualified:
- * 3.4.3.2-2 "let S be the set of all declarations of m in X
- * and in the transitive closure of all namespaces nominated by using-
- * directives in X and its used namespaces, except that using-directives are
- * ignored in any namespace, including X, directly containing one or more
- * declarations of m."
- *
- * for unqualified:
- * 7.3.4-2 The using-directive is transitive: if a scope contains a using
- * directive that nominates a second namespace that itself contains using-
- * directives, the effect is as if the using-directives from the second
- * namespace also appeared in the first.
- */
- static private void lookupInNominated( LookupData data, IContainerSymbol symbol, LinkedList transitiveDirectives ) throws ParserSymbolTableException{
- //if the data.usingDirectives is empty, there is nothing to do.
- if( data.usingDirectives == null ){
- return;
- }
-
- //local variables
- LinkedList directives = null; //using directives association with declaration
- Iterator iter = null;
- IContainerSymbol temp = null;
-
- boolean foundSomething = false;
- int size = 0;
-
- directives = (LinkedList) data.usingDirectives.remove( symbol );
-
- if( directives == null ){
- return;
- }
-
- iter = directives.iterator();
- size = directives.size();
- for( int i = size; i > 0; i-- ){
- temp = (IContainerSymbol) iter.next();
-
- //namespaces are searched at most once
- if( !data.visited.contains( temp ) ){
- data.visited.add( temp );
-
- Map map = lookupInContained( data, temp );
- foundSomething = !map.isEmpty();
- mergeResults( data, data.foundItems, map );
-
- //only consider the transitive using directives if we are an unqualified
- //lookup, or we didn't find the name in decl
- if( (!data.qualified || !foundSomething || data.mode == LookupMode.PREFIX ) && temp.getUsingDirectives() != null ){
- //name wasn't found, add transitive using directives for later consideration
- transitiveDirectives.addAll( temp.getUsingDirectives() );
- }
- }
- }
-
- return;
- }
-
- /**
- * @param map
- * @param map2
- */
- private static void mergeResults( LookupData data, Map resultMap, Map map ) throws ParserSymbolTableException {
- if( resultMap == null || map == null || map.isEmpty() ){
- return;
- }
-
- Iterator keyIterator = map.keySet().iterator();
- Object key = null;
- while( keyIterator.hasNext() ){
- key = keyIterator.next();
- if( resultMap.containsKey( key ) ){
- List list = new LinkedList();
- Object obj = resultMap.get( key );
-
- if ( obj instanceof List ) list.addAll( (List) obj );
- else list.add( obj );
-
- obj = map.get( key );
-
- if( obj instanceof List ) list.addAll( (List) obj );
- else list.add( obj );
-
- resultMap.put( key, collectSymbol( data, list ) );
- } else {
- resultMap.put( key, map.get( key ) );
- }
- }
- }
-
- /**
- * function LookupInContained
- * @param data
- * @return List
- *
- * Look for data.name in our collection _containedDeclarations
- */
- protected static Map lookupInContained( LookupData data, IContainerSymbol lookIn ) throws ParserSymbolTableException{
- Map found = new LinkedHashMap();
-
- boolean foundSomething = false;
- ISymbol temp = null;
- Object obj = null;
-
- if( data.associated != null ){
- //we are looking in lookIn, remove it from the associated scopes list
- data.associated.remove( lookIn );
- }
-
- Map declarations = lookIn.getContainedSymbols();
-
- Iterator iterator = ( data.mode == LookupMode.PREFIX ) ? declarations.keySet().iterator() : null;
- String name = ( iterator != null && iterator.hasNext() ) ? (String) iterator.next() : data.name;
-
- while( name != null ) {
- if( nameMatches( data, name ) ){
- obj = ( declarations != null ) ? declarations.get( name ) : null;
-
- obj = collectSymbol( data, obj );
-
- if( obj != null )
- found.put( name, obj );
- }
-
- if( iterator != null && iterator.hasNext() ){
- name = (String) iterator.next();
- } else {
- name = null;
- }
- }
-
- if( !found.isEmpty() && data.mode == LookupMode.NORMAL ){
- return found;
- }
-
- if( lookIn instanceof IParameterizedSymbol ){
- Map parameters = ((IParameterizedSymbol)lookIn).getParameterMap();
- if( parameters != null ){
- iterator = ( data.mode == LookupMode.PREFIX ) ? parameters.keySet().iterator() : null;
- name = ( iterator != null && iterator.hasNext() ) ? (String) iterator.next() : data.name;
- while( name != null ){
- if( nameMatches( data, name ) ){
- obj = parameters.get( name );
- obj = collectSymbol( data, obj );
- if( obj != null ){
- found.put( name, obj );
- }
- }
- if( iterator != null && iterator.hasNext() ){
- name = (String) iterator.next();
- } else {
- name = null;
- }
- }
-
- }
- }
-
- return found;
- }
-
- private static boolean nameMatches( LookupData data, String name ){
- if( data.mode == LookupMode.PREFIX ){
- return name.regionMatches( true, 0, data.name, 0, data.name.length() );
- } else {
- return name.equals( data.name );
- }
- }
- private static boolean checkType( LookupData data, ISymbol symbol ) { //, TypeInfo.eType type, TypeInfo.eType upperType ){
- if( data.filter == null ){
- return true;
- }
-
- if( data.templateInstance != null && symbol.isTemplateMember() ){
- if( symbol.isType( TypeInfo.t_type ) ){
- symbol = symbol.getTypeSymbol();
- }
- if( symbol.isType( TypeInfo.t_undef ) && symbol.getContainingSymbol().isType( TypeInfo.t_template ) ){
- TypeInfo info = (TypeInfo) data.templateInstance.getArgumentMap().get( symbol );
- return data.filter.shouldAccept( symbol, info );
- }
- }
- return data.filter.shouldAccept( symbol );
- }
-
- private static Object collectSymbol(LookupData data, Object object ) throws ParserSymbolTableException {
- if( object == null ){
- return null;
- }
-
- ISymbol foundSymbol = null;
-
- Iterator iter = ( object instanceof List ) ? ((List)object).iterator() : null;
- ISymbol symbol = ( iter != null ) ? (ISymbol) iter.next() : (ISymbol) object;
-
- Set functionSet = new HashSet();
- ISymbol obj = null;
- IContainerSymbol cls = null;
-
- while( symbol != null ){
- if( !symbol.getIsInvisible() && checkType( data, symbol ) ){//, data.type, data.upperType ) ){
- if( symbol.isTemplateMember() && data.templateInstance != null )
- foundSymbol = new TemplateInstance( symbol.getSymbolTable(), symbol, data.templateInstance.getArgumentMap() );
- else
- foundSymbol = symbol;
-
- if( foundSymbol.isType( TypeInfo.t_function ) ){
- if( foundSymbol.isForwardDeclaration() && foundSymbol.getTypeSymbol() != null ){
- foundSymbol = foundSymbol.getTypeSymbol();
- }
-
- functionSet.add( foundSymbol );
- } else {
- //if this is a class-name, other stuff hides it
- if( foundSymbol.isType( TypeInfo.t_class, TypeInfo.t_enumeration ) ){
- if( cls == null ){
- cls = (IContainerSymbol) foundSymbol;
- } else {
- if( cls.getTypeInfo().isForwardDeclaration() && cls.getTypeSymbol() == foundSymbol ){
- //cls is a forward declaration of decl, we want decl.
- cls = (IContainerSymbol) foundSymbol;
- } else if( foundSymbol.getTypeInfo().isForwardDeclaration() && foundSymbol.getTypeSymbol() == cls ){
- //decl is a forward declaration of cls, we already have what we want (cls)
- } else {
- if( data.mode == LookupMode.PREFIX ){
- if( data.ambiguities == null ){
- data.ambiguities = new HashSet();
- }
- data.ambiguities.add( foundSymbol.getName() );
- } else {
- throw new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous );
- }
- }
- }
- } else {
- //an object, can only have one of these
- if( obj == null ){
- obj = foundSymbol;
- } else {
- if( data.mode == LookupMode.PREFIX ){
- if( data.ambiguities == null ){
- data.ambiguities = new HashSet();
- }
- data.ambiguities.add( foundSymbol.getName() );
- } else {
- throw new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous );
- }
- }
- }
- }
- }
-
- if( iter != null ){
- symbol = iter.hasNext() ? (ISymbol) iter.next() : null;
- } else {
- symbol = null;
- }
- }
-
- int numFunctions = functionSet.size();
-
- boolean ambiguous = false;
-
- if( cls != null ){
- //the class is only hidden by other stuff if they are from the same scope
- if( obj != null && cls.getContainingSymbol() != obj.getContainingSymbol()){
- ambiguous = true;
- }
- if( !functionSet.isEmpty() ){
- Iterator fnIter = functionSet.iterator();
- IParameterizedSymbol fn = null;
- for( int i = numFunctions; i > 0; i-- ){
- fn = (IParameterizedSymbol) fnIter.next();
- if( cls.getContainingSymbol()!= fn.getContainingSymbol()){
- ambiguous = true;
- break;
- }
- }
- }
- }
-
- if( obj != null && !ambiguous ){
- if( numFunctions > 0 ){
- ambiguous = true;
- } else {
- return obj;
- }
- } else if( numFunctions > 0 ) {
- return new LinkedList( functionSet );
- }
-
- if( ambiguous ){
- if( data.mode == LookupMode.PREFIX ){
- if( data.ambiguities == null ){
- data.ambiguities = new HashSet();
- }
- data.ambiguities.add( foundSymbol.getName() );
- } else {
- throw new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous );
- }
- }
-
- return cls;
- }
- /**
- *
- * @param data
- * @param lookIn
- * @return Declaration
- * @throws ParserSymbolTableException
- */
- private static Map lookupInParents( LookupData data, ISymbol lookIn ) throws ParserSymbolTableException{
- IDerivableContainerSymbol container = null;
- /*if( lookIn instanceof TemplateInstance ){
-
- } else*/
- if( lookIn instanceof IDerivableContainerSymbol ){
- container = (IDerivableContainerSymbol) lookIn;
- } else{
- throw new ParserSymbolTableException( ParserSymbolTableException.r_InternalError );
- }
-
- List scopes = container.getParents();
-
- Map temp = null;
- Map symbol = null;
- Map inherited = null;
-
- Iterator iterator = null;
- IDerivableContainerSymbol.IParentSymbol wrapper = null;
-
- if( scopes == null )
- return null;
-
- //use data to detect circular inheritance
- if( data.inheritanceChain == null )
- data.inheritanceChain = new HashSet();
-
- data.inheritanceChain.add( container );
-
- iterator = scopes.iterator();
-
- int size = scopes.size();
-
- for( int i = size; i > 0; i-- )
- {
- wrapper = (IDerivableContainerSymbol.IParentSymbol) iterator.next();
- ISymbol parent = wrapper.getParent();
- if( parent.isType( TypeInfo.t_undef ) && parent.getContainingSymbol().isType( TypeInfo.t_template ) ){
- TypeInfo info = (TypeInfo) data.templateInstance.getArgumentMap().get( parent );
- if( info.getTypeSymbol() instanceof IDerivableContainerSymbol ){
- parent = (IDerivableContainerSymbol) info.getTypeSymbol();
- } else {
- throw new ParserSymbolTableException( ParserSymbolTableException.r_BadTemplate );
- }
- }
- if( !wrapper.isVirtual() || !data.visited.contains( parent ) ){
- if( wrapper.isVirtual() ){
- data.visited.add( parent );
- }
-
- //if the inheritanceChain already contains the parent, then that
- //is circular inheritance
- if( ! data.inheritanceChain.contains( parent ) ){
- //is this name define in this scope?
- if( parent instanceof TemplateInstance ){
- ISymbol tempInstance = data.templateInstance;
- data.templateInstance = (TemplateInstance) parent;
- ISymbol instance = ((TemplateInstance)parent).getInstantiatedSymbol();
- if( instance instanceof IContainerSymbol )
- temp = lookupInContained( data, (IContainerSymbol)instance );
- else
- throw new ParserSymbolTableException( ParserSymbolTableException.r_BadTemplate );
- data.templateInstance = tempInstance;
- } else if( parent instanceof IDerivableContainerSymbol ){
- temp = lookupInContained( data, (IDerivableContainerSymbol) parent );
- } else {
- throw new ParserSymbolTableException( ParserSymbolTableException.r_BadTypeInfo );
- }
-
- if( temp.isEmpty() || data.mode == LookupMode.PREFIX ){
- inherited = lookupInParents( data, parent );
- mergeInheritedResults( temp, inherited );
- }
- } else {
- throw new ParserSymbolTableException( ParserSymbolTableException.r_CircularInheritance );
- }
- }
-
- if( temp != null && !temp.isEmpty() ){
- if( symbol == null || symbol.isEmpty() ){
- symbol = temp;
- } else if ( temp != null && !temp.isEmpty() ) {
- Iterator iter = temp.keySet().iterator();
- Object key = null;
- while( iter.hasNext() ){
- key = iter.next();
- if( symbol.containsKey( key ) ){
- ISymbol sym = (ISymbol) symbol.get( key );
- if( !checkAmbiguity( sym, temp.get( key ) ) ){
- if( data.mode == LookupMode.PREFIX ){
- if( data.ambiguities == null ){
- data.ambiguities = new HashSet();
- }
- data.ambiguities.add( sym.getName() );
- } else {
- throw new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous );
- }
- }
- } else {
- symbol.put( key, temp.get( key ) );
- }
- }
- }
- } else {
- temp = null; //reset temp for next iteration
- }
- }
-
- data.inheritanceChain.remove( container );
-
- return symbol;
- }
-
- private static boolean checkAmbiguity( Object obj1, Object obj2 ) throws ParserSymbolTableException{
- //it is not ambiguous if they are the same thing and it is static or an enumerator
- if( obj1 == obj2 ){
-
- Iterator iter = ( obj1 instanceof List ) ? ((List) obj1).iterator() : null;
- ISymbol symbol = ( iter != null ) ? (ISymbol) iter.next() : ( ISymbol )obj1;
- while( symbol != null ) {
- TypeInfo type = ((ISymbol)obj1).getTypeInfo();
- if( !type.checkBit( TypeInfo.isStatic ) && !type.isType( TypeInfo.t_enumerator ) ){
- return false;
- }
-
- if( iter != null && iter.hasNext() ){
- symbol = (ISymbol) iter.next();
- } else {
- symbol = null;
- }
- }
- return true;
- }
- return false;
- }
-
- /**
- * Symbols in map are added to the resultMap if a symbol with that name does not already exist there
- * @param resultMap
- * @param map
- * @throws ParserSymbolTableException
- */
- private static void mergeInheritedResults( Map resultMap, Map map ) throws ParserSymbolTableException{
- if( resultMap == null || map == null || map.isEmpty() ){
- return;
- }
-
- Iterator keyIterator = map.keySet().iterator();
- Object key = null;
- while( keyIterator.hasNext() ){
- key = keyIterator.next();
- if( !resultMap.containsKey( key ) ){
- resultMap.put( key, map.get( key ) );
- }
- }
- }
-
- /**
- * function isValidOverload
- * @param origDecl
- * @param newDecl
- * @return boolean
- *
- * 3.3.7 "A class name or enumeration name can be hidden by the name of an
- * object, function or enumerator declared in the same scope"
- *
- * 3.4-1 "Name lookup may associate more than one declaration with a name if
- * it finds the name to be a function name"
- */
- protected static boolean isValidOverload( ISymbol origSymbol, ISymbol newSymbol ){
- TypeInfo.eType origType = origSymbol.getType();
- TypeInfo.eType newType = newSymbol.getType();
-
- //handle forward decls
- if( origSymbol.getTypeInfo().isForwardDeclaration() ){
- if( origSymbol.getTypeSymbol() == newSymbol )
- return true;
-
- //friend class declarations
- if( origSymbol.getIsInvisible() && origSymbol.isType( newSymbol.getType() ) ){
- origSymbol.getTypeInfo().setTypeSymbol( newSymbol );
- return true;
- }
- }
-
- if( (origType.compareTo(TypeInfo.t_class) >= 0 && origType.compareTo(TypeInfo.t_enumeration) <= 0) && //class name or enumeration ...
- ( newType == TypeInfo.t_type || (newType.compareTo( TypeInfo.t_function ) >= 0 /*&& newType <= TypeInfo.typeMask*/) ) ){
-
- return true;
- }
- //if the origtype is not a class-name or enumeration name, then the only other
- //allowable thing is if they are both functions.
- if( origSymbol instanceof IParameterizedSymbol && newSymbol instanceof IParameterizedSymbol )
- return isValidFunctionOverload( (IParameterizedSymbol) origSymbol, (IParameterizedSymbol) newSymbol );
- else
- return false;
- }
-
- protected static boolean isValidOverload( List origList, ISymbol newSymbol ){
- if( origList.size() == 1 ){
- return isValidOverload( (ISymbol)origList.iterator().next(), newSymbol );
- } else if ( origList.size() > 1 ){
-
- //the first thing can be a class-name or enumeration name, but the rest
- //must be functions. So make sure the newDecl is a function before even
- //considering the list
- if( newSymbol.getType() != TypeInfo.t_function && newSymbol.getType() != TypeInfo.t_constructor ){
- return false;
- }
-
- Iterator iter = origList.iterator();
- ISymbol symbol = (ISymbol) iter.next();
- boolean valid = isValidOverload( symbol, newSymbol );//( (symbol.getType().compareTo( TypeInfo.t_class ) >= 0 ) && (symbol.getType().compareTo( TypeInfo.t_enumeration ) <= 0 ) );
-
- if( !valid && (symbol instanceof IParameterizedSymbol) )
- valid = isValidFunctionOverload( (IParameterizedSymbol)symbol, (IParameterizedSymbol)newSymbol );
-
- while( valid && iter.hasNext() ){
- symbol = (ISymbol) iter.next();
- valid = ( symbol instanceof IParameterizedSymbol) && isValidFunctionOverload( (IParameterizedSymbol)symbol, (IParameterizedSymbol)newSymbol );
- }
-
- return valid;
- }
-
- //empty list, return true
- return true;
- }
-
- private static boolean isValidFunctionOverload( IParameterizedSymbol origSymbol, IParameterizedSymbol newSymbol ){
- if( ( !origSymbol.isType( TypeInfo.t_function ) && !origSymbol.isType( TypeInfo.t_constructor ) ) ||
- ( ! newSymbol.isType( TypeInfo.t_function ) && ! newSymbol.isType( TypeInfo.t_constructor ) ) ){
- return false;
- }
-
- //handle forward decls
- if( origSymbol.getTypeInfo().isForwardDeclaration() &&
- origSymbol.getTypeSymbol() == newSymbol )
- {
- return true;
- }
- if( origSymbol.hasSameParameters( newSymbol ) ){
- //functions with the same name and same parameter types cannot be overloaded if any of them
- //is static
- if( origSymbol.getTypeInfo().checkBit( TypeInfo.isStatic ) || newSymbol.getTypeInfo().checkBit( TypeInfo.isStatic ) ){
- return false;
- }
-
- //if none of them are static, then the function can be overloaded if they differ in the type
- //of their implicit object parameter.
- if( origSymbol.compareCVQualifiersTo( newSymbol ) != 0 ){
- return true;
- }
-
- return false;
- }
-
- return true;
- }
-
- /**
- *
- * @param data
- * @return Declaration
- * @throws ParserSymbolTableException
- *
- * Resolve the foundItems set down to one declaration and return that
- * declaration.
- * If we successfully resolve, then the data.foundItems list will be
- * cleared. If however, we were not able to completely resolve the set,
- * then the data.foundItems set will be left with those items that
- * survived the partial resolution and we will return null. (currently,
- * this case applies to when we have overloaded functions and no parameter
- * information)
- *
- * NOTE: data.parameters == null means there is no parameter information at
- * all, when looking for functions with no parameters, an empty list must be
- * provided in data.parameters.
- */
- static protected ISymbol resolveAmbiguities( LookupData data ) throws ParserSymbolTableException{
- ISymbol decl = null;
- ISymbol obj = null;
- IContainerSymbol cls = null;
-
- if( data.foundItems == null || data.foundItems.isEmpty() || data.mode == LookupMode.PREFIX ){
- return null;
- }
-
- int size = data.foundItems.size();
- //Iterator iter = data.foundItems.iterator();
-
- Object object = data.foundItems.get( data.name );
-
- LinkedList functionList = new LinkedList();
-
- if( object instanceof List ){
- functionList.addAll( (List) object );
- } else {
- ISymbol symbol = (ISymbol) object;
- if( symbol.isType( TypeInfo.t_function ) ){
- functionList.add( symbol );
- } else {
- return symbol;
- }
- }
-
- if( data.parameters == null ){
- //we have no parameter information, if we only have one function, return
- //that, otherwise we can't decide between them
- if( functionList.size() == 1){
- return (ISymbol) functionList.getFirst();
- } else {
- throw new ParserSymbolTableException( ParserSymbolTableException.r_UnableToResolveFunction );
- }
- } else {
- return resolveFunction( data, functionList );
- }
- }
-
- static protected IParameterizedSymbol resolveFunction( LookupData data, List functions ) throws ParserSymbolTableException{
- if( functions == null ){
- return null;
- }
-
- reduceToViable( data, functions );
-
- int numSourceParams = ( data.parameters == null ) ? 0 : data.parameters.size();
- int numFns = functions.size();
-
- if( numSourceParams == 0 ){
- //no parameters
- //if there is only 1 viable function, return it, if more than one, its ambiguous
- if( numFns == 0 ){
- return null;
- } else if ( numFns == 1 ){
- return (IParameterizedSymbol)functions.iterator().next();
- } else if ( numFns == 2 ){
- Iterator iter = functions.iterator();
- while( iter.hasNext() ){
- IParameterizedSymbol fn = (IParameterizedSymbol) iter.next();
- if( fn.getTypeInfo().isForwardDeclaration() && fn.getTypeSymbol() != null ){
- if( functions.contains( fn.getTypeSymbol() ) ){
- return (IParameterizedSymbol) fn.getTypeSymbol();
- }
- }
- }
- }
-
- if( data.parameters == null )
- throw new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous );
- }
-
- IParameterizedSymbol bestFn = null; //the best function
- IParameterizedSymbol currFn = null; //the function currently under consideration
- Cost [] bestFnCost = null; //the cost of the best function
- Cost [] currFnCost = null; //the cost for the current function
-
- Iterator iterFns = functions.iterator();
- Iterator sourceParams = null;
- Iterator targetParams = null;
-
- int numTargetParams = 0;
- int comparison;
- Cost cost = null;
- Cost temp = null;
-
- TypeInfo source = null;
- TypeInfo target = null;
-
- boolean hasWorse = false;
- boolean hasBetter = false;
- boolean ambiguous = false;
- boolean currHasAmbiguousParam = false;
- boolean bestHasAmbiguousParam = false;
-
- List parameters = null;
-
- if( numSourceParams == 0 ){
- parameters = new LinkedList();
- parameters.add( new TypeInfo( TypeInfo.t_void, 0, null ) );
- numSourceParams = 1;
- } else {
- parameters = data.parameters;
- }
-
- for( int i = numFns; i > 0; i-- ){
- currFn = (IParameterizedSymbol) iterFns.next();
-
- if( bestFn != null ){
- if( bestFn.isForwardDeclaration() && bestFn.getTypeSymbol() == currFn ){
- bestFn = currFn;
- continue;
- } else if( currFn.isForwardDeclaration() && currFn.getTypeSymbol() == bestFn ){
- continue;
- }
- }
-
- sourceParams = parameters.iterator();
-
- List parameterList = null;
- if( currFn.getParameterList().isEmpty() && !currFn.hasVariableArgs() ){
- //the only way we get here and have no parameters, is if we are looking
- //for a function that takes void parameters ie f( void )
- parameterList = new LinkedList();
- parameterList.add( currFn.getSymbolTable().newSymbol( "", TypeInfo.t_void ) );
- } else {
- parameterList = currFn.getParameterList();
- }
-
- targetParams = parameterList.iterator();
- numTargetParams = parameterList.size();
-
- if( currFnCost == null ){
- currFnCost = new Cost [ numSourceParams ];
- }
-
- comparison = 0;
- boolean varArgs = false;
-
- for( int j = 0; j < numSourceParams; j++ ){
- source = (TypeInfo) sourceParams.next();
-
- if( targetParams.hasNext() )
- target = ((ISymbol)targetParams.next()).getTypeInfo();
- else
- varArgs = true;
-
- if( varArgs ){
- cost = new Cost( source, null );
- cost.rank = Cost.ELLIPSIS_CONVERSION;
- } else if ( target.getHasDefault() && source.isType( TypeInfo.t_void ) && !source.hasPtrOperators() ){
- //source is just void, ie no parameter, if target had a default, then use that
- cost = new Cost( source, target );
- cost.rank = Cost.IDENTITY_RANK;
- } else if( source.equals( target ) ){
- cost = new Cost( source, target );
- cost.rank = Cost.IDENTITY_RANK; //exact match, no cost
- } else {
-
- cost = checkStandardConversionSequence( source, target );
-
- //12.3-4 At most one user-defined conversion is implicitly applied to
- //a single value. (also prevents infinite loop)
- if( cost.rank == Cost.NO_MATCH_RANK && !data.forUserDefinedConversion ){
- temp = checkUserDefinedConversionSequence( source, target );
- if( temp != null ){
- cost = temp;
- }
- }
- }
-
- currFnCost[ j ] = cost;
- }
-
-
- hasWorse = false;
- hasBetter = false;
- //In order for this function to be better than the previous best, it must
- //have at least one parameter match that is better that the corresponding
- //match for the other function, and none that are worse.
- for( int j = 0; j < numSourceParams; j++ ){
- if( currFnCost[ j ].rank < 0 ){
- hasWorse = true;
- hasBetter = false;
- break;
- }
-
- //an ambiguity in the user defined conversion sequence is only a problem
- //if this function turns out to be the best.
- currHasAmbiguousParam = ( currFnCost[ j ].userDefined == 1 );
-
- if( bestFnCost != null ){
- comparison = currFnCost[ j ].compare( bestFnCost[ j ] );
- hasWorse |= ( comparison < 0 );
- hasBetter |= ( comparison > 0 );
- } else {
- hasBetter = true;
- }
- }
-
- //If function has a parameter match that is better than the current best,
- //and another that is worse (or everything was just as good, neither better nor worse).
- //then this is an ambiguity (unless we find something better than both later)
- ambiguous |= ( hasWorse && hasBetter ) || ( !hasWorse && !hasBetter );
-
- if( !hasWorse ){
- if( hasBetter ){
- //the new best function.
- ambiguous = false;
- bestFnCost = currFnCost;
- bestHasAmbiguousParam = currHasAmbiguousParam;
- currFnCost = null;
- bestFn = currFn;
- }
- }
- }
-
- if( ambiguous || bestHasAmbiguousParam ){
- throw new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous );
- }
-
- return bestFn;
- }
-
- static private void reduceToViable( LookupData data, List functions ){
- int numParameters = ( data.parameters == null ) ? 0 : data.parameters.size();
- int num;
-
- //Trim the list down to the set of viable functions
- IParameterizedSymbol function;
- Iterator iter = functions.iterator();
- while( iter.hasNext() ){
- function = (IParameterizedSymbol) iter.next();
- num = ( function.getParameterList() == null ) ? 0 : function.getParameterList().size();
-
- //if there are m arguments in the list, all candidate functions having m parameters
- //are viable
- if( num == numParameters ){
- continue;
- }
- //check for void
- else if( numParameters == 0 && num == 1 ){
- ISymbol param = (ISymbol)function.getParameterList().iterator().next();
- if( param.isType( TypeInfo.t_void ) )
- continue;
- }
- else if( numParameters == 1 && num == 0 ){
- TypeInfo paramType = (TypeInfo) data.parameters.iterator().next();
- if( paramType.isType( TypeInfo.t_void ) )
- continue;
- }
-
- //A candidate function having fewer than m parameters is viable only if it has an
- //ellipsis in its parameter list.
- if( num < numParameters ){
- if( function.hasVariableArgs() ) {
- continue;
- } else {
- //not enough parameters, remove it
- iter.remove();
- }
- }
- //a candidate function having more than m parameters is viable only if the (m+1)-st
- //parameter has a default argument
- else {
- ListIterator listIter = function.getParameterList().listIterator( num );
- TypeInfo param;
- for( int i = num; i > ( numParameters - num + 1); i-- ){
- param = ((ISymbol)listIter.previous()).getTypeInfo();
- if( !param.getHasDefault() ){
- iter.remove();
- break;
- }
- }
- }
- }
- }
-
- /**
- * function ProcessDirectives
- * @param Declaration decl
- * @param LookupData data
- * @param LinkedList directives
- *
- * Go through the directives and for each nominated namespace find the
- * closest enclosing declaration for that namespace and decl, then add the
- * nominated namespace to the lookup data for consideration when we reach
- * the enclosing declaration.
- */
- static private void processDirectives( IContainerSymbol symbol, LookupData data, List directives ){
- IContainerSymbol enclosing = null;
- IContainerSymbol temp = null;
-
- int size = directives.size();
- Iterator iter = directives.iterator();
-
- for( int i = size; i > 0; i-- ){
- temp = (IContainerSymbol) iter.next();
-
- //namespaces are searched at most once
- if( !data.visited.contains( temp ) ){
- enclosing = getClosestEnclosingDeclaration( symbol, temp );
-
- //the data.usingDirectives is a map from enclosing declaration to
- //a list of namespaces to consider when we reach that enclosing
- //declaration
- LinkedList list = (data.usingDirectives == null )
- ? null
- : (LinkedList) data.usingDirectives.get( enclosing );
- if ( list == null ){
- list = new LinkedList();
- list.add( temp );
- if( data.usingDirectives == null ){
- data.usingDirectives = new HashMap();
- }
- data.usingDirectives.put( enclosing, list );
- } else {
- list.add( temp );
- }
- }
- }
- }
-
- /**
- * function getClosestEnclosingDeclaration
- * @param decl1
- * @param decl2
- * @return Declaration
- *
- * 7.3.4-1 "During unqualified lookup, the names appear as if they were
- * declared in the nearest enclosing namespace which contains both the
- * using-directive and the nominated namespace"
- *
- * TBD: Consider rewriting this iteratively instead of recursively, for
- * performance
- */
- static private IContainerSymbol getClosestEnclosingDeclaration( ISymbol symbol1, ISymbol symbol2 ){
- if( symbol1 == symbol2 ){
- return ( symbol1 instanceof IContainerSymbol ) ? (IContainerSymbol) symbol1 : symbol1.getContainingSymbol();
- }
-
- if( symbol1.getDepth() == symbol2.getDepth() ){
- return getClosestEnclosingDeclaration( symbol1.getContainingSymbol(), symbol2.getContainingSymbol() );
- } else if( symbol1.getDepth() > symbol2.getDepth() ) {
- return getClosestEnclosingDeclaration( symbol1.getContainingSymbol(), symbol2 );
- } else {
- return getClosestEnclosingDeclaration( symbol1, symbol2.getContainingSymbol() );
- }
- }
-
- /**
- *
- * @param obj
- * @param base
- * @return int
- * figure out if base is a base class of obj, and return the "distance" to
- * the base class.
- * ie:
- * A -> B -> C
- * the distance from A to B is 1 and from A to C is 2. This distance is used
- * to rank standard pointer conversions.
- *
- * TBD: Consider rewriting iteratively for performance.
- */
- static protected int hasBaseClass( ISymbol obj, ISymbol base ) throws ParserSymbolTableException {
- return hasBaseClass( obj, base, false );
- }
-
- static private int hasBaseClass( ISymbol obj, ISymbol base, boolean throwIfNotVisible ) throws ParserSymbolTableException{
- if( obj == base ){
- return 0;
- }
- IDerivableContainerSymbol symbol = null;
- TemplateInstance instance = null;
- if( obj instanceof TemplateInstance ){
- instance = (TemplateInstance) obj;
- ISymbol temp = instance.getInstantiatedSymbol();
- if( temp instanceof IDerivableContainerSymbol ){
- symbol = (IDerivableContainerSymbol) temp;
- } else {
- return -1;
- }
- } else if( obj instanceof IDerivableContainerSymbol ){
- symbol = (IDerivableContainerSymbol) obj;
- } else {
- return -1;
- }
-
- if( symbol.hasParents() ){
- ISymbol temp = null;
- IDerivableContainerSymbol parent = null;
- IDerivableContainerSymbol.IParentSymbol wrapper;
-
- Iterator iter = symbol.getParents().iterator();
- int size = symbol.getParents().size();
-
- for( int i = size; i > 0; i-- ){
- wrapper = (IDerivableContainerSymbol.IParentSymbol) iter.next();
- temp = wrapper.getParent();
- boolean isVisible = ( wrapper.getVisibility() == ASTAccessVisibility.PUBLIC );
- if( temp instanceof TemplateInstance ){
- instance = (TemplateInstance) temp;
- if( instance.getInstantiatedSymbol() instanceof IDerivableContainerSymbol ){
- if( instance.getInstantiatedSymbol() == base ){
- if( throwIfNotVisible && !isVisible )
- throw new ParserSymbolTableException( ParserSymbolTableException.r_BadVisibility );
- else
- return 1;
- } else {
- int n = hasBaseClass( instance, base, throwIfNotVisible );
- if( n > 0 ){
- return n + 1;
- }
- }
- }
- } else {
- if( temp.isType( TypeInfo.t_undef ) && temp.getContainingSymbol().isType( TypeInfo.t_template ) ){
- if( instance == null ) continue;
- TypeInfo info = (TypeInfo) instance.getArgumentMap().get( temp );
- if( info == null || !info.isType( TypeInfo.t_class, TypeInfo.t_struct ) ){
- continue;
- }
- parent = (IDerivableContainerSymbol) info.getTypeSymbol();
- }
- else if ( temp instanceof IDerivableContainerSymbol ){
- parent = (IDerivableContainerSymbol)temp;
- } else {
- continue;
- }
- if( parent == base ){
- if( throwIfNotVisible && !isVisible )
- throw new ParserSymbolTableException( ParserSymbolTableException.r_BadVisibility );
- else
- return 1;
- } else {
- int n = hasBaseClass( parent, base, throwIfNotVisible );
- if( n > 0 ){
- return n + 1;
- }
- }
- }
- }
- }
-
- return -1;
- }
-
- static protected void getAssociatedScopes( ISymbol symbol, HashSet associated ){
- if( symbol == null ){
- return;
- }
- //if T is a class type, its associated classes are the class itself,
- //and its direct and indirect base classes. its associated Namespaces are the
- //namespaces in which its associated classes are defined
- //if( symbol.getType() == TypeInfo.t_class ){
- if( symbol instanceof IDerivableContainerSymbol ){
- associated.add( symbol );
- associated.add( symbol.getContainingSymbol() );
- getBaseClassesAndContainingNamespaces( (IDerivableContainerSymbol) symbol, associated );
- }
- //if T is a union or enumeration type, its associated namespace is the namespace in
- //which it is defined. if it is a class member, its associated class is the member's
- //class
- else if( symbol.getType() == TypeInfo.t_union || symbol.getType() == TypeInfo.t_enumeration ){
- associated.add( symbol.getContainingSymbol() );
- }
- }
-
- static private void getBaseClassesAndContainingNamespaces( IDerivableContainerSymbol obj, HashSet classes ){
- if( obj.getParents() != null ){
- if( classes == null ){
- return;
- }
-
- Iterator iter = obj.getParents().iterator();
- int size = obj.getParents().size();
- IDerivableContainerSymbol.IParentSymbol wrapper;
- ISymbol base;
-
- for( int i = size; i > 0; i-- ){
- wrapper = (IDerivableContainerSymbol.IParentSymbol) iter.next();
- base = wrapper.getParent();
- classes.add( base );
- if( base.getContainingSymbol().getType() == TypeInfo.t_namespace ){
- classes.add( base.getContainingSymbol());
- }
-
- getBaseClassesAndContainingNamespaces( (IDerivableContainerSymbol) base, classes );
- }
- }
- }
-
- static protected boolean okToAddUsingDeclaration( ISymbol obj, IContainerSymbol context ){
- boolean okToAdd = false;
-
- //7.3.3-5 A using-declaration shall not name a template-id
- if( obj.isTemplateMember() && obj.getContainingSymbol().isType( TypeInfo.t_template ) ){
- okToAdd = false;
- }
- //7.3.3-4
- else if( context.isType( TypeInfo.t_class, TypeInfo.t_struct ) ){
- IContainerSymbol container = obj.getContainingSymbol();
-
- try{
- //a member of a base class
- if( obj.getContainingSymbol().getType() == context.getType() ){
- okToAdd = ( hasBaseClass( (IDerivableContainerSymbol) context, (IDerivableContainerSymbol) container ) > 0 );
- }
- else if ( obj.getContainingSymbol().getType() == TypeInfo.t_union ) {
- // TODO : must be an _anonymous_ union
- container = container.getContainingSymbol();
- okToAdd = ( container instanceof IDerivableContainerSymbol )
- ? ( hasBaseClass( (IDerivableContainerSymbol)context, (IDerivableContainerSymbol) container ) > 0 )
- : false;
- }
- //an enumerator for an enumeration
- else if ( obj.getType() == TypeInfo.t_enumerator ){
- container = container.getContainingSymbol();
- okToAdd = ( container instanceof IDerivableContainerSymbol )
- ? ( hasBaseClass( (IDerivableContainerSymbol)context, (IDerivableContainerSymbol) container ) > 0 )
- : false;
- }
- } catch ( ParserSymbolTableException e ) {
- //not going to happen since we didn't ask for the visibility exception from hasBaseClass
- }
- } else {
- okToAdd = true;
- }
-
- return okToAdd;
- }
-
- static private Cost lvalue_to_rvalue( TypeInfo source, TypeInfo target ){
-
- //lvalues will have type t_type
- if( source.isType( TypeInfo.t_type ) ){
- source = getFlatTypeInfo( source );
- }
-
- if( target.isType( TypeInfo.t_type ) ){
- ISymbol symbol = target.getTypeSymbol();
- if( symbol != null && symbol.isForwardDeclaration() && symbol.getTypeSymbol() != null ){
- target = new TypeInfo( target );
- target.setType( TypeInfo.t_type );
- target.setTypeSymbol( symbol.getTypeSymbol() );
- }
- }
-
- Cost cost = new Cost( source, target );
-
- //if either source or target is null here, then there was a problem
- //with the parameters and we can't match them.
- if( cost.source == null || cost.target == null ){
- return cost;
- }
-
- TypeInfo.PtrOp op = null;
-
- if( cost.source.hasPtrOperators() ){
- List sourcePtrs = cost.source.getPtrOperators();
- Iterator iterator = sourcePtrs.iterator();
- TypeInfo.PtrOp ptr = (TypeInfo.PtrOp)iterator.next();
- if( ptr.getType() == TypeInfo.PtrOp.t_reference ){
- iterator.remove();
- }
- int size = sourcePtrs.size();
- Iterator iter = sourcePtrs.iterator();
-
- for( int i = size; i > 0; i-- ){
- op = (TypeInfo.PtrOp) iter.next();
- if( op.getType() == TypeInfo.PtrOp.t_array ){
- op.setType( TypeInfo.PtrOp.t_pointer );
- }
- }
- }
-
- if( cost.target.hasPtrOperators() ){
- List targetPtrs = cost.target.getPtrOperators();
- ListIterator iterator = targetPtrs.listIterator();
- TypeInfo.PtrOp ptr = (TypeInfo.PtrOp)iterator.next();
-
- if( ptr.getType() == TypeInfo.PtrOp.t_reference ){
- if( ptr.isConst() || ptr.isVolatile() ){
- iterator.set( new PtrOp( PtrOp.t_undef, ptr.isConst(), ptr.isVolatile() ) );
- } else {
- iterator.remove();
- }
- cost.targetHadReference = true;
- }
- int size = targetPtrs.size();
- Iterator iter = targetPtrs.iterator();
-
- for( int i = size; i > 0; i-- ){
- op = (TypeInfo.PtrOp) iter.next();
- if( op.getType() == TypeInfo.PtrOp.t_array ){
- op.setType( TypeInfo.PtrOp.t_pointer );
- }
- }
- }
-
- return cost;
- }
-
- /**
- * qualificationConversion
- * @param cost
- *
- * see spec section 4.4 regarding qualification conversions
- */
- static private void qualificationConversion( Cost cost ){
- int size = cost.source.getPtrOperators().size();
- int size2 = cost.target.getPtrOperators().size();
-
- TypeInfo.PtrOp op1 = null, op2 = null;
- boolean canConvert = true;
-
- Iterator iter1 = cost.source.getPtrOperators().iterator();
- Iterator iter2 = cost.target.getPtrOperators().iterator();
-
- if( size != size2 ){
- if( size2 - size == 1 ){
- op2 = (PtrOp) iter2.next();
- if( op2.isConst() || op2.isVolatile() ){
- canConvert = true;
- } else {
- canConvert = false;
- }
- } else {
- canConvert = false;
- }
- } else if ( size == 1 ){
- op1 = (TypeInfo.PtrOp) iter1.next();
- op2 = (TypeInfo.PtrOp) iter2.next();
-
- //can only convert if op2 is more qualified
- if( ( op1.isConst() && !op2.isConst() ) ||
- ( op1.isVolatile() && !op2.isVolatile() ) )
- {
- cost.qualification = 0;
- return;
- }
- canConvert = true;
- } else if( size > 0 ){
- op1 = (TypeInfo.PtrOp) iter1.next();
- op2 = (TypeInfo.PtrOp) iter2.next();
-
- boolean constInEveryCV2k = true;
-
- for( int j= 1; j < size; j++ ){
- op1 = (TypeInfo.PtrOp) iter1.next();
- op2 = (TypeInfo.PtrOp) iter2.next();
-
- //pointer types must be similar
- if( op1.getType() != op2.getType() ){
- canConvert = false;
- break;
- }
- //if const is in cv1,j then const is in cv2,j. Similary for volatile
- if( ( op1.isConst() && !op2.isConst() ) ||
- ( op1.isVolatile() && !op2.isVolatile() ) )
- {
- canConvert = false;
- break;
- }
-
- //if cv1,j and cv2,j are different then const is in every cv2,k for 0<k<j
- if( ( op1.compareCVTo( op2 ) != 0 ) && !constInEveryCV2k ){
- canConvert = false;
- break;
- }
-
- constInEveryCV2k &= op2.isConst();
- }
- }
-
- if( canConvert == true ){
- cost.qualification = 1;
- cost.rank = Cost.LVALUE_OR_QUALIFICATION_RANK;
- } else {
- cost.qualification = 0;
- }
- }
-
- /**
- *
- * @param source
- * @param target
- * @return int
- *
- * 4.5-1 char, signed char, unsigned char, short int or unsigned short int
- * can be converted to int if int can represent all the values of the source
- * type, otherwise they can be converted to unsigned int.
- * 4.5-2 wchar_t or an enumeration can be converted to the first of the
- * following that can hold it: int, unsigned int, long unsigned long.
- * 4.5-4 bool can be promoted to int
- * 4.6 float can be promoted to double
- */
- static private void promotion( Cost cost ){
- TypeInfo src = cost.source;
- TypeInfo trg = cost.target;
-
- int mask = TypeInfo.isShort | TypeInfo.isLong | TypeInfo.isUnsigned;
-
- if( (src.isType( TypeInfo.t_bool, TypeInfo.t_float ) || src.isType( TypeInfo.t_enumeration )) &&
- (trg.isType( TypeInfo.t_int ) || trg.isType( TypeInfo.t_double )) )
- {
- if( src.getType() == trg.getType() && (( src.getTypeInfo() & mask) == (trg.getTypeInfo() & mask)) ){
- //same, no promotion needed
- return;
- }
-
- if( src.isType( TypeInfo.t_float ) ){
- cost.promotion = trg.isType( TypeInfo.t_double ) ? 1 : 0;
- } else {
- cost.promotion = ( trg.isType( TypeInfo.t_int ) && trg.canHold( src ) ) ? 1 : 0;
- }
-
- } else {
- cost.promotion = 0;
- }
-
- cost.rank = (cost.promotion > 0 ) ? Cost.PROMOTION_RANK : Cost.NO_MATCH_RANK;
- }
-
- /**
- *
- * @param source
- * @param target
- * @return int
- *
- */
- static private void conversion( Cost cost ){
- TypeInfo src = cost.source;
- TypeInfo trg = cost.target;
-
- int temp = -1;
-
- cost.conversion = 0;
- cost.detail = 0;
-
- if( !src.hasSamePtrs( trg ) ){
- return;
- }
- if( src.hasPtrOperators() && src.getPtrOperators().size() == 1 ){
- TypeInfo.PtrOp ptr = (TypeInfo.PtrOp)src.getPtrOperators().iterator().next();
- ISymbol srcDecl = src.isType( TypeInfo.t_type ) ? src.getTypeSymbol() : null;
- ISymbol trgDecl = trg.isType( TypeInfo.t_type ) ? trg.getTypeSymbol() : null;
- if( ptr.getType() == TypeInfo.PtrOp.t_pointer ){
- if( srcDecl == null || (trgDecl == null && !trg.isType( TypeInfo.t_void )) ){
- return;
- }
-
- //4.10-2 an rvalue of type "pointer to cv T", where T is an object type can be
- //converted to an rvalue of type "pointer to cv void"
- if( trg.isType( TypeInfo.t_void ) ){
- cost.rank = Cost.CONVERSION_RANK;
- cost.conversion = 1;
- cost.detail = 2;
- return;
- }
-
- cost.detail = 1;
-
- //4.10-3 An rvalue of type "pointer to cv D", where D is a class type can be converted
- // to an rvalue of type "pointer to cv B", where B is a base class of D.
- if( (srcDecl instanceof IDerivableContainerSymbol) && trgDecl.isType( srcDecl.getType() ) ){
- try {
- temp = hasBaseClass( (IDerivableContainerSymbol) srcDecl, (IDerivableContainerSymbol) trgDecl );
- } catch (ParserSymbolTableException e) {
- //not going to happen since we didn't ask for the visibility exception
- }
- cost.rank = ( temp > -1 ) ? Cost.CONVERSION_RANK : Cost.NO_MATCH_RANK;
- cost.conversion = ( temp > -1 ) ? temp : 0;
- cost.detail = 1;
- return;
- }
- } else if( ptr.getType() == TypeInfo.PtrOp.t_memberPointer ){
- //4.11-2 An rvalue of type "pointer to member of B of type cv T", where B is a class type,
- //can be converted to an rvalue of type "pointer to member of D of type cv T" where D is a
- //derived class of B
- if( srcDecl == null || trgDecl == null ){
- return;
- }
-
- TypeInfo.PtrOp srcPtr = trg.hasPtrOperators() ? (TypeInfo.PtrOp)trg.getPtrOperators().iterator().next() : null;
- if( trgDecl.isType( srcDecl.getType() ) && srcPtr != null && srcPtr.getType() == TypeInfo.PtrOp.t_memberPointer ){
- try {
- temp = hasBaseClass( (IDerivableContainerSymbol)ptr.getMemberOf(), (IDerivableContainerSymbol)srcPtr.getMemberOf() );
- } catch (ParserSymbolTableException e) {
- //not going to happen since we didn't ask for the visibility exception
- }
- cost.rank = ( temp > -1 ) ? Cost.CONVERSION_RANK : Cost.NO_MATCH_RANK;
- cost.detail = 1;
- cost.conversion = ( temp > -1 ) ? temp : 0;
- return;
- }
- }
- } else if( !src.hasPtrOperators() ) {
- //4.7 An rvalue of an integer type can be converted to an rvalue of another integer type.
- //An rvalue of an enumeration type can be converted to an rvalue of an integer type.
- if( src.isType( TypeInfo.t_bool, TypeInfo.t_int ) ||
- src.isType( TypeInfo.t_float, TypeInfo.t_double ) ||
- src.isType( TypeInfo.t_enumeration ) )
- {
- if( trg.isType( TypeInfo.t_bool, TypeInfo.t_int ) ||
- trg.isType( TypeInfo.t_float, TypeInfo.t_double ) )
- {
- cost.rank = Cost.CONVERSION_RANK;
- cost.conversion = 1;
- }
- }
- }
- }
-
- static private void derivedToBaseConversion( Cost cost ) throws ParserSymbolTableException{
- TypeInfo src = cost.source;
- TypeInfo trg = cost.target;
-
- ISymbol srcDecl = src.isType( TypeInfo.t_type ) ? src.getTypeSymbol() : null;
- ISymbol trgDecl = trg.isType( TypeInfo.t_type ) ? trg.getTypeSymbol() : null;
-
- if( !src.hasSamePtrs( trg ) || srcDecl == null || trgDecl == null || !cost.targetHadReference ){
- return;
- }
-
- int temp = hasBaseClass( (IDerivableContainerSymbol) srcDecl, (IDerivableContainerSymbol) trgDecl, true );
-
- if( temp > -1 ){
- cost.rank = Cost.DERIVED_TO_BASE_CONVERSION;
- cost.conversion = temp;
- }
- }
-
- static private Cost checkStandardConversionSequence( TypeInfo source, TypeInfo target ) throws ParserSymbolTableException{
- Cost cost = lvalue_to_rvalue( source, target );
-
- if( cost.source == null || cost.target == null ){
- return cost;
- }
-
- if( cost.source.equals( cost.target ) ){
- cost.rank = Cost.IDENTITY_RANK;
- return cost;
- }
-
- qualificationConversion( cost );
-
- //if we can't convert the qualifications, then we can't do anything
- if( cost.qualification == 0 ){
- return cost;
- }
-
- //was the qualification conversion enough?
- if( cost.source.isType( TypeInfo.t_type ) && cost.target.isType( TypeInfo.t_type ) ){
- if( cost.target.hasSamePtrs( cost.source ) ){
- ISymbol srcSymbol = cost.source.getTypeSymbol();
- ISymbol trgSymbol = cost.target.getTypeSymbol();
- if( srcSymbol != null && trgSymbol != null ){
- if( srcSymbol.equals( trgSymbol ) )
- {
- return cost;
- }
- }
- }
- }
-
- promotion( cost );
- if( cost.promotion > 0 || cost.rank > -1 ){
- return cost;
- }
-
- conversion( cost );
-
- if( cost.rank > -1 )
- return cost;
-
- derivedToBaseConversion( cost );
-
- return cost;
- }
-
- static private Cost checkUserDefinedConversionSequence( TypeInfo source, TypeInfo target ) throws ParserSymbolTableException {
- Cost cost = null;
- Cost constructorCost = null;
- Cost conversionCost = null;
-
- ISymbol targetDecl = null;
- ISymbol sourceDecl = null;
- IParameterizedSymbol constructor = null;
- IParameterizedSymbol conversion = null;
-
- //constructors
- if( target.getType() == TypeInfo.t_type ){
- targetDecl = target.getTypeSymbol();
- if( targetDecl.isType( TypeInfo.t_class, TypeInfo.t_union ) ){
- LookupData data = new LookupData( EMPTY_NAME, TypeInfo.t_constructor, null );
- data.parameters = new LinkedList();
- data.parameters.add( source );
- data.forUserDefinedConversion = true;
-
- IDerivableContainerSymbol container = (IDerivableContainerSymbol) targetDecl;
-
- if( targetDecl instanceof TemplateInstance ){
- data.templateInstance = targetDecl;
- container = (IDerivableContainerSymbol)((TemplateInstance) targetDecl).getInstantiatedSymbol();
- }
-
- if( !container.getConstructors().isEmpty() ){
- LinkedList constructors = new LinkedList( container.getConstructors() );
- constructor = resolveFunction( data, constructors );
- }
- if( constructor != null && constructor.getTypeInfo().checkBit( TypeInfo.isExplicit ) ){
- constructor = null;
- }
-
- }
- }
-
- //conversion operators
- if( source.getType() == TypeInfo.t_type ){
- source = getFlatTypeInfo( source );
- sourceDecl = ( source != null ) ? source.getTypeSymbol() : null;
-
- if( sourceDecl != null && (sourceDecl instanceof IContainerSymbol) ){
- String name = target.toString();
-
- if( !name.equals(EMPTY_NAME) ){
- LookupData data = new LookupData( "operator " + name, TypeInfo.t_function, null ); //$NON-NLS-1$
- LinkedList params = new LinkedList();
- data.parameters = params;
- data.forUserDefinedConversion = true;
-
- data.foundItems = lookupInContained( data, (IContainerSymbol) sourceDecl );
- conversion = (IParameterizedSymbol)resolveAmbiguities( data );
- }
- }
- }
-
- if( constructor != null ){
- constructorCost = checkStandardConversionSequence( (TypeInfo) new TypeInfo( TypeInfo.t_type, 0, constructor.getContainingSymbol() ), target );
- }
- if( conversion != null ){
- conversionCost = checkStandardConversionSequence( (TypeInfo) new TypeInfo( target.getType(), 0, target.getTypeSymbol() ), target );
- }
-
- //if both are valid, then the conversion is ambiguous
- if( constructorCost != null && constructorCost.rank != Cost.NO_MATCH_RANK &&
- conversionCost != null && conversionCost.rank != Cost.NO_MATCH_RANK )
- {
- cost = constructorCost;
- cost.userDefined = Cost.AMBIGUOUS_USERDEFINED_CONVERSION;
- cost.rank = Cost.USERDEFINED_CONVERSION_RANK;
- } else {
- if( constructorCost != null && constructorCost.rank != Cost.NO_MATCH_RANK ){
- cost = constructorCost;
- cost.userDefined = constructor.hashCode();
- cost.rank = Cost.USERDEFINED_CONVERSION_RANK;
- } else if( conversionCost != null && conversionCost.rank != Cost.NO_MATCH_RANK ){
- cost = conversionCost;
- cost.userDefined = conversion.hashCode();
- cost.rank = Cost.USERDEFINED_CONVERSION_RANK;
- }
- }
-
- return cost;
- }
-
- /**
- * Determine the type of a conditional operator based on the second and third operands
- * @param secondOp
- * @param thirdOp
- * @return
- * Spec 5.16
- * Determine if the second operand can be converted to match the third operand, and vice versa.
- * - If both can be converted, or one can be converted but the conversion is ambiguous, the program
- * is illformed (throw ParserSymbolTableException)
- * - If neither can be converted, further checking must be done (return null)
- * - If exactly one conversion is possible, that conversion is applied ( return the other TypeInfo )
- */
- static public TypeInfo getConditionalOperand( TypeInfo secondOp, TypeInfo thirdOp ) throws ParserSymbolTableException{
-
- //can secondOp convert to thirdOp ?
- Cost secondCost = checkStandardConversionSequence( secondOp, getFlatTypeInfo( thirdOp ) );
-
- if( secondCost.rank == Cost.NO_MATCH_RANK ){
- secondCost = checkUserDefinedConversionSequence( secondOp, getFlatTypeInfo( thirdOp ) );
- }
-
- Cost thirdCost = checkStandardConversionSequence( thirdOp, getFlatTypeInfo( secondOp ) );
- if( thirdCost.rank == Cost.NO_MATCH_RANK ){
- thirdCost = checkUserDefinedConversionSequence( thirdOp, getFlatTypeInfo( secondOp ) );
- }
-
-
- boolean canConvertSecond = ( secondCost != null && secondCost.rank != Cost.NO_MATCH_RANK );
- boolean canConvertThird = ( thirdCost != null && thirdCost.rank != Cost.NO_MATCH_RANK );
-
- if( !canConvertSecond && !canConvertThird ){
- //neither can be converted
- return null;
- } else if ( canConvertSecond && canConvertThird ){
- //both can be converted -> illformed
- throw new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous );
- } else {
- if( canConvertSecond ){
- if( secondCost.userDefined == Cost.AMBIGUOUS_USERDEFINED_CONVERSION ){
- //conversion is ambiguous -> ill-formed
- throw new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous );
- } else {
- return thirdOp;
- }
- } else {
- if( thirdCost.userDefined == Cost.AMBIGUOUS_USERDEFINED_CONVERSION ){
- //conversion is ambiguous -> ill-formed
- throw new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous );
- } else {
- return secondOp;
- }
- }
- }
- }
-
- /**
- *
- * @param decl
- * @return TypeInfo
- * The top level TypeInfo represents modifications to the object and the
- * remaining TypeInfo's represent the object.
- */
- // TODO move this to ITypeInfo ?
- static protected TypeInfo getFlatTypeInfo( TypeInfo topInfo ){
- TypeInfo returnInfo = topInfo;
- TypeInfo info = null;
-
- if( topInfo.getType() == TypeInfo.t_type && topInfo.getTypeSymbol() != null ){
- returnInfo = (TypeInfo)new TypeInfo();
-
- ISymbol typeSymbol = topInfo.getTypeSymbol();
-
- info = typeSymbol.getTypeInfo();
-
- while( info.getTypeSymbol() != null && ( info.getType() == TypeInfo.t_type || info.isForwardDeclaration() ) ){
- typeSymbol = info.getTypeSymbol();
-
- returnInfo.addPtrOperator( info.getPtrOperators() );
-
- info = typeSymbol.getTypeInfo();
- }
-
- if( info.isType( TypeInfo.t_class, TypeInfo.t_enumeration ) ){
- returnInfo.setType( TypeInfo.t_type );
- returnInfo.setTypeSymbol( typeSymbol );
- } else {
- returnInfo.setTypeInfo( info.getTypeInfo() );
- returnInfo.setType( info.getType() );
- returnInfo.setTypeSymbol( null );
- returnInfo.addPtrOperator( info.getPtrOperators() );
- }
-
- returnInfo.applyOperatorExpressions( topInfo.getOperatorExpressions() );
-
- if( topInfo.hasPtrOperators() ){
- TypeInfo.PtrOp topPtr = (PtrOp) topInfo.getPtrOperators().iterator().next();
- TypeInfo.PtrOp ptr = null;
- if( returnInfo.hasPtrOperators() ){
- ptr = (PtrOp)returnInfo.getPtrOperators().iterator().next();
- } else {
- ptr = new PtrOp();
- returnInfo.addPtrOperator( ptr );
- ptr.setType( topPtr.getType() );
- }
-
- ptr.setConst( topPtr.isConst() );
- ptr.setVolatile( topPtr.isVolatile() );
- }
- } else {
- returnInfo = new TypeInfo( topInfo );
- }
-
- return returnInfo;
- }
-
- static private IParameterizedSymbol matchTemplatePartialSpecialization( IParameterizedSymbol template, List args ){
- if( template == null ){
- return null;
- }
-
- List specs = template.getSpecializations();
- int size = ( specs != null ) ? specs.size() : 0;
- if( size == 0 ){
- return template;
- }
-
- IParameterizedSymbol bestMatch = null;
- boolean bestMatchIsBest = true;
- Iterator iter = specs.iterator();
- IParameterizedSymbol spec = null;
- List specArgs = null;
- for( int i = size; i > 0; i-- ){
- spec = (IParameterizedSymbol) iter.next();
- specArgs = spec.getArgumentList();
- if( specArgs == null || specArgs.size() != args.size() ){
- continue;
- }
-
- ISymbol sym1 = null, sym2 = null;
- Iterator iter1 = specArgs.iterator();
- Iterator iter2 = args.iterator();
-
- HashMap map = new HashMap();
- //String name = null;
- boolean match = true;
- for( int j = specArgs.size(); j > 0; j-- ){
- sym1 = (ISymbol)iter1.next();
- TypeInfo info2 = (TypeInfo) iter2.next();
- if( info2.isType( TypeInfo.t_type ) ){
- sym2 = sym2.getTypeSymbol();
- } else {
- sym2 = template.getSymbolTable().newSymbol( EMPTY_NAME );
- sym2.setTypeInfo( info2 );
- }
-
- if( !deduceTemplateArgument( map, sym1, sym2, null ) ){
- match = false;
- break;
- }
- /*
- name = sym1.getName();
- if( name.equals( "" ) ){
- //no name, only type
- } else if( map.containsKey( name ) ) {
- ISymbol val = (ISymbol) map.get( name );
- if( val.getType() != sym2.getType() ){
- match = false;
- break;
- }
- } else {
- map.put( name, sym2 );
- }
- */
- }
- if( match ){
- int compare = orderSpecializations( bestMatch, spec );
- if( compare == 0 ){
- bestMatchIsBest = false;
- } else if( compare < 0 ) {
- bestMatch = spec;
- bestMatchIsBest = true;
- }
- }
- }
-
- return bestMatchIsBest ? bestMatch : null;
- }
-
- /**
- * Compare spec1 to spec2. Return > 0 if spec1 is more specialized, < 0 if spec2
- * is more specialized, = 0 otherwise.
- * @param spec1
- * @param spec2
- * @return
- */
- static private int orderSpecializations( IParameterizedSymbol spec1, IParameterizedSymbol spec2 ){
- if( spec1 == null ){
- return -1;
- }
-
- Iterator iter = spec1.getContainedSymbols().keySet().iterator();
- ISymbol decl = (ISymbol) spec1.getContainedSymbols().get( iter.next() );
-
- //to order class template specializations, we need to transform them into function templates
- if( decl.isType( TypeInfo.t_class ) ) {
- spec1 = classTemplateSpecializationToFunctionTemplate( spec1 );
- spec2 = classTemplateSpecializationToFunctionTemplate( spec2 );
- }
-
- TemplateInstance transformed1 = transformFunctionTemplateForOrdering( spec1 );
- TemplateInstance transformed2 = transformFunctionTemplateForOrdering( spec2 );
-
- //Using the transformed parameter list, perform argument deduction against the other
- //function template
- boolean d1 = deduceTemplateArguments( spec2, transformed1 );
- boolean d2 = deduceTemplateArguments( spec1, transformed2 );
-
- //The transformed template is at least as specialized as the other iff the deduction
- //succeeds and the deduced parameter types are an exact match
- //A template is more specialized than another iff it is at least as specialized as the
- //other template and that template is not at least as specialized as the first.
- if( d1 && d2 || !d1 && !d2 )
- return 0;
- else if( d1 && !d2 )
- return 1;
- else
- return -1;
- }
-
- /**
- *
- * @param template
- * @param args
- * @return
- *
- * A type that is specified in terms of template parameters (P) is compared with an actual
- * type (A), and an attempt is made to find template argument vaules that will make P,
- * after substitution of the deduced values, compatible with A.
- */
- static private boolean deduceTemplateArguments( IParameterizedSymbol template, TemplateInstance argSource ){
- if( template.getContainedSymbols() == null || template.getContainedSymbols().size() != 1 ){
- return false;
- }
- Iterator iter = template.getContainedSymbols().keySet().iterator();
- ISymbol templateSymbol = (ISymbol) template.getContainedSymbols().get( iter.next() );
- if( !templateSymbol.isType( TypeInfo.t_function ) ){
- return false;
- }
-
- IParameterizedSymbol argTemplate = (IParameterizedSymbol)argSource.getInstantiatedSymbol();
- iter = argTemplate.getContainedSymbols().keySet().iterator();
- ISymbol argFunction = (ISymbol) argTemplate.getContainedSymbols().get( iter.next() );
- if( !argFunction.isType( TypeInfo.t_function ) ){
- return false;
- }
-
- List args = ((IParameterizedSymbol) argFunction).getParameterList();
-
- IParameterizedSymbol function = (IParameterizedSymbol) templateSymbol;
-
- if( function.getParameterList() == null || function.getParameterList().size() != args.size() ){
- return false;
- }
-
- HashMap map = new HashMap();
-
- Iterator pIter = function.getParameterList().iterator();
- Iterator aIter = args.iterator();
- while( pIter.hasNext() ){
- if( !deduceTemplateArgument( map, (ISymbol) pIter.next(), (ISymbol) aIter.next(), argSource.getArgumentMap() ) ){
- return false;
- }
- }
-
- return true;
- }
-
- static private boolean deduceTemplateArgument( Map map, ISymbol p, ISymbol a, Map argumentMap ){
- if( argumentMap != null && argumentMap.containsKey( a ) ){
- a = (ISymbol) argumentMap.get( a );
- }
-
- ISymbol pSymbol = p, aSymbol = a;
-
- if( p.isType( TypeInfo.t_type ) ){
- pSymbol = p.getTypeSymbol();
- aSymbol = a.isType( TypeInfo.t_type ) ? a.getTypeSymbol() : a;
- return deduceTemplateArgument( map, pSymbol, aSymbol, argumentMap );
- } else {
- if( pSymbol.isTemplateMember() && pSymbol.isType( TypeInfo.t_undef ) ){
- //T* or T& or T[ const ]
- //also
- List pPtrs = pSymbol.getPtrOperators();
- List aPtrs = aSymbol.getPtrOperators();
-
- if( pPtrs != null ){
- TypeInfo.PtrOp pOp = (TypeInfo.PtrOp) pPtrs.iterator().next();;
- TypeInfo.PtrOp aOp = ( aPtrs != null ) ? (TypeInfo.PtrOp)pPtrs.iterator().next() : null;
-
- if( pOp != null && aOp != null && pOp.getType() == aOp.getType() ){
- if( pOp.getType() == TypeInfo.PtrOp.t_memberPointer ){
-
- } else {
- TypeInfo type = new TypeInfo( aSymbol.getTypeInfo() );
- type.getPtrOperators().clear();
- map.put( pSymbol.getName(), type );
- return true;
- }
- } else {
- return false;
- }
- } else {
- //T
- map.put( pSymbol.getName(), a.getTypeInfo() );
- return true;
- }
-
-
- }
- //template-name<T> or template-name<i>
- else if( pSymbol.isType( TypeInfo.t_template ) && aSymbol.isType( TypeInfo.t_template ) ){
- List pArgs = ((IParameterizedSymbol)pSymbol).getArgumentList();
- List aArgs = ((IParameterizedSymbol)aSymbol).getArgumentList();
-
- if( pArgs == null || aArgs == null || pArgs.size() != aArgs.size()){
- return false;
- }
- Iterator pIter = pArgs.iterator();
- Iterator aIter = aArgs.iterator();
- while( pIter.hasNext() ){
- if( !deduceTemplateArgument( map, (ISymbol) pIter.next(), (ISymbol) aIter.next(), argumentMap ) ){
- return false;
- }
- }
- }
- //T (*) ( ), T ( T::* ) ( T ), & variations
- else if( pSymbol.isType( TypeInfo.t_function ) && aSymbol.isType( TypeInfo.t_function ) ){
- IParameterizedSymbol pFunction = (IParameterizedSymbol)pSymbol;
- IParameterizedSymbol aFunction = (IParameterizedSymbol)aSymbol;
-
- if( !deduceTemplateArgument( map, aFunction.getReturnType(), pFunction.getReturnType(), argumentMap ) ){
- return false;
- }
- if( pSymbol.getPtrOperators() != null ){
- List ptrs = pSymbol.getPtrOperators();
- TypeInfo.PtrOp op = (TypeInfo.PtrOp) ptrs.iterator().next();;
- if( op.getType() == TypeInfo.PtrOp.t_memberPointer ){
- if( !deduceTemplateArgument( map, op.getMemberOf(), pFunction.getContainingSymbol(), argumentMap ) ){
- return false;
- }
- }
- }
-
- List pParams = pFunction.getParameterList();
- List aParams = aFunction.getParameterList();
- if( pParams.size() != aParams.size() ){
- return false;
- } else {
- Iterator pIter = pParams.iterator();
- Iterator aIter = aParams.iterator();
- while( pIter.hasNext() ){
- if( !deduceTemplateArgument( map, (ISymbol) pIter.next(), (ISymbol) aIter.next(), argumentMap ) ){
- return false;
- }
- }
- }
-
- } else if( pSymbol.getType() == aSymbol.getType() ){
- if( pSymbol.getTypeInfo().getHasDefault() ){
- if( !aSymbol.getTypeInfo().getHasDefault() ||
- aSymbol.getTypeInfo().getDefault().equals( pSymbol.getTypeInfo().getDefault() ) )
- {
- return false;
- }
- }
- //value
- map.put( pSymbol.getName(), aSymbol.getTypeInfo() );
- return true;
- }
- }
-
- return false;
- }
- /**
- * transform the class template to a function template as described in the spec
- * 14.5.4.2-1
- * @param template
- * @return IParameterizedSymbol
- * the function template has the same template parameters as the partial specialization and
- * has a single function parameter whose type is a class template specialization with the template
- * arguments of the partial specialization
- */
- static private IParameterizedSymbol classTemplateSpecializationToFunctionTemplate( IParameterizedSymbol template ){
- IParameterizedSymbol transformed = (IParameterizedSymbol) template.clone();
- transformed.getArgumentList().clear();
- transformed.getContainedSymbols().clear();
-
- IParameterizedSymbol function = template.getSymbolTable().newParameterizedSymbol( transformed.getName(), TypeInfo.t_function );
- try{
- transformed.addSymbol( function );
- } catch ( ParserSymbolTableException e ){
- //we shouldn't get this because there aren't any other symbols in the template
- }
-
- function.addParameter( template );
-
- return transformed;
- }
-
- /**
- * transform a function template for use in partial ordering, as described in the
- * spec 14.5.5.2-3
- * @param template
- * @return
- * -for each type template parameter, synthesize a unique type and substitute that for each
- * occurence of that parameter in the function parameter list
- * -for each non-type template parameter, synthesize a unique value of the appropriate type and
- * susbstitute that for each occurence of that parameter in the function parameter list
- * for each template template parameter, synthesize a unique class template and substitute that
- * for each occurence of that parameter in the function parameter list
- */
- static private TemplateInstance transformFunctionTemplateForOrdering( IParameterizedSymbol template ){
-
- List paramList = template.getParameterList();
-
- int size = ( paramList != null ) ? paramList.size() : 0;
- if( size == 0 ){
- return null;
- }
-
- HashMap map = new HashMap();
- for( Iterator iterator = paramList.iterator(); iterator.hasNext(); ) {
- ISymbol param = (ISymbol) iterator.next();
- ISymbol val = template.getSymbolTable().newSymbol( EMPTY_NAME, TypeInfo.t_type );
- if( false /* is value */ ){
- //val.getTypeInfo().setHasDefault()
- }
- map.put( param, val );
- }
-
- return new TemplateInstance( template.getSymbolTable(), template, map );
- }
-
- //private Stack _contextStack = new Stack();
- private IContainerSymbol _compilationUnit;
- private ParserLanguage _language;
- private LinkedList undoList = new LinkedList();
- private HashSet markSet = new HashSet();
-
- public void setLanguage( ParserLanguage language ){
- _language = language;
- }
-
- public ParserLanguage getLanguage(){
- return _language;
- }
-
- protected void pushCommand( Command command ){
- undoList.addFirst( command );
- }
-
- public Mark setMark(){
- Mark mark = new Mark();
- undoList.addFirst( mark );
- markSet.add( mark );
- return mark;
- }
-
- public boolean rollBack( Mark toMark ){
- if( markSet.contains( toMark ) ){
- markSet.remove( toMark );
- Command command = ( Command )undoList.removeFirst();
- while( command != toMark ){
- command.undoIt();
- command = ( Command ) undoList.removeFirst();
- }
-
- return true;
- }
-
- return false;
- }
-
- public boolean commit( Mark toMark ){
- if( markSet.contains( toMark ) ){
- markSet.remove( toMark );
- Command command = ( Command )undoList.removeLast();
- while( command != toMark ){
- command = (Command) undoList.removeLast();
- }
- return true;
- }
-
- return false;
- }
-
- static abstract protected class Command{
- abstract public void undoIt();
- }
-
- static public class Mark extends Command{
- public void undoIt(){ };
- }
-
-
- static public class LookupMode extends Enum{
- public static final LookupMode PREFIX = new LookupMode( 1 );
- public static final LookupMode NORMAL = new LookupMode( 2 );
-
- private LookupMode( int constant)
- {
- super( constant );
- }
- }
-
-
- static protected class LookupData
- {
- public Set ambiguities;
- public String name;
- public Map usingDirectives;
- public Set visited = new HashSet(); //used to ensure we don't visit things more than once
-
- public HashSet inheritanceChain; //used to detect circular inheritance
-
- public List parameters; //parameter info for resolving functions
- public HashSet associated; //associated namespaces for argument dependant lookup
- public ISymbol stopAt; //stop looking along the stack once we hit this declaration
- public TypeFilter filter = null;
-
- public boolean qualified = false;
- public boolean ignoreUsingDirectives = false;
- public boolean usingDirectivesOnly = false;
- public boolean forUserDefinedConversion = false;
-
- public Map foundItems = null;
-
- public ISymbol templateInstance = null;
- public LookupMode mode = LookupMode.NORMAL;
-
- public LookupData( String n, TypeInfo.eType t, ISymbol i ){
- name = n;
- filter = new TypeFilter( t );
- templateInstance = i;
- }
- public LookupData( String n, TypeFilter f, ISymbol i ){
- name = n;
- filter = ( f != null ) ? f : new TypeFilter( TypeInfo.t_any );
- templateInstance = i;
- }
- }
-
- static private class Cost
- {
-
- public Cost( TypeInfo s, TypeInfo t ){
- source = ( s != null ) ? new TypeInfo( s ) : new TypeInfo();
- target = ( t != null ) ? new TypeInfo( t ) : new TypeInfo();
- }
-
- public TypeInfo source;
- public TypeInfo target;
-
- public boolean targetHadReference = false;
-
- public int lvalue;
- public int promotion;
- public int conversion;
- public int qualification;
- public int userDefined;
- public int rank = -1;
- public int detail;
-
- //Some constants to help clarify things
- public static final int AMBIGUOUS_USERDEFINED_CONVERSION = 1;
-
- public static final int NO_MATCH_RANK = -1;
- public static final int IDENTITY_RANK = 0;
- public static final int LVALUE_OR_QUALIFICATION_RANK = 0;
- public static final int PROMOTION_RANK = 1;
- public static final int CONVERSION_RANK = 2;
- public static final int DERIVED_TO_BASE_CONVERSION = 3;
- public static final int USERDEFINED_CONVERSION_RANK = 4;
- public static final int ELLIPSIS_CONVERSION = 5;
-
-
- public int compare( Cost cost ){
- int result = 0;
-
- if( rank != cost.rank ){
- return cost.rank - rank;
- }
-
- if( userDefined != 0 || cost.userDefined != 0 ){
- if( userDefined == 0 || cost.userDefined == 0 ){
- return cost.userDefined - userDefined;
- } else {
- if( (userDefined == AMBIGUOUS_USERDEFINED_CONVERSION || cost.userDefined == AMBIGUOUS_USERDEFINED_CONVERSION) ||
- (userDefined != cost.userDefined ) )
- {
- return 0;
- }
- // else they are the same constructor/conversion operator and are ranked
- //on the standard conversion sequence
- }
- }
-
- if( promotion > 0 || cost.promotion > 0 ){
- result = cost.promotion - promotion;
- }
- if( conversion > 0 || cost.conversion > 0 ){
- if( detail == cost.detail ){
- result = cost.conversion - conversion;
- } else {
- result = cost.detail - detail;
- }
- }
-
- if( result == 0 ){
- if( cost.qualification != qualification ){
- return cost.qualification - qualification;
- } else if( (cost.qualification == qualification) && qualification == 0 ){
- return 0;
- } else {
- int size = cost.target.hasPtrOperators() ? cost.target.getPtrOperators().size() : 0;
- int size2 = target.hasPtrOperators() ? target.getPtrOperators().size() : 0;
-
- ListIterator iter1 = cost.target.getPtrOperators().listIterator( size );
- ListIterator iter2 = target.getPtrOperators().listIterator( size2 );
-
- TypeInfo.PtrOp op1 = null, op2 = null;
-
- int subOrSuper = 0;
- for( int i = ( size < size2 ) ? size : size2; i > 0; i-- ){
- op1 = (TypeInfo.PtrOp)iter1.previous();
- op2 = (TypeInfo.PtrOp)iter2.previous();
-
- if( subOrSuper == 0)
- subOrSuper = op1.compareCVTo( op2 );
- else if( ( subOrSuper > 0 && ( op1.compareCVTo( op2 ) < 0 )) ||
- ( subOrSuper < 0 && ( op1.compareCVTo( op2 ) > 0 )) )
- {
- result = -1;
- break;
- }
- }
- if( result == -1 ){
- result = 0;
- } else {
- if( size == size2 ){
- result = subOrSuper;
- } else {
- result = size - size2;
- }
- }
- }
- }
-
- return result;
- }
- }
-
- /**
- * The visibility of the symbol is modified by the visibility of the base classes
- * @param symbol
- * @param qualifyingSymbol
- * @return
- */
- public static ASTAccessVisibility getVisibility(ISymbol symbol, IContainerSymbol qualifyingSymbol) throws ParserSymbolTableException {
-
- IContainerSymbol container = symbol.getContainingSymbol();
- if( qualifyingSymbol == null || container.equals( qualifyingSymbol ) ){
- ISymbolASTExtension extension = symbol.getASTExtension();
- IASTNode node = extension != null ? extension.getPrimaryDeclaration() : null;
- if( node != null && node instanceof IASTMember ){
- return ((IASTMember)node).getVisiblity();
- } else {
- throw new ParserSymbolTableException( ParserSymbolTableException.r_InternalError );
- }
- }
-
- if( ! (qualifyingSymbol instanceof IDerivableContainerSymbol) ){
- throw new ParserSymbolTableException( ParserSymbolTableException.r_InternalError );
- }
-
- List parents = ((IDerivableContainerSymbol) qualifyingSymbol).getParents();
- Iterator iter = parents.iterator();
- IParentSymbol parent = null;
- ASTAccessVisibility symbolAccess = null;
- ASTAccessVisibility parentAccess = null;
-
- while( iter.hasNext() ){
- parent = (IParentSymbol) iter.next();
-
- if( container == parent.getParent() ){
- parentAccess = parent.getAccess();
- symbolAccess = ((IASTMember)symbol.getASTExtension().getPrimaryDeclaration()).getVisiblity();
-
- return ( parentAccess.getEnumValue() > symbolAccess.getEnumValue() ) ? parentAccess : symbolAccess;
- }
- }
-
- iter = parents.iterator();
-
- //if static or an enumerator, the symbol could be visible through more than one path through the heirarchy,
- //so we need to check all paths
- boolean checkAllPaths = ( symbol.isType( TypeInfo.t_enumerator ) || symbol.getTypeInfo().checkBit( TypeInfo.isStatic ) );
- ASTAccessVisibility resultingAccess = null;
- while( iter.hasNext() ){
- parent = (IParentSymbol) iter.next();
- parentAccess = parent.getAccess();
- symbolAccess = getVisibility( symbol, (IContainerSymbol) parent.getParent() );
-
- if( symbolAccess != null ){
- symbolAccess = ( parentAccess.getEnumValue() > symbolAccess.getEnumValue() ) ? parentAccess : symbolAccess;
- if( checkAllPaths ){
- if( resultingAccess != null )
- resultingAccess = ( resultingAccess.getEnumValue() > symbolAccess.getEnumValue() ) ? symbolAccess : resultingAccess;
- else
- resultingAccess = symbolAccess;
- } else {
- return symbolAccess;
- }
- }
- }
- return resultingAccess;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTableException.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTableException.java
deleted file mode 100644
index b562e49fddc..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTableException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**********************************************************************
- * 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.parser.pst;
-
-/**
- * @author aniefer
- *
- * 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 ParserSymbolTableException extends Exception {
-
- /**
- * Constructor for ParserSymbolTableException.
- */
- public ParserSymbolTableException() {
- super();
- }
-
- /**
- * Constructor for ParserSymbolTableException.
- * @param int r: reason
- */
- public ParserSymbolTableException( int r ) {
- reason = r;
- }
-
- public static final int r_InternalError = -1;
- public static final int r_Ambiguous = 0;
- public static final int r_BadTypeInfo = 1;
- public static final int r_CircularInheritance = 2;
- public static final int r_InvalidOverload = 3;
- public static final int r_BadTemplate = 4;
- public static final int r_InvalidUsing = 5;
- public static final int r_BadVisibility = 6;
- public static final int r_UnableToResolveFunction = 7;
-
- public int reason = -1;
-} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/SpecializedSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/SpecializedSymbol.java
deleted file mode 100644
index f6b6c331cbb..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/SpecializedSymbol.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 IBM 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 Corp. - Rational Software - initial implementation
- ******************************************************************************/
-/*
- * Created on Nov 6, 2003
- */
-package org.eclipse.cdt.internal.core.parser.pst;
-
-/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-public class SpecializedSymbol extends ParameterizedSymbol implements ISpecializedSymbol {
- protected SpecializedSymbol( ParserSymbolTable table, String name ){
- super( table, name, TypeInfo.t_template );
- }
-
- protected SpecializedSymbol( ParserSymbolTable table, String name, ISymbolASTExtension obj ){
- super( table, name, obj );
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/StandardSymbolExtension.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/StandardSymbolExtension.java
deleted file mode 100644
index 4e7a7928cbe..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/StandardSymbolExtension.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**********************************************************************
- * 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.pst;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-import org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class StandardSymbolExtension extends AbstractSymbolExtension
-{
-
- /**
- * @author jcamelon
- *
- */
- private class SimpleIterator implements Iterator
- {
- boolean hasNext = true;
- /**
- *
- */
- public SimpleIterator()
- {
- }
-
- /* (non-Javadoc)
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext()
- {
- return hasNext;
- }
-
- /* (non-Javadoc)
- * @see java.util.Iterator#next()
- */
- public Object next()
- {
- if( hasNext )
- {
- hasNext = false;
- return primaryDeclaration;
- }
-
- throw new NoSuchElementException();
- }
-
- /* (non-Javadoc)
- * @see java.util.Iterator#remove()
- */
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- }
- /**
- * @param symbol
- * @param primaryDeclaration
- */
- public StandardSymbolExtension(ISymbol symbol, ASTSymbol primaryDeclaration)
- {
- super(symbol, primaryDeclaration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension#getAllDefinitions()
- */
- public Iterator getAllDefinitions()
- {
- return this.new SimpleIterator();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension#addDefinition(org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol)
- */
- public void addDefinition(ASTSymbol definition) throws ExtensionException
- {
- throw new ExtensionException();
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateInstance.java
deleted file mode 100644
index 277463169d6..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateInstance.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 IBM 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 Corp. - Rational Software - initial implementation
- ******************************************************************************/
-/*
- * Created on Nov 6, 2003
- */
-package org.eclipse.cdt.internal.core.parser.pst;
-
-import java.util.Iterator;
-import java.util.Map;
-
-
-public class TemplateInstance extends BasicSymbol
-{
- private final ParserSymbolTable _table;
-
- protected TemplateInstance( ParserSymbolTable table, ISymbol symbol, Map argMap ){
- super(table, ParserSymbolTable.EMPTY_NAME );
- this._table = table;
- _instantiatedSymbol = symbol;
- symbol.setTemplateInstance( this );
- _argumentMap = argMap;
- }
-
- public boolean equals( Object t ){
- if( t == null || !( t instanceof TemplateInstance ) ){
- return false;
- }
-
- TemplateInstance instance = (TemplateInstance) t;
-
- if( _instantiatedSymbol != instance._instantiatedSymbol ){
- return false;
- }
-
- //check arg map
- Iterator iter1 = _argumentMap.keySet().iterator();
- Iterator iter2 = instance._argumentMap.keySet().iterator();
- int size = _argumentMap.size();
- int size2 = instance._argumentMap.size();
- ISymbol t1 = null, t2 = null;
- if( size == size2 ){
- for( int i = size; i > 0; i-- ){
- t1 = (ISymbol)iter1.next();
- t2 = (ISymbol)iter2.next();
- if( t1 != t2 || !_argumentMap.get(t1).equals( instance._argumentMap.get(t2) ) ){
- return false;
- }
- }
- }
-
- return true;
- }
-
- public ISymbol getInstantiatedSymbol(){
- _instantiatedSymbol.setTemplateInstance( this );
- return _instantiatedSymbol;
- }
-
- public TypeInfo.eType getType(){
- ISymbol symbol = _instantiatedSymbol;
- TypeInfo.eType returnType = _instantiatedSymbol.getType();
- if( returnType == TypeInfo.t_type ){
- symbol = symbol.getTypeSymbol();
- TypeInfo info = null;
- while( symbol != null && symbol.getType() == TypeInfo.t_undef && symbol.getContainingSymbol().getType() == TypeInfo.t_template ){
- info = (TypeInfo) _argumentMap.get( symbol );
- if( !info.isType( TypeInfo.t_type ) ){
- break;
- }
- symbol = info.getTypeSymbol();
- }
-
- return ( info != null ) ? info.getType() : TypeInfo.t_type;
- }
-
- return returnType;
- }
-
- public boolean isType( TypeInfo.eType type ){
- return ( type == TypeInfo.t_any || getType() == type );
- }
-
- public boolean isType( TypeInfo.eType type, TypeInfo.eType upperType ){
- if( type == TypeInfo.t_any )
- return true;
-
- if( upperType == TypeInfo.t_undef ){
- return ( getType() == type );
- } else {
- return ( getType().compareTo( type ) >= 0 && getType().compareTo( upperType ) <= 0 );
- }
- }
-
- public ISymbol getTypeSymbol(){
- ISymbol symbol = _instantiatedSymbol.getTypeSymbol();
- if( symbol != null && symbol.getType() == TypeInfo.t_undef &&
- symbol.getContainingSymbol().getType() == TypeInfo.t_template )
- {
- TypeInfo info = (TypeInfo) _argumentMap.get( symbol );
- return ( info != null ) ? info.getTypeSymbol() : null;
- }
-
- return symbol;
- }
-
- public TypeInfo getTypeInfo(){
- ISymbol symbol = _instantiatedSymbol.getTypeSymbol();
- if( symbol != null && symbol.getType() == TypeInfo.t_undef &&
- symbol.getContainingSymbol().getType() == TypeInfo.t_template )
- {
- TypeInfo info = (TypeInfo) _argumentMap.get( symbol );
- return info;
- }
-
- return _instantiatedSymbol.getTypeInfo();
- }
-
- public Map getArgumentMap(){
- return _argumentMap;
- }
-
-
- private ISymbol _instantiatedSymbol;
- //private LinkedList _arguments;
- private Map _argumentMap;
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeFilter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeFilter.java
deleted file mode 100644
index 7b45291bca5..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeFilter.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 IBM 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 Corp. - Rational Software - initial implementation
- ******************************************************************************/
-
-package org.eclipse.cdt.internal.core.parser.pst;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.cdt.core.parser.ast.IASTNode.LookupKind;
-
-/**
- * @author aniefer
- */
-public class TypeFilter {
-
- public TypeFilter(){
- }
-
- public TypeFilter( Set types ){
- acceptedTypes.addAll( types );
- }
-
- public TypeFilter( TypeInfo.eType type ){
- acceptedTypes.add( type );
- }
-
- public TypeFilter( LookupKind kind ){
- acceptedKinds.add( kind );
- populatedAcceptedTypes( kind );
- }
-
- public void addAcceptedType( TypeInfo.eType type ){
- acceptedTypes.add( type );
- }
-
- public void addAcceptedType( LookupKind kind ) {
- populatedAcceptedTypes( kind );
- acceptedKinds.add( kind );
- }
-
- public boolean shouldAccept( ISymbol symbol ){
- return shouldAccept( symbol, symbol.getTypeInfo() );
- }
- public boolean shouldAccept( ISymbol symbol, TypeInfo typeInfo ){
- if( acceptedTypes.contains( TypeInfo.t_any ) ){
- return true;
- }
-
- if( acceptedKinds.isEmpty() ){
- return acceptedTypes.contains( typeInfo.getType() );
- }
-
- IContainerSymbol container = symbol.getContainingSymbol();
-
- boolean symbolIsMember = container.isType( TypeInfo.t_class, TypeInfo.t_union );
- boolean symbolIsLocal = container.isType( TypeInfo.t_constructor, TypeInfo.t_function ) ||
- container.isType( TypeInfo.t_block );
-
- if( typeInfo.isType( TypeInfo.t_function ) )
- {
- if( ( acceptedKinds.contains( LookupKind.FUNCTIONS ) && !symbolIsMember ) ||
- ( acceptedKinds.contains( LookupKind.METHODS ) && symbolIsMember ) )
- {
- return true;
- } else {
- return false;
- }
- }
- else if ( typeInfo.isType( TypeInfo.t_type ) || typeInfo.isType( TypeInfo.t_bool, TypeInfo.t_enumerator ) )
- {
- if( ( acceptedKinds.contains( LookupKind.VARIABLES ) && !symbolIsMember && !symbolIsLocal ) ||
- ( acceptedKinds.contains( LookupKind.LOCAL_VARIABLES ) && !symbolIsMember && symbolIsLocal ) ||
- ( acceptedKinds.contains( LookupKind.FIELDS ) && symbolIsMember ) )
- {
- return true;
- } else {
- return false;
- }
- }
- else
- {
- return acceptedTypes.contains( typeInfo.getType() );
- }
- }
-
- /**
- * @param lookupKind
- */
- private void populatedAcceptedTypes(LookupKind kind) {
- if ( kind == LookupKind.ALL ) { acceptedTypes.add( TypeInfo.t_any ); }
- else if ( kind == LookupKind.STRUCTURES ) { acceptedTypes.add( TypeInfo.t_class );
- acceptedTypes.add( TypeInfo.t_struct );
- acceptedTypes.add( TypeInfo.t_union ); }
- else if ( kind == LookupKind.STRUCS ) { acceptedTypes.add( TypeInfo.t_struct ); }
- else if ( kind == LookupKind.UNIONS ) { acceptedTypes.add( TypeInfo.t_union ); }
- else if ( kind == LookupKind.CLASSES ) { acceptedTypes.add( TypeInfo.t_class ); }
- else if ( kind == LookupKind.CONSTRUCTORS ){ acceptedTypes.add( TypeInfo.t_constructor ); }
- else if ( kind == LookupKind.NAMESPACES ) { acceptedTypes.add( TypeInfo.t_namespace ); }
- else if ( kind == LookupKind.ENUMERATIONS ){ acceptedTypes.add( TypeInfo.t_enumeration ); }
- else if ( kind == LookupKind.ENUMERATORS ) { acceptedTypes.add( TypeInfo.t_enumerator ); }
- }
-
-
- private Set acceptedTypes = new HashSet();
- private Set acceptedKinds = new HashSet();
-} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeInfo.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeInfo.java
deleted file mode 100644
index 958832d87c1..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TypeInfo.java
+++ /dev/null
@@ -1,527 +0,0 @@
-/**********************************************************************
- * 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.pst;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.cdt.core.parser.Enum;
-
-
-public class TypeInfo {
- public TypeInfo(){
- super();
- }
-
- public TypeInfo( TypeInfo.eType type, int info, ISymbol symbol ){
- super();
- _typeInfo = info;
- _type = type;
- _typeDeclaration = symbol;
- }
-
- public TypeInfo( TypeInfo.eType type, int info, ISymbol symbol, TypeInfo.PtrOp op, boolean hasDefault ){
- super();
- _typeInfo = info;
- _type = type;
- _typeDeclaration = symbol;
- if( op != null ){
- _ptrOperators = new LinkedList();
- _ptrOperators.add( op );
- } else {
- _ptrOperators = null;
- }
- _hasDefaultValue = hasDefault;
- }
-
- public TypeInfo( TypeInfo.eType type, int info, ISymbol symbol, TypeInfo.PtrOp op, Object def ){
- super();
- _typeInfo = info;
- _type = type;
- _typeDeclaration = symbol;
- if( op != null ){
- _ptrOperators = new LinkedList();
- _ptrOperators.add( op );
- } else {
- _ptrOperators = null;
- }
- _hasDefaultValue = true;
- setDefault( def );
- }
-
- public TypeInfo( TypeInfo info ){
- super();
-
- _typeInfo = info._typeInfo;
- _type = info._type;
- _typeDeclaration = info._typeDeclaration;
- _ptrOperators = ( info._ptrOperators == null ) ? null : (LinkedList)info._ptrOperators.clone();
- _hasDefaultValue = info._hasDefaultValue;
- }
-
- 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;
- public static final int isForward = 0x100000;
- public static final int isComplex = 0x200000;
- public static final int isImaginary= 0x400000;
-
- // Types (maximum type is typeMask
- // Note that these should be considered ordered and if you change
- // the order, you should consider the ParserSymbolTable uses
- public static final TypeInfo.eType t_any = new TypeInfo.eType( -1 ); //don't care
- public static final TypeInfo.eType t_undef = new TypeInfo.eType( 0 ); //not specified
- public static final TypeInfo.eType t_type = new TypeInfo.eType( 1 ); //Type Specifier
- public static final TypeInfo.eType t_namespace = new TypeInfo.eType( 2 );
- public static final TypeInfo.eType t_class = new TypeInfo.eType( 3 );
- public static final TypeInfo.eType t_struct = new TypeInfo.eType( 4 );
- public static final TypeInfo.eType t_union = new TypeInfo.eType( 5 );
- public static final TypeInfo.eType t_enumeration = new TypeInfo.eType( 6 );
- public static final TypeInfo.eType t_constructor = new TypeInfo.eType( 7 );
- public static final TypeInfo.eType t_function = new TypeInfo.eType( 8 );
- public static final TypeInfo.eType t__Bool = new TypeInfo.eType( 9 );
- public static final TypeInfo.eType t_bool = new TypeInfo.eType( 10 );
- public static final TypeInfo.eType t_char = new TypeInfo.eType( 11 );
- public static final TypeInfo.eType t_wchar_t = new TypeInfo.eType( 12 );
- public static final TypeInfo.eType t_int = new TypeInfo.eType( 13 );
- public static final TypeInfo.eType t_float = new TypeInfo.eType( 14 );
- public static final TypeInfo.eType t_double = new TypeInfo.eType( 15 );
- public static final TypeInfo.eType t_void = new TypeInfo.eType( 16 );
- public static final TypeInfo.eType t_enumerator = new TypeInfo.eType( 17 );
- public static final TypeInfo.eType t_block = new TypeInfo.eType( 18 );
- public static final TypeInfo.eType t_template = new TypeInfo.eType( 19 );
- public static final TypeInfo.eType t_asm = new TypeInfo.eType( 20 );
- public static final TypeInfo.eType t_linkage = new TypeInfo.eType( 21 );
-
- //public static final eType t_templateParameter = new eType( 18 );
-
- public static class eType implements Comparable{
- protected eType( int v ){
- _val = v;
- }
-
- public int compareTo( Object o ){
- TypeInfo.eType t = (TypeInfo.eType) o;
- return _val - t._val;
- }
-
- public int toInt(){
- return _val;
- }
-
- private int _val;
- }
-
- public static class OperatorExpression extends Enum{
-
- //5.3.1-1 : The unary * operator, the expression to which it is applied shall be
- //a pointer to an object type or a pointer to a function type and the result
- //is an lvalue refering to the object or function to which the expression points
- public static final OperatorExpression indirection = new OperatorExpression( 1 );
-
- //5.3.1-2 : The result of the unary & operator is a pointer to its operand
- public static final OperatorExpression addressof = new OperatorExpression( 0 );
-
- //5.2.1 A postfix expression followed by an expression in square brackets is a postfix
- //expression. one of the expressions shall have the type "pointer to T" and the other
- //shall have a enumeration or integral type. The result is an lvalue of type "T"
- public static final OperatorExpression subscript = new OperatorExpression( 2 );
-
- protected OperatorExpression(int enumValue) {
- super(enumValue);
- }
- }
-
- public static class PtrOp {
- public PtrOp( TypeInfo.eType type ){
- this.type = type;
- }
- public PtrOp( TypeInfo.eType type, boolean isConst, boolean isVolatile ){
- this.type = type;
- this.isConst = isConst;
- this.isVolatile = isVolatile;
- }
- public PtrOp( ISymbol memberOf, boolean isConst, boolean isVolatile ){
- this.type = PtrOp.t_memberPointer;
- this.isConst = isConst;
- this.isVolatile = isVolatile;
- this.memberOf = memberOf;
- }
-
- public PtrOp(){
- super();
- }
-
- public static final TypeInfo.eType t_undef = new TypeInfo.eType( 0 );
- public static final TypeInfo.eType t_pointer = new TypeInfo.eType( 1 );
- public static final TypeInfo.eType t_reference = new TypeInfo.eType( 2 );
- public static final TypeInfo.eType t_array = new TypeInfo.eType( 3 );
- public static final TypeInfo.eType t_memberPointer = new TypeInfo.eType( 4 );
-
- public TypeInfo.eType getType() { return type; }
- public void setType( TypeInfo.eType type ) { this.type = type; }
-
- public boolean isConst() { return isConst; }
- public boolean isVolatile() { return isVolatile; }
- public void setConst( boolean isConst ) { this.isConst = isConst; }
- public void setVolatile(boolean isVolatile) { this.isVolatile = isVolatile; }
-
- public ISymbol getMemberOf() { return memberOf; }
- public void setMemberOf( ISymbol member ) { this.memberOf = member; }
-
- public int compareCVTo( TypeInfo.PtrOp ptr ){
- int cv1 = ( isConst() ? 1 : 0 ) + ( isVolatile() ? 1 : 0 );
- int cv2 = ( ptr.isConst() ? 1 : 0 ) + ( ptr.isVolatile() ? 1 : 0 );
-
- return cv1 - cv2;
- }
- public boolean equals( Object o ){
- if( o == null || !(o instanceof TypeInfo.PtrOp) ){
- return false;
- }
- TypeInfo.PtrOp op = (TypeInfo.PtrOp)o;
-
- return ( isConst() == op.isConst() &&
- isVolatile() == op.isVolatile() &&
- getType() == op.getType() );
- }
-
- private TypeInfo.eType type = PtrOp.t_undef;
- private boolean isConst = false;
- private boolean isVolatile = false;
- private ISymbol memberOf = null;
- }
-
- private static final String _image[] = { "", //$NON-NLS-1$ t_undef
- "", //$NON-NLS-1$ t_type
- "namespace", //$NON-NLS-1$ t_namespace
- "class", //$NON-NLS-1$ t_class
- "struct", //$NON-NLS-1$ t_struct
- "union", //$NON-NLS-1$ t_union
- "enum", //$NON-NLS-1$ t_enumeration
- "", //$NON-NLS-1$ t_constructor
- "", //$NON-NLS-1$ t_function
- "bool", //$NON-NLS-1$ t_bool
- "char", //$NON-NLS-1$ t_char
- "wchar_t", //$NON-NLS-1$ t_wchar_t
- "int", //$NON-NLS-1$ t_int
- "float", //$NON-NLS-1$ t_float
- "double", //$NON-NLS-1$ t_double
- "void", //$NON-NLS-1$ t_void
- "", //$NON-NLS-1$ t_enumerator
- "", //$NON-NLS-1$ t_block
- "template", //$NON-NLS-1$ t_template
- "", //$NON-NLS-1$ t_asm
- "" //$NON-NLS-1$ t_linkage
- };
- //Partial ordering :
- // none < const
- // none < volatile
- // none < const volatile
- // const < const volatile
- // volatile < const volatile
- public static final int cvConst = 2;
- public static final int cvVolatile = 3;
- public static final int cvConstVolatile = 5;
-
- // Convenience methods
- public void setBit(boolean b, int mask){
- if( b ){
- _typeInfo = _typeInfo | mask;
- } else {
- _typeInfo = _typeInfo & ~mask;
- }
- }
-
- public boolean checkBit(int mask){
- return (_typeInfo & mask) != 0;
- }
-
- public void setType( TypeInfo.eType t){
- _type = t;
- }
-
- public TypeInfo.eType getType(){
- return _type;
- }
-
- public boolean isType( TypeInfo.eType type ){
- return isType( type, TypeInfo.t_undef );
- }
-
- public int getTypeInfo(){
- return _typeInfo;
- }
-
- public void setTypeInfo( int typeInfo ){
- _typeInfo = typeInfo;
- }
-
- /**
- *
- * @param type
- * @param upperType
- * @return boolean
- *
- * type checking, check that this declaration's type is between type and
- * upperType (inclusive). upperType of 0 means no range and our type must
- * be type.
- */
- public boolean isType( TypeInfo.eType type, TypeInfo.eType upperType ){
- //type of -1 means we don't care
- if( type == TypeInfo.t_any )
- return true;
-
- //upperType of 0 means no range
- if( upperType == TypeInfo.t_undef ){
- return ( getType() == type );
- } else {
- return ( getType().compareTo( type ) >= 0 && getType().compareTo( upperType ) <= 0 );
- }
- }
-
- public ISymbol getTypeSymbol(){
- return _typeDeclaration;
- }
-
- public void setTypeSymbol( ISymbol type ){
- _typeDeclaration = type;
- }
-
- public boolean hasPtrOperators(){
- return ( _ptrOperators != null && _ptrOperators.size() > 0 );
- }
-
- public List getPtrOperators(){
- if( _ptrOperators == null ){
- _ptrOperators = new LinkedList();
- }
- return _ptrOperators;
- }
-
- public boolean hasSamePtrs( TypeInfo type ){
- int size = getPtrOperators().size();
- int size2 = type.getPtrOperators().size();
- Iterator iter1 = getPtrOperators().iterator();
- Iterator iter2 = type.getPtrOperators().iterator();
- TypeInfo.PtrOp ptr1 = null, ptr2 = null;
- if( size2 < size ) {
- for( int i = size; i > size2; i-- ){
- ptr2 = (PtrOp) iter1.next();
- if( ptr2.getType() != PtrOp.t_undef ){
- return false;
- }
- }
- size = size2;
- } else if ( size < size2 ){
- for( int i = size2; i > size; i-- ){
- ptr1 = (PtrOp)iter2.next();
- if( ptr1.getType() != PtrOp.t_undef ){
- return false;
- }
- }
- size2 = size;
- }
-
- if( size == size2 ){
- if( size > 0 ){
- for( int i = size; i > 0; i-- ){
- ptr1 = (TypeInfo.PtrOp)iter1.next();
- ptr2 = (TypeInfo.PtrOp)iter2.next();
- if( ptr1.getType() != ptr2.getType() ){
- return false;
- }
- }
- }
- return true;
- }
- return false;
- }
-
- public List getOperatorExpressions(){
- if( _operatorExpressions == null ){
- _operatorExpressions = new LinkedList();
- }
- return _operatorExpressions;
- }
-
-
- public void applyOperatorExpressions( List ops ){
- if( ops == null || ops.isEmpty() )
- return;
-
- int size = ops.size();
- Iterator iter = ops.iterator();
- OperatorExpression op = null;
- for( int i = size; i > 0; i-- ){
- op = (OperatorExpression)iter.next();
- if( op == OperatorExpression.indirection ||
- op == OperatorExpression.subscript )
- {
- //indirection operator, can only be applied to a pointer
- //subscript should be applied to something that is "pointer to T", the result is a lvalue of type "T"
- if( hasPtrOperators() ){
- ListIterator iterator = getPtrOperators().listIterator( getPtrOperators().size() );
- TypeInfo.PtrOp last = (TypeInfo.PtrOp)iterator.previous();
- if( last.getType() == TypeInfo.PtrOp.t_pointer ||
- last.getType() == TypeInfo.PtrOp.t_array )
- {
- iterator.remove();
- }
- }
- } else if( op == OperatorExpression.addressof ){
- //Address-of unary operator, results in pointer to T
- //TODO or pointer to member
- TypeInfo.PtrOp newOp = new TypeInfo.PtrOp( PtrOp.t_pointer );
- addPtrOperator( newOp );
- }
- }
- }
-
- public void addPtrOperator( TypeInfo.PtrOp ptr ){
- if( _ptrOperators == null ){
- _ptrOperators = new LinkedList();
- }
- if( ptr != null )
- _ptrOperators.add( ptr );
- }
-
- public void addPtrOperator( List ptrs ){
- if( _ptrOperators == null ){
- _ptrOperators = new LinkedList();
- }
- if( ptrs != null )
- _ptrOperators.addAll( ptrs );
- }
-
- public void addOperatorExpression( OperatorExpression exp ){
- if( _operatorExpressions == null ){
- _operatorExpressions = new LinkedList();
- }
- _operatorExpressions.add( exp );
- }
-
- public boolean getHasDefault(){
- return _hasDefaultValue;
- }
-
- public void setHasDefault( boolean def ){
- _hasDefaultValue = def;
- }
- public void setDefault( Object t ){
- _defaultValue = t;
- }
- public Object getDefault(){
- return _defaultValue;
- }
-
- public boolean isForwardDeclaration(){
- return checkBit( isForward );
- }
-
- public void setIsForwardDeclaration( boolean forward ){
- setBit( forward, isForward );
- }
-
- /**
- * canHold
- * @param type
- * @return boolean
- * return true is the our type can hold all the values of the passed in
- * type.
- * TODO, for now return true if our type is "larger" (based on ordering of
- * the type values)
- */
- public boolean canHold( TypeInfo type ){
- return getType().compareTo( type.getType() ) >= 0;
- }
-
- public boolean equals( Object t ){
- if( t == null || !(t instanceof TypeInfo) ){
- return false;
- }
-
- TypeInfo type = (TypeInfo)t;
-
- boolean result = ( _typeInfo == type._typeInfo );
- result &= ( _type == type._type );
-
- if( _typeDeclaration instanceof TemplateInstance ){
- result &= _typeDeclaration.equals( type._typeDeclaration );
- } else {
- if( _typeDeclaration != null && type._typeDeclaration != null &&
- _typeDeclaration.isType( TypeInfo.t_bool, TypeInfo.t_void ) &&
- type._typeDeclaration.isType( TypeInfo.t_bool, TypeInfo.t_void ) )
- {
- //if typeDeclaration is a basic type, then only need the types the same
- result &= ( _typeDeclaration.getType() == type._typeDeclaration.getType() );
- } else {
- //otherwise, its a user defined type, need the decls the same
- result &= ( _typeDeclaration == type._typeDeclaration );
- }
- }
-
- int size1 = (_ptrOperators == null) ? 0 : _ptrOperators.size();
- int size2 = (type._ptrOperators == null) ? 0 : type._ptrOperators.size();
- if( size1 == size2 ){
- if( size1 != 0 ){
- Iterator iter1 = _ptrOperators.iterator();
- Iterator iter2 = type._ptrOperators.iterator();
-
- TypeInfo.PtrOp op1 = null, op2 = null;
- for( int i = size1; i > 0; i-- ){
- op1 = (TypeInfo.PtrOp)iter1.next();
- op2 = (TypeInfo.PtrOp)iter2.next();
-
- if( !op1.equals(op2) ){
- return false;
- }
- }
- }
- } else {
- return false;
- }
-
- return result;
- }
-
- public String toString(){
- if( isType( TypeInfo.t_type ) ){
- return _typeDeclaration.getName();
- } else {
- return TypeInfo._image[ getType().toInt() ];
- }
- }
-
- private int _typeInfo = 0;
- private TypeInfo.eType _type = TypeInfo.t_undef;
- private ISymbol _typeDeclaration;
-
- private boolean _hasDefaultValue = false;
- private Object _defaultValue = null;
- private LinkedList _ptrOperators;
- private LinkedList _operatorExpressions;
-} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/util/ASTUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/util/ASTUtil.java
deleted file mode 100644
index 04cced9ba18..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/util/ASTUtil.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001 Rational Software Corp. 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 implementation
- ******************************************************************************/
-package org.eclipse.cdt.internal.core.parser.util;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ast.ASTClassKind;
-import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTExpression;
-import org.eclipse.cdt.core.parser.ast.IASTFunction;
-import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
-import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTTemplateParameter;
-import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
-
-/**
- * This is a utility class to help convert AST elements to Strings.
- */
-
-public class ASTUtil {
- public static String[] getTemplateParameters(IASTTemplateDeclaration templateDeclaration){
- // add the parameters
- Iterator i = templateDeclaration.getTemplateParameters();
- return getTemplateParameters(i);
- }
- public static String[] getTemplateParameters(Iterator templateParams){
- List paramList = new ArrayList();
- while (templateParams.hasNext()){
- StringBuffer paramType = new StringBuffer();
- IASTTemplateParameter parameter = (IASTTemplateParameter)templateParams.next();
- if((parameter.getIdentifier() != null) && (parameter.getIdentifier().length() != 0))
- {
- paramList.add(parameter.getIdentifier().toString());
- }
- else
- {
- IASTTemplateParameter.ParamKind kind = parameter.getTemplateParameterKind();
- if(kind == IASTTemplateParameter.ParamKind.CLASS){
- paramType.append("class");
- }
- if(kind == IASTTemplateParameter.ParamKind.TYPENAME){
- paramType.append("typename");
- }
- if(kind == IASTTemplateParameter.ParamKind.TEMPLATE_LIST){
- paramType.append("template<");
- String[] subParams = getTemplateParameters(parameter.getTemplateParameters());
- int p = 0;
- if ( subParams.length > 0)
- paramType.append(subParams[p++]);
- while( p < subParams.length){
- paramType.append(", ");
- paramType.append(subParams[p++]);
- }
- paramType.append(">");
- }
- if(kind == IASTTemplateParameter.ParamKind.PARAMETER){
- paramType.append(getType(parameter.getParameterDeclaration()));
- }
- paramList.add(paramType.toString());
- } // end else
- }// end while
- String[] parameterTypes = new String[paramList.size()];
- for(int j=0; j<paramList.size(); ++j){
- parameterTypes[j] = (String) paramList.get(j);
- }
- return parameterTypes;
-
- }
-
- public static String getType(IASTAbstractDeclaration declaration)
- {
- StringBuffer type = new StringBuffer();
-
- // get type from declaration
- type.append(getDeclarationType(declaration));
- type.append(getPointerOperation(declaration));
- type.append(getArrayQualifiers(declaration));
-
- type.append(getPointerToFunctionType(declaration));
- if (declaration instanceof IASTParameterDeclaration)
- type.append(getInitializerClause((IASTParameterDeclaration)declaration));
- return type.toString();
- }
-
- public static String getInitializerClause(IASTParameterDeclaration declaration){
- StringBuffer initializer = new StringBuffer();
- if(declaration != null){
- IASTInitializerClause clause = declaration.getDefaultValue();
- if(clause != null){
- IASTExpression expression = clause.getAssigmentExpression();
- if(expression != null){
- String literal = expression.getLiteralString();
- if(literal.length() > 0)
- initializer.append("=");
- initializer.append(literal);
- }
- }
- }
- return initializer.toString();
- }
- public static String getPointerToFunctionType(IASTAbstractDeclaration declaration){
- StringBuffer type = new StringBuffer();
- ASTPointerOperator po = declaration.getPointerToFunctionOperator();
- if(po != null){
- type.append("(");
- type.append(getPointerOperator(po));
- type.append(")");
- String[] parameters =getParameterTypes(declaration.getParameters());
- type.append(getParametersString(parameters));
- }
- return type.toString();
- }
- public static String getDeclarationType(IASTAbstractDeclaration declaration){
- StringBuffer type = new StringBuffer();
-
- if(declaration.isConst())
- type.append("const ");
- IASTTypeSpecifier typeSpecifier = declaration.getTypeSpecifier();
- if(typeSpecifier instanceof IASTElaboratedTypeSpecifier){
- IASTElaboratedTypeSpecifier elab = (IASTElaboratedTypeSpecifier) typeSpecifier;
- type.append(getElaboratedTypeSignature(elab));
- }else if(typeSpecifier instanceof IASTSimpleTypeSpecifier){
- IASTSimpleTypeSpecifier simpleSpecifier = (IASTSimpleTypeSpecifier) typeSpecifier;
- type.append(simpleSpecifier.getTypename());
- }
- return type.toString();
- }
-
- public static String getElaboratedTypeSignature(IASTElaboratedTypeSpecifier elab){
- StringBuffer type = new StringBuffer();
- ASTClassKind t = elab.getClassKind();
- if( t == ASTClassKind.CLASS){
- type.append("class");
- }
- else if( t == ASTClassKind.STRUCT){
- type.append("struct");
- }
- else if( t == ASTClassKind.UNION){
- type.append("union");
- }
- else if( t == ASTClassKind.STRUCT){
- type.append("enum");
- }
- type.append(" ");
- type.append(elab.getName().toString());
- return type.toString();
- }
-
- public static String getPointerOperation(IASTAbstractDeclaration declaration){
- StringBuffer pointerString = new StringBuffer();
- Iterator i = declaration.getPointerOperators();
- while(i.hasNext()){
- ASTPointerOperator po = (ASTPointerOperator) i.next();
- pointerString.append(getPointerOperator(po));
- }
- return pointerString.toString();
- }
-
- public static String getPointerOperator(ASTPointerOperator po){
- String pointerString ="";
- if(po == ASTPointerOperator.POINTER)
- pointerString = ("*");
-
- if(po == ASTPointerOperator.REFERENCE)
- pointerString =("&");
-
- if(po == ASTPointerOperator.CONST_POINTER)
- pointerString =("* const");
-
- if(po == ASTPointerOperator.VOLATILE_POINTER)
- pointerString =("* volatile");
-
- return pointerString;
- }
-
- public static String getArrayQualifiers(IASTAbstractDeclaration declaration){
- StringBuffer arrayString = new StringBuffer();
- Iterator i = declaration.getArrayModifiers();
- while (i.hasNext()){
- i.next();
- arrayString.append("[]");
- }
- return arrayString.toString();
- }
-
- public static String[] getFunctionParameterTypes(IASTFunction functionDeclaration)
- {
- Iterator parameters = functionDeclaration.getParameters();
- return getParameterTypes(parameters);
- }
-
- public static String[] getParameterTypes(Iterator parameters){
- List paramList = new ArrayList();
- while (parameters.hasNext()){
- IASTParameterDeclaration param = (IASTParameterDeclaration)parameters.next();
- paramList.add(getType(param));
- }
- String[] parameterTypes = new String[paramList.size()];
- for(int i=0; i<paramList.size(); ++i){
- parameterTypes[i] = (String)paramList.get(i);
- }
- return parameterTypes;
- }
- public static String getParametersString(String[] parameterTypes)
- {
- StringBuffer parameters = new StringBuffer("");
-
- if ((parameterTypes != null) && (parameterTypes.length > 0)) {
- parameters.append("(");
- int i = 0;
- parameters.append(parameterTypes[i++]);
- while (i < parameterTypes.length) {
- parameters.append(", ");
- parameters.append(parameterTypes[i++]);
- }
- parameters.append(")");
- } else {
- if (parameterTypes != null) parameters.append("()");
- }
-
- return parameters.toString();
- }
-
-}

Back to the top