SimpleLexer::dispatchTokens PHP Method

dispatchTokens() protected method

Sends the matched token and any leading unmatched text to the parser changing the lexer to a new mode if one is listed.
protected dispatchTokens ( string $unmatched, string $matched, string $mode = false ) : boolean
$unmatched string Unmatched leading portion.
$matched string Actual token match.
$mode string Mode after match. A boolean false mode causes no change.
return boolean False if there was any error from the parser.
    protected function dispatchTokens($unmatched, $matched, $mode = false)
    {
        if (!$this->invokeParser($unmatched, LEXER_UNMATCHED)) {
            return false;
        }
        if (is_bool($mode)) {
            return $this->invokeParser($matched, LEXER_MATCHED);
        }
        if ($this->isModeEnd($mode)) {
            if (!$this->invokeParser($matched, LEXER_EXIT)) {
                return false;
            }
            return $this->mode->leave();
        }
        if ($this->isSpecialMode($mode)) {
            $this->mode->enter($this->decodeSpecial($mode));
            if (!$this->invokeParser($matched, LEXER_SPECIAL)) {
                return false;
            }
            return $this->mode->leave();
        }
        $this->mode->enter($mode);
        return $this->invokeParser($matched, LEXER_ENTER);
    }