Interface ILanguageProvider
Provides access to language-specific functionality.
public interface ILanguageProvider
- Extension Methods
Properties
ASTBuilder
CodeBuilder ASTBuilder { get; }
Property Value
FileExtension
Default file extension (without leading dot) for source files for current language.
string FileExtension { get; }
Property Value
FullNameComparer
Gets composite identifier comparer (e.g. namespace of full type name).
IComparer<IEnumerable<CodeIdentifier>> FullNameComparer { get; }
Property Value
FullNameEqualityComparer
Gets composite identifier equality comparer (e.g. namespace of full type name).
IEqualityComparer<IEnumerable<CodeIdentifier>> FullNameEqualityComparer { get; }
Property Value
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
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
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
TypeEqualityComparerWithNRT
Gets IType equality comparer to compare types with taking into account NRT annotations on types.
IEqualityComparer<IType> TypeEqualityComparerWithNRT { get; }
Property Value
TypeEqualityComparerWithoutNRT
Gets IType equality comparer to compare types without taking into account NRT annotations on types.
IEqualityComparer<IType> TypeEqualityComparerWithoutNRT { get; }
Property Value
TypeParser
Type and namespace parser service.
ITypeParser TypeParser { get; }
Property Value
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
ITypeType 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
stringNewline character sequence.
indent
stringSingle indent unit character sequence.
useNRT
boolIndicates 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
stringCharacter to validate.
category
UnicodeCategoryCharacter 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
stringCharacter to validate.
category
UnicodeCategoryCharacter unicode category.
Returns
- bool
true
if character is valid at non-starting position in identifier.