diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2BaseTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2BaseTest.java index c39f444d8b7..bd330870184 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2BaseTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2BaseTest.java @@ -165,9 +165,9 @@ public class AST2BaseTest extends BaseTestCase { IScannerInfo scannerInfo, boolean parseComments) { IScannerExtensionConfiguration configuration = null; if( lang == ParserLanguage.C ) - configuration = new GCCScannerExtensionConfiguration(); + configuration= GCCScannerExtensionConfiguration.getInstance(); else - configuration = new GPPScannerExtensionConfiguration(); + configuration= GPPScannerExtensionConfiguration.getInstance(); IScanner scanner; scanner= new CPreprocessor(codeReader, scannerInfo, lang, NULL_LOG, configuration, FileCodeReaderFactory.getInstance()); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/ExpansionExplorerTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/ExpansionExplorerTests.java index 25a81be249c..f47e241bc85 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/ExpansionExplorerTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/ExpansionExplorerTests.java @@ -85,7 +85,7 @@ public class ExpansionExplorerTests extends BaseTestCase { private MacroExpander createExpander(final String macrodefs) throws OffsetLimitReachedException { CPreprocessor cpp= new CPreprocessor(new CodeReader(macrodefs.toCharArray()), new ScannerInfo(), ParserLanguage.C, new NullLogService(), - new GCCScannerExtensionConfiguration(), NullCodeReaderFactory.getInstance()); + GCCScannerExtensionConfiguration.getInstance(), NullCodeReaderFactory.getInstance()); int type; do { type= cpp.nextTokenRaw().getType(); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/LexerTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/LexerTests.java index 4852ae633a3..182af970e23 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/LexerTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/LexerTests.java @@ -53,7 +53,7 @@ public class LexerTests extends BaseTestCase { private void init(String input, boolean dollar, boolean minmax) throws Exception { fLog.clear(); final LexerOptions lexerOptions = new LexerOptions(); - lexerOptions.fSupportDollarInitializers= dollar; + lexerOptions.fSupportDollarInIdentifiers= dollar; lexerOptions.fSupportMinAndMax= minmax; fLexer= new Lexer(input.toCharArray(), lexerOptions, fLog, null); fLexer.nextToken(); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/PreprocessorSpeedTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/PreprocessorSpeedTest.java index 6ffdaa012f6..a8e953d7fe1 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/PreprocessorSpeedTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/PreprocessorSpeedTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. + * Copyright (c) 2005, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -80,10 +80,10 @@ public class PreprocessorSpeedTest { ICodeReaderFactory readerFactory= FileCodeReaderFactory.getInstance(); IScannerExtensionConfiguration scannerConfig; if (lang == ParserLanguage.C) { - scannerConfig= new GCCScannerExtensionConfiguration(); + scannerConfig= GCCScannerExtensionConfiguration.getInstance(); } else { - scannerConfig= new GPPScannerExtensionConfiguration(); + scannerConfig= GPPScannerExtensionConfiguration.getInstance(); } ParserMode mode = ParserMode.COMPLETE_PARSE; CPreprocessor cpp= new CPreprocessor(reader, info, lang, new NullLogService(), scannerConfig, readerFactory); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/PreprocessorTestsBase.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/PreprocessorTestsBase.java index 834b537cdde..8b36ddb7c21 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/PreprocessorTestsBase.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/PreprocessorTestsBase.java @@ -67,10 +67,10 @@ public abstract class PreprocessorTestsBase extends BaseTestCase { IScannerExtensionConfiguration scannerConfig; if (lang == ParserLanguage.C) { - scannerConfig= new GCCScannerExtensionConfiguration(); + scannerConfig= GCCScannerExtensionConfiguration.getInstance(); } else { - scannerConfig= new GPPScannerExtensionConfiguration(); + scannerConfig= GPPScannerExtensionConfiguration.getInstance(); } fScanner= new CPreprocessor(input, scannerInfo, lang, NULL_LOG, scannerConfig, readerFactory); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/c/GCCLanguage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/c/GCCLanguage.java index cc7b7cffd0e..4a6046fa6fa 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/c/GCCLanguage.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/c/GCCLanguage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 QNX Software Systems and others. + * Copyright (c) 2005, 2008 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,7 +12,6 @@ * Anton Leherbauer (Wind River Systems) * Mike Kucera - IBM *******************************************************************************/ - package org.eclipse.cdt.core.dom.ast.gnu.c; import org.eclipse.cdt.core.CCorePlugin; @@ -22,6 +21,7 @@ import org.eclipse.cdt.core.dom.parser.IScannerExtensionConfiguration; import org.eclipse.cdt.core.dom.parser.ISourceCodeParser; import org.eclipse.cdt.core.dom.parser.c.GCCParserExtensionConfiguration; import org.eclipse.cdt.core.dom.parser.c.GCCScannerExtensionConfiguration; +import org.eclipse.cdt.core.dom.parser.c.ICParserExtensionConfiguration; import org.eclipse.cdt.core.index.IIndex; import org.eclipse.cdt.core.parser.IParserLogService; import org.eclipse.cdt.core.parser.IScanner; @@ -37,8 +37,8 @@ import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCLinkageFactory; */ public class GCCLanguage extends AbstractCLikeLanguage { - protected static final GCCScannerExtensionConfiguration C_GNU_SCANNER_EXTENSION = new GCCScannerExtensionConfiguration(); - protected static final GCCParserExtensionConfiguration C_GNU_PARSER_EXTENSION = new GCCParserExtensionConfiguration(); + protected static final GCCScannerExtensionConfiguration C_GNU_SCANNER_EXTENSION= GCCScannerExtensionConfiguration.getInstance(); + protected static final GCCParserExtensionConfiguration C_GNU_PARSER_EXTENSION= GCCParserExtensionConfiguration.getInstance(); // Must match the id in the extension public static final String ID = CCorePlugin.PLUGIN_ID + ".gcc"; //$NON-NLS-1$ @@ -73,13 +73,19 @@ public class GCCLanguage extends AbstractCLikeLanguage { return C_GNU_SCANNER_EXTENSION; } + /** + * Returns the extension configuration used for creating the parser. + * @since 5.1 + */ + protected ICParserExtensionConfiguration getParserExtensionConfiguration() { + return C_GNU_PARSER_EXTENSION; + } @Override protected ISourceCodeParser createParser(IScanner scanner, ParserMode parserMode, IParserLogService logService, IIndex index) { - return new GNUCSourceParser(scanner, parserMode, logService, C_GNU_PARSER_EXTENSION, index); + return new GNUCSourceParser(scanner, parserMode, logService, getParserExtensionConfiguration(), index); } - @Override protected ParserLanguage getParserLanguage() { return ParserLanguage.C; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/GPPLanguage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/GPPLanguage.java index 9bb52e90ab9..db3d66216c8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/GPPLanguage.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/GPPLanguage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 QNX Software Systems and others. + * Copyright (c) 2005, 2008 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,6 +21,7 @@ import org.eclipse.cdt.core.dom.parser.IScannerExtensionConfiguration; import org.eclipse.cdt.core.dom.parser.ISourceCodeParser; import org.eclipse.cdt.core.dom.parser.cpp.GPPParserExtensionConfiguration; import org.eclipse.cdt.core.dom.parser.cpp.GPPScannerExtensionConfiguration; +import org.eclipse.cdt.core.dom.parser.cpp.ICPPParserExtensionConfiguration; import org.eclipse.cdt.core.index.IIndex; import org.eclipse.cdt.core.parser.IParserLogService; import org.eclipse.cdt.core.parser.IScanner; @@ -36,8 +37,8 @@ import org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPLinkageFactory; */ public class GPPLanguage extends AbstractCLikeLanguage { - protected static final GPPScannerExtensionConfiguration CPP_GNU_SCANNER_EXTENSION = new GPPScannerExtensionConfiguration(); - protected static final GPPParserExtensionConfiguration CPP_GNU_PARSER_EXTENSION = new GPPParserExtensionConfiguration(); + protected static final GPPScannerExtensionConfiguration CPP_GNU_SCANNER_EXTENSION= GPPScannerExtensionConfiguration.getInstance(); + protected static final GPPParserExtensionConfiguration CPP_GNU_PARSER_EXTENSION= GPPParserExtensionConfiguration.getInstance(); public static final String ID = CCorePlugin.PLUGIN_ID + ".g++"; //$NON-NLS-1$ private static final GPPLanguage DEFAULT_INSTANCE = new GPPLanguage(); @@ -70,9 +71,17 @@ public class GPPLanguage extends AbstractCLikeLanguage { return CPP_GNU_SCANNER_EXTENSION; } + /** + * Returns the extension configuration used for creating the parser. + * @since 5.1 + */ + protected ICPPParserExtensionConfiguration getParserExtensionConfiguration() { + return CPP_GNU_PARSER_EXTENSION; + } + @Override protected ISourceCodeParser createParser(IScanner scanner, ParserMode parserMode, IParserLogService logService, IIndex index) { - return new GNUCPPSourceParser(scanner, parserMode, logService, CPP_GNU_PARSER_EXTENSION, index); + return new GNUCPPSourceParser(scanner, parserMode, logService, getParserExtensionConfiguration(), index); } @Override diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/AbstractScannerExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/AbstractScannerExtensionConfiguration.java index 1c9500711d5..2056e23c943 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/AbstractScannerExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/AbstractScannerExtensionConfiguration.java @@ -11,22 +11,23 @@ *******************************************************************************/ package org.eclipse.cdt.core.dom.parser; +import java.util.ArrayList; + import org.eclipse.cdt.core.parser.IMacro; +import org.eclipse.cdt.core.parser.IToken; import org.eclipse.cdt.core.parser.util.CharArrayIntMap; /** * Abstract scanner extension configuration to help model C/C++ dialects. - * - *
- * EXPERIMENTAL. This class or interface has been added as - * part of a work in progress. There is no guarantee that this API will work or - * that it will remain the same. Please do not use this API without consulting - * with the CDT team. - *
- * * @since 4.0 */ public abstract class AbstractScannerExtensionConfiguration implements IScannerExtensionConfiguration { + private static final IMacro[] EMPTY_MACRO_ARRAY = new IMacro[0]; + private ArrayList+ * Example: + * addMacro("max(a,b)", "(((a)>(b) ? (a) : (b))"); + ** @param signature the signature of the macro, see {@link IMacro#getSignature()}. * @param value the macro value + * @since 5.1 */ + protected void addMacro(String signature, String value) { + if (fAddMacroList == null) { + fAddMacroList= new ArrayList
- * This interface is not intended to be implemented directly. Clients should - * subclass {@link AbstractScannerExtensionConfiguration} instead. - *
- *- * EXPERIMENTAL. This class or interface has been added as - * part of a work in progress. There is no guarantee that this API will work or - * that it will remain the same. Please do not use this API without consulting - * with the CDT team. - *
- * - * @author jcamelon + * + * @noimplement This interface is not intended to be implemented by clients. Clients can subclass + * {@link AbstractScannerExtensionConfiguration}, instead. */ public interface IScannerExtensionConfiguration { @@ -50,6 +40,14 @@ public interface IScannerExtensionConfiguration { */ public boolean support$InIdentifiers(); + /** + * Support for extension "At Signs in Identifier Names". If enabled, the '@' sign is treated as part of + * identifiers. + * @returntrue
, if @ should be supported in identifiers
+ * @since 5.1
+ */
+ public boolean supportAtSignInIdentifiers();
+
/**
* Support for (deprecated) GNU minimum and maximum operators (<?
* and >?
).
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/AbstractCParserExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/AbstractCParserExtensionConfiguration.java
index dc04f787875..42d1d3819b8 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/AbstractCParserExtensionConfiguration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/AbstractCParserExtensionConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Anton Leherbauer (Wind River Systems) - initial API and implementation
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.core.dom.parser.c;
@@ -17,14 +18,6 @@ import org.eclipse.cdt.internal.core.dom.parser.GCCBuiltinSymbolProvider;
/**
* Abstract C parser extension configuration to help model C dialects.
- *
- * - * EXPERIMENTAL. This class or interface has been added as - * part of a work in progress. There is no guarantee that this API will work or - * that it will remain the same. Please do not use this API without consulting - * with the CDT team. - *
- * * @since 4.0 */ public abstract class AbstractCParserExtensionConfiguration implements ICParserExtensionConfiguration { @@ -95,4 +88,11 @@ public abstract class AbstractCParserExtensionConfiguration implements ICParserE return null; } + /** + * {@inheritDoc} + * @since 5.1 + */ + public boolean supportParameterInfoBlock() { + return false; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCParserExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCParserExtensionConfiguration.java index f08db291398..5df338d2a0b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCParserExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCParserExtensionConfiguration.java @@ -6,8 +6,9 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * IBM Rational Software - Initial API and implementation - * Ed Swartz (Nokia) + * IBM Rational Software - Initial API and implementation + * Ed Swartz (Nokia) + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.core.dom.parser.c; @@ -16,9 +17,16 @@ import org.eclipse.cdt.core.parser.ParserLanguage; import org.eclipse.cdt.internal.core.dom.parser.GCCBuiltinSymbolProvider; /** - * @author jcamelon + * Configures the parser for c-source code as accepted by gcc. */ public class GCCParserExtensionConfiguration extends AbstractCParserExtensionConfiguration { + private static GCCParserExtensionConfiguration sInstance= new GCCParserExtensionConfiguration(); + /** + * @since 5.1 + */ + public static GCCParserExtensionConfiguration getInstance() { + return sInstance; + } /* * @see org.eclipse.cdt.core.dom.parser.c.AbstractCParserExtensionConfiguration#supportStatementsInExpressions() diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java index 5fb3e258dbc..57de27534cd 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java @@ -13,24 +13,22 @@ package org.eclipse.cdt.core.dom.parser.c; import org.eclipse.cdt.core.dom.parser.GNUScannerExtensionConfiguration; -import org.eclipse.cdt.core.parser.IMacro; -import org.eclipse.cdt.core.parser.util.CharArrayIntMap; /** - * @author jcamelon + * Configures the preprocessor for parsing c-sources as accepted by gcc. */ public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfiguration { - private static IMacro[] sAdditionalMacros; - private static CharArrayIntMap sAdditionalKeywords; - static { - final IMacro[] macros = GNUScannerExtensionConfiguration.getAdditionalGNUMacros(); - sAdditionalMacros= new IMacro[macros.length+1]; - System.arraycopy(macros, 0, sAdditionalMacros, 0, macros.length); - sAdditionalMacros[macros.length]= createMacro("_Pragma(arg)", ""); //$NON-NLS-1$//$NON-NLS-2$ - - sAdditionalKeywords= new CharArrayIntMap(10, -1); - GNUScannerExtensionConfiguration.addAdditionalGNUKeywords(sAdditionalKeywords); + private static GCCScannerExtensionConfiguration sInstance= new GCCScannerExtensionConfiguration(); + /** + * @since 5.1 + */ + public static GCCScannerExtensionConfiguration getInstance() { + return sInstance; + } + + public GCCScannerExtensionConfiguration() { + addMacro("_Pragma(arg)", ""); //$NON-NLS-1$//$NON-NLS-2$ } /* (non-Javadoc) @@ -40,22 +38,4 @@ public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfigu public boolean supportMinAndMaxOperators() { return false; } - - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#getAdditionalMacros() - */ - @Override - public IMacro[] getAdditionalMacros() { - return sAdditionalMacros; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#getAdditionalKeywords() - */ - @Override - public CharArrayIntMap getAdditionalKeywords() { - return sAdditionalKeywords; - } - } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/ICParserExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/ICParserExtensionConfiguration.java index b5de8aa47bd..52a6109ad1f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/ICParserExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/ICParserExtensionConfiguration.java @@ -6,9 +6,10 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * IBM Rational Software - Initial API and implementation - * Ed Swartz (Nokia) - * Anton Leherbauer (Wind River Systems) + * IBM Rational Software - Initial API and implementation + * Ed Swartz (Nokia) + * Anton Leherbauer (Wind River Systems) + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.core.dom.parser.c; @@ -17,20 +18,10 @@ import org.eclipse.cdt.core.dom.parser.IBuiltinBindingsProvider; /** * C parser extension configuration interface. * - *- * This interface is not intended to be implemented directly. Clients should - * subclass {@link AbstractCParserExtensionConfiguration} instead. - *
- *- * EXPERIMENTAL. This class or interface has been added as - * part of a work in progress. There is no guarantee that this API will work or - * that it will remain the same. Please do not use this API without consulting - * with the CDT team. - *
+ * @noimplement This interface is not intended to be implemented by clients. + * Clients can subclass {@link AbstractCParserExtensionConfiguration} instead. * * @see "http://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html" - * - * @author jcamelon * @since 4.0 */ public interface ICParserExtensionConfiguration { @@ -78,17 +69,6 @@ public interface ICParserExtensionConfiguration { */ public boolean supportKnRC(); - /** - * See http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html for more - * information on GCC's Other Built-in Symbols. - * - * @returntrue
if support for the extension should be
- * enabled
- * @deprecated use {@link #getBuiltinBindingsProvider()} instead.
- */
- @Deprecated
- public boolean supportGCCOtherBuiltinSymbols();
-
/**
* See http://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html for more
* information on GCC's Attribute Specifiers.
@@ -113,4 +93,23 @@ public interface ICParserExtensionConfiguration {
* null
*/
public IBuiltinBindingsProvider getBuiltinBindingsProvider();
+
+ /**
+ * Skips information in brackets provided at the beginning of a parameter declaration:
+ * true
if support for the extension should be
+ * enabled
+ * @deprecated use {@link #getBuiltinBindingsProvider()} instead.
+ */
+ @Deprecated
+ public boolean supportGCCOtherBuiltinSymbols();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/AbstractCPPParserExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/AbstractCPPParserExtensionConfiguration.java
index 5bd847a0f25..e0f5baa02e3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/AbstractCPPParserExtensionConfiguration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/AbstractCPPParserExtensionConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Anton Leherbauer (Wind River Systems) - initial API and implementation
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.core.dom.parser.cpp;
@@ -19,13 +20,6 @@ import org.eclipse.cdt.internal.core.dom.parser.GCCBuiltinSymbolProvider;
/**
* Abstract C++ parser extension configuration to help model C++ dialects.
*
- * - * EXPERIMENTAL. This class or interface has been added as - * part of a work in progress. There is no guarantee that this API will work or - * that it will remain the same. Please do not use this API without consulting - * with the CDT team. - *
- * * @since 4.0 */ public abstract class AbstractCPPParserExtensionConfiguration implements ICPPParserExtensionConfiguration { @@ -121,6 +115,14 @@ public abstract class AbstractCPPParserExtensionConfiguration implements ICPPPar return false; } + /** + * {@inheritDoc} + * @since 5.1 + */ + public boolean supportParameterInfoBlock() { + return false; + } + /* * @see org.eclipse.cdt.core.dom.parser.cpp.ICPPParserExtensionConfiguration#getBuiltinBindingsProvider() */ @@ -130,5 +132,4 @@ public abstract class AbstractCPPParserExtensionConfiguration implements ICPPPar } return null; } - } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/GPPParserExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/GPPParserExtensionConfiguration.java index 799ed3c9694..80441e92c9b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/GPPParserExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/GPPParserExtensionConfiguration.java @@ -6,8 +6,9 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * IBM Rational Software - Initial API and implementation - * Ed Swartz (Nokia) + * IBM Rational Software - Initial API and implementation + * Ed Swartz (Nokia) + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.core.dom.parser.cpp; @@ -16,9 +17,16 @@ import org.eclipse.cdt.core.parser.ParserLanguage; import org.eclipse.cdt.internal.core.dom.parser.GCCBuiltinSymbolProvider; /** - * @author jcamelon + * Configures the parser for c++-sources as accepted by g++. */ public class GPPParserExtensionConfiguration extends AbstractCPPParserExtensionConfiguration { + private static GPPParserExtensionConfiguration sInstance= new GPPParserExtensionConfiguration(); + /** + * @since 5.1 + */ + public static GPPParserExtensionConfiguration getInstance() { + return sInstance; + } /* * @see org.eclipse.cdt.core.dom.parser.cpp.AbstractCPPParserExtensionConfiguration#allowRestrictPointerOperators() diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/GPPScannerExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/GPPScannerExtensionConfiguration.java index 9eabc9da3c8..7fed446553f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/GPPScannerExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/GPPScannerExtensionConfiguration.java @@ -16,20 +16,24 @@ package org.eclipse.cdt.core.dom.parser.cpp; import org.eclipse.cdt.core.dom.parser.GNUScannerExtensionConfiguration; import org.eclipse.cdt.core.parser.IToken; import org.eclipse.cdt.core.parser.Keywords; -import org.eclipse.cdt.core.parser.util.CharArrayIntMap; /** - * @author jcamelon + * Configures the preprocessor for c++-sources as accepted by g++. */ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfiguration { - private static CharArrayIntMap sAdditionalKeywords; - static { - sAdditionalKeywords= new CharArrayIntMap(10, -1); - GNUScannerExtensionConfiguration.addAdditionalGNUKeywords(sAdditionalKeywords); - sAdditionalKeywords.put( Keywords.cRESTRICT, IToken.t_restrict ); - sAdditionalKeywords.put( Keywords.c_COMPLEX, IToken.t__Complex ); - sAdditionalKeywords.put( Keywords.c_IMAGINARY, IToken.t__Imaginary ); + private static GPPScannerExtensionConfiguration sInstance= new GPPScannerExtensionConfiguration(); + /** + * @since 5.1 + */ + public static GPPScannerExtensionConfiguration getInstance() { + return sInstance; + } + + public GPPScannerExtensionConfiguration() { + addKeyword(Keywords.cRESTRICT, IToken.t_restrict); + addKeyword(Keywords.c_COMPLEX, IToken.t__Complex); + addKeyword(Keywords.c_IMAGINARY, IToken.t__Imaginary); } /* (non-Javadoc) @@ -39,12 +43,4 @@ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfigu public boolean supportMinAndMaxOperators() { return true; } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#getAdditionalKeywords() - */ - @Override - public CharArrayIntMap getAdditionalKeywords() { - return sAdditionalKeywords; - } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/ICPPParserExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/ICPPParserExtensionConfiguration.java index c9a105af324..917ddc16351 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/ICPPParserExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/ICPPParserExtensionConfiguration.java @@ -6,9 +6,10 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * IBM Rational Software - Initial API and implementation - * Ed Swartz (Nokia) - * Anton Leherbauer (Wind River Systems) + * IBM Rational Software - Initial API and implementation + * Ed Swartz (Nokia) + * Anton Leherbauer (Wind River Systems) + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.core.dom.parser.cpp; @@ -18,21 +19,11 @@ import org.eclipse.cdt.core.dom.parser.IScannerExtensionConfiguration; /** * C++ parser extension configuration interface. * - *- * This interface is not intended to be implemented directly. Clients should - * subclass {@link AbstractCPPParserExtensionConfiguration} instead. - *
- *- * EXPERIMENTAL. This class or interface has been added as - * part of a work in progress. There is no guarantee that this API will work or - * that it will remain the same. Please do not use this API without consulting - * with the CDT team. - *
+ * @noimplement This interface is not intended to be implemented by clients. + * Clients can subclass {@link AbstractCPPParserExtensionConfiguration} instead. * * @see "http://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html" * @see "http://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Extensions.html" - * - * @author jcamelon * @since 4.0 */ public interface ICPPParserExtensionConfiguration { @@ -76,16 +67,6 @@ public interface ICPPParserExtensionConfiguration { */ public boolean supportComplexNumbers(); - /** - * Support for the GNU__restrict__
keyword.
- *
- * @return true
if support for the extension should be
- * enabled
- * @deprecated configure extra keywords, via {@link IScannerExtensionConfiguration#getAdditionalKeywords()}
- */
- @Deprecated
- public boolean supportRestrictKeyword();
-
/**
* Support for GNU long long types.
*
@@ -129,16 +110,6 @@ public interface ICPPParserExtensionConfiguration {
*/
public boolean supportKnRC();
- /**
- * See http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html for more
- * information on GCC's Other Built-in Symbols.
- *
- * @return true
if support for the extension should be enabled
- * @deprecated use {@link #getBuiltinBindingsProvider()} instead.
- */
- @Deprecated
- public boolean supportGCCOtherBuiltinSymbols();
-
/**
* See http://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html for more
* information on GCC's Attribute Specifiers.
@@ -163,4 +134,24 @@ public interface ICPPParserExtensionConfiguration {
* null
*/
public IBuiltinBindingsProvider getBuiltinBindingsProvider();
+
+ /**
+ * Skips information in brackets provided at the beginning of a parameter declaration:
+ *