コード例 #1
0
 public TempCondition(Script script, CodeObject allow, ScriptExecutable executable, Executable_Block block)
 {
     m_Script = script;
     this.Allow = allow;
     this.Executable = executable;
     this.Block = block;
 }
コード例 #2
0
ファイル: CodeMember.cs プロジェクト: xgrommx/Scorpio-CSharp
 public CodeMember(string name, CodeObject parent)
 {
     this.Parent       = parent;
     this.MemberString = name;
     this.Type         = MEMBER_TYPE.STRING;
 }
コード例 #3
0
 public TableVariable(object key, CodeObject value) {
     this.key = key;
     this.value = value;
 }
コード例 #4
0
 public ScriptInstruction(Opcode opcode, CodeObject operand0, CodeObject operand1)
 {
     Opcode = opcode;
     Operand0 = operand0;
     Operand1 = operand1;
 }
コード例 #5
0
        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);
        }
コード例 #6
0
 private ScriptObject ResolveOperand_impl(CodeObject value)
 {
     if (value is CodeScriptObject) {
         return ParseScriptObject((CodeScriptObject)value);
     } else if (value is CodeRegion) {
         return ParseRegion((CodeRegion)value);
     } else if (value is CodeFunction) {
         return ParseFunction((CodeFunction)value);
     } else if (value is CodeCallFunction) {
         return ParseCall((CodeCallFunction)value, true);
     } else if (value is CodeMember) {
         return GetVariable((CodeMember)value);
     } else if (value is CodeArray) {
         return ParseArray((CodeArray)value);
     } else if (value is CodeTable) {
         return ParseTable((CodeTable)value);
     } else if (value is CodeOperator) {
         return ParseOperate((CodeOperator)value);
     } else if (value is CodeTernary) {
         return ParseTernary((CodeTernary)value);
     } else if (value is CodeAssign) {
         return ParseAssign((CodeAssign)value);
     } else if (value is CodeEval) {
         return ParseEval((CodeEval)value);
     }
     return m_script.Null;
 }
コード例 #7
0
 private void InvokeContinue(CodeObject con)
 {
     m_Continue = true;
     if (!SupportContinue()) {
         if (m_parent == null)
             throw new ExecutionException(m_script, "当前模块不支持continue语法");
         m_parent.InvokeContinue(con);
     }
 }
コード例 #8
0
 //返回变量数据
 private CodeObject GetVariable(CodeObject parent)
 {
     CodeObject ret = parent;
     for ( ; ; ) {
         Token m = ReadToken();
         if (m.Type == TokenType.Period) {
             ret = new CodeMember(ReadIdentifier(), ret);
         } else if (m.Type == TokenType.LeftBracket) {
             CodeObject member = GetObject();
             ReadRightBracket();
             if (member is CodeScriptObject) {
                 ScriptObject obj = ((CodeScriptObject)member).Object;
                 if (member.Not) {
                     ret = new CodeMember(!obj.LogicOperation(), ret);
                 } else if (member.Negative) {
                     ScriptNumber num = obj as ScriptNumber;
                     if (num == null) throw new ParserException("Script Object Type [" + obj.Type + "] is cannot use [-] sign", m);
                     ret = new CodeMember(num.Negative().KeyValue, ret);
                 } else {
                     ret = new CodeMember(obj.KeyValue, ret);
                 }
             } else {
                 ret = new CodeMember(member, ret);
             }
         } else if (m.Type == TokenType.LeftPar) {
             UndoToken();
             ret = GetFunction(ret);
         } else {
             UndoToken();
             break;
         }
         ret.StackInfo = new StackInfo(m_strBreviary, m.SourceLine);
     }
     return ret;
 }
コード例 #9
0
 public CodeMember(object value, CodeObject parent)
 {
     this.Parent      = parent;
     this.MemberValue = value;
     this.Type        = MEMBER_TYPE.VALUE;
 }
コード例 #10
0
 public CodeMember(CodeObject member, CodeObject parent)
 {
     this.MemberObject = member;
     this.Parent = parent;
     this.Type = MEMBER_TYPE.OBJECT;
 }
コード例 #11
0
 public CodeMember(object value, CodeObject parent)
 {
     this.Parent = parent;
     this.MemberValue = value;
     this.Type = MEMBER_TYPE.VALUE;
 }
コード例 #12
0
 public CodeCallFunction(CodeObject member, List<CodeObject> parameters) {
     this.Member = member;
     this.Parameters = parameters.ToArray();
     this.ParametersCount = parameters.Count;
 }
コード例 #13
0
ファイル: CodeRegion.cs プロジェクト: bobbyzhu/Scorpio-CSharp
 public CodeObject Context;            //变量
 public CodeRegion(CodeObject Context)
 {
     this.Context = Context;
 }
コード例 #14
0
 public TokenType Operator;          //符号类型
 public CodeOperator(CodeObject Right, CodeObject Left, TokenType type, string breviary, int line) : base(breviary, line)
 {
     this.Left = Left;
     this.Right = Right;
     this.Operator = type;
 }
