private function matches(string $expected, bool $shouldConsume = true, int $cursor = null) : bool
    {
        $stream = $this->getStream($cursor);
        $expectedLength = strlen($expected);

        if (substr($stream, 0, $expectedLength) == $expected) {
            if ($shouldConsume) {
                $this->cursor += $expectedLength;
            }

            return true;
        }

        return false;
    }
private function matches(string $expected, bool $shouldConsume = true, int $cursor = null) : bool
    {
        $stream = $this->getStream($cursor);
        $expectedLength = strlen($expected);

        if (substr($stream, 0, $expectedLength) == $expected) {
            if ($shouldConsume) {
                $this->cursor += $expectedLength;
            }

            return true;
        }

        return false;
    }
private function matches ( string $ expected , bool $ shouldConsume = true , int $ cursor = null ) : bool { $ stream = $ this -> getStream ( $ cursor ) ; $ expectedLength = strlen ( $ expected ) ; if ( substr ( $ stream , 0 , $ expectedLength ) == $ expected ) { if ( $ shouldConsume ) { $ this -> cursor += $ expectedLength ; } return true ; } return false ; }
Gets whether or not the input at the cursor matches an expected value

@param string $expected The expected string
@param bool $shouldConsume Whether or not to consume the expected value on a match
@param int|null $cursor The cursor position to match at
@return bool True if the input at the cursor matches the expected value, otherwise false
Gets whether or not the input at the cursor matches an expected value