本文整理汇总了C#中ParseNode.GetParent方法的典型用法代码示例。如果您正苦于以下问题:C# ParseNode.GetParent方法的具体用法?C# ParseNode.GetParent怎么用?C# ParseNode.GetParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParseNode
的用法示例。
在下文中一共展示了ParseNode.GetParent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Expacc
private void Expacc()
{
_currentNode.AddChild(new ParseNode(ParseEnum.ExpressionAccent));
_currentNode = _currentNode.getChildren()[_currentNode.getChildren().Count - 1];
if (!_lex.EndOfInput)
{
if (_current is AddSub)
{
_currentNode.AddChild(new ParseNode(ParseEnum.Operator, _current.GetValue()));
_current = _lex.GetNextToken();
Term();
Expacc();
}
else if (_current is Equals)
{
_currentNode.AddChild(new ParseNode(ParseEnum.Equals));
_current = _lex.GetNextToken();
Expressie();
}
else
{
_currentNode.AddChild(new ParseNode(ParseEnum.Empty));
}
}
_currentNode = _currentNode.GetParent();
}
示例2: Push
/// <summary>
/// Pushes a node onto the AST stack, which is used for constructing the tree
/// </summary>
/// <param name="x"></param>
public void Push(ParseNode x)
{
Trace.Assert(x != null);
Trace.Assert(x.GetParent() == Peek());
nodes.Push(x);
}
示例3: Factor
private void Factor()
{
_currentNode.AddChild(new ParseNode(ParseEnum.Factor));
_currentNode = _currentNode.getChildren()[_currentNode.getChildren().Count - 1];
if (!_lex.EndOfInput)
{
if (_current is OpenParenthesis)
{
_currentNode.AddChild(new ParseNode(ParseEnum.OpenParenthesis));
_current = _lex.GetNextToken();
Expressie();
if (_current is CloseParenthesis)
{
_currentNode.AddChild(new ParseNode(ParseEnum.CloseParenthesis));
_current = _lex.GetNextToken();
}
}
else if (_current is Variable)
{
_currentNode.AddChild(new ParseNode(ParseEnum.Variable, _current.GetValue()));
_current = _lex.GetNextToken();
}
else if (_current is Number)
{
_currentNode.AddChild(new ParseNode(ParseEnum.Number, _current.GetValue()));
_current = _lex.GetNextToken();
}
else
{
Console.WriteLine("Syntaxfout.");
Stop();
}
}
_currentNode = _currentNode.GetParent();
}
示例4: Expressie
private void Expressie()
{
_currentNode.AddChild(new ParseNode(ParseEnum.Expression));
_currentNode = _currentNode.getChildren()[_currentNode.getChildren().Count - 1];
Term();
Expacc();
_currentNode = _currentNode.GetParent();
}
示例5: Termacc
private void Termacc()
{
_currentNode.AddChild(new ParseNode(ParseEnum.TermAccent));
_currentNode = _currentNode.getChildren()[_currentNode.getChildren().Count - 1];
if (!_lex.EndOfInput)
{
if (_current is Operator)
{
_currentNode.AddChild(new ParseNode(ParseEnum.Operator, _current.GetValue()));
_current = _lex.GetNextToken();
Factor();
Termacc();
}
else
{
_currentNode.AddChild(new ParseNode(ParseEnum.Empty));
}
}
_currentNode = _currentNode.GetParent();
}
示例6: Term
private void Term()
{
_currentNode.AddChild(new ParseNode(ParseEnum.Term));
_currentNode = _currentNode.getChildren()[_currentNode.getChildren().Count - 1];
Factor();
Termacc();
_currentNode = _currentNode.GetParent();
}