Simple state machine to keep track of code input on command line. To use in conjunction with linenoise.