public function expect($type)
    {
        $token = $this->current();
        if (!$this->is($type)) {
            if (is_array($type)) {
                $type = implode(' or ', $type);
            }
            $actual = sprintf('<%s:%s>', $token->getType(), $token->getValue());
            throw new \LogicException(sprintf('Syntax Error: %s expected %s given at line %d', $type, $actual, $token->getLine()));
        }
        $this->next();

        return $token;
    }