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