mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-12 00:29:17 +05:00
allow utf-8 variables names in Python dump
This commit is contained in:
parent
4e4f62e33a
commit
50b5fac2a8
@ -884,25 +884,25 @@ namespace {
|
||||
bool isValidName = true;
|
||||
int nbUnderscore = 0;
|
||||
int p;
|
||||
// replace not allowed chars by underscore
|
||||
const char* name = aName.ToCString();
|
||||
for ( p = 0; name[p]; ++p ) {
|
||||
if ( !isalnum( name[p] ) && name[p] != '_' )
|
||||
{
|
||||
if ( p == 0 || p+1 == aName.Length() || name[p-1] == '_')
|
||||
{
|
||||
aName.Remove( p+1, 1 ); // remove __ and _ from the start and the end
|
||||
--p;
|
||||
name = aName.ToCString();
|
||||
}
|
||||
else
|
||||
{
|
||||
aName.SetValue( p+1, '_');
|
||||
nbUnderscore++;
|
||||
}
|
||||
isValidName = false;
|
||||
}
|
||||
}
|
||||
// // replace not allowed chars by underscore
|
||||
// const char* name = aName.ToCString();
|
||||
// for ( p = 0; name[p]; ++p ) {
|
||||
// if ( !isalnum( name[p] ) && name[p] != '_' )
|
||||
// {
|
||||
// if ( p == 0 || p+1 == aName.Length() || name[p-1] == '_')
|
||||
// {
|
||||
// aName.Remove( p+1, 1 ); // remove __ and _ from the start and the end
|
||||
// --p;
|
||||
// name = aName.ToCString();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// aName.SetValue( p+1, '_');
|
||||
// nbUnderscore++;
|
||||
// }
|
||||
// isValidName = false;
|
||||
// }
|
||||
// }
|
||||
// aName must not start with a digit
|
||||
if ( aName.IsIntegerValue() ) {
|
||||
aName.Insert( 1, 'a' );
|
||||
|
Loading…
Reference in New Issue
Block a user