Added code to detect lexical errors.