Package org.eclipse.cdt.core.model

# Interface ILanguage

All Superinterfaces:
  `org.eclipse.core.runtime.IAdaptable`

All Known Implementing Classes:
  `AbstractCLikeLanguage`, `AbstractLanguage`, `AssemblyLanguage`, `GCCLanguage`, `GPPLanguage`

public interface ILanguage extends org.eclipse.core.runtime.IAdaptable
Models differences between languages. The interface is not supposed to be implemented directly. Rather than that clients may subclass `AbstractLanguage`.

Restriction:
  This interface is not intended to be implemented by clients.
Restriction:
  This interface is not intended to be extended by clients.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`OPTION_ADD_COMMENTS`
Deprecated.
Has no effect.
`static final int`
`OPTION_IS_SOURCE_UNIT`
Deprecated.
Has no effect.
`static final int`
`OPTION_NO_IMAGE_LOCATIONS`
Option for `getASTTranslationUnit(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, int, IParserLogService)` Performance optimization, allows the parser not to create image-locations.
`static final int`
`OPTION_PARSE_INACTIVE_CODE`
Option for `getASTTranslationUnit(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, int, IParserLogService)` Instructs the parser to create ast nodes for inactive code branches, if possible.
`static final int`
`OPTION_SKIP_FUNCTION_BODIES`
Option for `getASTTranslationUnit(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, int, IParserLogService)` Instructs the parser to skip function and method bodies.
`static final int`
`OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS`
Option for `getASTTranslationUnit(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, int, IParserLogService)` Allows the parser not to create ast nodes for expressions within aggregate initializers when they do not contain names.

## Method Summary

Modifier and Type
Method
Description
`IContributedModelBuilder`
`createModelBuilder(ITranslationUnit tu)`
Used to override the default model building behavior for a translation unit.
`IASTTranslationUnit`
`getASTTranslationUnit(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory fileCreator, IIndex index, int options, IParserLogService log)`
Deprecated.
replaced by `getASTTranslationUnit(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, int, IParserLogService)`
`IASTTranslationUnit`
`getASTTranslationUnit(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory fileCreator, IIndex index, IParserLogService log)`
Deprecated.
replaced by `getASTTranslationUnit(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, int, IParserLogService)`
`IASTTranslationUnit`
`getASTTranslationUnit(FileContent content, IScannerInfo scanInfo, IncludeFileContentProvider fileCreator, IIndex index, int options, IParserLogService log)`
Constructs an AST for the source code provided by `reader`.
`IASTCompletionNode`
`getCompletionNode(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory fileCreator, IIndex index, IParserLogService log, int offset)`
Deprecated.
replaced by `getCompletionNode(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, IParserLogService, int)`.
`IASTCompletionNode`
`getCompletionNode(FileContent reader, IScannerInfo scanInfo, IncludeFileContentProvider fileCreator, IIndex index, IParserLogService log, int offset)`
Returns the AST completion node for the given offset.
`String`
`getId()`
Return the language id for this language.
`int`
`getLinkageID()`
Return the id of the linkage this language contributes to.
`String`
`getName()`
Returns the human readable name corresponding to this language, suitable for display.
`IASTName[]`
`getSelectedNames(IASTTranslationUnit ast, int start, int length)`
Deprecated.
replaced by `IASTTranslationUnit.getNodeSelector(String)`.

### Methods inherited from interface org.eclipse.core.runtime.IAdaptable

`getAdapter`

## Field Details

### OPTION_SKIP_FUNCTION_BODIES

static final int OPTION_SKIP_FUNCTION_BODIES
Option for `getASTTranslationUnit(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, int, IParserLogService)` Instructs the parser to skip function and method bodies.

See Also:
  - Constant Field Values

### OPTION_ADD_COMMENTS

@Deprecated static final int OPTION_ADD_COMMENTS
Deprecated.
Has no effect.

See Also:
  - Constant Field Values
Restriction:
  This field is not intended to be referenced by clients.

### OPTION_NO_IMAGE_LOCATIONS

static final int OPTION_NO_IMAGE_LOCATIONS
Option for `getASTTranslationUnit(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, int, IParserLogService)` Performance optimization, allows the parser not to create image-locations. When using this option `IASTName.getImageLocation()` will always return `null`.

See Also:
  - Constant Field Values

### OPTION_IS_SOURCE_UNIT

@Deprecated static final int OPTION_IS_SOURCE_UNIT
Deprecated.
Has no effect.

See Also:
  - Constant Field Values

### OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS

