Lexer code cleanup using nextSegmentUntil:.