Class MuLangCompiler
Compiles MuLang source code into runtime-independent portable IR.
public static class MuLangCompiler
- Inheritance
-
MuLangCompiler
- Inherited Members
Methods
Analyze(string, EnvironmentSchema, CompilationMode, MuLangCompilationOptions?)
Analyzes MuLang source code using the specified compilation options without producing portable IR.
public static AnalysisResult Analyze(string source, EnvironmentSchema environment, CompilationMode compilationMode, MuLangCompilationOptions? options = null)
Parameters
sourcestringThe MuLang source code.
environmentEnvironmentSchemaThe environment schema available to the analyzed code.
compilationModeCompilationModeThe compilation mode.
optionsMuLangCompilationOptionsThe analysis options, or
nullto use Default.
Returns
- AnalysisResult
The analysis result.
Exceptions
- ArgumentNullException
Thrown when
sourceorenvironmentisnull.- ArgumentException
Thrown when the source document URI is not absolute, or the result type or language version is incompatible with the analysis settings.
- ArgumentOutOfRangeException
Thrown when
compilationModeis not defined.
Analyze(string, EnvironmentSchema, CompilationMode, TypeSymbol?, LanguageProfile?)
Analyzes MuLang source code using the specified compilation settings without producing portable IR.
[Obsolete("Use Analyze(string, EnvironmentSchema, CompilationMode, MuLangCompilationOptions) instead.")]
public static AnalysisResult Analyze(string source, EnvironmentSchema environment, CompilationMode compilationMode, TypeSymbol? expectedResultType = null, LanguageProfile? profile = null)
Parameters
sourcestringThe MuLang source code.
environmentEnvironmentSchemaThe environment schema available to the analyzed code.
compilationModeCompilationModeThe compilation mode.
expectedResultTypeTypeSymbolThe expected result type, or
nullto infer an expression result or usevoidfor a program.profileLanguageProfileThe language profile, or
nullto use Latest.
Returns
- AnalysisResult
The analysis result.
Exceptions
- ArgumentNullException
Thrown when
sourceorenvironmentisnull.- ArgumentOutOfRangeException
Thrown when
compilationModeis not defined.- ArgumentException
Thrown when the result type or language version is incompatible with the analysis settings.
Classify(string, LanguageProfile?)
Classifies MuLang source text using the specified language profile.
public static ClassificationResult Classify(string source, LanguageProfile? profile = null)
Parameters
sourcestringThe MuLang source code.
profileLanguageProfileThe language profile, or
nullto use Latest.
Returns
- ClassificationResult
The lexical classification result.
Exceptions
- ArgumentNullException
Thrown when
sourceisnull.
ClassifySemantically(string, EnvironmentSchema, CompilationMode, TypeSymbol?, LanguageProfile?)
Classifies MuLang identifiers using binding information from the specified compilation settings.
public static SemanticClassificationResult ClassifySemantically(string source, EnvironmentSchema environment, CompilationMode compilationMode, TypeSymbol? expectedResultType = null, LanguageProfile? profile = null)
Parameters
sourcestringThe MuLang source code.
environmentEnvironmentSchemaThe environment schema available to the classified code.
compilationModeCompilationModeThe compilation mode.
expectedResultTypeTypeSymbolThe expected result type, or
nullto infer an expression result or usevoidfor a program.profileLanguageProfileThe language profile, or
nullto use Latest.
Returns
- SemanticClassificationResult
The semantic classification result.
Exceptions
- ArgumentNullException
Thrown when
sourceorenvironmentisnull.- ArgumentOutOfRangeException
Thrown when
compilationModeis not defined.- ArgumentException
Thrown when the result type or language version is incompatible with the classification settings.
Compile(string, EnvironmentSchema, CompilationMode, MuLangCompilationOptions?)
Compiles MuLang source code using the specified compilation options.
public static CompilationResult Compile(string source, EnvironmentSchema environment, CompilationMode compilationMode, MuLangCompilationOptions? options = null)
Parameters
sourcestringThe MuLang source code.
environmentEnvironmentSchemaThe environment schema available to the compiled code.
compilationModeCompilationModeThe compilation mode.
optionsMuLangCompilationOptionsThe compilation options, or
nullto use Default.
Returns
- CompilationResult
The compilation result.
Exceptions
- ArgumentNullException
Thrown when
sourceorenvironmentisnull.- ArgumentException
Thrown when the source document URI is not absolute, or the result type or language version is incompatible with the compilation settings.
- ArgumentOutOfRangeException
Thrown when
compilationModeis not defined.
Compile(string, EnvironmentSchema, CompilationMode, TypeSymbol?, LanguageProfile?)
Compiles MuLang source code using the specified compilation settings.
[Obsolete("Use Compile(string, EnvironmentSchema, CompilationMode, MuLangCompilationOptions) instead.")]
public static CompilationResult Compile(string source, EnvironmentSchema environment, CompilationMode compilationMode, TypeSymbol? expectedResultType = null, LanguageProfile? profile = null)
Parameters
sourcestringThe MuLang source code.
environmentEnvironmentSchemaThe environment schema available to the compiled code.
compilationModeCompilationModeThe compilation mode.
expectedResultTypeTypeSymbolThe expected result type, or
nullto infer an expression result or usevoidfor a program.profileLanguageProfileThe language profile, or
nullto use Latest.
Returns
- CompilationResult
The compilation result.
Exceptions
- ArgumentNullException
Thrown when
sourceorenvironmentisnull.- ArgumentOutOfRangeException
Thrown when
compilationModeis not defined.- ArgumentException
Thrown when the result type or language version is incompatible with the compilation settings.
GetHover(string, EnvironmentSchema, CompilationMode, int, MuLangCompilationOptions?)
Gets semantic hover information at a Unicode scalar offset.
public static HoverInfo? GetHover(string source, EnvironmentSchema environment, CompilationMode compilationMode, int offset, MuLangCompilationOptions? options = null)
Parameters
sourcestringThe MuLang source code.
environmentEnvironmentSchemaThe environment schema available to the source code.
compilationModeCompilationModeThe compilation mode.
offsetintThe zero-based Unicode scalar offset.
optionsMuLangCompilationOptionsThe analysis options, or
nullto use Default.
Returns
- HoverInfo
The hover information, or
nullwhen no resolved symbol covers the offset.
Exceptions
- ArgumentNullException
Thrown when
sourceorenvironmentisnull.- ArgumentOutOfRangeException
Thrown when the offset is outside the source or the compilation mode is not defined.
- ArgumentException
Thrown when the source document URI, result type, or language version is incompatible with the analysis settings.
GetSemanticDocument(string, EnvironmentSchema, CompilationMode, MuLangCompilationOptions?)
Gets the resolved semantic model for MuLang source code.
public static SemanticDocumentResult GetSemanticDocument(string source, EnvironmentSchema environment, CompilationMode compilationMode, MuLangCompilationOptions? options = null)
Parameters
sourcestringThe MuLang source code.
environmentEnvironmentSchemaThe environment schema available to the source code.
compilationModeCompilationModeThe compilation mode.
optionsMuLangCompilationOptionsThe analysis options, or
nullto use Default.
Returns
- SemanticDocumentResult
The resolved semantic document.
Exceptions
- ArgumentNullException
Thrown when
sourceorenvironmentisnull.- ArgumentException
Thrown when the source document URI, result type, or language version is incompatible with the analysis settings.
- ArgumentOutOfRangeException
Thrown when
compilationModeis not defined.