public function testGroupStack()
 {
     $log = new ArrayList();
     $listener = function (GroupEvent $event) use($log) {
         $log->add($event->getName() . ' ' . $event->getGroup()->type);
     };
     $parser = new Parser();
     $parser->getContext()->addListener(Context::EVENT_GROUP_ENTER, $listener);
     $parser->getContext()->addListener(Context::EVENT_GROUP_LEAVE, $listener);
     $parser->parse($this->getCode());
     $this->assertEquals(['context.group_enter block', 'context.group_leave block', 'context.group_enter block', 'context.group_leave block', 'context.group_enter call', 'context.group_leave call', 'context.group_enter block', 'context.group_leave block', 'context.group_enter block', 'context.group_enter group', 'context.group_leave group', 'context.group_leave block'], $log->toArray());
 }
 /**
  * Retrieves a token at the given index
  * 
  * @param int $index the given index
  * @return Token 
  */
 public function get($index)
 {
     return parent::get($index);
 }