本文整理汇总了C#中IIntStream.Seek方法的典型用法代码示例。如果您正苦于以下问题:C# IIntStream.Seek方法的具体用法?C# IIntStream.Seek怎么用?C# IIntStream.Seek使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IIntStream
的用法示例。
在下文中一共展示了IIntStream.Seek方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AlreadyParsedRule
public virtual bool AlreadyParsedRule(IIntStream input, int ruleIndex)
{
int ruleMemoization = this.GetRuleMemoization(ruleIndex, input.Index);
switch (ruleMemoization)
{
case -1:
return false;
case -2:
this.state.failed = true;
break;
default:
input.Seek(ruleMemoization + 1);
break;
}
return true;
}
示例2: AlreadyParsedRule
/// <summary>
/// Has this rule already parsed input at the current index in the
/// input stream? Return the stop token index or MEMO_RULE_UNKNOWN.
/// If we attempted but failed to parse properly before, return
/// MEMO_RULE_FAILED.
///
/// This method has a side-effect: if we have seen this input for
/// this rule and successfully parsed before, then seek ahead to
/// 1 past the stop token matched for this rule last time.
/// </summary>
public virtual bool AlreadyParsedRule(IIntStream input, int ruleIndex)
{
int stopIndex = GetRuleMemoization(ruleIndex, input.Index);
if (stopIndex == MEMO_RULE_UNKNOWN)
{
return false;
}
if (stopIndex == MEMO_RULE_FAILED)
{
state.failed = true;
}
else
{
input.Seek(stopIndex + 1); // jump to one past stop token
}
return true;
}
示例3: AlreadyParsedRule
/** <summary>
* Has this rule already parsed input at the current index in the
* input stream? Return the stop token index or MEMO_RULE_UNKNOWN.
* If we attempted but failed to parse properly before, return
* MEMO_RULE_FAILED.
* </summary>
*
* <remarks>
* This method has a side-effect: if we have seen this input for
* this rule and successfully parsed before, then seek ahead to
* 1 past the stop token matched for this rule last time.
* </remarks>
*/
public virtual bool AlreadyParsedRule( IIntStream input, int ruleIndex )
{
int stopIndex = GetRuleMemoization( ruleIndex, input.Index );
if ( stopIndex == MemoRuleUnknown )
{
return false;
}
if ( stopIndex == MemoRuleFailed )
{
//System.out.println("rule "+ruleIndex+" will never succeed");
state.failed = true;
}
else
{
//System.out.println("seen rule "+ruleIndex+" before; skipping ahead to @"+(stopIndex+1)+" failed="+state.failed);
input.Seek( stopIndex + 1 ); // jump to one past stop token
}
return true;
}