public function finish(Lexer $lexer) {
        if (is_array($this->exitPattern)) {
            foreach ($this->exitPattern as $exitPattern) {
                $lexer->addExitPattern($exitPattern, $this->name);
            }
        } else {
            $lexer->addExitPattern($this->exitPattern, $this->name);
        }

        return $this;
    }