AjTalk.Compiler.Parser.CompileKeywordExpression C# (CSharp) Méthode

CompileKeywordExpression() private méthode

private CompileKeywordExpression ( ) : void
Résultat void
        private void CompileKeywordExpression()
        {
            int initialposition = this.block.Bytecodes == null ? 0 : this.block.Bytecodes.Length;

            this.CompileBinaryExpression();

            int condposition = this.block.Bytecodes == null ? 0 : this.block.Bytecodes.Length;

            string mthname = string.Empty;
            Token token;

            token = this.NextToken();

            while (token != null && token.Type == TokenType.Name && token.Value.EndsWith(":"))
            {
                mthname += token.Value;
                this.CompileBinaryExpression();
                token = this.NextToken();
            }

            if (token != null)
                this.PushToken(token);

            if (mthname == "whileFalse:" || mthname == "whileTrue:")
            {
                this.block.CompileByteCode(ByteCode.Value);
                this.block.CompileByteCode(ByteCode.Pop);
                this.block.CompileJumpByteCode(ByteCode.Jump, (short)initialposition);
                this.block.CompileInsert(condposition, 4);
                int finalposition = this.block.Bytecodes.Length;
                this.block.CompileBlockJumpByteCodeAt(mthname == "whileFalse:" ? ByteCode.JumpIfTrue : ByteCode.JumpIfFalse, (short)finalposition, condposition);
            }
            else if (mthname == "ifFalse:" || mthname == "ifTrue:")
            {
                this.block.CompileByteCode(ByteCode.Value);
                this.block.CompileInsert(condposition, 7);
                this.block.CompileJumpByteCodeAt(mthname == "ifFalse:" ? ByteCode.JumpIfFalse : ByteCode.JumpIfTrue, (short)(condposition + 7), condposition);
                this.block.CompileByteCodeAt(ByteCode.GetNil, condposition + 3);
                int finalposition = this.block.Bytecodes.Length;
                this.block.CompileJumpByteCodeAt(ByteCode.Jump, (short)finalposition, condposition + 4);
            }
            else if (mthname != string.Empty)
                this.block.CompileSend(mthname);
        }