コード例 #15
0
ファイル: CodeMember.cs プロジェクト: xgrommx/Scorpio-CSharp
 public CodeMember(CodeObject member, CodeObject parent)
 {
     this.MemberObject = member;
     this.Parent       = parent;
     this.Type         = MEMBER_TYPE.OBJECT;
 }
コード例 #16
0
 //解析单纯for循环
 private void ParseFor_Simple(string Identifier, CodeObject obj)
 {
     CodeForSimple ret = new CodeForSimple();
     ret.Identifier = Identifier;
     ret.Begin = obj;
     ret.Finished = GetObject();
     if (PeekToken().Type == TokenType.Comma)
     {
         ReadToken();
         ret.Step = GetObject();
     }
     ReadRightParenthesis();
     ret.BlockExecutable = ParseStatementBlock(Executable_Block.For);
     m_scriptExecutable.AddScriptInstruction(new ScriptInstruction(Opcode.CALL_FORSIMPLE, ret));
 }
コード例 #17
0
 //返回变量数据
 private CodeObject GetVariable(CodeObject parent)
 {
     CodeObject ret = parent;
     for ( ; ; ) {
         Token m = ReadToken();
         if (m.Type == TokenType.Period) {
             string identifier = ReadIdentifier();
             ret = new CodeMember(identifier, ret);
         } else if (m.Type == TokenType.LeftBracket) {
             CodeObject member = GetObject();
             ReadRightBracket();
             if (member is CodeScriptObject) {
                 ScriptObject obj = ((CodeScriptObject)member).Object;
                 if (obj is ScriptNumber || obj is ScriptString)
                     ret = new CodeMember(obj.ObjectValue, ret);
                 else
                     throw new ParserException("获取变量只能是 number或string", m);
             } else {
                  ret = new CodeMember(member, ret);
             }
         } else if (m.Type == TokenType.LeftPar) {
             UndoToken();
             ret = GetFunction(ret);
         } else {
             UndoToken();
             break;
         }
         ret.StackInfo = new StackInfo(m_strBreviary, m.SourceLine);
     }
     return ret;
 }
コード例 #18
0
 //返回一个调用函数 Object
 private CodeCallFunction GetFunction(CodeObject member)
 {
     ReadLeftParenthesis();
     List<CodeObject> pars = new List<CodeObject>();
     Token token = PeekToken();
     while (token.Type != TokenType.RightPar)
     {
         pars.Add(GetObject());
         token = PeekToken();
         if (token.Type == TokenType.Comma)
             ReadComma();
         else if (token.Type == TokenType.RightPar)
             break;
         else
             throw new ParserException("Comma ',' or right parenthesis ')' expected in function declararion.", token);
     }
     ReadRightParenthesis();
     return new CodeCallFunction(member, pars);
 }
コード例 #19
0
 public CodeCallFunction(CodeObject member, List <CodeObject> parameters)
 {
     this.Member          = member;
     this.Parameters      = parameters.ToArray();
     this.ParametersCount = parameters.Count;
 }
コード例 #20
0
 private void InvokeBreak(CodeObject bre)
 {
     m_Break = true;
     if (!SupportBreak()) {
         if (m_parent == null)
             throw new ExecutionException(m_script, "当前模块不支持break语法");
         m_parent.InvokeBreak(bre);
     }
 }
コード例 #21
0
 public TableVariable(object key, CodeObject value)
 {
     this.key   = key;
     this.value = value;
 }
コード例 #22
0
 ScriptObject ResolveOperand(CodeObject value)
 {
     m_script.SetStackInfo(value.StackInfo);
     ScriptObject ret = ResolveOperand_impl(value);
     if (value.Not) {
         ret = m_script.CreateBool(!ret.LogicOperation());
     }  else if (value.Negative) {
         ScriptNumber b = ret as ScriptNumber;
         if (b == null) throw new ExecutionException(m_script, "Script Object Type [" + ret.Type + "] is cannot use [-] sign");
         ret = b.Negative();
     }
     return ret;
 }
コード例 #23
0
ファイル: CodeOperator.cs プロジェクト: zhoyq/Scorpio-CSharp
 public TokenType Operator;          //符号类型
 public CodeOperator(CodeObject Right, CodeObject Left, TokenType type, string breviary, int line) : base(breviary, line)
 {
     this.Left     = Left;
     this.Right    = Right;
     this.Operator = type;
 }
コード例 #24
0
 public ScriptInstruction(Opcode opcode, CodeObject operand0)
     : this(opcode, operand0, null)
 {
 }
コード例 #25
0
 public CodeAssign(CodeMember member, CodeObject value, TokenType assignType, string breviary, int line) : base(breviary, line)
 {
     this.member     = member;
     this.value      = value;
     this.AssignType = assignType;
 }
コード例 #26
0
 public CodeAssign(CodeMember member, CodeObject value, TokenType assignType, string breviary, int line) : base(breviary, line)
 {
     this.member = member;
     this.value = value;
     this.AssignType = assignType;
 }
コード例 #27
0
        public CodeObject Context; //变量

        #endregion Fields

        #region Constructors

        public CodeRegion(CodeObject Context)
        {
            this.Context = Context;
        }