src/Language/Lexer.php
private function positionAfterWhitespace()
    {
        while ($this->position < $this->source->length) {
            [, $code, $bytes] = $this->readChar();

            // Skip whitespace
            // tab | space | comma | BOM
            if ($code === 9 || $code === 32 || $code === 44 || $code === 0xFEFF) {
                $this->moveStringCursor(1, $bytes);
            } elseif ($code === 10) { // new line
                $this->moveStringCursor(1, $bytes);
                $this->line++;
                $this->lineStart = $this->position;
            } elseif ($code === 13) { // carriage return
                [, $nextCode, $nextBytes] = $this->moveStringCursor(1, $bytes)->readChar();

                if ($nextCode === 10) { // lf after cr
                    $this->moveStringCursor(1, $nextBytes);
                }
                $this->line++;
                $this->lineStart = $this->position;
            } else {
                break;
            }
        }
    }
private function positionAfterWhitespace()
    {
        while ($this->position < $this->source->length) {
            [, $code, $bytes] = $this->readChar();

            // Skip whitespace
            // tab | space | comma | BOM
            if ($code === 9 || $code === 32 || $code === 44 || $code === 0xFEFF) {
                $this->moveStringCursor(1, $bytes);
            } elseif ($code === 10) { // new line
                $this->moveStringCursor(1, $bytes);
                $this->line++;
                $this->lineStart = $this->position;
            } elseif ($code === 13) { // carriage return
                [, $nextCode, $nextBytes] = $this->moveStringCursor(1, $bytes)->readChar();

                if ($nextCode === 10) { // lf after cr
                    $this->moveStringCursor(1, $nextBytes);
                }
                $this->line++;
                $this->lineStart = $this->position;
            } else {
                break;
            }
        }
    }
private function positionAfterWhitespace ( ) { while ( $ this -> position < $ this -> source -> length ) { [ , $ code , $ bytes ] = $ this -> readChar ( ) ; // Skip whitespace // tab | space | comma | BOM if ( $ code === 9 || $ code === 32 || $ code === 44 || $ code === 0xFEFF ) { $ this -> moveStringCursor ( 1 , $ bytes ) ; } elseif ( $ code === 10 ) { // new line $ this -> moveStringCursor ( 1 , $ bytes ) ; $ this -> line ++ ; $ this -> lineStart = $ this -> position ; } elseif ( $ code === 13 ) { // carriage return [ , $ nextCode , $ nextBytes ] = $ this -> moveStringCursor ( 1 , $ bytes ) -> readChar ( ) ; if ( $ nextCode === 10 ) { // lf after cr $ this -> moveStringCursor ( 1 , $ nextBytes ) ; } $ this -> line ++ ; $ this -> lineStart = $ this -> position ; } else { break ; } } }
Reads from body starting at startPosition until it finds a non-whitespace
or commented character, then places cursor to the position of that character.
Reads from body starting at startPosition until it finds a non - whitespace or commented character then places cursor to the position of that character .