Esempio n. 1
0
 public override void Visit(IASTVisitor visitor)
 {
     if (terminal.IsExplicit)
     {
         visitor.BeginNode(this);
         visitor.EndNode(this);
     }
 }
Esempio n. 2
0
        public override void Visit(IASTVisitor visitor)
        {
            if (isExplicit)
            {
                visitor.BeginNode(this);
            }
            foreach (var node in nodes)
            {
                node.Visit(visitor);
            }

            if (isExplicit)
            {
                visitor.EndNode(this);
            }
        }
Esempio n. 3
0
        /// <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;
        }