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
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 implement
getScannerExtensionConfiguration(IScannerInfo info),
getParserLanguage() and
createParser(IScanner scanner, ParserMode parserMode, IParserLogService logService, IIndex index).- Since:
- 5.0
- See Also:
-
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 -
Method Summary
Modifier and TypeMethodDescriptionUsed 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(Class<T> adapter) getASTTranslationUnit(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory codeReaderFactory, IIndex index, int options, IParserLogService log) Deprecated.getASTTranslationUnit(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory fileCreator, IIndex index, IParserLogService log) Deprecated.getASTTranslationUnit(FileContent reader, IScannerInfo scanInfo, IncludeFileContentProvider fileCreator, IIndex index, int options, IParserLogService log) Constructs an AST for the source code provided byreader.String[]Returns the built-in type names defined for this language.getCompletionNode(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory fileCreator, IIndex index, IParserLogService log, int offset) Deprecated.getCompletionNode(FileContent reader, IScannerInfo scanInfo, IncludeFileContentProvider fileCreator, IIndex index, IParserLogService log, int offset) Returns the AST completion node for the given offset.String[]Returns the keywords defined for this language, excluding built-in types.protected abstract ParserLanguageString[]Returns the preprocessor keywords (directives) defined for this language.protected IScannerExtensionConfigurationDeprecated.Do not override this method.protected IScannerExtensionConfigurationIASTName[]getSelectedNames(IASTTranslationUnit ast, int start, int length) Deprecated.Methods inherited from class org.eclipse.cdt.core.model.AbstractLanguage
getNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.cdt.core.model.ILanguage
getId, getLinkageID
-
Constructor Details
-
AbstractCLikeLanguage
public AbstractCLikeLanguage()
-
-
Method Details
-
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
- 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
- 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.- Specified by:
getSelectedNamesin interfaceILanguage
-
createModelBuilder
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
- Specified by:
getAdapterin interfaceorg.eclipse.core.runtime.IAdaptable- Overrides:
getAdapterin classorg.eclipse.core.runtime.PlatformObject
-
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
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
Description copied from interface:ICLanguageKeywordsReturns the preprocessor keywords (directives) defined for this language.- Specified by:
getPreprocessorKeywordsin interfaceICLanguageKeywords- Returns:
- an array of keywords, never
null
-
createScanner(FileContent, IScannerInfo, IncludeFileContentProvider, IParserLogService)