/** * @param SyntaxNode $astNode * @return bool */ public function visitSyntaxNode(SyntaxNode $astNode) { $nodeId = $this->buildDOTIdentifier($astNode); $this->dotWriter->writeNode($nodeId); $this->formatter->whitespace(1, $this->dotWriter); //formatting options $this->dotWriter->writeStatementTerminator(); if (0 < $astNode->countChildren()) { $this->visitContext->pushParentId($nodeId); } return true; }
/** * @param RuleNode $astNode * @return bool */ public function visitRuleNode(RuleNode $astNode) { $increment = $this->visitContext->countParentIds(); $this->formatter->indent($increment, $this->dotWriter); $nodeId = $this->buildDOTIdentifier($astNode); $parentId = $this->visitContext->peekParentId(); $this->dotWriter->writeEdgeStatement($parentId, $nodeId); $this->formatter->whitespace(1, $this->dotWriter); //formatting options $this->dotWriter->writeStatementTerminator(); $this->visitContext->pushParentId($nodeId); return true; }
/** * @param RepetitionNode $astNode * * @return bool */ public function visitRepetitionNode(RepetitionNode $astNode) { $increment = $this->visitContext->countParentIds(); $this->formatter->indent($increment, $this->dotWriter); $parentId = $this->visitContext->peekParentId(); $nodeId = $this->buildNumberedDOTIdentifier('"repeated_expression[%s]"', $this->visitContext); $this->dotWriter->writeEdgeStatement($parentId, $nodeId); $this->formatter->whitespace(1, $this->dotWriter); //formatting options $this->dotWriter->writeStatementTerminator(); $this->visitContext->pushParentId($nodeId); return true; }
/** * @param ConcatenationNode $astNode * * @return bool */ public function visitConcatenationNode(ConcatenationNode $astNode) { $increment = $this->visitContext->countParentIds(); $this->formatter->indent($increment, $this->dotWriter); $nodeId = $this->buildNumberedDOTIdentifier('"sequence[%s]"', $this->visitContext); $parentId = $this->visitContext->peekParentId(); $this->dotWriter->writeEdgeStatement($parentId, $nodeId); $this->formatter->whitespace(1, $this->dotWriter); //formatting options $this->dotWriter->writeStatementTerminator(); if (0 < $astNode->countChildren()) { $this->visitContext->pushParentId($nodeId); } return true; }