C# Класс NGettext.PluralCompile.Compiler.PluralRuleCompiler

Compiler that compiles a plural rule abstract syntax tree into a managed dynamic method delegate using an IL code generator.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
CompileToDynamicMethod ( Token astRoot, Type outputDelegateType ) : Delegate

Compiles a plural rule abstract syntax tree into managed dynamic method delegate using an IL code generator.

Защищенные методы

Метод Описание
CompileFinish ( ILGenerator il ) : void

Emits instructions required for compilation stop procedure.

CompileNode ( ILGenerator il, Token node ) : void

Recursively compiles an AST node to the IL instructions.

CompileStart ( ILGenerator il ) : void

Emits instructions required for compilation start procedure.

CreateDynamicMethod ( Type outputDelegateType ) : DynamicMethod

Creates a new DynamicMethod instance with signature of given delegate type.

EmitConditionalBranch ( ILGenerator il, OpCode conditionOpCode, Token trueNode, Token falseNode ) : void

Emits instructions required for conditional branch using given OpCode to check condition and given nodes for positive and negative branches.

EmitConditionalValue ( ILGenerator il, OpCode conditionOpCode, long trueValue = 1, long falseValue ) : void

Emits instructions required for creating a value on the stack based on specified condition operation result.

We can not use simplified OpCodes.Clt, OpCodes.Cgt and similar instructions because we use an Int64 as an argument value.

Описание методов

CompileFinish() защищенный Метод

Emits instructions required for compilation stop procedure.
protected CompileFinish ( ILGenerator il ) : void
il System.Reflection.Emit.ILGenerator IL generator instance.
Результат void

CompileNode() защищенный Метод

Recursively compiles an AST node to the IL instructions.
protected CompileNode ( ILGenerator il, Token node ) : void
il System.Reflection.Emit.ILGenerator IL generator instance.
node NGettext.Plural.Ast.Token AST node.
Результат void

CompileStart() защищенный Метод

Emits instructions required for compilation start procedure.
protected CompileStart ( ILGenerator il ) : void
il System.Reflection.Emit.ILGenerator IL generator instance.
Результат void

CompileToDynamicMethod() публичный Метод

Compiles a plural rule abstract syntax tree into managed dynamic method delegate using an IL code generator.
public CompileToDynamicMethod ( Token astRoot, Type outputDelegateType ) : Delegate
astRoot NGettext.Plural.Ast.Token abstract syntax tree root node.
outputDelegateType System.Type Type of output delegate.
Результат System.Delegate

CreateDynamicMethod() защищенный Метод

Creates a new DynamicMethod instance with signature of given delegate type.
protected CreateDynamicMethod ( Type outputDelegateType ) : DynamicMethod
outputDelegateType System.Type
Результат System.Reflection.Emit.DynamicMethod

EmitConditionalBranch() защищенный Метод

Emits instructions required for conditional branch using given OpCode to check condition and given nodes for positive and negative branches.
protected EmitConditionalBranch ( ILGenerator il, OpCode conditionOpCode, Token trueNode, Token falseNode ) : void
il System.Reflection.Emit.ILGenerator IL generator instance.
conditionOpCode System.Reflection.Emit.OpCode OpCode of the condition check operation.
trueNode NGettext.Plural.Ast.Token AST node that will be executed when condition returns positive result.
falseNode NGettext.Plural.Ast.Token AST node that will be executed when condition returns negative result.
Результат void

EmitConditionalValue() защищенный Метод

Emits instructions required for creating a value on the stack based on specified condition operation result.
We can not use simplified OpCodes.Clt, OpCodes.Cgt and similar instructions because we use an Int64 as an argument value.
protected EmitConditionalValue ( ILGenerator il, OpCode conditionOpCode, long trueValue = 1, long falseValue ) : void
il System.Reflection.Emit.ILGenerator IL generator instance.
conditionOpCode System.Reflection.Emit.OpCode OpCode of the condition check operation.
trueValue long A value that will be put on stack when condition returns positive result.
falseValue long A value that will be put on stack when condition returns negative result.
Результат void