diff --git a/common/libeval_compiler/libeval_compiler.cpp b/common/libeval_compiler/libeval_compiler.cpp index bfcd3392d3..69081171f8 100644 --- a/common/libeval_compiler/libeval_compiler.cpp +++ b/common/libeval_compiler/libeval_compiler.cpp @@ -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 ); } diff --git a/include/libeval_compiler/libeval_compiler.h b/include/libeval_compiler/libeval_compiler.h index 134028671d..5175793aa5 100644 --- a/include/libeval_compiler/libeval_compiler.h +++ b/include/libeval_compiler/libeval_compiler.h @@ -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; diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index 9cafe92452..634a3a03bc 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -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 );