public CodeObject Allow; //判断条件 public TempCondition(Script script, CodeObject allow, ScriptExecutable executable, Executable_Block block) { m_Script = script; this.Allow = allow; this.Executable = executable; this.Block = block; }
public TempCondition(Script script, CodeObject allow, ScriptExecutable executable, Executable_Block block) { m_Script = script; this.Allow = allow; this.Executable = executable; this.Block = block; }
public List <object> Allow; //判断条件 public TempCase(Script script, List <object> allow, ScriptExecutable executable, Executable_Block block) { m_Script = script; this.Allow = allow; this.Executable = executable; this.Block = block; }
public TempCase(Script script, List<object> allow, ScriptExecutable executable, Executable_Block block) { m_Script = script; this.Allow = allow; this.Executable = executable; this.Block = block; }
//解析区域代码内容( {} 之间的内容) private ScriptExecutable ParseStatementBlock(Executable_Block block, bool readLeftBrace, TokenType finished) { BeginExecutable(block); if (readLeftBrace && PeekToken().Type != TokenType.LeftBrace) { ParseStatement(); if (PeekToken().Type == TokenType.SemiColon) { ReadToken(); } } else { if (readLeftBrace) { ReadLeftBrace(); } TokenType tokenType; while (HasMoreTokens()) { tokenType = ReadToken().Type; if (tokenType == finished) { break; } UndoToken(); ParseStatement(); } } ScriptExecutable ret = m_scriptExecutable; ret.EndScriptInstruction(); EndExecutable(); return(ret); }
private ScriptExecutable ParseStatementBlock(Executable_Block block, bool readLeftBrace, Scorpio.Compiler.TokenType finished) { this.BeginExecutable(block); if (readLeftBrace && (this.PeekToken().Type != Scorpio.Compiler.TokenType.LeftBrace)) { this.ParseStatement(); if (this.PeekToken().Type == Scorpio.Compiler.TokenType.SemiColon) { this.ReadToken(); } } else { if (readLeftBrace) { this.ReadLeftBrace(); } while (this.HasMoreTokens()) { if (this.ReadToken().Type == finished) { break; } this.UndoToken(); this.ParseStatement(); } } ScriptExecutable scriptExecutable = this.m_scriptExecutable; scriptExecutable.EndScriptInstruction(); this.EndExecutable(); return(scriptExecutable); }
public ScriptContext(Script script, ScriptExecutable scriptExecutable, ScriptContext parent, Executable_Block block) { m_script = script; m_parent = parent; m_scriptExecutable = scriptExecutable; m_variableDictionary.Clear(); m_block = block; m_InstructionCount = m_scriptExecutable != null ? m_scriptExecutable.Count : 0; }
public ScriptContext(Script script, ScriptExecutable scriptExecutable, ScriptContext parent, Executable_Block block) { m_script = script; m_parent = parent; m_block = block; m_variableDictionary = new Dictionary<String, ScriptObject>(); if (scriptExecutable != null) { m_scriptInstructions = scriptExecutable.ScriptInstructions; m_InstructionCount = m_scriptInstructions.Length; } }
public ScriptContext(Script script, ScriptExecutable scriptExecutable, ScriptContext parent, Executable_Block block) { m_script = script; m_parent = parent; m_block = block; m_variableDictionary = new Dictionary <String, ScriptObject>(); if (scriptExecutable != null) { m_scriptInstructions = scriptExecutable.ScriptInstructions; m_InstructionCount = m_scriptInstructions.Length; } }
//解析判断内容 private TempCondition ParseCondition(bool condition, Executable_Block block) { CodeObject con = null; if (condition) { ReadLeftParenthesis(); con = GetObject(); ReadRightParenthesis(); } return(new TempCondition(con, ParseStatementBlock(block), block)); }
private TempCondition ParseCondition(bool condition, Executable_Block block) { CodeObject allow = null; if (condition) { this.ReadLeftParenthesis(); allow = this.GetObject(); this.ReadRightParenthesis(); } return(new TempCondition(allow, this.ParseStatementBlock(block), block)); }
bool ProcessCondition(TempCondition con, Executable_Block block) { if (con == null) { return(false); } if (con.Allow != null) { object b = ResolveOperand(con.Allow).ObjectValue; if (b == null || b.Equals(false)) { return(false); } } con.Context.Initialize(this); con.Context.Execute(); return(true); }
bool ProcessCondition(TempCondition con, Executable_Block block) { if (con == null) { return(false); } if (con.Allow != null) { ScriptBoolean b = ResolveOperand(con.Allow) as ScriptBoolean; if (b == null) { throw new ExecutionException("if 条件必须是一个bool型"); } if (b.Value == false) { return(false); } } con.Context.Initialize(this); con.Context.Execute(); return(true); }
public ScriptExecutable Executable; //指令列表 #endregion Fields #region Constructors public TempCondition(Script script, CodeObject allow, ScriptExecutable executable, Executable_Block block) { this.Allow = allow; this.Executable = executable; this.Context = new ScriptContext(script, executable, null, block); }
//解析区域代码内容( {} 之间的内容) private ScriptExecutable ParseStatementBlock(Executable_Block block) { return ParseStatementBlock(block, true, TokenType.RightBrace); }
//解析区域代码内容( {} 之间的内容) private ScriptExecutable ParseStatementBlock(Executable_Block block, bool readLeftBrace, TokenType finished) { BeginExecutable(block); if (readLeftBrace && PeekToken().Type != TokenType.LeftBrace) { ParseStatement(); } else { if (readLeftBrace) ReadLeftBrace(); TokenType tokenType; while (HasMoreTokens()) { tokenType = ReadToken().Type; if (tokenType == finished) break; UndoToken(); ParseStatement(); } } ScriptExecutable ret = m_scriptExecutable; ret.EndScriptInstruction(); EndExecutable(); return ret; }
//解析判断内容 private TempCondition ParseCondition(bool condition, Executable_Block block) { CodeObject con = null; if (condition) { ReadLeftParenthesis(); con = GetObject(); ReadRightParenthesis(); } return new TempCondition(con, ParseStatementBlock(block), block); }
public void BeginExecutable(Executable_Block block) { m_scriptExecutable = new ScriptExecutable(block); m_Executables.Push(m_scriptExecutable); }
public ScriptExecutable(Executable_Block block) { m_Block = block; m_listScriptInstructions = new List<ScriptInstruction>(); }
private ScriptInstruction[] m_arrayScriptInstructions; //指令列表 public ScriptExecutable(Script script, Executable_Block block) { Script = script; Block = block; m_listScriptInstructions = new List <ScriptInstruction>(); }
public void BeginExecutable(Executable_Block block) { this.m_scriptExecutable = new ScriptExecutable(block); this.m_Executables.Push(this.m_scriptExecutable); }
bool ProcessCondition(TempCondition con, ScriptContext context, Executable_Block block) { if (con == null) return false; if (con.Allow != null) { object b = ResolveOperand(con.Allow).ObjectValue; if (b == null || b.Equals(false)) return false; } context.Initialize(this); context.Execute(); return true; }
public ScriptContext(Script script, ScriptExecutable scriptExecutable, Executable_Block block) : this(script, scriptExecutable, null, block) { }
private ScriptExecutable ParseStatementBlock(Executable_Block block) { return(this.ParseStatementBlock(block, true, Scorpio.Compiler.TokenType.RightBrace)); }
public ScriptContext Context; //指令执行 public TempCondition(Script script, CodeObject allow, ScriptExecutable executable, Executable_Block block) { this.Allow = allow; this.Executable = executable; this.Context = new ScriptContext(script, executable, null, block); }
//解析区域代码内容( {} 之间的内容) private ScriptExecutable ParseStatementBlock(Executable_Block block) { return(ParseStatementBlock(block, true, TokenType.RightBrace)); }
private List<ScriptInstruction> m_listScriptInstructions; //指令列表 #endregion Fields #region Constructors public ScriptExecutable(Script script, Executable_Block block) { Script = script; Block = block; m_listScriptInstructions = new List<ScriptInstruction>(); }
public ScriptExecutable Executable; //指令列表 #endregion Fields #region Constructors public TempCase(Script script, List<object> allow, ScriptExecutable executable, Executable_Block block) { this.Allow = allow; this.Executable = executable; this.Context = new ScriptContext(script, executable, null, block); }
public ScriptExecutable(Executable_Block block) { m_Block = block; m_listScriptInstructions = new List <ScriptInstruction>(); }
public ScriptContext Context; //指令执行 public TempCase(Script script, List <object> allow, ScriptExecutable executable, Executable_Block block) { this.Allow = allow; this.Executable = executable; this.Context = new ScriptContext(script, executable, null, block); }