static final int OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS
Option for `getASTTranslationUnit(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, int, IParserLogService)` Allows the parser not to create ast nodes for expressions within aggregate initializers when they do not contain names.

Since:
  5.1
See Also:
  - Constant Field Values

### OPTION_PARSE_INACTIVE_CODE

static final int OPTION_PARSE_INACTIVE_CODE
Option for `getASTTranslationUnit(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, int, IParserLogService)` Instructs the parser to create ast nodes for inactive code branches, if possible. The parser makes its best effort to create ast for the inactive code branches but may decide to skip parts of the inactive code (e.g. function bodies, entire code branches, etc.).

The inactive nodes can be accessed via `IASTDeclarationListOwner.getDeclarations(boolean)` or by using a visitor with `ASTVisitor.includeInactiveNodes` set to `true`.

Since:
  5.1
See Also:
  - Constant Field Values

## Method Details

### getId

String getId()
Return the language id for this language. This is to differentiate languages from each other.

### getLinkageID

int getLinkageID()
Return the id of the linkage this language contributes to. This is especially important for languages that write to the index.

Since:
  5.0
See Also:
  - `ILinkage`

### getName

String getName()
Returns the human readable name corresponding to this language, suitable for display.

Since:
  4.0

### getASTTranslationUnit

IASTTranslationUnit getASTTranslationUnit(FileContent content, IScannerInfo scanInfo, IncludeFileContentProvider fileCreator, IIndex index, int options, IParserLogService log) throws org.eclipse.core.runtime.CoreException
Constructs an AST for the source code provided by `reader`.

Parameters:
  `content` - source code to be parsed.
  `scanInfo` - provides include paths and defined symbols.
  `fileCreator` - factory that provides file content for files included
  `index` - (optional) index to use to lookup symbols external to the translation unit.
  `options` - A combination of `OPTION_SKIP_FUNCTION_BODIES`, `OPTION_NO_IMAGE_LOCATIONS`, or `0`.
  `log` - logger
Returns:
  an AST for the source code provided by reader.
Throws:
  `org.eclipse.core.runtime.CoreException`
Since:
  5.2

### getCompletionNode

IASTCompletionNode getCompletionNode(FileContent reader, IScannerInfo scanInfo, IncludeFileContentProvider fileCreator, IIndex index, IParserLogService log, int offset) throws org.eclipse.core.runtime.CoreException
Returns the AST completion node for the given offset.

Throws:
  `org.eclipse.core.runtime.CoreException`
Since:
  5.2

### createModelBuilder

IContributedModelBuilder createModelBuilder(ITranslationUnit tu)
Used to override the default model building behavior for a translation unit.

Parameters:
  `tu` - the `ITranslationUnit` to be parsed (non-`null`)
Returns:
  an `IModelBuilder`, which parses the given translation unit and returns the `ICElement`s of its model, or `null` to parse using the default CDT model builder

### getSelectedNames

@Deprecated IASTName[] getSelectedNames(IASTTranslationUnit ast, int start, int length)
Deprecated.
replaced by `IASTTranslationUnit.getNodeSelector(String)`.

Restriction:
  This method is not intended to be referenced by clients.

### getASTTranslationUnit

@Deprecated IASTTranslationUnit getASTTranslationUnit(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory fileCreator, IIndex index, IParserLogService log) throws org.eclipse.core.runtime.CoreException
Deprecated.
replaced by `getASTTranslationUnit(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, int, IParserLogService)`

Throws:
  `org.eclipse.core.runtime.CoreException`
Restriction:
  This method is not intended to be referenced by clients.

### getASTTranslationUnit

@Deprecated IASTTranslationUnit getASTTranslationUnit(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory fileCreator, IIndex index, int options, IParserLogService log) throws org.eclipse.core.runtime.CoreException
Deprecated.
replaced by `getASTTranslationUnit(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, int, IParserLogService)`

Throws:
  `org.eclipse.core.runtime.CoreException`
Restriction:
  This method is not intended to be referenced by clients.

### getCompletionNode

@Deprecated IASTCompletionNode getCompletionNode(CodeReader reader, IScannerInfo scanInfo, ICodeReaderFactory fileCreator, IIndex index, IParserLogService log, int offset) throws org.eclipse.core.runtime.CoreException
Deprecated.
replaced by `getCompletionNode(FileContent, IScannerInfo, IncludeFileContentProvider, IIndex, IParserLogService, int)`.

Throws:
  `org.eclipse.core.runtime.CoreException`
Restriction:
  This method is not intended to be referenced by clients.