There is a problem though with replacing it all with a function - lexing speed. Lexing speed is critically dependent on being able to consume whitespace fast, hence all the inline code to do it. Running the source through two passes makes it half as fast.