Example #1
0
 protected function formatItem(Item $item)
 {
     $rule = $item->getRule();
     $components = $rule->getComponents();
     // the dot
     array_splice($components, $item->getDotIndex(), 0, array('•'));
     if ($rule->getNumber() === 0) {
         $string = '';
     } else {
         $string = sprintf("%s → ", $rule->getName());
     }
     $string .= implode(' ', $components);
     if ($item->isReduceItem()) {
         $string .= sprintf(' [%s]', implode(' ', $item->getLookahead()));
     }
     return $string;
 }