public override void Visit(IASTVisitor visitor) { if (terminal.IsExplicit) { visitor.BeginNode(this); visitor.EndNode(this); } }
public override void Visit(IASTVisitor visitor) { if (isExplicit) { visitor.BeginNode(this); } foreach (var node in nodes) { node.Visit(visitor); } if (isExplicit) { visitor.EndNode(this); } }
/// <summary> /// Don't override this method, implement VisitNode on child /// </summary> /// <param name="astVisitor"></param> /// <returns></returns> public bool AcceptASTVisitor(IASTVisitor astVisitor) { bool continueVisit = astVisitor.BeginNode(this) && VisitNode(astVisitor); if (continueVisit && CodeElement != null) { CodeElement.AcceptASTVisitor(astVisitor); } if (continueVisit) { //To Handle concurrent modifications during traverse. //Get the array of Children that must be traverse. Node[] childrenNodes = children.ToArray(); foreach (Node child in childrenNodes) { if (!continueVisit) { break; } continueVisit = child.AcceptASTVisitor(astVisitor); } } astVisitor.EndNode(this); return continueVisit; }