mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
Some refactoring of class names.
Consistency is key.
This commit is contained in:
parent
84d63b4941
commit
2a48843261
17 changed files with 157 additions and 57 deletions
|
@ -18,10 +18,10 @@ import org.eclipse.cdt.core.model.tests.CModelElementsTests;
|
||||||
import org.eclipse.cdt.core.model.tests.StructuralCModelElementsTests;
|
import org.eclipse.cdt.core.model.tests.StructuralCModelElementsTests;
|
||||||
import org.eclipse.cdt.core.parser.tests.ast2.AST2CPPTests;
|
import org.eclipse.cdt.core.parser.tests.ast2.AST2CPPTests;
|
||||||
import org.eclipse.cdt.core.parser.tests.ast2.AST2Tests;
|
import org.eclipse.cdt.core.parser.tests.ast2.AST2Tests;
|
||||||
|
import org.eclipse.cdt.core.parser.tests.ast2.CompleteParser2Tests;
|
||||||
import org.eclipse.cdt.core.parser.tests.ast2.DOMLocationTests;
|
import org.eclipse.cdt.core.parser.tests.ast2.DOMLocationTests;
|
||||||
import org.eclipse.cdt.core.parser.tests.ast2.GCCTests;
|
import org.eclipse.cdt.core.parser.tests.ast2.GCCTests;
|
||||||
import org.eclipse.cdt.core.parser.tests.parser2.CompleteParser2Tests;
|
import org.eclipse.cdt.core.parser.tests.ast2.QuickParser2Tests;
|
||||||
import org.eclipse.cdt.core.parser.tests.parser2.QuickParser2Tests;
|
|
||||||
import org.eclipse.cdt.core.parser.tests.scanner2.ObjectMapTest;
|
import org.eclipse.cdt.core.parser.tests.scanner2.ObjectMapTest;
|
||||||
import org.eclipse.cdt.core.parser.tests.scanner2.Scanner2Test;
|
import org.eclipse.cdt.core.parser.tests.scanner2.Scanner2Test;
|
||||||
|
|
||||||
|
|
|
@ -53,9 +53,9 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPParserExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPParserExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner;
|
import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author aniefer
|
* @author aniefer
|
||||||
|
@ -74,11 +74,11 @@ public class AST2BaseTest extends TestCase {
|
||||||
CodeReader codeReader = new CodeReader(code
|
CodeReader codeReader = new CodeReader(code
|
||||||
.toCharArray());
|
.toCharArray());
|
||||||
ScannerInfo scannerInfo = new ScannerInfo();
|
ScannerInfo scannerInfo = new ScannerInfo();
|
||||||
IScannerConfiguration configuration = null;
|
IScannerExtensionConfiguration configuration = null;
|
||||||
if( lang == ParserLanguage.C )
|
if( lang == ParserLanguage.C )
|
||||||
configuration = new GCCScannerConfiguration();
|
configuration = new GCCScannerExtensionConfiguration();
|
||||||
else
|
else
|
||||||
configuration = new GPPScannerConfiguration();
|
configuration = new GPPScannerExtensionConfiguration();
|
||||||
IScanner scanner = new DOMScanner( codeReader, scannerInfo, ParserMode.COMPLETE_PARSE, lang, NULL_LOG, configuration, SavedCodeReaderFactory.getInstance() );
|
IScanner scanner = new DOMScanner( codeReader, scannerInfo, ParserMode.COMPLETE_PARSE, lang, NULL_LOG, configuration, SavedCodeReaderFactory.getInstance() );
|
||||||
|
|
||||||
ISourceCodeParser parser2 = null;
|
ISourceCodeParser parser2 = null;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.tests.parser2;
|
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||||
|
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
@ -67,14 +67,14 @@ import org.eclipse.cdt.internal.core.dom.parser.c.GNUCSourceParser;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.c.ICParserExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.dom.parser.c.ICParserExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ANSICPPParserExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ANSICPPParserExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPParserExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.GPPParserExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPParserExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPParserExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner;
|
import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
@ -138,17 +138,17 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
CodeReader codeReader = new CodeReader(code
|
CodeReader codeReader = new CodeReader(code
|
||||||
.toCharArray());
|
.toCharArray());
|
||||||
ScannerInfo scannerInfo = new ScannerInfo();
|
ScannerInfo scannerInfo = new ScannerInfo();
|
||||||
IScannerConfiguration configuration = null;
|
IScannerExtensionConfiguration configuration = null;
|
||||||
if( lang == ParserLanguage.C )
|
if( lang == ParserLanguage.C )
|
||||||
configuration = new GCCScannerConfiguration();
|
configuration = new GCCScannerExtensionConfiguration();
|
||||||
else
|
else
|
||||||
configuration = new GPPScannerConfiguration();
|
configuration = new GPPScannerExtensionConfiguration();
|
||||||
ISourceCodeParser parser2 = null;
|
ISourceCodeParser parser2 = null;
|
||||||
IScanner scanner = new DOMScanner( codeReader, scannerInfo, ParserMode.COMPLETE_PARSE, lang, NULL_LOG, configuration, SavedCodeReaderFactory.getInstance() );
|
IScanner scanner = new DOMScanner( codeReader, scannerInfo, ParserMode.COMPLETE_PARSE, lang, NULL_LOG, configuration, SavedCodeReaderFactory.getInstance() );
|
||||||
if (lang == ParserLanguage.CPP) {
|
if (lang == ParserLanguage.CPP) {
|
||||||
ICPPParserExtensionConfiguration config = null;
|
ICPPParserExtensionConfiguration config = null;
|
||||||
if (gcc)
|
if (gcc)
|
||||||
config = new GNUCPPParserExtensionConfiguration();
|
config = new GPPParserExtensionConfiguration();
|
||||||
else
|
else
|
||||||
config = new ANSICPPParserExtensionConfiguration();
|
config = new ANSICPPParserExtensionConfiguration();
|
||||||
parser2 = new GNUCPPSourceParser(scanner, ParserMode.COMPLETE_PARSE,
|
parser2 = new GNUCPPSourceParser(scanner, ParserMode.COMPLETE_PARSE,
|
|
@ -0,0 +1,100 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* Copyright (c) 2004 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM - Initial API and implementation
|
||||||
|
**********************************************************************/
|
||||||
|
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.CDOM;
|
||||||
|
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTProblem;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
|
import org.eclipse.cdt.core.parser.CodeReader;
|
||||||
|
import org.eclipse.cdt.core.parser.IParserLogService;
|
||||||
|
import org.eclipse.cdt.core.parser.IScanner;
|
||||||
|
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||||
|
import org.eclipse.cdt.core.parser.NullLogService;
|
||||||
|
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||||
|
import org.eclipse.cdt.core.parser.ParserMode;
|
||||||
|
import org.eclipse.cdt.core.parser.ScannerInfo;
|
||||||
|
import org.eclipse.cdt.core.parser.tests.FileBasePluginTest;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.ISourceCodeParser;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.c.CVisitor;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.c.GCCParserExtensionConfiguration;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.c.GNUCSourceParser;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.GPPParserExtensionConfiguration;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerExtensionConfiguration;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerExtensionConfiguration;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public class DOMLocationInclusionTests extends FileBasePluginTest {
|
||||||
|
|
||||||
|
private static final IScannerInfo SCANNER_INFO = new ScannerInfo();
|
||||||
|
private static final IParserLogService NULL_LOG = new NullLogService();
|
||||||
|
private static final ICodeReaderFactory factory = CDOM
|
||||||
|
.getInstance()
|
||||||
|
.getCodeReaderFactory(
|
||||||
|
CDOM.PARSE_SAVED_RESOURCES);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name
|
||||||
|
* @param className
|
||||||
|
*/
|
||||||
|
public DOMLocationInclusionTests(String name) {
|
||||||
|
super(name, DOMLocationInclusionTests.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IASTTranslationUnit parse(IFile code, ParserLanguage language)
|
||||||
|
throws Exception {
|
||||||
|
InputStream stream = code.getContents();
|
||||||
|
IScanner scanner = new DOMScanner(new CodeReader(code.getLocation()
|
||||||
|
.toOSString(), stream), SCANNER_INFO, ParserMode.COMPLETE_PARSE,
|
||||||
|
language, NULL_LOG, getScannerConfig(language), factory);
|
||||||
|
ISourceCodeParser parser = null;
|
||||||
|
if (language == ParserLanguage.CPP) {
|
||||||
|
parser = new GNUCPPSourceParser( scanner, ParserMode.COMPLETE_PARSE, NULL_LOG, new GPPParserExtensionConfiguration() );
|
||||||
|
} else {
|
||||||
|
parser = new GNUCSourceParser( scanner, ParserMode.COMPLETE_PARSE, NULL_LOG, new GCCParserExtensionConfiguration() );
|
||||||
|
}
|
||||||
|
stream.close();
|
||||||
|
IASTTranslationUnit parseResult = parser.parse();
|
||||||
|
|
||||||
|
if (parser.encounteredError())
|
||||||
|
throw new ParserException("FAILURE"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
if (language == ParserLanguage.C) {
|
||||||
|
IASTProblem[] problems = CVisitor.getProblems(parseResult);
|
||||||
|
assertEquals(problems.length, 0);
|
||||||
|
} else if (language == ParserLanguage.CPP) {
|
||||||
|
IASTProblem[] problems = CPPVisitor.getProblems(parseResult);
|
||||||
|
assertEquals(problems.length, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return parseResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private IScannerExtensionConfiguration getScannerConfig(ParserLanguage language) {
|
||||||
|
if (language == ParserLanguage.CPP)
|
||||||
|
return new GPPScannerExtensionConfiguration();
|
||||||
|
return new GCCScannerExtensionConfiguration();
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.core.parser.tests.parser2;
|
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
@ -33,14 +33,14 @@ import org.eclipse.cdt.internal.core.dom.parser.c.GNUCSourceParser;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.c.ICParserExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.dom.parser.c.ICParserExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ANSICPPParserExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ANSICPPParserExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPParserExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.GPPParserExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPParserExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPParserExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner;
|
import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
@ -1362,17 +1362,17 @@ public class QuickParser2Tests extends TestCase {
|
||||||
|
|
||||||
CodeReader codeReader = new CodeReader( code.toCharArray() );
|
CodeReader codeReader = new CodeReader( code.toCharArray() );
|
||||||
IScannerInfo scannerInfo = new ScannerInfo();
|
IScannerInfo scannerInfo = new ScannerInfo();
|
||||||
IScannerConfiguration configuration = null;
|
IScannerExtensionConfiguration configuration = null;
|
||||||
if( lang == ParserLanguage.C )
|
if( lang == ParserLanguage.C )
|
||||||
configuration = new GCCScannerConfiguration();
|
configuration = new GCCScannerExtensionConfiguration();
|
||||||
else
|
else
|
||||||
configuration = new GPPScannerConfiguration();
|
configuration = new GPPScannerExtensionConfiguration();
|
||||||
IScanner scanner = new DOMScanner( codeReader, scannerInfo, ParserMode.COMPLETE_PARSE, lang, NULL_LOG, configuration, SavedCodeReaderFactory.getInstance() );
|
IScanner scanner = new DOMScanner( codeReader, scannerInfo, ParserMode.COMPLETE_PARSE, lang, NULL_LOG, configuration, SavedCodeReaderFactory.getInstance() );
|
||||||
ISourceCodeParser parser2 = null;
|
ISourceCodeParser parser2 = null;
|
||||||
if (lang == ParserLanguage.CPP) {
|
if (lang == ParserLanguage.CPP) {
|
||||||
ICPPParserExtensionConfiguration config = null;
|
ICPPParserExtensionConfiguration config = null;
|
||||||
if (gcc)
|
if (gcc)
|
||||||
config = new GNUCPPParserExtensionConfiguration();
|
config = new GPPParserExtensionConfiguration();
|
||||||
else
|
else
|
||||||
config = new ANSICPPParserExtensionConfiguration();
|
config = new ANSICPPParserExtensionConfiguration();
|
||||||
parser2 = new GNUCPPSourceParser(scanner, ParserMode.QUICK_PARSE,
|
parser2 = new GNUCPPSourceParser(scanner, ParserMode.QUICK_PARSE,
|
|
@ -30,9 +30,9 @@ import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||||
import org.eclipse.cdt.core.parser.ParserMode;
|
import org.eclipse.cdt.core.parser.ParserMode;
|
||||||
import org.eclipse.cdt.core.parser.ScannerInfo;
|
import org.eclipse.cdt.core.parser.ScannerInfo;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.ObjectStyleMacro;
|
import org.eclipse.cdt.internal.core.parser.scanner2.ObjectStyleMacro;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.Scanner2;
|
import org.eclipse.cdt.internal.core.parser.scanner2.Scanner2;
|
||||||
|
|
||||||
|
@ -78,11 +78,11 @@ public class BaseScanner2Test extends TestCase {
|
||||||
IParserLogService logService = ( log == null ) ? ParserFactory.createDefaultLogService() : log;
|
IParserLogService logService = ( log == null ) ? ParserFactory.createDefaultLogService() : log;
|
||||||
ParserMode ourMode = ( (mode == null )? ParserMode.COMPLETE_PARSE : mode );
|
ParserMode ourMode = ( (mode == null )? ParserMode.COMPLETE_PARSE : mode );
|
||||||
ISourceElementRequestor ourRequestor = (( requestor == null) ? new NullSourceElementRequestor() : requestor );
|
ISourceElementRequestor ourRequestor = (( requestor == null) ? new NullSourceElementRequestor() : requestor );
|
||||||
IScannerConfiguration configuration = null;
|
IScannerExtensionConfiguration configuration = null;
|
||||||
if( language == ParserLanguage.C )
|
if( language == ParserLanguage.C )
|
||||||
configuration = new GCCScannerConfiguration();
|
configuration = new GCCScannerExtensionConfiguration();
|
||||||
else
|
else
|
||||||
configuration = new GPPScannerConfiguration();
|
configuration = new GPPScannerExtensionConfiguration();
|
||||||
return new Scanner2( code, config, ourRequestor, ourMode, language, logService, workingCopies, configuration );
|
return new Scanner2( code, config, ourRequestor, ourMode, language, logService, workingCopies, configuration );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,9 @@ import org.eclipse.cdt.core.parser.ParserFactoryError;
|
||||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||||
import org.eclipse.cdt.core.parser.ParserMode;
|
import org.eclipse.cdt.core.parser.ParserMode;
|
||||||
import org.eclipse.cdt.core.parser.ScannerInfo;
|
import org.eclipse.cdt.core.parser.ScannerInfo;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.Scanner2;
|
import org.eclipse.cdt.internal.core.parser.scanner2.Scanner2;
|
||||||
|
|
||||||
// A test that just calculates the speed of the parser
|
// A test that just calculates the speed of the parser
|
||||||
|
@ -84,11 +84,11 @@ public class SpeedTest2 extends TestCase {
|
||||||
IParserLogService logService = ( log == null ) ? ParserFactory.createDefaultLogService() : log;
|
IParserLogService logService = ( log == null ) ? ParserFactory.createDefaultLogService() : log;
|
||||||
ParserMode ourMode = ( (mode == null )? ParserMode.COMPLETE_PARSE : mode );
|
ParserMode ourMode = ( (mode == null )? ParserMode.COMPLETE_PARSE : mode );
|
||||||
ISourceElementRequestor ourRequestor = (( requestor == null) ? new NullSourceElementRequestor() : requestor );
|
ISourceElementRequestor ourRequestor = (( requestor == null) ? new NullSourceElementRequestor() : requestor );
|
||||||
IScannerConfiguration configuration = null;
|
IScannerExtensionConfiguration configuration = null;
|
||||||
if( language == ParserLanguage.C )
|
if( language == ParserLanguage.C )
|
||||||
configuration = new GCCScannerConfiguration();
|
configuration = new GCCScannerExtensionConfiguration();
|
||||||
else
|
else
|
||||||
configuration = new GPPScannerConfiguration();
|
configuration = new GPPScannerExtensionConfiguration();
|
||||||
return new Scanner2( code, config, ourRequestor, ourMode, language, logService, workingCopies, configuration );
|
return new Scanner2( code, config, ourRequestor, ourMode, language, logService, workingCopies, configuration );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,9 @@ import org.eclipse.cdt.internal.core.parser.QuickParseCallback;
|
||||||
import org.eclipse.cdt.internal.core.parser.StructuralParseCallback;
|
import org.eclipse.cdt.internal.core.parser.StructuralParseCallback;
|
||||||
import org.eclipse.cdt.internal.core.parser.ast.complete.CompleteParseASTFactory;
|
import org.eclipse.cdt.internal.core.parser.ast.complete.CompleteParseASTFactory;
|
||||||
import org.eclipse.cdt.internal.core.parser.ast.quick.QuickParseASTFactory;
|
import org.eclipse.cdt.internal.core.parser.ast.quick.QuickParseASTFactory;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.Scanner2;
|
import org.eclipse.cdt.internal.core.parser.scanner2.Scanner2;
|
||||||
import org.eclipse.cdt.internal.core.parser.token.KeywordSets;
|
import org.eclipse.cdt.internal.core.parser.token.KeywordSets;
|
||||||
|
|
||||||
|
@ -87,11 +87,11 @@ public class ParserFactory {
|
||||||
IParserLogService logService = ( log == null ) ? createDefaultLogService() : log;
|
IParserLogService logService = ( log == null ) ? createDefaultLogService() : log;
|
||||||
ParserMode ourMode = ( (mode == null )? ParserMode.COMPLETE_PARSE : mode );
|
ParserMode ourMode = ( (mode == null )? ParserMode.COMPLETE_PARSE : mode );
|
||||||
ISourceElementRequestor ourRequestor = (( requestor == null) ? new NullSourceElementRequestor() : requestor );
|
ISourceElementRequestor ourRequestor = (( requestor == null) ? new NullSourceElementRequestor() : requestor );
|
||||||
IScannerConfiguration configuration = null;
|
IScannerExtensionConfiguration configuration = null;
|
||||||
if( language == ParserLanguage.C )
|
if( language == ParserLanguage.C )
|
||||||
configuration = new GCCScannerConfiguration();
|
configuration = new GCCScannerExtensionConfiguration();
|
||||||
else
|
else
|
||||||
configuration = new GPPScannerConfiguration();
|
configuration = new GPPScannerExtensionConfiguration();
|
||||||
|
|
||||||
return new Scanner2( code, config, ourRequestor, ourMode, language, logService, workingCopies, configuration );
|
return new Scanner2( code, config, ourRequestor, ourMode, language, logService, workingCopies, configuration );
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class GNUCPPParserExtensionConfiguration implements
|
public class GPPParserExtensionConfiguration implements
|
||||||
ICPPParserExtensionConfiguration {
|
ICPPParserExtensionConfiguration {
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
|
@ -1120,7 +1120,7 @@ abstract class BaseScanner implements IScanner {
|
||||||
|
|
||||||
public BaseScanner(CodeReader reader, IScannerInfo info,
|
public BaseScanner(CodeReader reader, IScannerInfo info,
|
||||||
ParserMode parserMode, ParserLanguage language, IParserLogService log,
|
ParserMode parserMode, ParserLanguage language, IParserLogService log,
|
||||||
IScannerConfiguration configuration) {
|
IScannerExtensionConfiguration configuration) {
|
||||||
|
|
||||||
this.parserMode = parserMode;
|
this.parserMode = parserMode;
|
||||||
this.language = language;
|
this.language = language;
|
||||||
|
@ -4298,7 +4298,7 @@ abstract class BaseScanner implements IScanner {
|
||||||
|
|
||||||
protected int offsetBoundary = -1;
|
protected int offsetBoundary = -1;
|
||||||
|
|
||||||
protected void setupBuiltInMacros(IScannerConfiguration config) {
|
protected void setupBuiltInMacros(IScannerExtensionConfiguration config) {
|
||||||
|
|
||||||
definitions.put(__STDC__.name, __STDC__);
|
definitions.put(__STDC__.name, __STDC__);
|
||||||
definitions.put(__FILE__.name, __FILE__);
|
definitions.put(__FILE__.name, __FILE__);
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class DOMScanner extends BaseScanner {
|
||||||
* @param readerFactory TODO
|
* @param readerFactory TODO
|
||||||
* @param requestor
|
* @param requestor
|
||||||
*/
|
*/
|
||||||
public DOMScanner(CodeReader reader, IScannerInfo info, ParserMode parserMode, ParserLanguage language, IParserLogService log, IScannerConfiguration configuration, ICodeReaderFactory readerFactory) {
|
public DOMScanner(CodeReader reader, IScannerInfo info, ParserMode parserMode, ParserLanguage language, IParserLogService log, IScannerExtensionConfiguration configuration, ICodeReaderFactory readerFactory) {
|
||||||
super(reader, info, parserMode, language, log, configuration);
|
super(reader, info, parserMode, language, log, configuration);
|
||||||
this.expressionEvaluator = new ExpressionEvaluator(null, null);
|
this.expressionEvaluator = new ExpressionEvaluator(null, null);
|
||||||
this.codeReaderFactory = readerFactory;
|
this.codeReaderFactory = readerFactory;
|
||||||
|
|
|
@ -19,7 +19,7 @@ import org.eclipse.cdt.internal.core.parser.scanner2.BaseScanner.ExpressionEvalu
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class GCCScannerConfiguration extends GNUScannerConfiguration implements IScannerConfiguration {
|
public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfiguration implements IScannerExtensionConfiguration {
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#supportMinAndMaxOperators()
|
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#supportMinAndMaxOperators()
|
|
@ -15,7 +15,7 @@ import org.eclipse.cdt.core.parser.util.CharArrayObjectMap;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public abstract class GNUScannerConfiguration implements IScannerConfiguration {
|
public abstract class GNUScannerExtensionConfiguration implements IScannerExtensionConfiguration {
|
||||||
|
|
||||||
protected static final char[] emptyCharArray = "".toCharArray(); //$NON-NLS-1$
|
protected static final char[] emptyCharArray = "".toCharArray(); //$NON-NLS-1$
|
||||||
|
|
|
@ -19,8 +19,8 @@ import org.eclipse.cdt.core.parser.util.CharArrayIntMap;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class GPPScannerConfiguration extends GNUScannerConfiguration implements
|
public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfiguration implements
|
||||||
IScannerConfiguration {
|
IScannerExtensionConfiguration {
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#supportMinAndMaxOperators()
|
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#supportMinAndMaxOperators()
|
|
@ -16,7 +16,7 @@ import org.eclipse.cdt.core.parser.util.CharArrayObjectMap;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public interface IScannerConfiguration {
|
public interface IScannerExtensionConfiguration {
|
||||||
|
|
||||||
public boolean initializeMacroValuesTo1();
|
public boolean initializeMacroValuesTo1();
|
||||||
public boolean support$InIdentifiers();
|
public boolean support$InIdentifiers();
|
|
@ -47,7 +47,7 @@ public class Scanner2 extends BaseScanner {
|
||||||
public Scanner2(CodeReader reader, IScannerInfo info,
|
public Scanner2(CodeReader reader, IScannerInfo info,
|
||||||
ISourceElementRequestor requestor, ParserMode parserMode,
|
ISourceElementRequestor requestor, ParserMode parserMode,
|
||||||
ParserLanguage language, IParserLogService log, List workingCopies,
|
ParserLanguage language, IParserLogService log, List workingCopies,
|
||||||
IScannerConfiguration configuration) {
|
IScannerExtensionConfiguration configuration) {
|
||||||
super(reader, info, parserMode, language, log, configuration);
|
super(reader, info, parserMode, language, log, configuration);
|
||||||
this.requestor = requestor;
|
this.requestor = requestor;
|
||||||
this.callbackManager = new ScannerCallbackManager(requestor);
|
this.callbackManager = new ScannerCallbackManager(requestor);
|
||||||
|
|
|
@ -37,7 +37,7 @@ import org.eclipse.cdt.internal.core.dom.parser.c.GCCParserExtensionConfiguratio
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.c.GNUCSourceParser;
|
import org.eclipse.cdt.internal.core.dom.parser.c.GNUCSourceParser;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.c.ICParserExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.dom.parser.c.ICParserExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ANSICPPParserExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ANSICPPParserExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPParserExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.GPPParserExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPParserExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPParserExtensionConfiguration;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
|
@ -117,7 +117,7 @@ public class InternalASTServiceProvider implements IASTServiceProvider {
|
||||||
if( l == ParserLanguage.C )
|
if( l == ParserLanguage.C )
|
||||||
parser = new GNUCSourceParser( scanner, ParserMode.COMPLETE_PARSE, ParserUtil.getParserLogService(), new GCCParserExtensionConfiguration() );
|
parser = new GNUCSourceParser( scanner, ParserMode.COMPLETE_PARSE, ParserUtil.getParserLogService(), new GCCParserExtensionConfiguration() );
|
||||||
else
|
else
|
||||||
parser = new GNUCPPSourceParser( scanner, ParserMode.COMPLETE_PARSE, ParserUtil.getParserLogService(), new GNUCPPParserExtensionConfiguration() );
|
parser = new GNUCPPSourceParser( scanner, ParserMode.COMPLETE_PARSE, ParserUtil.getParserLogService(), new GPPParserExtensionConfiguration() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -150,7 +150,7 @@ public class InternalASTServiceProvider implements IASTServiceProvider {
|
||||||
}
|
}
|
||||||
else if( dialect.equals( dialects[3]))
|
else if( dialect.equals( dialects[3]))
|
||||||
{
|
{
|
||||||
ICPPParserExtensionConfiguration config = new GNUCPPParserExtensionConfiguration();
|
ICPPParserExtensionConfiguration config = new GPPParserExtensionConfiguration();
|
||||||
parser = new GNUCPPSourceParser( scanner, ParserMode.COMPLETE_PARSE, ParserUtil.getParserLogService(), config );
|
parser = new GNUCPPSourceParser( scanner, ParserMode.COMPLETE_PARSE, ParserUtil.getParserLogService(), config );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue