Added CharSource class to allow changing lexer loop from while() to foreach()