AjTalk.Compiler.VmCompiler.CompileBlock C# (CSharp) Method

CompileBlock() public method

public CompileBlock ( string text ) : Block
text string
return AjTalk.Language.Block
        public Block CompileBlock(string text)
        {
            ModelParser parser = new ModelParser(text);
            var expr = parser.ParseBlock();
            Block block = new Block(text);
            BytecodeCompiler compiler = new BytecodeCompiler(block);
            compiler.CompileExpression(expr);
            return block;
        }

Usage Example

Beispiel #1
0
        public void ResumeNewProcess()
        {
            AutoResetEvent handle = new AutoResetEvent(false);
            Machine machine = new Machine();
            VmCompiler compiler = new VmCompiler();
            machine.SetGlobalObject("handle", handle);
            Block block = compiler.CompileBlock("handle !Set");

            Process process = new Process(block, null, machine);
            machine.SetGlobalObject("process", process);

            compiler.CompileBlock("process resume").Execute(machine, null);

            if (!handle.WaitOne(500))
                Assert.Fail("Process didn't run");
        }
All Usage Examples Of AjTalk.Compiler.VmCompiler::CompileBlock