/**
  * {@inheritDoc}
  */
 public function dump(array $table)
 {
     // for readability
     ksort($table['action']);
     ksort($table['goto']);
     // the grammar dictates the parse table,
     // therefore the result is always the same
     if (!$this->written) {
         $this->writeHeader();
         $this->writer->indent();
         foreach ($table['action'] as $n => $state) {
             $this->writeState($n, $state);
             $this->writer->writeLine();
         }
         $this->writer->outdent();
         $this->writeMiddle();
         $this->writer->indent();
         foreach ($table['goto'] as $n => $map) {
             $this->writeGoto($n, $map);
             $this->writer->writeLine();
         }
         $this->writer->outdent();
         $this->writeFooter();
         $this->written = true;
     }
     return $this->writer->get();
 }