resetPosition() landed on the wrong token
The only position the API exposes is Token::$position, a character offset into the input. resetPosition() wrote that number straight into the token array index, so for "hello world foo" resetPosition(6) jumped past the end of the list instead of to "world", and the lexer looked empty.
The offset is mapped to a token index
resetPosition() finds the first token whose position is at or after the given offset and puts the cursor there, without an extra map in memory. resetPosition(0) and lexers with one-character tokens behave as before, and the tests cover multi-character tokens.