hafriedlander\Peg\Parser\CachedRegexp::match PHP Method

match() public method

public match ( )
    function match()
    {
        $current_pos = $this->parser->pos;
        $dirty = $this->check_pos === NULL || $this->check_pos > $current_pos || $this->match_pos !== NULL && $this->match_pos < $current_pos;
        if ($dirty) {
            $this->check_pos = $current_pos;
            $matched = preg_match($this->rx, $this->parser->string, $this->matches, PREG_OFFSET_CAPTURE, $this->check_pos);
            if ($matched) {
                $this->match_pos = $this->matches[0][1];
            } else {
                $this->match_pos = NULL;
            }
        }
        if ($this->match_pos === $current_pos) {
            $this->parser->pos += strlen($this->matches[0][0]);
            return $this->matches[0][0];
        }
        return FALSE;
    }