本文整理汇总了C#中ParseState.BuildNode方法的典型用法代码示例。如果您正苦于以下问题:C# ParseState.BuildNode方法的具体用法?C# ParseState.BuildNode怎么用?C# ParseState.BuildNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParseState
的用法示例。
在下文中一共展示了ParseState.BuildNode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public static Node Parse(ParseState parsestate)
{
if (parsestate.CurrentSymbol != Symbol.LeftParen) return null;
++parsestate.TokenIndex;
Node c1 = parsestate.BuildNode(true);
if (c1 == null) return null;
parsestate.BaseNode.Children.Add(c1);
if (parsestate.CurrentSymbol != Symbol.Comma) return null;
++parsestate.TokenIndex;
Node c2 = parsestate.BuildNode(true);
if (c2 == null) return null;
parsestate.BaseNode.Children.Add(c2);
if (parsestate.CurrentSymbol != Symbol.Comma) return null;
++parsestate.TokenIndex;
Node c3 = parsestate.BuildNode(true);
if (c3 == null) return null;
parsestate.BaseNode.Children.Add(c3);
if (parsestate.CurrentSymbol != Symbol.RightParen) return null;
++parsestate.TokenIndex;
return parsestate.BaseNode;
}
示例2: Parse
public static Node Parse(ParseState parsestate)
{
Operator @operator = parsestate.CurrentOperator;
switch (@operator)
{
case Operator.Equals:
case Operator.NotEquals:
case Operator.Greater:
case Operator.GreaterEquals:
case Operator.Lesser:
case Operator.LesserEquals:
++parsestate.TokenIndex;
break;
default:
return null;
}
Node child1 = parsestate.BuildNode(true);
if (child1 == null) return null;
if (parsestate.CurrentSymbol != Symbol.Comma) return null;
++parsestate.TokenIndex;
Node child2 = parsestate.BuildNode(true);
if (child2 == null) return null;
parsestate.BaseNode.Children.Add(child1);
parsestate.BaseNode.Children.Add(child2);
return parsestate.BaseNode;
}
示例3: Parse
public static Node Parse(ParseState parsestate)
{
if (parsestate.CurrentSymbol != Symbol.Comma) return null;
++parsestate.TokenIndex;
Node child = parsestate.BuildNode(false);
if (child == null) return null;
parsestate.BaseNode.Children.Add(child);
return parsestate.BaseNode;
}
示例4: Parse
public static Node Parse(ParseState parsestate)
{
Node basenode = parsestate.BuildParenNumberNode(true);
if (basenode == null)
{
#warning Hack
parsestate.BaseNode.Children.Add(Node.ZeroNode);
basenode = parsestate.BaseNode;
}
if (parsestate.CurrentOperator != Operator.Equals) return null;
++parsestate.TokenIndex;
Node arg1 = parsestate.BuildNode(false);
if (arg1 == null) return null;
basenode.Children.Add(arg1);
if (parsestate.CurrentSymbol != Symbol.Comma)
{
#warning Hack
basenode.Children.Add(Node.ZeroNode);
basenode.Arguments.Add(Operator.Equals);
return basenode;
}
++parsestate.TokenIndex;
Operator @operator = parsestate.CurrentOperator;
if (@operator == Operator.Equals || @operator == Operator.NotEquals)
{
++parsestate.TokenIndex;
Node rangenode = parsestate.BuildRangeNode();
if (rangenode != null)
{
basenode.Children.Add(rangenode.Children[1]);
basenode.Children.Add(rangenode.Children[2]);
basenode.Arguments.Add(@operator);
basenode.Arguments.Add(rangenode.Arguments[1]);
basenode.Arguments.Add(rangenode.Arguments[2]);
return basenode;
}
--parsestate.TokenIndex;
}
switch (@operator)
{
case Operator.Equals:
case Operator.NotEquals:
case Operator.GreaterEquals:
case Operator.LesserEquals:
case Operator.Lesser:
case Operator.Greater:
++parsestate.TokenIndex;
break;
default:
return null;
}
Node arg = parsestate.BuildNode(false);
if (arg == null) return null;
basenode.Arguments.Add(@operator);
basenode.Children.Add(arg);
return basenode;
}
示例5: Parse
public static Node Parse(ParseState state)
{
Operator initoperator = state.CurrentOperator;
switch (initoperator)
{
#warning Compatability. Equals should be the only one that works.
case Operator.Equals:
case Operator.NotEquals:
case Operator.GreaterEquals:
case Operator.LesserEquals:
++state.TokenIndex;
break;
default:
return null;
}
Node arg1 = state.BuildNode(false);
if (arg1 == null) return null;
state.BaseNode.Children.Add(arg1);
if (state.CurrentSymbol != Symbol.Comma)
{
#warning Hack
state.BaseNode.Children.Add(Node.ZeroNode);
state.BaseNode.Arguments.Add(Operator.Equals);
return state.BaseNode;
}
++state.TokenIndex;
Operator @operator = state.CurrentOperator;
if (@operator == Operator.Equals || @operator == Operator.NotEquals)
{
++state.TokenIndex;
Node rangenode = state.BuildRangeNode();
if (rangenode != null)
{
state.BaseNode.Children.Add(rangenode.Children[1]);
state.BaseNode.Children.Add(rangenode.Children[2]);
state.BaseNode.Arguments.Add(@operator);
state.BaseNode.Arguments.Add(rangenode.Arguments[1]);
state.BaseNode.Arguments.Add(rangenode.Arguments[2]);
return state.BaseNode;
}
--state.TokenIndex;
}
switch (@operator)
{
case Operator.Equals:
case Operator.NotEquals:
case Operator.GreaterEquals:
case Operator.LesserEquals:
case Operator.Lesser:
case Operator.Greater:
++state.TokenIndex;
break;
default:
return null;
}
Node arg = state.BuildNode(false);
if (arg == null) return null;
state.BaseNode.Arguments.Add(@operator);
state.BaseNode.Children.Add(arg);
return state.BaseNode;
}