예제 #1
0
 /**
  * @param GroupNode $astNode
  *
  * @return bool
  */
 public function postVisitGroupNode(GroupNode $astNode)
 {
     if (0 < $astNode->countChildren()) {
         $this->visitContext->popParentId();
     }
     return true;
 }
예제 #2
0
 /**
  * @param CommentNode $astNode
  * @return bool
  */
 public function visitCommentNode(CommentNode $astNode)
 {
     $increment = $this->visitContext->countParentIds();
     $this->formatter->indent($increment, $this->dotWriter);
     $nodeId = $this->buildNumberedDOTIdentifier('"comment[%s]"', $this->visitContext);
     $parentId = $this->visitContext->peekParentId();
     $this->dotWriter->writeEdgeStatement($parentId, $nodeId);
     $this->formatter->whitespace(1, $this->dotWriter);
     //formatting options
     $this->dotWriter->writeStatementTerminator();
     return true;
 }
예제 #3
0
 /**
  * @param RuleNode $astNode
  * @return bool
  */
 public function postVisitRuleNode(RuleNode $astNode)
 {
     $this->visitContext->popParentId();
     return true;
 }
예제 #4
0
 /**
  * @param SyntaxNode $astNode
  * @return bool
  */
 public function postVisitSyntaxNode(SyntaxNode $astNode)
 {
     $this->dotWriter->closeGraph();
     $this->visitContext->popParentId();
     return true;
 }
예제 #5
0
 protected function buildNumberedDOTIdentifier($sprintfPattern, VisitContext $visitContext)
 {
     $idNumber = $visitContext->getNodeCount();
     return sprintf($sprintfPattern, $idNumber);
 }