generalization and cleanup of lexeme parsing