mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-02 14:45:25 +02:00
CORE
Filled out IASTMethod & IASTFunction & added implementations. Updated IScanner, clients & implementations to use IScannerInfo. Finished SimpleDeclaration porting to new architecture, only thing left is templates. TESTS Updated IScanner, clients & implementations to use IScannerInfo.
This commit is contained in:
parent
9faa3cf7a9
commit
d71d9270d8
61 changed files with 1937 additions and 574 deletions
|
@ -1,3 +1,6 @@
|
|||
2003-07-08 John Camelon
|
||||
Updated IScanner, clients & implementations to use IScannerInfo.
|
||||
|
||||
2003-07-07 John Camelon
|
||||
Update ClassDeclarationPatternTests::testBug39652().
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.cdt.core.parser.ILineOffsetReconciler;
|
|||
import org.eclipse.cdt.core.parser.IParser;
|
||||
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
|
||||
|
@ -55,7 +56,7 @@ public class AutomatedTest extends AutomatedFramework {
|
|||
FileInputStream stream = new FileInputStream( file );
|
||||
|
||||
String filePath = file.getCanonicalPath();
|
||||
parser = ParserFactory.createParser( ParserFactory.createScanner( new InputStreamReader (stream), filePath, null, null, ParserMode.QUICK_PARSE ), nullCallback, ParserMode.QUICK_PARSE);
|
||||
parser = ParserFactory.createParser( ParserFactory.createScanner( new InputStreamReader (stream), filePath, new ScannerInfo(), ParserMode.QUICK_PARSE ), nullCallback, ParserMode.QUICK_PARSE);
|
||||
parser.setCppNature( ((String)natures.get( filePath )).equalsIgnoreCase("cpp") );
|
||||
|
||||
mapping = ParserFactory.createLineOffsetReconciler( new InputStreamReader( stream ) );
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.cdt.core.parser.ParserMode;
|
|||
import org.eclipse.cdt.internal.core.dom.DOMBuilder;
|
||||
import org.eclipse.cdt.internal.core.dom.TranslationUnit;
|
||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -40,7 +41,7 @@ public class BaseDOMTest extends TestCase {
|
|||
public TranslationUnit parse(String code, boolean quickParse, boolean throwOnError ) throws Exception {
|
||||
DOMBuilder domBuilder = new DOMBuilder();
|
||||
ParserMode mode = quickParse ? ParserMode.QUICK_PARSE : ParserMode.COMPLETE_PARSE;
|
||||
IParser parser = ParserFactory.createParser(ParserFactory.createScanner( new StringReader( code ), null, null, null, mode ), domBuilder, mode );
|
||||
IParser parser = ParserFactory.createParser(ParserFactory.createScanner( new StringReader( code ), null, new ScannerInfo(), mode ), domBuilder, mode );
|
||||
if( ! parser.parse() )
|
||||
if( throwOnError ) throw new ParserException( "Parse failure" );
|
||||
else domBuilder.getTranslationUnit().setParseSuccessful( false );
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.cdt.core.parser.IScanner;
|
|||
import org.eclipse.cdt.core.parser.IToken;
|
||||
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||
import org.eclipse.cdt.core.parser.ScannerException;
|
||||
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -36,7 +37,7 @@ public class BaseScannerTest extends TestCase {
|
|||
|
||||
protected void initializeScanner(String input)
|
||||
{
|
||||
scanner= ParserFactory.createScanner( new StringReader(input),"TEXT", null, null, null );
|
||||
scanner= ParserFactory.createScanner( new StringReader(input),"TEXT", new ScannerInfo(), null );
|
||||
}
|
||||
|
||||
public int fullyTokenize() throws Exception
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.eclipse.cdt.core.parser.ParserFactory;
|
|||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTExpression;
|
||||
import org.eclipse.cdt.internal.core.parser.NullSourceElementRequestor;
|
||||
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
|
||||
|
||||
public class ExprEvalTest extends TestCase {
|
||||
|
||||
|
@ -24,7 +25,7 @@ public class ExprEvalTest extends TestCase {
|
|||
|
||||
public void runTest(String code, int expectedValue) throws Exception {
|
||||
|
||||
IParser parser = ParserFactory.createParser(ParserFactory.createScanner( new StringReader( code ), null, null, null, null ), new NullSourceElementRequestor(), ParserMode.QUICK_PARSE);
|
||||
IParser parser = ParserFactory.createParser(ParserFactory.createScanner( new StringReader( code ), null, new ScannerInfo(), null ), new NullSourceElementRequestor(), ParserMode.QUICK_PARSE);
|
||||
IASTExpression expression = parser.expression(null);
|
||||
assertEquals(expectedValue, expression.evaluateExpression());
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import junit.framework.Test;
|
|||
import org.eclipse.cdt.core.parser.IParser;
|
||||
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
/**
|
||||
|
@ -238,7 +239,7 @@ public class FractionalAutomatedTest extends AutomatedFramework {
|
|||
try{
|
||||
result = null;
|
||||
IParser parser = ParserFactory.createParser(
|
||||
ParserFactory.createScanner( new StringReader( code ), null, null, null, ParserMode.QUICK_PARSE ), nullCallback, ParserMode.QUICK_PARSE);
|
||||
ParserFactory.createScanner( new StringReader( code ), null, new ScannerInfo(), ParserMode.QUICK_PARSE ), nullCallback, ParserMode.QUICK_PARSE);
|
||||
parser.setCppNature( cppNature );
|
||||
parser.parse();
|
||||
} catch ( Exception e ){
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.cdt.internal.core.dom.IOffsetable;
|
|||
import org.eclipse.cdt.internal.core.dom.NamespaceDefinition;
|
||||
import org.eclipse.cdt.internal.core.dom.SimpleDeclaration;
|
||||
import org.eclipse.cdt.internal.core.dom.TemplateDeclaration;
|
||||
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
/**
|
||||
|
@ -53,7 +54,7 @@ public class LineNumberTest extends TestCase {
|
|||
public void testDOMLineNos() throws Exception
|
||||
{
|
||||
DOMBuilder domBuilder = new DOMBuilder();
|
||||
IParser parser = ParserFactory.createParser( ParserFactory.createScanner( new InputStreamReader( fileIn ), null, null, null, ParserMode.QUICK_PARSE ), domBuilder, ParserMode.QUICK_PARSE );
|
||||
IParser parser = ParserFactory.createParser( ParserFactory.createScanner( new InputStreamReader( fileIn ), null, new ScannerInfo(), ParserMode.QUICK_PARSE ), domBuilder, ParserMode.QUICK_PARSE );
|
||||
//parser.mapLineNumbers(true);
|
||||
if( ! parser.parse() ) fail( "Parse of file failed");
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ 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.ParserSymbolTable;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTableException;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.Declaration;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.Mark;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.TemplateInstance;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.TypeInfo;
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.eclipse.cdt.core.parser.IToken;
|
|||
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.core.parser.ScannerException;
|
||||
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -29,7 +30,7 @@ public class PreprocessorConditionalTest extends BaseScannerTest
|
|||
|
||||
protected void initializeScanner(String input, Map definitions )
|
||||
{
|
||||
scanner= ParserFactory.createScanner( new StringReader(input),"TEXT", definitions, null, ParserMode.COMPLETE_PARSE );
|
||||
scanner= ParserFactory.createScanner( new StringReader(input),"TEXT", new ScannerInfo( definitions, null), ParserMode.COMPLETE_PARSE );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.cdt.core.parser.ParserFactory;
|
|||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
|
||||
import org.eclipse.cdt.internal.core.parser.NullSourceElementRequestor;
|
||||
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -72,7 +73,7 @@ public class PreprocessorTest extends TestCase {
|
|||
|
||||
public IPreprocessor setupPreprocessor( String text, List includePaths, Map defns, ISourceElementRequestor rq )
|
||||
{
|
||||
IPreprocessor p = ParserFactory.createPreprocessor( new StringReader( text ), "test", defns, includePaths, ParserMode.COMPLETE_PARSE );
|
||||
IPreprocessor p = ParserFactory.createPreprocessor( new StringReader( text ), "test", new ScannerInfo(), ParserMode.COMPLETE_PARSE );
|
||||
p.setRequestor( rq );
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.io.StringReader;
|
|||
import java.io.StringWriter;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
import junit.framework.Test;
|
||||
|
||||
|
@ -26,6 +27,7 @@ import org.eclipse.cdt.core.parser.IParser;
|
|||
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.internal.core.dom.DOMBuilder;
|
||||
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
|
||||
|
@ -269,7 +271,7 @@ public class TortureTest extends FractionalAutomatedTest {
|
|||
try {
|
||||
DOMBuilder domBuilder = new DOMBuilder();
|
||||
parser = ParserFactory.createParser(
|
||||
ParserFactory.createScanner( new StringReader( code ), null, null, null, ParserMode.QUICK_PARSE ), nullCallback, ParserMode.QUICK_PARSE);
|
||||
ParserFactory.createScanner( new StringReader( code ), null, new ScannerInfo(), ParserMode.QUICK_PARSE ), nullCallback, ParserMode.QUICK_PARSE);
|
||||
|
||||
parser.setCppNature(cppNature);
|
||||
mapping = ParserFactory.createLineOffsetReconciler( new StringReader( code ) );
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.eclipse.cdt.core.parser.IProblem;
|
|||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.IToken;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
|
||||
|
@ -1259,7 +1260,7 @@ public class DOMBuilder implements IParserCallback, ISourceElementRequestor
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptClassReference(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier, int)
|
||||
*/
|
||||
public void acceptClassReference(IASTClassSpecifier classSpecifier, int referenceOffset) {
|
||||
public void acceptClassReference(IASTClassReference reference) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.cdt.core.parser.IParser;
|
|||
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
|
||||
|
||||
/**
|
||||
* A SourceIndexer indexes source files using the parser. The following items are indexed:
|
||||
|
@ -58,7 +59,7 @@ public class SourceIndexer extends AbstractIndexer {
|
|||
// Create a new Parser
|
||||
SourceIndexerRequestor requestor = new SourceIndexerRequestor(this, document);
|
||||
IParser parser = ParserFactory.createParser(
|
||||
ParserFactory.createScanner( new StringReader( document.getStringContent() ), document.getName(), null, null, ParserMode.QUICK_PARSE ),
|
||||
ParserFactory.createScanner( new StringReader( document.getStringContent() ), document.getName(), new ScannerInfo(), ParserMode.QUICK_PARSE ),
|
||||
requestor, ParserMode.QUICK_PARSE);
|
||||
try{
|
||||
parser.parse();
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.cdt.core.parser.IProblem;
|
|||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.IToken;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
|
||||
|
@ -256,7 +257,7 @@ public class SourceIndexerRequestor implements IParserCallback,ISourceElementReq
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptClassReference(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier, int)
|
||||
*/
|
||||
public void acceptClassReference(IASTClassSpecifier classSpecifier,int referenceOffset) {
|
||||
public void acceptClassReference(IASTClassReference reference) {
|
||||
// TODO Auto-generated method stub
|
||||
//System.out.println("acceptClassReference");
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ import org.eclipse.cdt.internal.core.dom.TemplateParameter;
|
|||
import org.eclipse.cdt.internal.core.dom.TranslationUnit;
|
||||
import org.eclipse.cdt.internal.core.dom.TypeSpecifier;
|
||||
import org.eclipse.cdt.internal.core.parser.Name;
|
||||
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
||||
|
||||
|
@ -93,9 +94,9 @@ public class CModelBuilder {
|
|||
new StringReader(
|
||||
translationUnit.getBuffer().getContents()
|
||||
),
|
||||
null, null, null,
|
||||
ParserMode.QUICK_PARSE,
|
||||
problemReporter, unitResult
|
||||
null, new ScannerInfo(), ParserMode.QUICK_PARSE,
|
||||
problemReporter,
|
||||
unitResult
|
||||
),
|
||||
domBuilder,
|
||||
ParserMode.QUICK_PARSE,
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2003-07-08 John Camelon
|
||||
Filled out IASTMethod & IASTFunction & added implementations.
|
||||
Updated IScanner, clients & implementations to use IScannerInfo.
|
||||
Finished SimpleDeclaration porting to new architecture, only thing left is templates.
|
||||
|
||||
2003-07-07 John Camelon
|
||||
Bug 39652 - AST: Nested Classes incorrectly report null qualified Names
|
||||
Fuller specification of Field/Method interfaces.
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTFactory;
|
||||
|
||||
/**
|
||||
|
@ -18,9 +16,9 @@ public interface IScanner {
|
|||
public void addDefinition(String key, String value);
|
||||
public Object getDefinition(String key);
|
||||
|
||||
public Object[] getIncludePaths();
|
||||
public String[] getIncludePaths();
|
||||
public void addIncludePath(String includePath);
|
||||
public void overwriteIncludePath( List newIncludePaths );
|
||||
public void overwriteIncludePath( String [] newIncludePaths );
|
||||
public void setRequestor( ISourceElementRequestor r );
|
||||
|
||||
public IToken nextToken() throws ScannerException, EndOfFile;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
|
||||
|
@ -65,7 +66,7 @@ public interface ISourceElementRequestor {
|
|||
public void exitMethodBody( IASTMethod method );
|
||||
public void acceptField( IASTField field );
|
||||
|
||||
public void acceptClassReference( IASTClassSpecifier classSpecifier, int referenceOffset );
|
||||
public void acceptClassReference( IASTClassReference reference );
|
||||
|
||||
public void exitTemplateDeclaration( IASTTemplateDeclaration declaration );
|
||||
public void exitTemplateSpecialization( IASTTemplateSpecialization specialization );
|
||||
|
|
|
@ -11,10 +11,8 @@
|
|||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
//import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTFactory;
|
||||
import org.eclipse.cdt.internal.core.parser.DefaultErrorHandlingPolicies;
|
||||
import org.eclipse.cdt.internal.core.parser.LineOffsetReconciler;
|
||||
|
@ -56,31 +54,29 @@ public class ParserFactory {
|
|||
return new Parser( scanner, ourCallback, ourMode, problemReporter, unitResult );
|
||||
}
|
||||
|
||||
public static IScanner createScanner( Reader input, String fileName, Map defns, List inclusions, ParserMode mode )
|
||||
public static IScanner createScanner( Reader input, String fileName, IScannerInfo config, ParserMode mode )
|
||||
{
|
||||
return createScanner(input, fileName, defns, inclusions, mode, null, null);
|
||||
return createScanner(input, fileName, config, mode, null, null);
|
||||
}
|
||||
|
||||
public static IScanner createScanner( Reader input, String fileName, Map defns, List inclusions, ParserMode mode, IProblemReporter problemReporter, ITranslationResult unitResult )
|
||||
public static IScanner createScanner( Reader input, String fileName, IScannerInfo config, ParserMode mode, IProblemReporter problemReporter, ITranslationResult unitResult )
|
||||
{
|
||||
ParserMode ourMode = ( (mode == null )? ParserMode.COMPLETE_PARSE : mode );
|
||||
IScanner s = new Scanner( input, fileName, defns, problemReporter, unitResult );
|
||||
IScanner s = new Scanner( input, fileName, config, problemReporter, unitResult );
|
||||
s.setMode( ourMode );
|
||||
s.overwriteIncludePath(inclusions);
|
||||
return s;
|
||||
}
|
||||
|
||||
public static IPreprocessor createPreprocessor( Reader input, String fileName, Map defns, List inclusions, ParserMode mode )
|
||||
public static IPreprocessor createPreprocessor( Reader input, String fileName, IScannerInfo info, ParserMode mode )
|
||||
{
|
||||
return createPreprocessor(input, fileName, defns, inclusions, mode, null, null);
|
||||
return createPreprocessor(input, fileName, info, mode, null, null);
|
||||
}
|
||||
|
||||
public static IPreprocessor createPreprocessor( Reader input, String fileName, Map defns, List inclusions, ParserMode mode, IProblemReporter problemReporter, ITranslationResult unitResult )
|
||||
public static IPreprocessor createPreprocessor( Reader input, String fileName, IScannerInfo info, ParserMode mode, IProblemReporter problemReporter, ITranslationResult unitResult )
|
||||
{
|
||||
ParserMode ourMode = ( (mode == null )? ParserMode.COMPLETE_PARSE : mode );
|
||||
IPreprocessor s = new Preprocessor( input, fileName, defns, problemReporter, unitResult );
|
||||
IPreprocessor s = new Preprocessor( input, fileName, info, problemReporter, unitResult );
|
||||
s.setMode( ourMode );
|
||||
s.overwriteIncludePath(inclusions);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,14 +10,10 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.ast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTAbstractDeclarator
|
||||
public class ASTNotImplementedException
|
||||
{
|
||||
public IASTTypeSpecifier getTypeSpecifier();
|
||||
public List getPointerOperators();
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/**********************************************************************
|
||||
* 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.core.parser.ast;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTAbstractDeclaration
|
||||
{
|
||||
public boolean isConst();
|
||||
|
||||
public IASTTypeSpecifier getTypeSpecifier();
|
||||
|
||||
public Iterator getPointerOperators();
|
||||
|
||||
public Iterator getArrayModifiers();
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
/**********************************************************************
|
||||
* 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.core.parser.ast;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTClassReference
|
||||
{
|
||||
public IASTClassSpecifier getClassSpecifier();
|
||||
public int getOffset();
|
||||
}
|
|
@ -17,5 +17,5 @@ package org.eclipse.cdt.core.parser.ast;
|
|||
public interface IASTEnumerator extends IASTOffsetableNamedElement {
|
||||
|
||||
public IASTEnumerationSpecifier getOwnerEnumerationSpecifier();
|
||||
// public IASTExpression getInitialValue();
|
||||
public IASTExpression getInitialValue();
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.ast;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -18,5 +18,5 @@ import java.util.List;
|
|||
*/
|
||||
public interface IASTExceptionSpecification
|
||||
{
|
||||
public List getTypeIds();
|
||||
public Iterator getTypeIds();
|
||||
}
|
||||
|
|
|
@ -9,76 +9,101 @@
|
|||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.ast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.Backtrack;
|
||||
import org.eclipse.cdt.core.parser.ITokenDuple;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.IASTArrayModifier;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTFactory {
|
||||
|
||||
public IASTMacro createMacro( String name, int startingOffset, int endingOffset, int nameOffset );
|
||||
public IASTInclusion createInclusion( String name, String fileName, boolean local, int startingOffset, int endingOffset, int nameOffset );
|
||||
|
||||
public IASTUsingDirective createUsingDirective(
|
||||
IASTScope scope,
|
||||
ITokenDuple duple)
|
||||
throws Backtrack;
|
||||
|
||||
public IASTUsingDeclaration createUsingDeclaration(
|
||||
IASTScope scope,
|
||||
boolean isTypeName,
|
||||
ITokenDuple name );
|
||||
|
||||
|
||||
public IASTASMDefinition createASMDefinition(
|
||||
IASTScope scope,
|
||||
String assembly,
|
||||
int first,
|
||||
int last);
|
||||
|
||||
public IASTNamespaceDefinition createNamespaceDefinition(
|
||||
IASTScope scope,
|
||||
String identifier,
|
||||
int startingOffset, int nameOffset);
|
||||
|
||||
public IASTCompilationUnit createCompilationUnit();
|
||||
|
||||
public IASTLinkageSpecification createLinkageSpecification(IASTScope scope, String spec);
|
||||
|
||||
public IASTClassSpecifier createClassSpecifier( IASTScope scope,
|
||||
String name,
|
||||
ASTClassKind kind,
|
||||
ClassNameType type,
|
||||
ASTAccessVisibility access,
|
||||
IASTTemplateDeclaration ownerTemplateDeclaration, int startingOffset, int nameOffset );
|
||||
|
||||
/**
|
||||
* @param astClassSpec
|
||||
* @param isVirtual
|
||||
* @param visibility
|
||||
* @param string
|
||||
*/
|
||||
public void addBaseSpecifier(IASTClassSpecifier astClassSpec, boolean isVirtual, ASTAccessVisibility visibility, String string);
|
||||
|
||||
public IASTElaboratedTypeSpecifier createElaboratedTypeSpecifier(ASTClassKind elaboratedClassKind, String typeName, int startingOffset, int endOffset );
|
||||
public IASTEnumerationSpecifier createEnumerationSpecifier(String name, int startingOffset, int nameOffset );
|
||||
public void addEnumerator(IASTEnumerationSpecifier enumeration, String string, int startingOffset, int endingOffset);
|
||||
|
||||
public IASTExpression createExpression( IASTExpression.Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, String id, String typeId, String literal, IASTNewExpressionDescriptor newDescriptor );
|
||||
|
||||
public interface IASTFactory
|
||||
{
|
||||
public IASTMacro createMacro(
|
||||
String name,
|
||||
int startingOffset,
|
||||
int endingOffset,
|
||||
int nameOffset);
|
||||
public IASTInclusion createInclusion(
|
||||
String name,
|
||||
String fileName,
|
||||
boolean local,
|
||||
int startingOffset,
|
||||
int endingOffset,
|
||||
int nameOffset);
|
||||
public IASTUsingDirective createUsingDirective(
|
||||
IASTScope scope,
|
||||
ITokenDuple duple)
|
||||
throws Backtrack;
|
||||
public IASTUsingDeclaration createUsingDeclaration(
|
||||
IASTScope scope,
|
||||
boolean isTypeName,
|
||||
ITokenDuple name);
|
||||
public IASTASMDefinition createASMDefinition(
|
||||
IASTScope scope,
|
||||
String assembly,
|
||||
int first,
|
||||
int last);
|
||||
public IASTNamespaceDefinition createNamespaceDefinition(
|
||||
IASTScope scope,
|
||||
String identifier,
|
||||
int startingOffset,
|
||||
int nameOffset);
|
||||
public IASTCompilationUnit createCompilationUnit();
|
||||
public IASTLinkageSpecification createLinkageSpecification(
|
||||
IASTScope scope,
|
||||
String spec);
|
||||
public IASTClassSpecifier createClassSpecifier(
|
||||
IASTScope scope,
|
||||
String name,
|
||||
ASTClassKind kind,
|
||||
ClassNameType type,
|
||||
ASTAccessVisibility access,
|
||||
IASTTemplateDeclaration ownerTemplateDeclaration,
|
||||
int startingOffset,
|
||||
int nameOffset);
|
||||
/**
|
||||
* @param astClassSpec
|
||||
* @param isVirtual
|
||||
* @param visibility
|
||||
* @param string
|
||||
*/
|
||||
public void addBaseSpecifier(
|
||||
IASTClassSpecifier astClassSpec,
|
||||
boolean isVirtual,
|
||||
ASTAccessVisibility visibility,
|
||||
String string);
|
||||
public IASTElaboratedTypeSpecifier createElaboratedTypeSpecifier(
|
||||
ASTClassKind elaboratedClassKind,
|
||||
String typeName,
|
||||
int startingOffset,
|
||||
int endOffset);
|
||||
public IASTEnumerationSpecifier createEnumerationSpecifier(
|
||||
String name,
|
||||
int startingOffset,
|
||||
int nameOffset);
|
||||
public void addEnumerator(
|
||||
IASTEnumerationSpecifier enumeration,
|
||||
String string,
|
||||
int startingOffset,
|
||||
int endingOffset, IASTExpression initialValue);
|
||||
public IASTExpression createExpression(
|
||||
IASTExpression.Kind kind,
|
||||
IASTExpression lhs,
|
||||
IASTExpression rhs,
|
||||
IASTExpression thirdExpression,
|
||||
String id,
|
||||
String typeId,
|
||||
String literal,
|
||||
IASTNewExpressionDescriptor newDescriptor);
|
||||
public IASTExpression.IASTNewExpressionDescriptor createNewDescriptor();
|
||||
|
||||
public IASTInitializerClause createInitializerClause(IASTInitializerClause.Kind kind, IASTExpression assignmentExpression, List initializerClauses);
|
||||
|
||||
public IASTExceptionSpecification createExceptionSpecification( List typeIds );
|
||||
public IASTInitializerClause createInitializerClause(
|
||||
IASTInitializerClause.Kind kind,
|
||||
IASTExpression assignmentExpression,
|
||||
List initializerClauses);
|
||||
public IASTExceptionSpecification createExceptionSpecification(List typeIds);
|
||||
/**
|
||||
* @param exp
|
||||
*/
|
||||
|
@ -88,10 +113,63 @@ public interface IASTFactory {
|
|||
* @param expressionList
|
||||
* @return
|
||||
*/
|
||||
public IASTConstructorMemberInitializer createConstructorMemberInitializer(ITokenDuple duple, IASTExpression expressionList );
|
||||
|
||||
public IASTSimpleTypeSpecifier createSimpleTypeSpecifier( IASTSimpleTypeSpecifier.SimpleType kind, ITokenDuple typeName, boolean isShort, boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename );
|
||||
|
||||
|
||||
public IASTConstructorMemberInitializer createConstructorMemberInitializer(
|
||||
ITokenDuple duple,
|
||||
IASTExpression expressionList);
|
||||
public IASTSimpleTypeSpecifier createSimpleTypeSpecifier(
|
||||
IASTSimpleTypeSpecifier.SimpleType kind,
|
||||
ITokenDuple typeName,
|
||||
boolean isShort,
|
||||
boolean isLong,
|
||||
boolean isSigned,
|
||||
boolean isUnsigned,
|
||||
boolean isTypename);
|
||||
public IASTFunction createFunction(
|
||||
IASTScope scope,
|
||||
String name,
|
||||
List parameters,
|
||||
IASTAbstractDeclaration returnType,
|
||||
IASTExceptionSpecification exception,
|
||||
boolean isInline,
|
||||
boolean isFriend,
|
||||
boolean isStatic,
|
||||
int startOffset,
|
||||
int nameOffset,
|
||||
IASTTemplateDeclaration ownerTemplate);
|
||||
public IASTAbstractDeclaration createAbstractDeclaration(
|
||||
boolean isConst,
|
||||
IASTTypeSpecifier typeSpecifier,
|
||||
List pointerOperators,
|
||||
List arrayModifiers);
|
||||
public IASTMethod createMethod(
|
||||
IASTScope scope,
|
||||
String name,
|
||||
List parameters,
|
||||
IASTAbstractDeclaration returnType,
|
||||
IASTExceptionSpecification exception,
|
||||
boolean isInline,
|
||||
boolean isFriend,
|
||||
boolean isStatic,
|
||||
int startOffset,
|
||||
int nameOffset,
|
||||
IASTTemplateDeclaration ownerTemplate,
|
||||
boolean isConst,
|
||||
boolean isVolatile,
|
||||
boolean isConstructor,
|
||||
boolean isDestructor,
|
||||
boolean isVirtual,
|
||||
boolean isExplicit,
|
||||
boolean isPureVirtual,
|
||||
ASTAccessVisibility visibility);
|
||||
|
||||
public IASTVariable createVariable(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression,
|
||||
IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic );
|
||||
|
||||
public IASTField createField( IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, ASTAccessVisibility visibility);
|
||||
|
||||
public IASTParameterDeclaration createParameterDeclaration( boolean isConst, IASTTypeSpecifier getTypeSpecifier, List pointerOperators, List arrayModifiers, String parameterName, IASTInitializerClause initializerClause );
|
||||
|
||||
public IASTTemplateDeclaration createTemplateDeclaration( IASTScope scope, List templateParameters );
|
||||
|
||||
|
||||
}
|
|
@ -14,6 +14,8 @@ package org.eclipse.cdt.core.parser.ast;
|
|||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTField extends IASTVariable {
|
||||
public interface IASTField extends IASTVariable, IASTMember {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -10,16 +10,22 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.ast;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTFunction {
|
||||
public interface IASTFunction extends IASTScope, IASTOffsetableNamedElement, IASTTemplatedDeclaration, IASTDeclaration {
|
||||
|
||||
public boolean isInline();
|
||||
public boolean isFriend();
|
||||
public boolean isStatic();
|
||||
|
||||
public IASTAbstractDeclarator getReturnType();
|
||||
public String getName();
|
||||
|
||||
public IASTAbstractDeclaration getReturnType();
|
||||
public Iterator getParameters();
|
||||
public IASTExceptionSpecification getExceptionSpec();
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.ast;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.cdt.core.parser.Enum;
|
||||
|
||||
|
@ -34,7 +34,7 @@ public interface IASTInitializerClause {
|
|||
}
|
||||
|
||||
public Kind getKind();
|
||||
public List getInitializerList();
|
||||
public Iterator getInitializers();
|
||||
public IASTExpression getAssigmentExpression();
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
/**********************************************************************
|
||||
* 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.core.parser.ast;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTMember extends IASTDeclaration
|
||||
{
|
||||
public ASTAccessVisibility getVisiblity();
|
||||
}
|
|
@ -14,7 +14,7 @@ package org.eclipse.cdt.core.parser.ast;
|
|||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTMethod extends IASTFunction {
|
||||
public interface IASTMethod extends IASTFunction, IASTMember {
|
||||
|
||||
public boolean isVirtual();
|
||||
public boolean isExplicit();
|
||||
|
@ -22,4 +22,9 @@ public interface IASTMethod extends IASTFunction {
|
|||
public boolean isConstructor();
|
||||
public boolean isDestructor();
|
||||
|
||||
public boolean isConst();
|
||||
public boolean isVolatile();
|
||||
public boolean isPureVirtual();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/**********************************************************************
|
||||
* 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.core.parser.ast;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTParameterDeclaration extends IASTAbstractDeclaration
|
||||
{
|
||||
public String getName();
|
||||
public IASTInitializerClause getDefaultValue();
|
||||
|
||||
}
|
|
@ -16,9 +16,10 @@ import java.util.Iterator;
|
|||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTTemplateDeclaration {
|
||||
public interface IASTTemplateDeclaration extends IASTDeclaration {
|
||||
|
||||
public ASTTemplateDeclarationType getTemplateDeclarationType();
|
||||
public Iterator getTemplateParameters();
|
||||
public IASTDeclaration getOwnedDeclaration();
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,9 @@ package org.eclipse.cdt.core.parser.ast;
|
|||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTTypedef {
|
||||
public interface IASTTypedef extends IASTDeclaration {
|
||||
|
||||
public String getName();
|
||||
public IASTAbstractDeclaration getAbstractDeclarator();
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ package org.eclipse.cdt.core.parser.ast;
|
|||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTVariable {
|
||||
public interface IASTVariable extends IASTDeclaration {
|
||||
|
||||
public boolean isAuto();
|
||||
public boolean isRegister();
|
||||
|
@ -22,7 +22,10 @@ public interface IASTVariable {
|
|||
public boolean isExtern();
|
||||
public boolean isMutable();
|
||||
|
||||
public IASTAbstractDeclarator getAbstractDeclaration();
|
||||
public IASTAbstractDeclaration getAbstractDeclaration();
|
||||
public String getName();
|
||||
public IASTInitializerClause getInitializerClause();
|
||||
|
||||
public boolean isBitfield();
|
||||
public IASTExpression getBitfieldExpression();
|
||||
}
|
||||
|
|
|
@ -9,287 +9,273 @@
|
|||
* 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.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.IASTTemplateDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTVariable;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.SimpleType;
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class DeclarationWrapper implements IDeclaratorOwner
|
||||
{
|
||||
private final IASTScope scope;
|
||||
private IASTTypeSpecifier typeSpecifier;
|
||||
private List declarators = new ArrayList();
|
||||
private boolean typeNamed = false;
|
||||
private String name = null;
|
||||
private boolean volatil = false;
|
||||
private boolean virtual = false;
|
||||
private boolean typedef = false;
|
||||
private boolean staticc = false;
|
||||
private boolean register = false;
|
||||
private boolean extern = false;
|
||||
private boolean explicit = false;
|
||||
private boolean constt = false;
|
||||
private int startingOffset = 0;
|
||||
private boolean auto = false,
|
||||
mutable = false,
|
||||
friend = false,
|
||||
inline = false;
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setAuto(boolean b)
|
||||
{
|
||||
auto = b;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public IASTScope getScope()
|
||||
{
|
||||
return scope;
|
||||
}
|
||||
/**
|
||||
* @param scope
|
||||
*/
|
||||
public DeclarationWrapper(IASTScope scope)
|
||||
{
|
||||
this.scope = scope;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setTypenamed(boolean b)
|
||||
{
|
||||
typeNamed = b;
|
||||
}
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public void setTypeName(String string)
|
||||
{
|
||||
name = string;
|
||||
}
|
||||
private int type = -1;
|
||||
/**
|
||||
* @param i
|
||||
*/
|
||||
public void setType(int i)
|
||||
{
|
||||
type = i;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setMutable(boolean b)
|
||||
{
|
||||
mutable = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setFriend(boolean b)
|
||||
{
|
||||
friend = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setInline(boolean b)
|
||||
{
|
||||
inline = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setRegister(boolean b)
|
||||
{
|
||||
register = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setStatic(boolean b)
|
||||
{
|
||||
staticc = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setTypedef(boolean b)
|
||||
{
|
||||
typedef = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setVirtual(boolean b)
|
||||
{
|
||||
virtual = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setVolatile(boolean b)
|
||||
{
|
||||
volatil = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setExtern(boolean b)
|
||||
{
|
||||
extern = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setExplicit(boolean b)
|
||||
{
|
||||
explicit = b;
|
||||
}
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setConst(boolean b)
|
||||
{
|
||||
constt = b;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isAuto()
|
||||
{
|
||||
return auto;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isConst()
|
||||
{
|
||||
return constt;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isExplicit()
|
||||
{
|
||||
return explicit;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isExtern()
|
||||
{
|
||||
return extern;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isFriend()
|
||||
{
|
||||
return friend;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isInline()
|
||||
{
|
||||
return inline;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isMutable()
|
||||
{
|
||||
return mutable;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isRegister()
|
||||
{
|
||||
return register;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public int getStartingOffset()
|
||||
{
|
||||
return startingOffset;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isStatic()
|
||||
{
|
||||
return staticc;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public int getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isTypedef()
|
||||
{
|
||||
return typedef;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isTypeNamed()
|
||||
{
|
||||
return typeNamed;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isVirtual()
|
||||
{
|
||||
return virtual;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isVolatile()
|
||||
{
|
||||
return volatil;
|
||||
}
|
||||
|
||||
public void addDeclarator( Declarator d )
|
||||
{
|
||||
declarators.add( d );
|
||||
}
|
||||
|
||||
public Iterator getDeclarators()
|
||||
{
|
||||
return Collections.unmodifiableList( declarators ).iterator();
|
||||
}
|
||||
private ITokenDuple name;
|
||||
private SimpleType simpleType = IASTSimpleTypeSpecifier.SimpleType.UNSPECIFIED;
|
||||
private boolean isSigned;
|
||||
private boolean isLong;
|
||||
private boolean isShort;
|
||||
private boolean isUnsigned;
|
||||
private final IASTTemplateDeclaration 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,
|
||||
IASTTemplateDeclaration 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
|
||||
*/
|
||||
|
@ -297,7 +283,6 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
{
|
||||
return typeSpecifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param specifier
|
||||
*/
|
||||
|
@ -305,45 +290,66 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
{
|
||||
typeSpecifier = specifier;
|
||||
}
|
||||
|
||||
private IASTFactory astFactory = null;
|
||||
/**
|
||||
* @param requestor
|
||||
*/
|
||||
public List createAndCallbackASTNodes()
|
||||
public List createASTNodes(IASTFactory astFactory)
|
||||
{
|
||||
this.astFactory = astFactory;
|
||||
Iterator i = declarators.iterator();
|
||||
List l = new ArrayList();
|
||||
while( i.hasNext() )
|
||||
l.add( createAndCallbackASTNode( (Declarator)i.next() ) );
|
||||
List l = new ArrayList();
|
||||
while (i.hasNext())
|
||||
l.add(createASTNode((Declarator)i.next()));
|
||||
return l;
|
||||
}
|
||||
/**
|
||||
* @param declarator
|
||||
*/
|
||||
private Object createAndCallbackASTNode(Declarator declarator)
|
||||
private IASTDeclaration createASTNode(Declarator declarator)
|
||||
{
|
||||
boolean isWithinClass = ( getScope() instanceof IASTClassSpecifier );
|
||||
boolean isFunction = declarator.isFunction();
|
||||
|
||||
if( isWithinClass && isFunction )
|
||||
return createMethodASTNode( declarator );
|
||||
else if( isWithinClass )
|
||||
return createFieldASTNode( declarator );
|
||||
else if ( ( ! isWithinClass )&& isFunction )
|
||||
return createFunctionASTNode( declarator );
|
||||
else
|
||||
return createVariableASTNode( declarator );
|
||||
|
||||
boolean isWithinClass = (getScope() instanceof IASTClassSpecifier);
|
||||
boolean isFunction = declarator.isFunction();
|
||||
if (isWithinClass && isFunction)
|
||||
return createMethodASTNode(declarator);
|
||||
else if (isWithinClass)
|
||||
return createFieldASTNode(declarator);
|
||||
else if ((!isWithinClass) && isFunction)
|
||||
return createFunctionASTNode(declarator);
|
||||
else
|
||||
return createVariableASTNode(declarator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param declarator
|
||||
* @return
|
||||
*/
|
||||
private IASTMethod createMethodASTNode(Declarator declarator)
|
||||
{
|
||||
|
||||
return null;
|
||||
return astFactory
|
||||
.createMethod(
|
||||
scope,
|
||||
declarator.getName(),
|
||||
createParameterList( declarator.getParameters() ),
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPtrOps(),
|
||||
declarator.getArrayModifiers()),
|
||||
declarator.getExceptionSpecification(),
|
||||
inline,
|
||||
friend,
|
||||
staticc,
|
||||
startingOffset,
|
||||
declarator.getNameStartOffset(),
|
||||
templateDeclaration,
|
||||
declarator.isConst(),
|
||||
declarator.isVolatile(),
|
||||
false, // isConstructor
|
||||
false, // isDestructor
|
||||
virtual,
|
||||
explicit,
|
||||
declarator.isPureVirtual(),
|
||||
((IASTClassSpecifier)scope).getCurrentVisibilityMode());
|
||||
}
|
||||
/**
|
||||
* @param declarator
|
||||
|
@ -351,8 +357,22 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
*/
|
||||
private IASTFunction createFunctionASTNode(Declarator declarator)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return astFactory.createFunction(
|
||||
scope,
|
||||
declarator.getName(),
|
||||
createParameterList( declarator.getParameters() ),
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPtrOps(),
|
||||
declarator.getArrayModifiers()),
|
||||
declarator.getExceptionSpecification(),
|
||||
inline,
|
||||
friend,
|
||||
staticc,
|
||||
startingOffset,
|
||||
declarator.getNameStartOffset(),
|
||||
templateDeclaration);
|
||||
}
|
||||
/**
|
||||
* @param declarator
|
||||
|
@ -360,17 +380,51 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
*/
|
||||
private IASTField createFieldASTNode(Declarator declarator)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return astFactory.createField( scope, declarator.getName(), auto, declarator.getInitializerClause(), declarator.getBitFieldExpression(),
|
||||
astFactory.createAbstractDeclaration( constt, getTypeSpecifier(), declarator.getPtrOps(), declarator.getArrayModifiers() ),
|
||||
mutable, extern, register, staticc, ((IASTClassSpecifier)scope).getCurrentVisibilityMode());
|
||||
}
|
||||
|
||||
private List createParameterList( List currentParameters )
|
||||
{
|
||||
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();
|
||||
result.add( astFactory.createParameterDeclaration( wrapper.isConst(), wrapper.getTypeSpecifier(),
|
||||
declarator.getPtrOps(), declarator.getArrayModifiers(),
|
||||
declarator.getName() == null ? "" : declarator.getName(), declarator.getInitializerClause() ) );
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param declarator
|
||||
* @return
|
||||
*/
|
||||
private IASTVariable createVariableASTNode(Declarator declarator)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return astFactory.createVariable(
|
||||
scope,
|
||||
declarator.getName(),
|
||||
isAuto(),
|
||||
declarator.getInitializerClause(),
|
||||
declarator.getBitFieldExpression(),
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPtrOps(),
|
||||
declarator.getArrayModifiers()),
|
||||
mutable,
|
||||
extern,
|
||||
register,
|
||||
staticc);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IDeclaratorOwner#getDeclarationWrapper()
|
||||
|
@ -379,6 +433,103 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
{
|
||||
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 SimpleType getSimpleType()
|
||||
{
|
||||
return simpleType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type
|
||||
*/
|
||||
public void setSimpleType(SimpleType 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,11 +16,12 @@ 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.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;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.*;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.IASTArrayModifier;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -118,7 +119,7 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner
|
|||
return Collections.unmodifiableList( ptrOps );
|
||||
}
|
||||
|
||||
public void addPtrOp( PointerOperator ptrOp )
|
||||
public void addPtrOp( ASTPointerOperator ptrOp )
|
||||
{
|
||||
ptrOps.add( ptrOp );
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.eclipse.cdt.core.parser.IProblem;
|
|||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.IToken;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
|
||||
|
@ -876,7 +877,7 @@ public class NullSourceElementRequestor implements ISourceElementRequestor, IPar
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptClassReference(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier, int)
|
||||
*/
|
||||
public void acceptClassReference(IASTClassSpecifier classSpecifier, int referenceOffset) {
|
||||
public void acceptClassReference(IASTClassReference reference) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.cdt.core.parser.ParserMode;
|
|||
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.IASTASMDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
|
@ -38,6 +39,7 @@ 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.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
|
||||
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;
|
||||
|
@ -951,7 +953,7 @@ public class Parser implements IParser
|
|||
throws Backtrack
|
||||
{
|
||||
Object simpleDecl = null;
|
||||
DeclarationWrapper sdw = new DeclarationWrapper(scope);
|
||||
DeclarationWrapper sdw = new DeclarationWrapper(scope, LA(1).getOffset(), null);
|
||||
try
|
||||
{
|
||||
simpleDecl = callback.simpleDeclarationBegin(container, LA(1));
|
||||
|
@ -960,6 +962,9 @@ public class Parser implements IParser
|
|||
{
|
||||
}
|
||||
declSpecifierSeq(simpleDecl, false, tryConstructor, sdw);
|
||||
if( sdw.getTypeSpecifier() == null && sdw.getSimpleType() != IASTSimpleTypeSpecifier.SimpleType.UNSPECIFIED )
|
||||
sdw.setTypeSpecifier( astFactory.createSimpleTypeSpecifier( sdw.getSimpleType(), sdw.getName(), sdw.isShort(), sdw.isLong(), sdw.isSigned(), sdw.isUnsigned(), sdw.isTypeNamed() ) );
|
||||
|
||||
Object declarator = null;
|
||||
DeclaratorDuple d = null;
|
||||
if (LT(1) != IToken.tSEMI)
|
||||
|
@ -1009,7 +1014,7 @@ public class Parser implements IParser
|
|||
throw backtrack;
|
||||
}
|
||||
|
||||
List l = sdw.createAndCallbackASTNodes();
|
||||
List l = sdw.createASTNodes(astFactory);
|
||||
|
||||
if( hasFunctionBody )
|
||||
{
|
||||
|
@ -1188,13 +1193,17 @@ public class Parser implements IParser
|
|||
{
|
||||
}
|
||||
|
||||
DeclarationWrapper sdw = new DeclarationWrapper( null );
|
||||
DeclarationWrapper sdw = new DeclarationWrapper( null, current.getOffset(), null );
|
||||
declSpecifierSeq(
|
||||
parameterDecl,
|
||||
true,
|
||||
false,
|
||||
sdw
|
||||
);
|
||||
if( sdw.getTypeSpecifier() == null && sdw.getSimpleType() != IASTSimpleTypeSpecifier.SimpleType.UNSPECIFIED )
|
||||
sdw.setTypeSpecifier( astFactory.createSimpleTypeSpecifier( sdw.getSimpleType(), sdw.getName(), sdw.isShort(), sdw.isLong(), sdw.isSigned(), sdw.isUnsigned(), sdw.isTypeNamed() ) );
|
||||
|
||||
|
||||
if (LT(1) != IToken.tSEMI)
|
||||
try
|
||||
{
|
||||
|
@ -1362,6 +1371,19 @@ public class Parser implements IParser
|
|||
|| (LT(3) != IToken.tLPAREN && LT(3) != IToken.tASSIGN))
|
||||
&& !LA(2).isPointer());
|
||||
}
|
||||
|
||||
private void callbackSimpleDeclToken( Object decl, Flags flags )
|
||||
{
|
||||
flags.setEncounteredRawType(true);
|
||||
try
|
||||
{
|
||||
callback.simpleDeclSpecifier(decl, consume());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* This function parses a declaration specifier sequence, as according to the ANSI C++ spec.
|
||||
*
|
||||
|
@ -1394,6 +1416,8 @@ public class Parser implements IParser
|
|||
throws Backtrack
|
||||
{
|
||||
Flags flags = new Flags(parm, tryConstructor);
|
||||
IToken typeNameBegin = null;
|
||||
IToken typeNameEnd = null;
|
||||
declSpecifiers : for (;;)
|
||||
{
|
||||
switch (LT(1))
|
||||
|
@ -1519,26 +1543,97 @@ public class Parser implements IParser
|
|||
}
|
||||
break;
|
||||
case IToken.t_signed :
|
||||
sdw.setSigned(true);
|
||||
if( typeNameBegin == null )
|
||||
typeNameBegin = LA(1);
|
||||
typeNameEnd = LA(1);
|
||||
callbackSimpleDeclToken(decl, flags);
|
||||
break;
|
||||
case IToken.t_unsigned :
|
||||
sdw.setUnsigned( true );
|
||||
if( typeNameBegin == null )
|
||||
typeNameBegin = LA(1);
|
||||
typeNameEnd = LA(1);
|
||||
callbackSimpleDeclToken(decl, flags);
|
||||
break;
|
||||
case IToken.t_short :
|
||||
sdw.setShort( true );
|
||||
if( typeNameBegin == null )
|
||||
typeNameBegin = LA(1);
|
||||
typeNameEnd = LA(1);
|
||||
callbackSimpleDeclToken(decl, flags);
|
||||
break;
|
||||
case IToken.t_long :
|
||||
if( typeNameBegin == null )
|
||||
typeNameBegin = LA(1);
|
||||
typeNameEnd = LA(1);
|
||||
|
||||
callbackSimpleDeclToken(decl, flags);
|
||||
sdw.setLong( true );
|
||||
break;
|
||||
|
||||
case IToken.t_char :
|
||||
if( typeNameBegin == null )
|
||||
typeNameBegin = LA(1);
|
||||
typeNameEnd = LA(1);
|
||||
|
||||
callbackSimpleDeclToken(decl, flags);
|
||||
sdw.setSimpleType( IASTSimpleTypeSpecifier.SimpleType.CHAR );
|
||||
break;
|
||||
case IToken.t_wchar_t :
|
||||
if( typeNameBegin == null )
|
||||
typeNameBegin = LA(1);
|
||||
typeNameEnd = LA(1);
|
||||
|
||||
callbackSimpleDeclToken(decl, flags);
|
||||
sdw.setSimpleType( IASTSimpleTypeSpecifier.SimpleType.WCHAR_T);
|
||||
break;
|
||||
|
||||
case IToken.t_bool :
|
||||
if( typeNameBegin == null )
|
||||
typeNameBegin = LA(1);
|
||||
typeNameEnd = LA(1);
|
||||
|
||||
callbackSimpleDeclToken(decl, flags);
|
||||
sdw.setSimpleType( IASTSimpleTypeSpecifier.SimpleType.BOOL);
|
||||
break;
|
||||
|
||||
case IToken.t_int :
|
||||
case IToken.t_long :
|
||||
if( typeNameBegin == null )
|
||||
typeNameBegin = LA(1);
|
||||
typeNameEnd = LA(1);
|
||||
|
||||
callbackSimpleDeclToken(decl, flags);
|
||||
sdw.setSimpleType( IASTSimpleTypeSpecifier.SimpleType.INT);
|
||||
break;
|
||||
|
||||
case IToken.t_float :
|
||||
if( typeNameBegin == null )
|
||||
typeNameBegin = LA(1);
|
||||
typeNameEnd = LA(1);
|
||||
|
||||
callbackSimpleDeclToken(decl, flags);
|
||||
sdw.setSimpleType( IASTSimpleTypeSpecifier.SimpleType.FLOAT);
|
||||
break;
|
||||
|
||||
case IToken.t_double :
|
||||
if( typeNameBegin == null )
|
||||
typeNameBegin = LA(1);
|
||||
typeNameEnd = LA(1);
|
||||
|
||||
callbackSimpleDeclToken(decl, flags);
|
||||
sdw.setSimpleType( IASTSimpleTypeSpecifier.SimpleType.DOUBLE );
|
||||
break;
|
||||
|
||||
case IToken.t_void :
|
||||
sdw.setType(LT(1));
|
||||
flags.setEncounteredRawType(true);
|
||||
try
|
||||
{
|
||||
callback.simpleDeclSpecifier(decl, consume());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
break;
|
||||
if( typeNameBegin == null )
|
||||
typeNameBegin = LA(1);
|
||||
typeNameEnd = LA(1);
|
||||
|
||||
callbackSimpleDeclToken(decl, flags);
|
||||
sdw.setSimpleType( IASTSimpleTypeSpecifier.SimpleType.VOID );
|
||||
break;
|
||||
|
||||
case IToken.t_typename :
|
||||
sdw.setTypenamed(true);
|
||||
try
|
||||
|
@ -1567,7 +1662,7 @@ public class Parser implements IParser
|
|||
}
|
||||
}
|
||||
ITokenDuple duple = new TokenDuple(first, last);
|
||||
sdw.setTypeName(duple.toString());
|
||||
sdw.setTypeName(duple);
|
||||
try
|
||||
{
|
||||
callback.simpleDeclSpecifierName(decl);
|
||||
|
@ -1583,13 +1678,29 @@ public class Parser implements IParser
|
|||
// TODO - Kludgy way to handle constructors/destructors
|
||||
// handle nested later:
|
||||
if (flags.haveEncounteredRawType())
|
||||
{
|
||||
if( typeNameBegin != null )
|
||||
sdw.setTypeName( new TokenDuple( typeNameBegin, typeNameEnd ));
|
||||
return;
|
||||
}
|
||||
if (parm && flags.haveEncounteredTypename())
|
||||
return;
|
||||
{
|
||||
if( typeNameBegin != null )
|
||||
sdw.setTypeName( new TokenDuple( typeNameBegin, typeNameEnd ));
|
||||
return;
|
||||
}
|
||||
if (lookAheadForConstructorOrConversion(flags))
|
||||
return;
|
||||
{
|
||||
if( typeNameBegin != null )
|
||||
sdw.setTypeName( new TokenDuple( typeNameBegin, typeNameEnd ));
|
||||
return;
|
||||
}
|
||||
if (lookAheadForDeclarator(flags))
|
||||
return;
|
||||
{
|
||||
if( typeNameBegin != null )
|
||||
sdw.setTypeName( new TokenDuple( typeNameBegin, typeNameEnd ));
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
callback.simpleDeclSpecifier(decl, LA(1));
|
||||
|
@ -1598,7 +1709,7 @@ public class Parser implements IParser
|
|||
{
|
||||
}
|
||||
ITokenDuple d = name();
|
||||
sdw.setTypeName(d.toString());
|
||||
sdw.setTypeName(d);
|
||||
try
|
||||
{
|
||||
callback.simpleDeclSpecifierName(decl);
|
||||
|
@ -1657,6 +1768,9 @@ public class Parser implements IParser
|
|||
break declSpecifiers;
|
||||
}
|
||||
}
|
||||
if( typeNameBegin != null )
|
||||
sdw.setTypeName( new TokenDuple( typeNameBegin, typeNameEnd ));
|
||||
|
||||
}
|
||||
/**
|
||||
* Parse an elaborated type specifier.
|
||||
|
@ -1882,7 +1996,7 @@ public class Parser implements IParser
|
|||
* @return Returns the same object sent in.
|
||||
* @throws Backtrack
|
||||
*/
|
||||
protected Object cvQualifier(Object ptrOp, PointerOperator po) throws Backtrack
|
||||
protected Object cvQualifier(Object ptrOp, boolean hasName, Declarator declarator) throws Backtrack
|
||||
{
|
||||
switch (LT(1))
|
||||
{
|
||||
|
@ -1894,7 +2008,11 @@ public class Parser implements IParser
|
|||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
po.setConst(true);
|
||||
|
||||
if( hasName )
|
||||
declarator.addPtrOp( ASTPointerOperator.CONST_POINTER_TO_FUNCTION );
|
||||
else
|
||||
declarator.addPtrOp( ASTPointerOperator.CONST_POINTER );
|
||||
return ptrOp;
|
||||
|
||||
case IToken.t_volatile :
|
||||
|
@ -1905,7 +2023,10 @@ public class Parser implements IParser
|
|||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
po.setVolatile( true );
|
||||
if( hasName )
|
||||
declarator.addPtrOp( ASTPointerOperator.VOLATILE_POINTER_TO_FUNCTION );
|
||||
else
|
||||
declarator.addPtrOp( ASTPointerOperator.VOLATILE_POINTER );
|
||||
return ptrOp;
|
||||
default :
|
||||
throw backtrack;
|
||||
|
@ -2594,7 +2715,7 @@ public class Parser implements IParser
|
|||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
d.addPtrOp( new PointerOperator( PointerOperator.Type.REFERENCE ) );
|
||||
d.addPtrOp( ASTPointerOperator.REFERENCE );
|
||||
return;
|
||||
}
|
||||
IToken mark = mark();
|
||||
|
@ -2609,9 +2730,9 @@ public class Parser implements IParser
|
|||
hasName = true;
|
||||
t = LT(1);
|
||||
}
|
||||
|
||||
if (t == IToken.tSTAR)
|
||||
{
|
||||
PointerOperator po = null;
|
||||
if (hasName)
|
||||
{
|
||||
try
|
||||
|
@ -2622,15 +2743,11 @@ public class Parser implements IParser
|
|||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
// just consume "*", so tokenType is left as "::" or Id
|
||||
po = new PointerOperator( PointerOperator.Type.NAMED );
|
||||
po.setName( nameDuple.toString() );
|
||||
consume(Token.tSTAR);
|
||||
}
|
||||
else
|
||||
{
|
||||
tokenType = consume(Token.tSTAR); // tokenType = "*"
|
||||
po = new PointerOperator( PointerOperator.Type.POINTER );
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -2644,7 +2761,7 @@ public class Parser implements IParser
|
|||
{
|
||||
try
|
||||
{
|
||||
ptrOp = cvQualifier(ptrOp, po);
|
||||
ptrOp = cvQualifier(ptrOp, hasName, d);
|
||||
}
|
||||
catch (Backtrack b)
|
||||
{
|
||||
|
@ -2659,7 +2776,6 @@ public class Parser implements IParser
|
|||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
d.addPtrOp(po);
|
||||
return;
|
||||
}
|
||||
backup(mark);
|
||||
|
@ -2754,6 +2870,7 @@ public class Parser implements IParser
|
|||
}
|
||||
throw backtrack;
|
||||
}
|
||||
IASTExpression initialValue = null;
|
||||
if (LT(1) == IToken.tASSIGN)
|
||||
{
|
||||
consume(IToken.tASSIGN);
|
||||
|
@ -2765,7 +2882,7 @@ public class Parser implements IParser
|
|||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
constantExpression(expression);
|
||||
initialValue = constantExpression(expression);
|
||||
try
|
||||
{
|
||||
callback.expressionEnd(expression);
|
||||
|
@ -2773,6 +2890,7 @@ public class Parser implements IParser
|
|||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -2783,7 +2901,7 @@ public class Parser implements IParser
|
|||
}
|
||||
if (LT(1) == IToken.tRBRACE)
|
||||
{
|
||||
astFactory.addEnumerator( enumeration, enumeratorIdentifier.toString(), enumeratorIdentifier.getOffset(), enumeratorIdentifier.getEndOffset() );
|
||||
astFactory.addEnumerator( enumeration, enumeratorIdentifier.toString(), enumeratorIdentifier.getOffset(), enumeratorIdentifier.getEndOffset(), initialValue);
|
||||
break;
|
||||
}
|
||||
if (LT(1) != IToken.tCOMMA)
|
||||
|
@ -2797,7 +2915,7 @@ public class Parser implements IParser
|
|||
}
|
||||
throw backtrack;
|
||||
}
|
||||
astFactory.addEnumerator( enumeration, enumeratorIdentifier.toString(), enumeratorIdentifier.getOffset(), enumeratorIdentifier.getEndOffset() );
|
||||
astFactory.addEnumerator( enumeration, enumeratorIdentifier.toString(), enumeratorIdentifier.getOffset(), enumeratorIdentifier.getEndOffset(), initialValue );
|
||||
consume(IToken.tCOMMA);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,97 +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 PointerOperator
|
||||
{
|
||||
private String name;
|
||||
private boolean isConst = false;
|
||||
private boolean isVolatile = false;
|
||||
|
||||
public static class Type
|
||||
{
|
||||
private final int type;
|
||||
public static final Type REFERENCE = new Type( 1 );
|
||||
public static final Type POINTER = new Type( 2 );
|
||||
public static final Type NAMED = new Type( 3 );
|
||||
|
||||
private Type( int type )
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
private Type type;
|
||||
|
||||
public PointerOperator( Type t )
|
||||
{
|
||||
this.type = t;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public Type getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isConst()
|
||||
{
|
||||
return isConst;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isVolatile()
|
||||
{
|
||||
return isVolatile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setConst(boolean b)
|
||||
{
|
||||
isConst = b;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
public void setVolatile(boolean b)
|
||||
{
|
||||
isVolatile = b;
|
||||
}
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public void setName(String string)
|
||||
{
|
||||
name = string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
|
@ -11,11 +11,11 @@
|
|||
package org.eclipse.cdt.internal.core.parser;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.parser.EndOfFile;
|
||||
import org.eclipse.cdt.core.parser.IPreprocessor;
|
||||
import org.eclipse.cdt.core.parser.IProblemReporter;
|
||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||
import org.eclipse.cdt.core.parser.ITranslationResult;
|
||||
import org.eclipse.cdt.core.parser.ScannerException;
|
||||
|
||||
|
@ -31,8 +31,8 @@ public class Preprocessor extends Scanner implements IPreprocessor {
|
|||
* @param filename
|
||||
* @param defns
|
||||
*/
|
||||
public Preprocessor(Reader reader, String filename, Map defns, IProblemReporter problemReporter, ITranslationResult unitResult) {
|
||||
super(reader, filename, defns, problemReporter, unitResult);
|
||||
public Preprocessor(Reader reader, String filename, IScannerInfo info, IProblemReporter problemReporter, ITranslationResult unitResult) {
|
||||
super(reader, filename, info, problemReporter, unitResult);
|
||||
}
|
||||
|
||||
public void process()
|
||||
|
|
|
@ -21,7 +21,6 @@ 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;
|
||||
|
||||
|
@ -32,6 +31,7 @@ import org.eclipse.cdt.core.parser.IParser;
|
|||
import org.eclipse.cdt.core.parser.IParserCallback;
|
||||
import org.eclipse.cdt.core.parser.IProblemReporter;
|
||||
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.ITranslationOptions;
|
||||
|
@ -53,7 +53,7 @@ import org.eclipse.cdt.core.parser.ast.IASTMacro;
|
|||
|
||||
public class Scanner implements IScanner {
|
||||
|
||||
public Scanner(Reader reader, String filename, Map defns, IProblemReporter problemReporter, ITranslationResult unitResult) {
|
||||
public Scanner(Reader reader, String filename, IScannerInfo info, IProblemReporter problemReporter, ITranslationResult unitResult) {
|
||||
try {
|
||||
//this is a hack to get around a sudden EOF experience
|
||||
contextStack.push(
|
||||
|
@ -69,10 +69,14 @@ public class Scanner implements IScanner {
|
|||
} catch( ScannerException se ) {
|
||||
//won't happen since we aren't adding an include or a macro
|
||||
}
|
||||
if( defns != null )
|
||||
definitions.putAll( defns );
|
||||
|
||||
originalConfig = info;
|
||||
if( info.getDefinedSymbols() != null )
|
||||
definitions.putAll( info.getDefinedSymbols() );
|
||||
|
||||
if( info.getIncludePaths() != null )
|
||||
overwriteIncludePath( info.getIncludePaths() );
|
||||
|
||||
|
||||
this.problemReporter = problemReporter;
|
||||
this.translationResult = unitResult;
|
||||
|
||||
|
@ -88,13 +92,15 @@ public class Scanner implements IScanner {
|
|||
includePaths.add( new File( includePath ) );
|
||||
}
|
||||
|
||||
public void overwriteIncludePath(List newIncludePaths) {
|
||||
public void overwriteIncludePath(String [] newIncludePaths) {
|
||||
if( newIncludePaths == null ) return;
|
||||
includePathNames = null;
|
||||
includePaths = null;
|
||||
includePathNames = new ArrayList();
|
||||
includePaths = new ArrayList();
|
||||
includePathNames.addAll(newIncludePaths);
|
||||
includePaths = new ArrayList();
|
||||
|
||||
for( int i = 0; i < newIncludePaths.length; ++i )
|
||||
includePathNames.add( newIncludePaths[i] );
|
||||
|
||||
Iterator i = includePathNames.iterator();
|
||||
while( i.hasNext() )
|
||||
|
@ -118,8 +124,8 @@ public class Scanner implements IScanner {
|
|||
return definitions.get(key);
|
||||
}
|
||||
|
||||
public final Object[] getIncludePaths() {
|
||||
return includePathNames.toArray();
|
||||
public final String[] getIncludePaths() {
|
||||
return (String[])includePathNames.toArray();
|
||||
}
|
||||
|
||||
protected boolean skipOverWhitespace() throws ScannerException {
|
||||
|
@ -342,6 +348,7 @@ public class Scanner implements IScanner {
|
|||
private ContextStack contextStack = new ContextStack();
|
||||
private IScannerContext lastContext = null;
|
||||
|
||||
private IScannerInfo originalConfig;
|
||||
private List includePathNames = new ArrayList();
|
||||
private List includePaths = new ArrayList();
|
||||
private Hashtable definitions = new Hashtable();
|
||||
|
@ -1658,8 +1665,8 @@ public class Scanner implements IScanner {
|
|||
ParserFactory.createScanner(
|
||||
new StringReader(expression + ";"),
|
||||
EXPRESSION,
|
||||
definitions,
|
||||
null, ParserMode.QUICK_PARSE );
|
||||
new ScannerInfo( definitions, originalConfig.getIncludePaths()),
|
||||
ParserMode.QUICK_PARSE );
|
||||
IParser parser = ParserFactory.createParser(trial, new NullSourceElementRequestor(), ParserMode.QUICK_PARSE );
|
||||
|
||||
try {
|
||||
|
@ -1897,7 +1904,7 @@ public class Scanner implements IScanner {
|
|||
|
||||
if( ! replacementString.equals( "" ) )
|
||||
{
|
||||
IScanner helperScanner = ParserFactory.createScanner( new StringReader(replacementString), null, null, null, mode, problemReporter, translationResult );
|
||||
IScanner helperScanner = ParserFactory.createScanner( new StringReader(replacementString), null, new ScannerInfo( ), mode, problemReporter, translationResult );
|
||||
helperScanner.setTokenizingMacroReplacementList( true );
|
||||
IToken t = helperScanner.nextToken(false);
|
||||
|
||||
|
@ -1995,7 +2002,7 @@ public class Scanner implements IScanner {
|
|||
|
||||
protected Vector getMacroParameters (String params, boolean forStringizing) throws ScannerException {
|
||||
|
||||
IScanner tokenizer = ParserFactory.createScanner(new StringReader(params), TEXT, definitions, null, mode, problemReporter, translationResult );
|
||||
IScanner tokenizer = ParserFactory.createScanner(new StringReader(params), TEXT, new ScannerInfo( definitions, originalConfig.getIncludePaths() ), mode, problemReporter, translationResult );
|
||||
Vector parameterValues = new Vector();
|
||||
Token t = null;
|
||||
String str = new String();
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/**********************************************************************
|
||||
* 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.IScannerInfo;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class ScannerInfo implements IScannerInfo
|
||||
{
|
||||
private Map definedSymbols = null;
|
||||
private String [] includePaths = null;
|
||||
|
||||
public ScannerInfo()
|
||||
{
|
||||
}
|
||||
|
||||
public ScannerInfo( Map d, String [] incs )
|
||||
{
|
||||
definedSymbols = d;
|
||||
includePaths = incs;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.IScannerInfo#getDefinedSymbols()
|
||||
*/
|
||||
public Map getDefinedSymbols()
|
||||
{
|
||||
return definedSymbols;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.IScannerInfo#getIncludePaths()
|
||||
*/
|
||||
public String[] getIncludePaths()
|
||||
{
|
||||
return includePaths;
|
||||
}
|
||||
}
|
|
@ -10,11 +10,13 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser.ast;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTExpression;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTArrayModifier
|
||||
{
|
||||
|
||||
public IASTExpression getExpression();
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ 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.IASTASMDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
|
||||
|
@ -27,14 +28,20 @@ import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
|
|||
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.IASTNamespaceDefinition;
|
||||
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.IASTTemplateDeclaration;
|
||||
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.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;
|
||||
|
@ -199,7 +206,7 @@ public class FullParseASTFactory extends BaseASTFactory implements IASTFactory {
|
|||
/* (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 endingOffset)
|
||||
public void addEnumerator(IASTEnumerationSpecifier enumeration, String string, int startingOffset, int endingOffset, IASTExpression initialValue)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
@ -266,5 +273,67 @@ public class FullParseASTFactory extends BaseASTFactory implements IASTFactory {
|
|||
return null;
|
||||
}
|
||||
|
||||
/* (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, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplateDeclaration ownerTemplate)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createAbstractDeclaration(boolean, org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier, java.util.List, java.util.List)
|
||||
*/
|
||||
public IASTAbstractDeclaration createAbstractDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (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, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplateDeclaration ownerTemplate, boolean isConst, boolean isVolatile, boolean isConstructor, boolean isDestructor, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, ASTAccessVisibility visibility)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (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)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (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, ASTAccessVisibility visibility)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createParameterDeclaration(boolean, org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier, java.util.List, java.util.List, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTInitializerClause)
|
||||
*/
|
||||
public IASTParameterDeclaration createParameterDeclaration(boolean isConst, IASTTypeSpecifier getTypeSpecifier, List pointerOperators, List arrayModifiers, String parameterName, IASTInitializerClause initializerClause)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateDeclaration(java.util.List)
|
||||
*/
|
||||
public IASTTemplateDeclaration createTemplateDeclaration(IASTScope scope, List templateParameters)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTAbstractDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class ASTAbstractDeclaration implements IASTAbstractDeclaration
|
||||
{
|
||||
private final boolean isConst;
|
||||
private final IASTTypeSpecifier typeSpecifier;
|
||||
private final List pointerOperators;
|
||||
private final List arrayModifiers;
|
||||
/**
|
||||
* @param isConst
|
||||
* @param typeSpecifier
|
||||
* @param pointerOperators
|
||||
* @param arrayModifiers
|
||||
*/
|
||||
public ASTAbstractDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers)
|
||||
{
|
||||
this.isConst = isConst;
|
||||
this.typeSpecifier = typeSpecifier;
|
||||
this.pointerOperators = pointerOperators;
|
||||
this.arrayModifiers = arrayModifiers;
|
||||
}
|
||||
/* (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()
|
||||
{
|
||||
return pointerOperators.iterator();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getArrayModifiers()
|
||||
*/
|
||||
public Iterator getArrayModifiers()
|
||||
{
|
||||
return arrayModifiers.iterator();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTExpression;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.IASTArrayModifier;
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.internal.core.parser.ast.quick;
|
|||
|
||||
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;
|
||||
|
||||
|
@ -22,7 +23,8 @@ import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
|
|||
public class ASTEnumerator
|
||||
implements IASTEnumerator, IASTOffsetableNamedElement
|
||||
{
|
||||
private final String name;
|
||||
private final IASTExpression initialValue;
|
||||
private final String name;
|
||||
private final IASTEnumerationSpecifier enumeration;
|
||||
private final NamedOffsets offsets = new NamedOffsets();
|
||||
/**
|
||||
|
@ -31,7 +33,7 @@ public class ASTEnumerator
|
|||
* @param startingOffset
|
||||
* @param endingOffset
|
||||
*/
|
||||
public ASTEnumerator(IASTEnumerationSpecifier enumeration, String string, int startingOffset, int endingOffset)
|
||||
public ASTEnumerator(IASTEnumerationSpecifier enumeration, String string, int startingOffset, int endingOffset, IASTExpression initialValue)
|
||||
{
|
||||
this.enumeration = enumeration;
|
||||
name = string;
|
||||
|
@ -39,6 +41,7 @@ public class ASTEnumerator
|
|||
offsets.setNameOffset( startingOffset );
|
||||
offsets.setEndingOffset( endingOffset );
|
||||
enumeration.addEnumerator(this);
|
||||
this.initialValue = initialValue;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
|
||||
|
@ -96,4 +99,11 @@ public class ASTEnumerator
|
|||
{
|
||||
return enumeration;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTEnumerator#getInitialValue()
|
||||
*/
|
||||
public IASTExpression getInitialValue()
|
||||
{
|
||||
return initialValue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ public class ASTExceptionSpecification implements IASTExceptionSpecification
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification#getTypeIds()
|
||||
*/
|
||||
public List getTypeIds()
|
||||
public Iterator getTypeIds()
|
||||
{
|
||||
return typeIds;
|
||||
return typeIds.iterator();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
/**********************************************************************
|
||||
* 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.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, ASTAccessVisibility visibility)
|
||||
{
|
||||
super(
|
||||
scope,
|
||||
name,
|
||||
isAuto,
|
||||
initializerClause,
|
||||
bitfieldExpression,
|
||||
abstractDeclaration,
|
||||
isMutable,
|
||||
isExtern,
|
||||
isRegister,
|
||||
isStatic);
|
||||
this.visibility = visibility;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTMember#getVisiblity()
|
||||
*/
|
||||
public ASTAccessVisibility getVisiblity()
|
||||
{
|
||||
return visibility;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
/**********************************************************************
|
||||
* 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.ast.IASTAbstractDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||
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, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception,
|
||||
boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplateDeclaration ownerTemplate )
|
||||
{
|
||||
super(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;
|
||||
offsets.setStartingOffset( startOffset );
|
||||
offsets.setNameOffset( nameOffset );
|
||||
}
|
||||
|
||||
private final IASTTemplateDeclaration 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 getElementNameOffset()
|
||||
{
|
||||
return offsets.getElementNameOffset();
|
||||
}
|
||||
/* (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 IASTTemplateDeclaration 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 getElementStartingOffset()
|
||||
{
|
||||
return offsets.getElementStartingOffset();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
|
||||
*/
|
||||
public int getElementEndingOffset()
|
||||
{
|
||||
return offsets.getElementEndingOffset();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
|
||||
*/
|
||||
public Iterator getDeclarations()
|
||||
{
|
||||
return declarations.iterator();
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser.ast.quick;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTExpression;
|
||||
|
@ -44,8 +45,8 @@ public class ASTInitializerClause implements IASTInitializerClause {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getInitializerList()
|
||||
*/
|
||||
public List getInitializerList() {
|
||||
return initializerClauses;
|
||||
public Iterator getInitializers() {
|
||||
return initializerClauses.iterator();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
/**********************************************************************
|
||||
* 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.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.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class ASTMethod extends ASTFunction implements IASTMethod
|
||||
{
|
||||
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;
|
||||
/**
|
||||
* @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,
|
||||
List parameters,
|
||||
IASTAbstractDeclaration returnType,
|
||||
IASTExceptionSpecification exception,
|
||||
boolean isInline,
|
||||
boolean isFriend,
|
||||
boolean isStatic,
|
||||
int startOffset,
|
||||
int nameOffset,
|
||||
IASTTemplateDeclaration ownerTemplate,
|
||||
boolean isConst,
|
||||
boolean isVolatile,
|
||||
boolean isConstructor,
|
||||
boolean isDestructor,
|
||||
boolean isVirtual,
|
||||
boolean isExplicit,
|
||||
boolean isPureVirtual, ASTAccessVisibility visibility)
|
||||
{
|
||||
super(
|
||||
scope,
|
||||
name,
|
||||
parameters,
|
||||
returnType,
|
||||
exception,
|
||||
isInline,
|
||||
isFriend,
|
||||
isStatic,
|
||||
startOffset,
|
||||
nameOffset,
|
||||
ownerTemplate);
|
||||
this.isVirtual = isVirtual;
|
||||
this.isPureVirtual = isPureVirtual;
|
||||
this.isConstructor = isConstructor;
|
||||
this.isDestructor = isDestructor;
|
||||
this.isExplicit = isExplicit;
|
||||
this.isConst = isConst;
|
||||
this.isVolatile = isVolatile;
|
||||
this.visibility = visibility;
|
||||
}
|
||||
/* (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.IASTMember#getOwnerClassSpecifier()
|
||||
*/
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTInitializerClause;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class ASTParameterDeclaration implements IASTParameterDeclaration
|
||||
{
|
||||
private final boolean isConst;
|
||||
private final IASTTypeSpecifier typeSpecifier;
|
||||
private final List pointerOperators;
|
||||
private final List arrayModifiers;
|
||||
private final String parameterName;
|
||||
private final IASTInitializerClause initializerClause;
|
||||
/**
|
||||
* @param isConst
|
||||
* @param typeSpecifier
|
||||
* @param pointerOperators
|
||||
* @param arrayModifiers
|
||||
* @param parameterName
|
||||
* @param initializerClause
|
||||
*/
|
||||
public ASTParameterDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, String parameterName, IASTInitializerClause initializerClause)
|
||||
{
|
||||
this.isConst = isConst;
|
||||
this.typeSpecifier = typeSpecifier;
|
||||
this.pointerOperators = pointerOperators;
|
||||
this.arrayModifiers = arrayModifiers;
|
||||
this.parameterName = parameterName;
|
||||
this.initializerClause = initializerClause;
|
||||
}
|
||||
/* (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 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()
|
||||
{
|
||||
return pointerOperators.iterator();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getArrayModifiers()
|
||||
*/
|
||||
public Iterator getArrayModifiers()
|
||||
{
|
||||
return arrayModifiers.iterator();
|
||||
}
|
||||
}
|
|
@ -97,7 +97,7 @@ public class ASTSimpleTypeSpecifier implements IASTSimpleTypeSpecifier
|
|||
if (isSigned())
|
||||
type.append("signed ");
|
||||
}
|
||||
this.typeName = typeName.toString();
|
||||
this.typeName = type.toString();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
/**********************************************************************
|
||||
* 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.ASTTemplateDeclarationType;
|
||||
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 ASTDeclaration implements IASTTemplateDeclaration
|
||||
{
|
||||
private IASTDeclaration ownedDeclaration;
|
||||
private List templateParameters;
|
||||
private ASTTemplateDeclarationType type;
|
||||
/**
|
||||
* @param templateParameters
|
||||
*/
|
||||
public ASTTemplateDeclaration(IASTScope scope, List templateParameters)
|
||||
{
|
||||
super( scope );
|
||||
this.templateParameters = templateParameters;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration#getTemplateDeclarationType()
|
||||
*/
|
||||
public ASTTemplateDeclarationType getTemplateDeclarationType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration#getTemplateParameters()
|
||||
*/
|
||||
public Iterator getTemplateParameters()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return templateParameters.iterator();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration#getOwnedDeclaration()
|
||||
*/
|
||||
public IASTDeclaration getOwnedDeclaration()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return ownedDeclaration;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,124 @@
|
|||
/**********************************************************************
|
||||
* 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.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;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class ASTVariable extends ASTDeclaration implements IASTVariable
|
||||
{
|
||||
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;
|
||||
/**
|
||||
* @param scope
|
||||
*/
|
||||
public ASTVariable(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression,
|
||||
IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic )
|
||||
{
|
||||
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;
|
||||
|
||||
}
|
||||
/* (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()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return bitfieldExpression;
|
||||
}
|
||||
|
||||
}
|
|
@ -17,6 +17,7 @@ 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.IASTASMDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
|
@ -27,14 +28,20 @@ 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.IASTNamespaceDefinition;
|
||||
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.IASTTemplateDeclaration;
|
||||
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.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;
|
||||
|
@ -133,9 +140,9 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
|||
/* (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 endingOffset)
|
||||
public void addEnumerator(IASTEnumerationSpecifier enumeration, String string, int startingOffset, int endingOffset, IASTExpression initialValue)
|
||||
{
|
||||
IASTEnumerator enumerator = new ASTEnumerator( enumeration, string, startingOffset, endingOffset );
|
||||
IASTEnumerator enumerator = new ASTEnumerator( enumeration, string, startingOffset, endingOffset, initialValue );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -172,8 +179,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
|||
*/
|
||||
public IASTArrayModifier createArrayModifier(IASTExpression exp)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return new ASTArrayModifier( exp );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -192,4 +198,59 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
|||
return new ASTSimpleTypeSpecifier( kind, typeName, isShort, isLong, isSigned, isUnsigned, isTypename );
|
||||
}
|
||||
|
||||
/* (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, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplateDeclaration ownerTemplate)
|
||||
{
|
||||
return new ASTFunction(scope, name, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createAbstractDeclaration(boolean, org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier, java.util.List, java.util.List)
|
||||
*/
|
||||
public IASTAbstractDeclaration createAbstractDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers)
|
||||
{
|
||||
return new ASTAbstractDeclaration( isConst, typeSpecifier, pointerOperators, arrayModifiers );
|
||||
}
|
||||
|
||||
/* (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, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplateDeclaration ownerTemplate, boolean isConst, boolean isVolatile, boolean isConstructor, boolean isDestructor, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, ASTAccessVisibility visibility)
|
||||
{
|
||||
return new ASTMethod(scope, name, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate, isConst, isVolatile, isConstructor, isDestructor, isVirtual, isExplicit, isPureVirtual, visibility);
|
||||
}
|
||||
|
||||
/* (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)
|
||||
{
|
||||
return new ASTVariable(scope, name, isAuto, initializerClause, bitfieldExpression, abstractDeclaration, isMutable, isExtern, isRegister, isStatic);
|
||||
}
|
||||
|
||||
/* (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, ASTAccessVisibility visibility)
|
||||
{
|
||||
return new ASTField(scope, name, isAuto, initializerClause, bitfieldExpression, abstractDeclaration, isMutable, isExtern, isRegister, isStatic, visibility);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createParameterDeclaration(boolean, org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier, java.util.List, java.util.List, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTInitializerClause)
|
||||
*/
|
||||
public IASTParameterDeclaration createParameterDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, String parameterName, IASTInitializerClause initializerClause)
|
||||
{
|
||||
return new ASTParameterDeclaration( isConst, typeSpecifier, pointerOperators, arrayModifiers, parameterName, initializerClause );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateDeclaration(java.util.List)
|
||||
*/
|
||||
public IASTTemplateDeclaration createTemplateDeclaration(IASTScope scope, List templateParameters)
|
||||
{
|
||||
return new ASTTemplateDeclaration( scope, templateParameters );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.cdt.core.parser.ScannerException;
|
|||
import org.eclipse.cdt.core.parser.ast.ASTClassKind;
|
||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||
import org.eclipse.cdt.core.search.ICSearchPattern;
|
||||
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
|
||||
import org.eclipse.cdt.internal.core.search.CharOperation;
|
||||
|
||||
/**
|
||||
|
@ -122,7 +123,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
|
|||
* @return
|
||||
*/
|
||||
private static CSearchPattern createClassPattern(String patternString, SearchFor searchFor, LimitTo limitTo, int matchMode, boolean caseSensitive) {
|
||||
IScanner scanner = ParserFactory.createScanner( new StringReader( patternString ), "TEXT", null, null, ParserMode.QUICK_PARSE );
|
||||
IScanner scanner = ParserFactory.createScanner( new StringReader( patternString ), "TEXT", new ScannerInfo(), ParserMode.QUICK_PARSE );
|
||||
|
||||
LinkedList list = new LinkedList();
|
||||
IToken token = null;
|
||||
|
|
|
@ -27,11 +27,33 @@ 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.ParserMode;
|
||||
import org.eclipse.cdt.core.parser.ast.*;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
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.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.IASTOffsetableNamedElement;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypedef;
|
||||
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.search.ICSearchPattern;
|
||||
import org.eclipse.cdt.core.search.ICSearchResultCollector;
|
||||
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
|
||||
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
|
@ -73,7 +95,7 @@ public class MatchLocator implements ISourceElementRequestor {
|
|||
public void acceptTypedef(IASTTypedef typedef) { }
|
||||
public void acceptEnumerator(IASTEnumerator enumerator) { }
|
||||
public void acceptEnumerationSpecifier(IASTEnumerationSpecifier enumeration){ }
|
||||
public void acceptClassReference(IASTClassSpecifier classSpecifier, int referenceOffset) { }
|
||||
public void acceptClassReference(IASTClassReference reference) { }
|
||||
public void acceptElaboratedTypeSpecifier(IASTElaboratedTypeSpecifier elaboratedTypeSpec){ }
|
||||
public void acceptMethodDeclaration(IASTMethod method) { }
|
||||
public void acceptField(IASTField field) { }
|
||||
|
@ -212,7 +234,7 @@ public class MatchLocator implements ISourceElementRequestor {
|
|||
}
|
||||
}
|
||||
|
||||
IScanner scanner = ParserFactory.createScanner( reader, pathString, null, null, ParserMode.QUICK_PARSE );
|
||||
IScanner scanner = ParserFactory.createScanner( reader, pathString, new ScannerInfo(), ParserMode.QUICK_PARSE );
|
||||
IParser parser = ParserFactory.createParser( scanner, null, ParserMode.QUICK_PARSE );
|
||||
parser.setRequestor( this );
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
2003-07-08 John Camelon
|
||||
Updated IScanner, clients & implementations to use IScannerInfo.
|
||||
|
||||
2003-07-03 Sean Evoy
|
||||
Changed property/wizard tab to use the new StandardBuildManager and
|
||||
the improved IStandardBuildInfo interface to set and retrieve
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.eclipse.cdt.internal.core.dom.TemplateDeclaration;
|
|||
import org.eclipse.cdt.internal.core.dom.TranslationUnit;
|
||||
import org.eclipse.cdt.internal.core.dom.TypeSpecifier;
|
||||
import org.eclipse.cdt.internal.core.parser.Name;
|
||||
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
|
||||
import org.eclipse.cdt.internal.parser.IStructurizerCallback;
|
||||
|
||||
/**
|
||||
|
@ -57,7 +58,7 @@ public class ComparatorModelBuilder {
|
|||
public void parse() {
|
||||
DOMBuilder domBuilder = new DOMBuilder();
|
||||
try {
|
||||
IParser parser = ParserFactory.createParser(ParserFactory.createScanner( new StringReader( code ), null, null, null, ParserMode.QUICK_PARSE ), domBuilder, ParserMode.QUICK_PARSE);
|
||||
IParser parser = ParserFactory.createParser(ParserFactory.createScanner( new StringReader( code ), null, new ScannerInfo(), ParserMode.QUICK_PARSE ), domBuilder, ParserMode.QUICK_PARSE);
|
||||
parser.parse();
|
||||
} catch (Exception e) {
|
||||
callback.reportError(e);
|
||||
|
|
Loading…
Add table
Reference in a new issue