594 Change in Type and Tokenizer Classes
Spring 2006, David Matuszek
The current assignment requires some minor changes in the
Tokenizer classes. My apologies; I can't forsee everything.
Fortunately, you should have good JUnit tests, so these modifications should
not be painful. They took me about 20 minutes, and that includes writing
up this page.
Add a new type
END_OF_INPUT will have the same meaning as the type
did in the original assignment.
EOL will now mean "end of
line", that is, a newline character,
'\n'. That's how I should
have defined it all along. Please update your Javadoc comments to reflect this
It is unlikely that you will have to change
Start by updating
TokenizerTest. Basically, this requires two
EOLtoken with tests for an
Don't forget to run your tests and make sure they fail!
Now update your
Tokenizer. For me, this meant adding a couple
of lines to my state machine's initial state, changing my
method to not skip over newlines, and changing
next() to return
END_OF_INPUT instead of
EOL when it reached the end
of the input.
Use JUnit to make sure your updated
Tokenizer works properly.