by notacoward · 9y ago · 0 comments
Then I switched to calling seperate functions within the switch statement for tokens. If the char is a colon and state is prefix, call parsePrefix. If the char is a whitespace, advance state etc.
I didn't know about jump tables back then, but relying on enums for states and branching proved to be a good idea. e.g If state is < 3, parseParameters(); if state is <2, parseMessage() etc.
Using nested conditionals and loops in the same function on the other hand proved to be a terrible idea.