Package org.eclipse.cdt.core.dom.parser
Class AbstractCLikeLanguage
- java.lang.Object
-
- org.eclipse.core.runtime.PlatformObject
-
- org.eclipse.cdt.core.model.AbstractLanguage
-
- org.eclipse.cdt.core.dom.parser.AbstractCLikeLanguage
-
- All Implemented Interfaces:
ICLanguageKeywords,ILanguage,org.eclipse.core.runtime.IAdaptable
- Direct Known Subclasses:
GCCLanguage,GPPLanguage
public abstract class AbstractCLikeLanguage extends AbstractLanguage implements ICLanguageKeywords
This class provides a skeletal implementation of the ILanguage interface for the DOM parser framework. This class uses the template method pattern, derived classes need only implementgetScannerExtensionConfiguration(IScannerInfo info),getParserLanguage()andcreateParser(IScanner scanner, ParserMode parserMode, IParserLogService logService, IIndex index).- Since:
- 5.0
- See Also:
AbstractScannerExtensionConfiguration
-
-
Field Summary
-
Fields inherited from interface org.eclipse.cdt.core.model.ILanguage
OPTION_ADD_COMMENTS, OPTION_IS_SOURCE_UNIT, OPTION_NO_IMAGE_LOCATIONS, OPTION_PARSE_INACTIVE_CODE, OPTION_SKIP_FUNCTION_BODIES, OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS
-
-
Constructor Summary
Constructors Constructor Description AbstractCLikeLanguage()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description IContributedModelBuildercreateModelBuilder(ITranslationUnit tu)Used to override the default model building behavior for a translation unit.protected ISourceCodeParsercreateParser(IScanner scanner, IParserLogService log, IIndex index, boolean forCompletion, int options)Creates the parser.protected ISourceCodeParsercreateParser(IScanner scanner, IParserLogService log, IIndex index, boolean forCompletion, int options, IParserSettings settings)Create the parser with additional settings.protected abstract ISourceCodeParsercreateParser(IScanner scanner, ParserMode parserMode, IParserLogService logService, IIndex index)protected ISourceCodeParsercreateParser(IScanner scanner, ParserMode parserMode, IParserLogService logService, IIndex index, int options, IParserSettings settings)protected IScannercreateScanner(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory fileCreator, IParserLogService log)Deprecated.protected IScannercreateScanner(FileContent content, IScannerInfo scanInfo, IncludeFileContentProvider fcp, IParserLogService log)Create the scanner to be used with the parser.<T> TgetAdapter(java.lang.Class<T> adapter)IASTTranslationUnitgetASTTranslationUnit(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory codeReaderFactory, IIndex index, int options, IParserLogService log)Deprecated.IASTTranslationUnitgetASTTranslationUnit(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory fileCreator, IIndex index, IParserLogService log)Deprecated.IASTTranslationUnitgetASTTranslationUnit(FileContent reader, IScannerInfo scanInfo, IncludeFileContentProvider fileCreator, IIndex index, int options, IParserLogService log)Constructs an AST for the source code provided byreader.java.lang.String[]getBuiltinTypes()Returns the built-in type names defined for this language.IASTCompletionNodegetCompletionNode(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory fileCreator, IIndex index, IParserLogService log, int offset)Deprecated.IASTCompletionNodegetCompletionNode(FileContent reader, IScannerInfo scanInfo, IncludeFileContentProvider fileCreator, IIndex index, IParserLogService log, int offset)Returns the AST completion node for the given offset.java.lang.String[]getKeywords()Returns the keywords defined for this language, excluding built-in types.protected abstract ParserLanguagegetParserLanguage()java.lang.String[]getPreprocessorKeywords()Returns the preprocessor keywords (directives) defined for this language.protected IScannerExtensionConfigurationgetScannerExtensionConfiguration()Deprecated.Do not override this method.protected IScannerExtensionConfigurationgetScannerExtensionConfiguration(IScannerInfo info)IASTName[]getSelectedNames(IASTTranslationUnit ast, int start, int length)Deprecated.-
Methods inherited from class org.eclipse.cdt.core.model.AbstractLanguage
getName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.cdt.core.model.ILanguage
getId, getLinkageID
-
-
-
-
Method Detail
-
getScannerExtensionConfiguration
@Deprecated protected IScannerExtensionConfiguration getScannerExtensionConfiguration()
Deprecated.Do not override this method. OverridegetScannerExtensionConfiguration(IScannerInfo)instead.- Restriction:
- This method is not intended to be re-implemented or extended by clients.
-
getScannerExtensionConfiguration
protected IScannerExtensionConfiguration getScannerExtensionConfiguration(IScannerInfo info)
- Returns:
- the scanner extension configuration for this language. May not return
null. - Since:
- 5.4
-
createParser
protected abstract ISourceCodeParser createParser(IScanner scanner, ParserMode parserMode, IParserLogService logService, IIndex index)
- Returns:
- the actual parser object.
-
createParser
protected ISourceCodeParser createParser(IScanner scanner, ParserMode parserMode, IParserLogService logService, IIndex index, int options, IParserSettings settings)
- Returns:
- the actual parser object, configured with additional settings.
- Since:
- 5.6
-
getParserLanguage
protected abstract ParserLanguage getParserLanguage()
- Returns:
- The ParserLanguage value corresponding to the language supported.
-
getASTTranslationUnit
@Deprecated public IASTTranslationUnit getASTTranslationUnit(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory fileCreator, IIndex index, IParserLogService log) throws org.eclipse.core.runtime.CoreException
Deprecated.- Specified by:
getASTTranslationUnitin interfaceILanguage- Throws:
org.eclipse.core.runtime.CoreException
-
getASTTranslationUnit
@Deprecated public IASTTranslationUnit getASTTranslationUnit(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory codeReaderFactory, IIndex index, int options, IParserLogService log) throws org.eclipse.core.runtime.CoreException
Deprecated.- Specified by:
getASTTranslationUnitin interfaceILanguage- Overrides:
getASTTranslationUnitin classAbstractLanguage- Throws:
org.eclipse.core.runtime.CoreException
-
getASTTranslationUnit
public IASTTranslationUnit getASTTranslationUnit(FileContent reader, IScannerInfo scanInfo, IncludeFileContentProvider fileCreator, IIndex index, int options, IParserLogService log) throws org.eclipse.core.runtime.CoreException
Description copied from interface:ILanguageConstructs an AST for the source code provided byreader.- Specified by:
getASTTranslationUnitin interfaceILanguage- Overrides:
getASTTranslationUnitin classAbstractLanguage- Parameters:
reader- source code to be parsed.scanInfo- provides include paths and defined symbols.fileCreator- factory that provides file content for files includedindex- (optional) index to use to lookup symbols external to the translation unit.options- A combination ofILanguage.OPTION_SKIP_FUNCTION_BODIES,ILanguage.OPTION_NO_IMAGE_LOCATIONS, or0.log- logger- Returns:
- an AST for the source code provided by reader.
- Throws:
org.eclipse.core.runtime.CoreException
-
getCompletionNode
@Deprecated public IASTCompletionNode getCompletionNode(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory fileCreator, IIndex index, IParserLogService log, int offset) throws org.eclipse.core.runtime.CoreException
Deprecated.- Specified by:
getCompletionNodein interfaceILanguage- Throws:
org.eclipse.core.runtime.CoreException
-
getCompletionNode
public IASTCompletionNode getCompletionNode(FileContent reader, IScannerInfo scanInfo, IncludeFileContentProvider fileCreator, IIndex index, IParserLogService log, int offset) throws org.eclipse.core.runtime.CoreException
Description copied from interface:ILanguageReturns the AST completion node for the given offset.- Specified by:
getCompletionNodein interfaceILanguage- Overrides:
getCompletionNodein classAbstractLanguage- Throws:
org.eclipse.core.runtime.CoreException
-
createParser
protected ISourceCodeParser createParser(IScanner scanner, IParserLogService log, IIndex index, boolean forCompletion, int options)
Creates the parser.- Parameters:
scanner- the IScanner to get tokens fromlog- the parser log serviceindex- the index to help resolve bindingsforCompletion- whether the parser is used for code completionoptions- for valid options seeAbstractLanguage.getASTTranslationUnit(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, int, IParserLogService)- Returns:
- an instance of ISourceCodeParser
-
createParser
protected ISourceCodeParser createParser(IScanner scanner, IParserLogService log, IIndex index, boolean forCompletion, int options, IParserSettings settings)
Create the parser with additional settings.- Parameters:
scanner- the IScanner to get tokens fromlog- the parser log serviceindex- the index to help resolve bindingsforCompletion- whether the parser is used for code completionoptions- for valid options seeAbstractLanguage.getASTTranslationUnit(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, int, IParserLogService)settings- for the parser- Returns:
- an instance of ISourceCodeParser
- Since:
- 5.6
-
createScanner
@Deprecated protected IScanner createScanner(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory fileCreator, IParserLogService log)
Deprecated.
-
createScanner
protected IScanner createScanner(FileContent content, IScannerInfo scanInfo, IncludeFileContentProvider fcp, IParserLogService log)
Create the scanner to be used with the parser.- Since:
- 5.2
-
getSelectedNames
@Deprecated public IASTName[] getSelectedNames(IASTTranslationUnit ast, int start, int length)
Deprecated.- Specified by:
getSelectedNamesin interfaceILanguage
-
createModelBuilder
public IContributedModelBuilder createModelBuilder(ITranslationUnit tu)
Description copied from interface:ILanguageUsed to override the default model building behavior for a translation unit.- Specified by:
createModelBuilderin interfaceILanguage- Parameters:
tu- theITranslationUnitto be parsed (non-null)- Returns:
- an
IModelBuilder, which parses the given translation unit and returns theICElements of its model, ornullto parse using the default CDT model builder
-
getAdapter
public <T> T getAdapter(java.lang.Class<T> adapter)
- Specified by:
getAdapterin interfaceorg.eclipse.core.runtime.IAdaptable- Overrides:
getAdapterin classorg.eclipse.core.runtime.PlatformObject
-
getBuiltinTypes
public java.lang.String[] getBuiltinTypes()
Description copied from interface:ICLanguageKeywordsReturns the built-in type names defined for this language.- Specified by:
getBuiltinTypesin interfaceICLanguageKeywords- Returns:
- an array of names, never
null
-
getKeywords
public java.lang.String[] getKeywords()
Description copied from interface:ICLanguageKeywordsReturns the keywords defined for this language, excluding built-in types.- Specified by:
getKeywordsin interfaceICLanguageKeywords- Returns:
- an array of keywords, never
null
-
getPreprocessorKeywords
public java.lang.String[] getPreprocessorKeywords()
Description copied from interface:ICLanguageKeywordsReturns the preprocessor keywords (directives) defined for this language.- Specified by:
getPreprocessorKeywordsin interfaceICLanguageKeywords- Returns:
- an array of keywords, never
null
-
-