scanDocument
Convenience function: scans a string into a list of lexemes.
Return
the list of lexemes, or throws IllegalStateException if scanning fails (which should not happen for any valid string input since the scanner is exhaustive).