Accept thousands separators in inferred values.

This commit is contained in:
Jeff Young 2022-12-19 20:05:54 +00:00
parent 58ce0bb804
commit 8db015bc0f
1 changed files with 7 additions and 1 deletions

View File

@ -1100,7 +1100,7 @@ bool SIM_MODEL::InferSimModel( T_symbol& aSymbol, std::vector<T_field>* aFields,
if( aModelParams->IsEmpty() ) if( aModelParams->IsEmpty() )
{ {
wxRegEx idealVal( wxT( "^" wxRegEx idealVal( wxT( "^"
"([0-9\\. ]+)" "([0-9\\,\\. ]+)"
"([fFpPnNuUmMkKgGtTμµ𝛍𝜇𝝁 ]|M(e|E)(g|G))?" "([fFpPnNuUmMkKgGtTμµ𝛍𝜇𝝁 ]|M(e|E)(g|G))?"
"([fFhHΩΩ𝛀𝛺𝝮rR]|ohm)?" "([fFhHΩΩ𝛀𝛺𝝮rR]|ohm)?"
"([-1-9 ]*)" "([-1-9 ]*)"
@ -1113,6 +1113,9 @@ bool SIM_MODEL::InferSimModel( T_symbol& aSymbol, std::vector<T_field>* aFields,
wxString valueExponent( idealVal.GetMatch( value, 2 ) ); wxString valueExponent( idealVal.GetMatch( value, 2 ) );
wxString valueFraction( idealVal.GetMatch( value, 6 ) ); wxString valueFraction( idealVal.GetMatch( value, 6 ) );
// Remove any thousands separators
valueMantissa.Replace( wxT( "," ), wxEmptyString );
if( valueMantissa.Contains( wxT( "." ) ) || valueFraction.IsEmpty() ) if( valueMantissa.Contains( wxT( "." ) ) || valueFraction.IsEmpty() )
{ {
aModelParams->Printf( wxT( "%s=\"%s%s\"" ), aModelParams->Printf( wxT( "%s=\"%s%s\"" ),
@ -1175,6 +1178,9 @@ bool SIM_MODEL::InferSimModel( T_symbol& aSymbol, std::vector<T_field>* aFields,
wxString valueExponent( sourceVal.GetMatch( value, 2 ) ); wxString valueExponent( sourceVal.GetMatch( value, 2 ) );
wxString valueFraction( sourceVal.GetMatch( value, 6 ) ); wxString valueFraction( sourceVal.GetMatch( value, 6 ) );
// Remove any thousands separators
valueMantissa.Replace( wxT( "," ), wxEmptyString );
if( valueMantissa.Contains( wxT( "." ) ) || valueFraction.IsEmpty() ) if( valueMantissa.Contains( wxT( "." ) ) || valueFraction.IsEmpty() )
{ {
aModelParams->Printf( wxT( "dc=\"%s%s\"" ), aModelParams->Printf( wxT( "dc=\"%s%s\"" ),