public function terminals(array $terminals): self
    {
        if (!$terminals) {
            return $this;
        }

        $new_terminals = $this->addNamedTokens($this->regexpMap, $terminals, 'terminal');

        $copy = clone $this;
        $copy->regexpMap = $new_terminals;
        return $copy;
    }
public function terminals(array $terminals): self
    {
        if (!$terminals) {
            return $this;
        }

        $new_terminals = $this->addNamedTokens($this->regexpMap, $terminals, 'terminal');

        $copy = clone $this;
        $copy->regexpMap = $new_terminals;
        return $copy;
    }
public function terminals ( array $ terminals ) : self { if ( ! $ terminals ) { return $ this ; } $ new_terminals = $ this -> addNamedTokens ( $ this -> regexpMap , $ terminals , 'terminal' ) ; $ copy = clone $ this ; $ copy -> regexpMap = $ new_terminals ; return $ copy ; }
Create new Lexer extending this one with terminals

Named tokens defined with regexps. Named regexps from DEFINEs can be
referenced here with named recursion `(?&name)`.

> Note: Returned object can be the same one in case of empty additions.
@param string[] $terminals Additional terminals. Only named are acceptable.
is restricted.
@return static
@since 1.4.0
Create new Lexer extending this one with terminals