Extracted common lexer scan function into lexer_scan_next_buffer().