Table of Contents

Interface ILanguageProvider

Namespace
LinqToDB.CodeModel
Assembly
linq2db.Tools.dll

Provides access to language-specific functionality.

public interface ILanguageProvider
Extension Methods

Properties

ASTBuilder

CodeBuilder ASTBuilder { get; }

Property Value

CodeBuilder

FileExtension

Default file extension (without leading dot) for source files for current language.

string FileExtension { get; }

Property Value

string

FullNameComparer

Gets composite identifier comparer (e.g. namespace of full type name).

IComparer<IEnumerable<CodeIdentifier>> FullNameComparer { get; }

Property Value

IComparer<IEnumerable<CodeIdentifier>>

FullNameEqualityComparer

Gets composite identifier equality comparer (e.g. namespace of full type name).

IEqualityComparer<IEnumerable<CodeIdentifier>> FullNameEqualityComparer { get; }

Property Value

IEqualityComparer<IEnumerable<CodeIdentifier>>

IdentifierEqualityComparer

Gets identifier equality comparer for current language. E.g. C# and F# use case-sensitive identifiers, but VB.NET works with case-insensitive identifiers.

IEqualityComparer<CodeIdentifier> IdentifierEqualityComparer { get; }

Property Value

IEqualityComparer<CodeIdentifier>

MissingXmlCommentWarnCodes

Warning codes for missing XML-doc comments warnings (if supported by language).

string[] MissingXmlCommentWarnCodes { get; }

Property Value

string[]

NRTSupported

Indicate that language supports nullable reference types annotations.

bool NRTSupported { get; }

Property Value

bool

RawIdentifierEqualityComparer

Gets identifier equality comparer for current language. E.g. C# and F# use case-sensitive identifiers, but VB.NET works with case-insensitive identifiers.

IEqualityComparer<string> RawIdentifierEqualityComparer { get; }

Property Value

IEqualityComparer<string>

TypeEqualityComparerWithNRT

Gets IType equality comparer to compare types with taking into account NRT annotations on types.

IEqualityComparer<IType> TypeEqualityComparerWithNRT { get; }

Property Value

IEqualityComparer<IType>

TypeEqualityComparerWithoutNRT

Gets IType equality comparer to compare types without taking into account NRT annotations on types.

IEqualityComparer<IType> TypeEqualityComparerWithoutNRT { get; }

Property Value

IEqualityComparer<IType>

TypeParser

Type and namespace parser service.

ITypeParser TypeParser { get; }

Property Value

ITypeParser

Methods

GetAlias(IType)

Returns language-specific type alias (if any) for provided type. For nullable type returns alias without nullability annotations.

string? GetAlias(IType type)

Parameters

type IType

Type to check for alias. Could be nullable type.

Returns

string

Type alias if provided type has it.

GetCodeGenerator(string, string, bool, IReadOnlyDictionary<CodeIdentifier, ISet<IEnumerable<CodeIdentifier>>>, IReadOnlyDictionary<IEnumerable<CodeIdentifier>, ISet<CodeIdentifier>>, IReadOnlyDictionary<IEnumerable<CodeIdentifier>, ISet<CodeIdentifier>>)

Returns visitor that could generate code using target language.

CodeGenerationVisitor GetCodeGenerator(string newLine, string indent, bool useNRT, IReadOnlyDictionary<CodeIdentifier, ISet<IEnumerable<CodeIdentifier>>> knownTypes, IReadOnlyDictionary<IEnumerable<CodeIdentifier>, ISet<CodeIdentifier>> scopedNames, IReadOnlyDictionary<IEnumerable<CodeIdentifier>, ISet<CodeIdentifier>> scopedTypes)

Parameters

newLine string

Newline character sequence.

indent string

Single indent unit character sequence.

useNRT bool

Indicates wether NRT annotations should be emmited by code generator.

knownTypes IReadOnlyDictionary<CodeIdentifier, ISet<IEnumerable<CodeIdentifier>>>

Information about namespaces, that include types with specific name.

scopedNames IReadOnlyDictionary<IEnumerable<CodeIdentifier>, ISet<CodeIdentifier>>

Information about names (type name, namespace or type member) in specific naming scopes.

scopedTypes IReadOnlyDictionary<IEnumerable<CodeIdentifier>, ISet<CodeIdentifier>>

Information about type names (type name and namespace) in specific naming scopes.

Returns

CodeGenerationVisitor

Visitor instance.

GetIdentifiersNormalizer()

Returns visitor that could be used to fix identifiers in code model.

CodeModelVisitor GetIdentifiersNormalizer()

Returns

CodeModelVisitor

Identifers normalization visitor instance.

IsValidIdentifierFirstChar(string, UnicodeCategory)

Verify that provided character could start indentifier name for current language.

bool IsValidIdentifierFirstChar(string character, UnicodeCategory category)

Parameters

character string

Character to validate.

category UnicodeCategory

Character unicode category.

Returns

bool

true if character is valid at starting position in identifier.

IsValidIdentifierNonFirstChar(string, UnicodeCategory)

Verify that provided character could be used in indentifier name at non-first position for current language.

bool IsValidIdentifierNonFirstChar(string character, UnicodeCategory category)

Parameters

character string

Character to validate.

category UnicodeCategory

Character unicode category.

Returns

bool

true if character is valid at non-starting position in identifier.