peterxu422 wrote
Is there a least ugly method?
Well, I ended up using JFlex. This tool (more or less) takes a lexical specification (which you write as a .flex file) and automatically generates a java file that is the Tokenizer for Jack.
It's not ugly but does require you to learn an additional tool.