Ban unitless numbers in DRC rules.
Fixes https://gitlab.com/kicad/code/kicad/issues/6029
This commit is contained in:
parent
c67770e6b6
commit
948036372e
|
@ -549,7 +549,8 @@ bool COMPILER::lexDefault( T_TOKEN& aToken )
|
|||
|
||||
|
||||
default:
|
||||
reportError( CST_PARSE, wxString::Format( _( "Unrecognized character '%c'" ), (char) ch ) );
|
||||
reportError( CST_PARSE, wxString::Format( _( "Unrecognized character '%c'" ),
|
||||
(char) ch ) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -979,6 +980,11 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
|
|||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( _( "Missing units for '%s'| (%s)" ),
|
||||
*node->value.str,
|
||||
m_unitResolver->GetSupportedUnitsMessage() );
|
||||
reportError( CST_CODEGEN, msg, node->srcPos );
|
||||
|
||||
value = DoubleValueFromString( EDA_UNITS::UNSCALED, *node->value.str );
|
||||
}
|
||||
|
||||
|
|
|
@ -168,6 +168,11 @@ public:
|
|||
return nullUnits;
|
||||
}
|
||||
|
||||
virtual wxString GetSupportedUnitsMessage() const
|
||||
{
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
virtual double Convert( const wxString& aString, int unitType ) const
|
||||
{
|
||||
return 0.0;
|
||||
|
|
|
@ -542,6 +542,11 @@ public:
|
|||
return pcbUnits;
|
||||
}
|
||||
|
||||
virtual wxString GetSupportedUnitsMessage() const override
|
||||
{
|
||||
return _( "must be mm, in, or mil" );
|
||||
}
|
||||
|
||||
virtual double Convert( const wxString& aString, int unitId ) const override
|
||||
{
|
||||
double v = wxAtof( aString );
|
||||
|
|
Loading…
Reference in New Issue