protected function generateRegex(
        string $regex,
        ?NodeInterface $parent,
        ?string $name
    ): NodeInterface{
        $node   = new RegexNode($this, $parent, $name);

        $node->setRegex($regex);

        return $node;
    }