libs/Parser/Grammar.php
public function addEvent($id, callable $cb)
    {
        if (!isset($this->events[$id])) {
            $this->events[$id] = [];
        }

        $this->events[$id][] = $cb;
    }
public function addEvent($id, callable $cb)
    {
        if (!isset($this->events[$id])) {
            $this->events[$id] = [];
        }

        $this->events[$id][] = $cb;
    }
public function addEvent ( $ id , callable $ cb ) { if ( ! isset ( $ this -> events [ $ id ] ) ) { $ this -> events [ $ id ] = [ ] ; } $ this -> events [ $ id ] [ ] = $ cb ; }
Add an event for a token.

@param   int                 $id                 Token identifier.
@param   callable            $cb                 Callback to call if the token occurs.
Add an event for a token .