Fix generator name mangling with underscored inputs

Generator currently mangles names like "UNKNOWN_ERROR" to "UNKNOWN__ERROR" because it treats all non-caps characters as lowercase letters. Fix is to differentiate between lowercase letters and other non-letter characters.