当前位置: 首页>>代码示例>>C#>>正文


C# ktList.Get_R方法代码示例

本文整理汇总了C#中KacTalk.ktList.Get_R方法的典型用法代码示例。如果您正苦于以下问题:C# ktList.Get_R方法的具体用法?C# ktList.Get_R怎么用?C# ktList.Get_R使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KacTalk.ktList的用法示例。


在下文中一共展示了ktList.Get_R方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleCompound

        protected ktValue HandleCompound(ktList Comp)
        {
            ktValue Value = ktValue.Null;
            //ktDebug.WrapLevel++;

            if (Comp == null)
            {
                return Value;
            }
#if Debug
	if (!ktDebug.Enabled) { ktDebug.D.Enable(); this.m_enabledDebug = true;  this.m_enabledAt = ktDebug.WrapLevel; }
	ktDebug.Log( "HCHCHCHCHCHCHCHCHHCHCHC:\n" + Comp.Get_R( ktDebug.GetPrefix(), true ) );
#endif

            ktToken SToken= null;
            ktToken First = null;
            ktToken Last = null;

            if ((Comp.Node != null) && (Comp.Node.Value != null))
            {
                SToken = (ktToken)(Comp.Node.Value);
            }
            if ((Comp.First != null) && (Comp.First.Node != null))
            {
                First = (ktToken)(Comp.First.Node.Value);
            }
            if ((Comp.Last != null) && (Comp.Last.Node != null))
            {
                Last = (ktToken)(Comp.Last.Node.Value);
            }

            if ((First == null) && (Last == null))
            {
                return Value;
            }

            ktDebug.Log("SEPV::" + First.Value + ";;" + Last.Value );
            if ((SToken != null) && (SToken.Value == "§"))
            {
#if Debug
                    ktDebug.Log("METHODCALL");
#endif
                

                ktClass Class = null;

                try
                {
                    Value = GetObjectFor(First);
                    if (Value.IsNull())
                    {
                        throw new Exception();
                    }
                    Class = (ktClass)Value.Value;
                }
                catch (Exception)
                {
#if Debug
                    ktDebug.Log("ID:" + Err.Message);
#endif
                    throw new ktError("Can't find the symbol '" + First.Value + "' on line " + First.LineNo.ToString() + " by character " + First.CharPos.ToString() + "!", ktERR._404);
                }

                First = (ktToken)Comp.First.Next.Node.Value;
                Last = (ktToken)Comp.Last.First.Node.Value;
                /*First = (ktToken)Comp.Last.First.Node.Value;
                Last = (ktToken)Comp.Last.Last.Node.Value;*/
                //ktDebug.Log(".." + First.Value + ";" + SToken.Value + "::\n" + Last.Value + "===----------====-===");

                Value = Class.RunMethod(First.Value,GetArguments(Comp.Last.Last));
            }
            else if ((First.Type == ktTokenType.CompStatement) && (First.Value == "."))
            {
#if Debug
	ktDebug.Log( "SEP::" + Comp.First.Get_R( ktDebug.GetPrefix() ) );
#endif
                Value = HandleCompound(Comp.First);
//                ktDebug.Log("SLU:" + Value.ToString() + ";");
                if (Value.Type == "ktFunction")
                {
                    ktDebug.Log("WTF???");
                    if ((Value.Value.GetType() == typeof(ktFunction)) ||
                        (Value.Value.GetType() == typeof(ktDelegateFunction)))
                    {
                        ktDebug.Log("WTF!!!_" + Value.ToString() + "!|!" + Value.Value.GetType().ToString());
                        ktFunction Func = (ktFunction)Value.Value;
                        Value = Func.Run(GetArguments(Comp.Last));
                    }
                    else
                    {
                        ktDebug.Log("WTF???_" + Value.ToString() + "!|!" + Value.Value.GetType().ToString());
                        ktClass Class = (ktClass)Value.Value;
                        Value = Class.RunMethod("run", GetArguments(Comp.Last));
                    }
                }
                else
                {
                    ktDebug.Log("HUM:" + Value.Type);
                    ktDebug.Log("HUM_T:" + Value.GetType() + ";" + Value.Value.GetType());
                    ktDebug.Log("HUM_T:" + Value.Value.GetStringType());
//.........这里部分代码省略.........
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:101,代码来源:ktBlock.cs

示例2: RunMethod

        public ktValue RunMethod(ktString Name, ktList Arguments)
        {
            if (Name.IsEmpty())
            {
                throw new ktError("Didn't get the name of the method to run in class '" +
                                m_Name + "'.", ktERR.NOTSET);
            }
            ktDebug.Log("RunM Arg:" + Arguments.Get_R());

            ktValue Value = ktValue.Null;
            //ktDebug.Log( "ktClass::RM( " + Name + " );" );
            try
            {
                Value = _RunMethod(Name, Arguments);
            }
            catch (Exception Err)
            {
                Value = (ktValue)Arguments.First.Node.Value;
                if (Name == "Export")
                {
                    return new ktValue("", "ktString", kacTalk.Main.MakeObjectOf("ktString", Export()), true, true);
                }
                else if (Name.AsLower() == "tostring")
                {
                    return new ktValue("", "ktString", kacTalk.Main.MakeObjectOf("ktString", ToString()), true, true);
                }
                else if (Name.AsLower() == "operator~")
                {
                    return new ktValue("", "ktString", kacTalk.Main.MakeObjectOf("ktString", ToString() + Value.ToString()), true, true);
                }
                else if (Name.AsLower().StartsWith("to", out Name))
                {
                }

                throw Err;
            }

            return Value;
        }
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:39,代码来源:ktClass.cs

示例3: HandleCompAssignment

        protected ktValue HandleCompAssignment(ktList Target, ktValue Value)
        {
            bool Constant = false, Hard = false;
            ktString Name = new ktString(), ClassName = null;
            ktToken Token = null;
            ktClass Class = null;
#if Debug
	ktDebug.Log( "HCAHCAHCAHCAHCAHCAHCAHCAHCAHCAHCAHCAHCAHCA" );
#endif
            ktDebug.Log("HCA: V:" + Value.Export() + "\n" + Target.Get_R());
            Target.Reset();
            foreach (ktList L in Target)
            {
                if ((L.Node == null) || (L.Node.Value == null))
                {
                    continue;
                }

                Token = (ktToken)L.Node.Value;
#if Debug
	ktDebug.Log( "HCA:" + Token.ToString() );
#endif

                switch (Token.Type)
                {
                    case ktTokenType.Const:
                        {
                            if (Constant)
                            {
                                throw new ktError("Unexpected " + Token.ToString() + " on line " +
                                                      Token.LineNo.ToString() + " by character " +
                                                      Token.CharPos.ToString() + "!",
                                                  ktERR.UNEXP);
                            }

                            Constant = true;
                            break;
                        }
                    case ktTokenType.Hard:
                        {
                            if (Hard)
                            {
                                throw new ktError("Unexpected " + Token.ToString() + " on line " +
                                                      Token.LineNo.ToString() + " by character " +
                                                      Token.CharPos.ToString() + "!",
                                                  ktERR.UNEXP);
                            }

                            Hard = true;
                            break;
                        }
                    case ktTokenType.Id:
                        {
                            if (!Name.IsEmpty())
                            {
                                try
                                {
                                    Class = GetClass(Name);
                                    ClassName = Name;
                                    Hard = true;
                                } catch (Exception) {
                                    throw new ktError("Unexpected " + Token.ToString() + " (" +
                                                          Token.Value + ") on line " +
                                                          Token.LineNo.ToString() + " by character " +
                                                          Token.CharPos.ToString() + "!",
                                                      ktERR.UNEXP);
                                }
                            }

                            Name = Token.Value;
                            break;
                        }
                }
            }

            Value.Constant = Constant;
            Value.HardType = Hard;
            if (!Value.IsNull())
            {
                ((ktClass)Value.Value).HardType = Hard;
                ((ktClass)Value.Value).IsConstant = Constant;
            }

            if (Class != null)
            {
                ktList Arg = new ktList();
                ktClass Obj = Class.CreateObject();
                Obj.HardType = Hard;
                Obj.IsConstant = Constant;

                if (!Value.IsNull())
                {
                    Arg.Add(Value);
                    Obj.RunMethod("Assign", Arg);
                }

                Value = new ktValue(Name, ClassName, Obj, Hard, Constant); 
            }

            SetVariable(Name, true, Value, true, true);
//.........这里部分代码省略.........
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:101,代码来源:ktBlock.cs

示例4: GetArguments

        public ktList GetArguments(ktList Arguments)
        {
            ktList Args = null;
            ktToken Token = null;

#if Debug
	ktDebug.Log( "GAGAGAGAGAGA:" + Arguments.Get_R( "\t", true ) );
#endif
            if (Arguments == null)
            {
                return null;
            }
            else if ((Arguments.Node != null) && (Arguments.Node.Value != null) &&
                      ((Token = (ktToken)(Arguments.Node.Value)).Type == ktTokenType.CompStatement))
            {
                Args = new ktList();

                Args.Add(HandleCompound(Arguments).CopyValue());

                return Args;
            }
            else if (((Arguments.First != null) && (Arguments.First.Node != null) &&
                       (Arguments.First.Node.Value != null) &&
                       ((Token = (ktToken)(Arguments.First.Node.Value)).Type == ktTokenType.CompStatement)
                      ) || ((Arguments.Node != null) && (Arguments.Node.Value != null) &&
                       ((Token = (ktToken)(Arguments.Node.Value)).Type == ktTokenType.CompStatement)
                      )
                    )
            {
#if Debug
	ktDebug.Log( "GACSGACSGACSGACSGACSGACS:" + Arguments.Get_R() );
#endif
                ktList Stat = new ktList();
                Stat.Node = new ktNode("ktStatement", new ktToken(ktTokenType.Statement, "ktStatement",
                                            Token.LineNo, Token.CharPos));

                Args = new ktList();
                Args.Node = new ktNode("ktList", new ktToken(ktTokenType.List, "ktList", Token.LineNo,
                                            Token.CharPos));
                Args.AddList(Stat);
                Stat.AddList(Arguments);

                return GetArguments(Args);
            }
#if Debug
	ktDebug.Log( "gQAGAGAGAGAGAGAGGAgA::::" + Arguments.Get_R( "\t", true )  );
#endif

            if (Arguments.GetCount() == 0)
            {
                if (Arguments.Node == null)
                {
                    return null;
                }

                Token = (ktToken)Arguments.Node.Value;
                //ktDebug.Log( "GAGA111:" + Token.Name );
                Args = new ktList();

                if (Token.Type == ktTokenType.RunStatement)
                {
                    Args.Add(TokenToValue(Token, null));
                }
                else
                {
                    Args.Add(TokenToValue(Token, null).CopyValue());
                }

            }
            else
            {
                ktValue Value = null;

                Arguments.Reset();
                foreach (ktList L in Arguments)
                {
                    if ((L.Node == null) || (L.Node.Value == null))
                    {
                        continue;
                    }

                    if (Args == null)
                    {
                        Args = new ktList();
                    }

                    Token = (ktToken)L.Node.Value;

                    if (Token.Type == ktTokenType.RunStatement)
                    {
                        Value = TokenToValue(Token, L);
                    }
                    else
                    {
                        Value = TokenToValue(Token, L).CopyValue();
                    }

                    if (Value != null)
                    {
                        Args.Add(Value);
//.........这里部分代码省略.........
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:101,代码来源:ktBlock.cs

示例5: HandleNew

        protected ktValue HandleNew(ktList Statement)
        {
            ktValue NewValue = ktValue.Null;
            ktClass NewObj = null;

#if Debug
	ktDebug.Log( "HandleNew:" + Statement.Get_R() );
#endif

            if ((Statement == null) || (Statement.GetCount() == 0) ||
                (Statement.First == null) || (Statement.First.Node == null) ||
                (Statement.First.Node.Value == null) ||
                ((Statement.First.First != null) && (
                        (Statement.First.First.Node == null) || (Statement.First.First.Node.Value == null)))
               )
            {
                throw new ktError("ktBlock::HandleNew: Didn't get enough information to create a new object!", ktERR.MISSING);
            }

            ktToken Token = (ktToken)Statement.First.Node.Value;
            ktString Name = new ktString();
            ktList Arguments = null;

            if (Token.Type == ktTokenType.Id)
            {
                Name = Token.Value;
            }
            else if ((Token.Type == ktTokenType.CompStatement) ||
                      (Token.Type == ktTokenType.Statement))
            {
                Token = (ktToken)Statement.First.First.Node.Value;
                Name = Token.Value;

                Arguments = GetArguments(Statement.First.Last);
            }

            NewObj = (ktClass)MakeObjectOf(Name, (object)null);

            if (Arguments != null)
            {
                ktDebug.Log("NO: " + NewObj.Export() + ";;Args:" + Arguments.Get_R());
                try
                {
                    NewObj.RunMethod("constructor", Arguments);
                }
                catch (ktError Err)
                {
                    ktDebug.Log("NEW_CONS:ERR:" + Err.ToString());
                    if (Err.ErrorNumber == ktERR.NOTFOUND)
                    {
                        throw new ktError("The class " + Name + " is missing an constructor!", ktERR.NOTFOUND);
                    }
                    else
                    {
                        throw Err;
                    }
                }
            }

            NewValue = new ktValue("", Name, NewObj, false, false);
            ktDebug.Log("NV: " + NewValue.ToString());
            return NewValue;
        }
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:63,代码来源:ktBlock.cs

示例6: HandleOperator

        protected ktValue HandleOperator(ktList OpTree)
        {
            ktValue Value = ktValue.Null;
            ktValue SecondValue = ktValue.Null;

            if (OpTree == null)
            {
                ktDebug.Log("NOOOOOOOHO!!O!!!!!!!");
                return Value;
            }
#if Debug
	ktDebug.Log( "HOHOHOHOHOHOHOHOHOHOHOHOHOHO:" + OpTree.Get_R( " ", true ) );
#endif

            ktToken Op = null;
            ktToken First = null;
            ktToken Last = null;

            if ((OpTree.Node != null) && (OpTree.Node.Value != null))
            {
                Op = (ktToken)(OpTree.Node.Value);
            }
            if ((OpTree.First != null) && (OpTree.First.Node != null))
            {
                if (OpTree.First.Node.Value is ktToken)
                {
                    First = (ktToken)(OpTree.First.Node.Value);
                }
                else if (OpTree.First.Node.Value is ktValue)
                {
                    Value = (ktValue)(OpTree.First.Node.Value);
                    First = new ktToken(ktTokenType.NULLTOKEN, "Value", 0, 0);
                }
            }
            if ((OpTree.Last != null) && (OpTree.Last.Node != null))
            {
                Last = (ktToken)(OpTree.Last.Node.Value);
            }

            if ((First == null) && (Last == null) || (Op == null))
            {
                return Value;
            }

            if (Op.Type == ktTokenType.Operator)
            {
                ktClass Class = null;

                if (First.Type == ktTokenType.NULLTOKEN)
                {
                    //ktDebug.Log( "000000000000000000000000000000" );
                }
                else
                {
                    Value = TokenToValue(First, OpTree.First);
                }

                SecondValue = TokenToValue(Last, OpTree.Last);

                if (Value.IsNull() || SecondValue.IsNull())
                {
                    throw new ktError("The " + (Value.IsNull() ? "left-hand" : "right-hand") +
                                  " operand can not be a null value!", ktERR.NULL);
                }

                try
                {
                    //ktDebug.Log("111:" + ((ktClass)Value.Value).Name + "!!!!222:" + ((ktClass)SecondValue.Value).Name + "#####");
                    Class = (ktClass)(Value.Value);
                    //ktDebug.Log( "?????????????????????????????????????" );
                    ktList Args = null;
                    if (((ktClass)SecondValue.Value).Name == "ktList")
                    {
                        ktDebug.Log("!!!!!!!!!");
                        Args = (ktList)(((ktClass)SecondValue.Value).GetProperty("___").Value);
                    }
                    else
                    {
                        Args = new ktList();
                        Args.Add(SecondValue);
                    }

                    ArrayList MethNames = new ArrayList(4);
                    MethNames.Add("operator" + Op.Value.ToString());
                    MethNames.Add("op" + Op.Value.ToString());

                    switch (Op.Value)
                    {
                        case "+":
                            {
                                MethNames.Add("_add");
                                break;
                            }
                        case "-":
                            {
                                MethNames.Add("_subtract");
                                break;
                            }
                        case "*":
                            {
//.........这里部分代码省略.........
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:101,代码来源:ktBlock.cs

示例7: HandleRunStatement

        protected ktValue HandleRunStatement(ktList Statement)
        {
#if Debug
	ktDebug.Log( "HrSHRSHRSHRSHRSHRSHRSHRSHRSHRSHRSHRSHRSHRSHRS" );
#endif
            ktValue Value = ktValue.Null;

            if ((Statement == null) || (Statement.IsEmpty()))
            {
                return Value;
            }
#if Debug
	ktDebug.Log( Statement.Get_R() );
#endif
            ktRunStatement RunStatement = new ktRunStatement(Statement, this);

            Value = RunStatement.AsValue();
#if Debug
	ktDebug.Log( "EOHRS" );
#endif
            return Value;
        }
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:22,代码来源:ktBlock.cs

示例8: MakeAOpTree

        /// <summary>
        /// Parse the tokens and create a optree
        /// </summary>
        protected ktList MakeAOpTree(ktList List, int RunNumb)
        {
            ktList Tree = new ktList(), Prev = null, Temp = null;
            ktToken Token = null, PrevToken = null;
            bool result = false, SkipNext = false, ReturnTree = false;

            //            ktDebug.Log("MAOT!! [" + RunNumb + "]\n" + List.Get_R("\t") );
            // null is null..
            if (List == null)
            {
                return null;
            }

            ktDebug.WrapLevel++;
            // Same, same, same...
            Tree.Node = List.Node;
            if ((Tree.Node == null) || (Tree.Node.Value == null) ||
                    (Tree.Node.Value.GetType() != typeof(ktToken)))
            {
                if (Tree.Node == null)
                {
                    Tree.Node = new ktNode("ktBlock");
                }
                Tree.Node.Value = new ktToken(ktTokenType.Block, "ktBlock", 0, 0);
            }
            ((ktToken)Tree.Node.Value).RunnedStep = RunNumb;

            //#if ParseDebug
               ktDebug.Log("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\nMAOT(" + RunNumb + "):" + List.Get_R());
            //#endif

            List.Reset();
            foreach (ktList L in List)
            {
                SkipNext = false;

                // Check so we don't try to work on nothing!
                if ((L.Node != null) && (L.Node.Value != null))
                {
                    // Get Token and previous...
                    Token = (ktToken)L.Node.Value;
                    Prev = Tree.Last;
                    // Get previous token if possible
                    if ((Prev != null) && (Prev.Node != null) && (Prev.Node.Value != null))
                    {
                        PrevToken = (ktToken)Prev.Node.Value;
                    }
                    else
                    {
                        PrevToken = new ktToken(ktTokenType.NULLTOKEN, ":null", 0, 0);
                    }
                    // Nothing here??
                }
                // Nothing there? ...
                else
                {
                    // ... Lets continue!
                    continue;
                }

                //ktDebug.Log("LLLLLLLLLL:::\n" + L.Get_R());
                //ktDebug.Log("LiLiLiLiLiLiLiLiLiLi:::\n" + List.Get_R());

            //#if ParseDebug3
                ktDebug.Log("opTT:" + Token.Type.ToString() + "(" + Token.Value + ")");
                ktDebug.Log("opPTT:" + PrevToken.Type.ToString() + "(" + PrevToken.Value + ")");
            //#endif
                // On run/pass 1
                if (RunNumb == 1)
                {
                    // Handle run 1
                    result = MakeAOpTree_Run1(PrevToken, Prev, Token, L, ref Tree, ref List, out SkipNext, out ReturnTree);
                }
                // On run/pass 2
                else if (RunNumb == 2)
                {
                    result = MakeAOpTree_Run2(PrevToken, Prev, Token, L, ref Tree, ref List, out SkipNext, out ReturnTree);
                }
                // On run/pass 3
                else if (RunNumb == 3)
                {
                    result = MakeAOpTree_Run3(PrevToken, Prev, Token, L, ref Tree, ref List, out SkipNext, out ReturnTree);
                }

                // If nothing was done ...
                if (!result)
                {
                    if ((Token.Type == ktTokenType.Id) || (Token.Type == ktTokenType.Null) ||
                         (Token.Type == ktTokenType.Number) || (Token.Type == ktTokenType.Float) ||
                         (Token.Type == ktTokenType.Boolean) ||
                         (Token.Type == ktTokenType.String)/* ||
                          (Token.Type == ktTokenType.If)*/ )
                    {
                        //ktDebug.Log("Constant etc!!(" + Token.Value + ")");
                        Temp = new ktList();
                        Temp.Node = L.Node;
                        ((ktToken)Temp.Node.Value).RunnedStep = RunNumb;
//.........这里部分代码省略.........
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:101,代码来源:kt.cs

示例9: RunLine

        public ktValue RunLine(ktList Line)
        {
            ktValue Ret = ktValue.Null;
            ktToken Token = null;
            ktToken LToken = null;

            if (Line == null)
            {
                throw new ktError("ktBlock::RunLine() : Didn't get a line to run!", ktERR.NOTSET);
            }
//#if Debug
	ktDebug.Log( "RL:" +  Line.Get_R( " ", true ) );
//#endif

            /*if (Token.LineNo == 3)
            {
                //ktDebug.Log("L3T: ");
                ktDebug.Log("L3: " + Line.Get_R(" ", true));
            }*/

            try
            {
                Token = (ktToken)Line.Node.Value;
                if (Line.GetCount() == 0)
                {
                    if (Line.Node != null)
                    {
                        if (Token.Type == ktTokenType.String)
                        {
                            Ret = new ktValue(":ktString", "ktString", MakeObjectOf("ktString", Token.Value),
                                              true, true);
                        }
                        else if (Token.Type == ktTokenType.Number)
                        {
                            Ret = new ktValue(":ktInt", "ktInt", MakeObjectOf("ktInt", Token.Value),
                                        true, true);
                        }
                        else if (Token.Type == ktTokenType.Float)
                        {
                            Ret = new ktValue(":ktFloat", "ktFloat", MakeObjectOf("ktFloat", Token.Value),
                                        true, true);
                        }
                        else if (Token.Type == ktTokenType.Id)
                        {
                            Ret = GetVariable(Token.Value);
                        }
                    }
                    else
                    {
                        //throw new ktError( "ktBlock::RunLine() : Didn't get a line to run!", ktERR.NOTSET );
                        return Ret;
                    }
                }

                switch (Token.Type)
                {
                    case ktTokenType.If:
                        {
                            bool r = CheckLogicStatement(Line.First,Token, ref Ret);
                            if (r)
                            {
                               // m_skipNextLine = true;
                                ktList Next = Line.First.Next;
                                ktToken IfToken = (ktToken)Next.Node.Value;
                                switch (IfToken.Type)
                                {
                                    case ktTokenType.Block:
                                        {
                                            IfToken.Block.SetParent(this);
                                            Ret = IfToken.Block.Run();
                                            break;
                                        }
                                    default:
                                        {
                                            Ret = RunLine(Next);
                                            break;
                                        }
                                };
                            }
                            return Ret;
                        }
                    case ktTokenType.For:
                        {
                            break;
                        }
                    case ktTokenType.Foreach:
                        {
                            break;
                        }
                    case ktTokenType.While:
                        {
                            break;
                        }
                }

                Line.Reset();
                foreach (ktList TL in Line)
                {
                    if ((TL.Node == null) || (TL.Node.Value == null))
                    {
//.........这里部分代码省略.........
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:101,代码来源:ktBlock.cs

示例10: HandleStatement

        protected ktValue HandleStatement(ktList Statement)
        {
#if Debug
	ktDebug.Log( "HSHSHSHSHSHSHSHSHSHSHSHSHSHSHS" );
#endif
            ktValue Value = ktValue.Null;
ktDebug.Log(Statement.Get_R());

            if ((Statement == null) || (Statement.IsEmpty()) ||
                (Statement.First.Node == null) || (Statement.First.Node.Value == null))
            {
                ktDebug.Log(Statement.Get_R());
                return Value;
            }
#if Debug
	ktDebug.Log( Statement.Get_R() );
#endif
            ktToken Token = (ktToken)Statement.First.Node.Value;

            Value = TokenToValue(Token, Statement.First);
#if Debug
	ktDebug.Log( "EOHS" );
#endif
            return Value;
        }
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:25,代码来源:ktBlock.cs

示例11: HandleCompStatement

        /// <summary>
        /// Handle a "compound satement"
        /// </summary>
        /// <param name="Token"></param>
        /// <param name="L"></param>
        /// <param name="Tree"></param>
        /// <param name="List"></param>
        /// <param name="SkipNext"></param>
        /// <param name="ReturnTree"></param>
        /// <returns></returns>
        private bool HandleCompStatement(ktToken Token, ktList L, ref ktList Tree, ref ktList List, out bool SkipNext, out bool ReturnTree, int RunNumb = 1)
        {
            ktList First = null, Second = null, SecondChild = null, Temp = null;
            ktToken FirstToken = null, SecondToken = null, SecondChildToken = null;

            SkipNext = false;
            ReturnTree = false;

            ktDebug.Log("HandleComp:\n" + L.Get_R());

            First = L.First;
            Second = L.First.Next;
            SecondChild = Second.First;
            FirstToken = (ktToken)First.Node.Value;
            SecondToken = (ktToken)Second.Node.Value;

            if (FirstToken.Type != ktTokenType.Id)
            {
                First = MakeAOpTree(First, RunNumb);
            }

            if (SecondChild != null)
            {
                SecondChildToken = (ktToken)SecondChild.Node.Value;
                if (SecondChildToken.Type == ktTokenType.List)
                {
                    SecondChild = MakeAOpTree(SecondChild, RunNumb);

                    Second.Clear();
                    Second.AddList(SecondChild);
                }
            }
            else if (SecondToken.Type != ktTokenType.Id)
            {
                Second = MakeAOpTree(Second, RunNumb);
            }

            Temp = new ktList();
            Temp.Node = L.Node;
            ((ktToken)Temp.Node.Value).RunnedStep = RunNumb;

            Temp.AddList(First);
            Temp.AddList(Second);

            Tree.AddList(Temp);

            /*ktDebug.Log("HandleComp__:\n" + Temp.Get_R());
            ktDebug.Log("HandleComp Tree:\n" + Tree.Get_R());*/

            return true;
        }
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:61,代码来源:kt.cs

示例12: MakeATree

        /// <summary>
        /// Parse the tokens and create a tree/* (mainly for operators)*/
        /// </summary>
        protected ktList MakeATree()
        {
            if (m_Lines == null)
            {
                m_Lines = new ktList();
                //m_Lines.Node = new ktNode( m_Name, new ktToken( ktTokenType.Program, m_Name, 0, 0 ) );
            }

            ktList Tree = MakeATree(m_LineStack, true, false);
            #if ParseDebug
            ktDebug.Log( "MAT_TREE1:" + Tree.Get_R( " ", true ) );
            #endif
            /*
            Tree = MakeATree( Tree, false, false );
            ktDebug.Log( "MAT_TREE2:" + Tree.Get_R( "\t", true ) );*/
            Tree = MakeATree(Tree, false, true);
            #if ParseDebug
            ktDebug.Log( "MAT_TREEEEEEEE:\n" + Tree.Get_R( " ", true ) );
            #endif

            /**/
            m_Lines = Tree;/*/
            m_Lines.AddList( Tree );/**/
            #if ParseDebug
            ktDebug.Log( "MAT_LINES:" + m_Lines.Get_R( " ", true ) );
            #endif

            return m_Lines;
        }

        /// <summary>
        /// React on the "token" in Word
        /// </summary>
        protected bool ReactOnToken(ktString Word, int Line, ref int CharPos)
        {
            /* In the C++/"original" version of this method, it didn't do what
             *  it's called (_React_ On Token), instead it just added the token to the list.
             *  This method, hovever, does react properly to the given token
             *	This also reduces the number of steps for scanning/parsering (creating the op. tree)
             *	from three to two (we could probably just do it all in one step, but it would be messy
             * 		and a bit complex..)
             */

            #if ParseDebug
            ktDebug.Log( "ReactOnToken(" + Word + ")" );
            ktDebug.Log( "BS:" + ktXML.FromList(m_BlockStack).AsXML() );
            #endif

            ktToken Token = new ktToken(Word, Line, CharPos);
            ktToken LastToken = null;
            ktToken LastAddedToken = null;
            ktToken.OnlyExportValue = true;

            if ((m_TokenStack != null) && (m_TokenStack.Last != null) &&
                (m_TokenStack.Last.Node != null) && (m_TokenStack.Last.Node.Value != null))
            {
                LastToken = (ktToken)m_TokenStack.Last.Node.Value;
            }
            if ((m_Tokens != null) && (m_Tokens.Last != null) &&
                (m_Tokens.Last.Node != null) && (m_Tokens.Last.Node.Value != null))
            {
                LastAddedToken = (ktToken)m_Tokens.Last.Node.Value;
            }

            if (m_CurToken != null)
            {
                // React differentely deppendig on "current token/'state'"
                switch (m_CurToken.Type)
                {
                    // If it's an comment...
                    case ktTokenType.MLComment:
                        {
                            // ... Check if the token is EOC? ...
                            if (Token.Type == ktTokenType.EOC)
                            {
                                m_CurToken = (ktToken)(m_TokenStack.Pop().Node.Value);
                            }
                            // ... ignore...
                            return true;
                        }
                    // If it's an comment...
                    case ktTokenType.OLComment:
                        {
                            // ... Check if the token is EOC? ...
                            if (Word == "\n")
                            {
                                m_CurToken = (ktToken)(m_TokenStack.Pop().Node.Value);
                            }
                            // ... ignore...
                            return true;
                        }
                    // If it's a string...
                    case ktTokenType.String:
                    case ktTokenType.StringQuot:
                    case ktTokenType.StartString:
                        {
                            // If we are at end of the string?
//.........这里部分代码省略.........
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:101,代码来源:kt.cs

示例13: _RunMethod

        public override ktValue _RunMethod(ktString Name, ktList Arguments)
        {
            if (Name.IsEmpty())
            {
                throw new ktError("Didn't get the name of the method to run in class '" +
                                m_Name + "'.", ktERR.NOTSET);
            }
            //ktDebug.Log( ";Name::"+ Name + ";;;;_\n" );
            if (Name == "_PropertyChanged")
            {
                if ((Arguments == null) || (Arguments.GetCount() != 2))
                {
                    throw new ktError("kactalk::_PropertyChanged() : Didn't get the two nnede arguments!",
                                      ktERR.MISSING);
                }
            #if Debug
            ktDebug.Log( "Args::" + Arguments.Get_R( "\t", true ) );
            #endif

                Name = Arguments.Get("Name").Node.Value.ToString();
                ktValue Value = (ktValue)Arguments.Get("Value").Node.Value;

                SetProperty(Name, Value);

                return ktValue.Null;
            }
            else /*if (Name.StartsWith( "operator", out Name )) {
                return HandleOperator( Name, Arguments );
            } else */
            {
                throw new ktError("Couldn't find the method '" +
                                  Name + "' in class '" + m_Name + "'.", ktERR._404);
            }
        }
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:34,代码来源:ktRunStatement.cs

示例14: HandleList

        protected ktValue HandleList(ktList List)
        {
            ktValue Value = ktValue.Null;

            if (List == null)
            {
                return Value;
            }
#if Debug
	ktDebug.Log( "HandleList:::" + List.Get_R() );
#endif
            ktClass ListClass = kacTalk.Main.MakeObjectOf("ktList", GetArguments(List));

            Value = new ktValue("ktList", "ktList", ListClass, true, true);
#if Debug
	ktDebug.Log( "EOHL" );
#endif
            return Value;
        }
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:19,代码来源:ktBlock.cs

示例15: Initiate

        public void Initiate()
        {
            if (m_Channel == null)
            {
                throw new ktError("ktTalker::Initiate failed due to the lack of a Channel!");
            }
            m_AvailableObjects = new ktList();

            m_Channel.Initiate( m_URI, m_APIKey );

            Console.WriteLine(m_AvailableObjects.Get_R());
        }
开发者ID:ChrisHinde,项目名称:KacTalk_NET,代码行数:12,代码来源:ktTalker.cs


注:本文中的KacTalk.ktList.Get_R方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。