Exemplo n.º 1
0
 protected function writeGoto($n, array $map)
 {
     $this->writer->writeLine((string) $n . ' => array(');
     $this->writer->indent();
     foreach ($map as $sym => $dest) {
         $this->writer->writeLine(sprintf('// on %s go to state %d', $sym, $dest));
         $this->writer->writeLine(sprintf("'%s' => %d,", $sym, $dest));
         $this->writer->writeLine();
     }
     $this->writer->outdent();
     $this->writer->writeLine('),');
 }
Exemplo n.º 2
0
 protected function writeHeader(StringWriter $writer, $stateNumber = null)
 {
     $writer->writeLine(sprintf('digraph %s {', $stateNumber ? 'State' . $stateNumber : 'Automaton'));
     $writer->indent();
     $writer->writeLine('rankdir="LR";');
 }