本文整理汇总了C#中KacTalk.ktList.GetCount方法的典型用法代码示例。如果您正苦于以下问题:C# ktList.GetCount方法的具体用法?C# ktList.GetCount怎么用?C# ktList.GetCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KacTalk.ktList
的用法示例。
在下文中一共展示了ktList.GetCount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _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);
}
}
示例2: HandleCompound
//.........这里部分代码省略.........
}
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 ((SToken != null) && (SToken.Value == "."))
{
ktClass Class = null;
try
{
Value = GetObjectFor(First);
ktDebug.Log("SLU!!!!!!!!!!");
if (Value.IsNull())
{
throw new Exception();
}
Class = (ktClass)Value.Value;
ktDebug.Log("SLU!!++++++!!");
// Class.GetM
}
catch (Exception Err)
{
#if Debug
ktDebug.Log( "ST.DOT.:" + 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);
} /*catch (NullReferenceException Err) {
#if Debug
ktDebug.Log( "ST.DOT.NULL:" + 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 );
}*/
if (Class == null)
{
throw new ktError("A null value was found where an object instance was required, on line " + Last.LineNo.ToString() + " by character " + Last.CharPos.ToString() + "!", ktERR.NULL);
}
Value = Class.GetMember(Last.Value);
#if Debug
ktDebug.Log( "SEP......." + Value.ToString() + ";E:" + First.LineNo );
#endif
}
else if ((SToken != null) && (SToken.Value == "::"))
{
ktDebug.Log("CONFU::" + Last.Value + ";");
ktDebug.Log("SEPV::" + First.Value);
ktContext Con = kacTalk.Main.GetContext(First.Value);
ktDebug.Log("CON::" + ((Con == null) ? "NULL" : Con.Export()) + ";");
Value = Con.GetMember(Last.Value);
ktDebug.Log("CON_MEM::" + ((Value == null) ? "NULL" : Value.Export()) + ";");
}
else
{
// ktDebug.Log(".." + First.Value + ";" + SToken.Value + "::\n" + Comp.Node.Value + "===----------====-===");
if ((First.Type == ktTokenType.Id) && (Comp.GetCount() == 2))
{
#if Debug
ktDebug.Log("IDIDIDIDIDIDIDIDIDIDID");
#endif
ktClass Class = null;
try
{
Value = GetObjectFor(First);
if (Value.IsNull())
{
throw new Exception();
}
Class = (ktClass)Value.Value;
// Class.GetM
}
catch (Exception Err)
{
#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);
}
Value = Class.RunMethod("_func_call", GetArguments(Comp.Last));
/*
if (Comp.GetCount() == 2) {
Value = RunFunction( First.Value, GetArguments( Comp.Last ) );
}*/
}
}
#if Debug
ktDebug.Log( "- - - EO_HC - - -" );
if (this.m_enabledDebug && (this.m_enabledAt == ktDebug.WrapLevel)) { ktDebug.D.Disable(); }
#endif
// ktDebug.WrapLevel--;
return Value;
}
示例3: 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;
}
示例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);
//.........这里部分代码省略.........
示例5: 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))
{
//.........这里部分代码省略.........