本文整理汇总了C#中KacTalk.ktString.Len方法的典型用法代码示例。如果您正苦于以下问题:C# ktString.Len方法的具体用法?C# ktString.Len怎么用?C# ktString.Len使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KacTalk.ktString
的用法示例。
在下文中一共展示了ktString.Len方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Scan
/// <summary>
/// Scan/Parse the script into tokens
/// </summary>
public bool Scan(ktString Script, ktString Name)
{
bool Ret = true;
Script.Replace("\r\n", "\n",true);
// Initiate the lineno.
m_CurLine = 1;
m_CharPos = 1;
// .. and name
m_Name = Name;
if (m_Tokens != null)
{
m_Tokens.Clear();
m_Tokens = null;
}
// Init...
ktString Line = new ktString();
int Pos = 0;
Script.Trim();
ktRegEx RE = new ktRegEx(ktToken.Separators);
// ... the block-stack
if (m_BlockStack != null)
{
m_BlockStack.Clear();
m_BlockStack = null;
}
m_BlockStack = new ktList();
// ... the token-list
if (m_Tokens != null)
{
m_Tokens.Clear();
m_Tokens = null;
}
m_Tokens = new ktList();
m_Tokens.Node = new ktNode("ktTStatement", new ktToken(ktTokenType.Statement, "", 0, 0));
// ... the token-stack
if (m_TokenStack != null)
{
m_TokenStack.Clear();
m_TokenStack = null;
}
m_TokenStack = new ktList();
// ... the lines (??)
if (m_Lines != null)
{
m_Lines.Clear();
m_Lines = null;
}
m_Lines = new ktList();
m_Lines.Node = new ktNode(Name, m_CurToken = new ktToken(ktTokenType.Program, Name, 0, 0));
// ... the line-stack
if (m_LineStack != null)
{
m_LineStack.Clear();
m_LineStack = null;
}
m_LineStack = new ktList();
if (m_MainBlock == null)
{
m_MainBlock = new ktBlock(new ktList());
}
else
{
if (m_MainBlock.Lines != null)
{
m_MainBlock.Lines.Clear();
}
m_MainBlock.ClearKTSymbols();
}
m_MainBlock.SetMain(this);
m_BlockStack.Add("ktTBlock", m_MainBlock);
/* In the "original scanner" (C++), we took one line (terminated by \n)
* at a time and worked on, now we just go through the line.
* And We hope that it will be much "leaner"!
*/
// Go on until the there's nothing left...
while (!Script.IsEmpty())
{
// Get the position for the next separator
Pos = RE.Find(Script);
// If there was none...
if (Pos < 0)
{
// Take it to the end...
Pos = Script.Len();
}
else if (Pos == 0)
{
Pos++;
//.........这里部分代码省略.........