本文整理汇总了C#中Lexer.Advance方法的典型用法代码示例。如果您正苦于以下问题:C# Lexer.Advance方法的具体用法?C# Lexer.Advance怎么用?C# Lexer.Advance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lexer
的用法示例。
在下文中一共展示了Lexer.Advance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateNonTerminal
public override bool CreateNonTerminal(Lexer lex, ProductionStorage ps)
{
string by;
// get the leading ( BY | A BU )
if (ps.MatchProduction(Selmaho.BY, out by))
{
if (by.Length == 2)
by = by[0].ToString();
_String += by;
}
else if (lex.Peek.Type == Selmaho.BU)
{
string l = lex.Advance();
if (l.Length > 1)
l = "(" + l + ")";
_String += l;
lex.Advance();//eat the bu
}
else
{
return false;
}
while(true)
{
if (ps.MatchProduction(Selmaho.BY, out by))
{
if (by.Length == 2)
by = by[0].ToString();
_String += by;
}
else if (lex.Peek.Type == Selmaho.BU)
{
string l = lex.Advance();
if (l.Length > 1)
l = "(" + l + ")";
_String += l;
lex.Advance();//eat the bu
}
else
break;
}
//eat the BOI that might be there
ps.MatchProduction(Selmaho.BOI);
return true;
}
示例2: CreateNonTerminal
public override bool CreateNonTerminal(Lexer lex, ProductionStorage ts)
{
if (lex.Current.Type == Selmaho.Operator)
{
_Operator = lex.Advance();
return true;
}
return false;
}