Flag non-compiling rule conditions when running DRC.

Also, clear custom rules after an error before
trying to reload just implicit rules.
This commit is contained in:
Jeff Young 2025-09-11 14:44:23 +01:00
parent 45166bf5c3
commit 8035a66152

View File

@ -527,10 +527,9 @@ void DRC_ENGINE::loadRules( const wxFileName& aPath )
void DRC_ENGINE::compileRules()
{
if( m_logReporter )
{
m_logReporter->Report( ( wxString::Format( wxT( "Compiling Rules (%d rules): " ),
(int) m_rules.size() ) ) );
}
m_logReporter->Report( wxT( "Compiling Rules" ) );
REPORTER error_semaphore;
for( std::shared_ptr<DRC_RULE>& rule : m_rules )
{
@ -539,9 +538,12 @@ void DRC_ENGINE::compileRules()
if( rule->m_Condition && !rule->m_Condition->GetExpression().IsEmpty() )
{
condition = rule->m_Condition;
condition->Compile( nullptr );
condition->Compile( &error_semaphore );
}
if( error_semaphore.HasMessageOfSeverity( RPT_SEVERITY_ERROR ) )
THROW_PARSE_ERROR( wxT( "Parse error" ), rule->m_Name, rule->m_Condition->GetExpression(), 0, 0 );
for( const DRC_CONSTRAINT& constraint : rule->m_Constraints )
{
if( !m_constraintMap.count( constraint.m_Type ) )
@ -594,6 +596,8 @@ void DRC_ENGINE::InitEngine( const wxFileName& aRulePath )
}
catch( PARSE_ERROR& original_parse_error )
{
m_rules.clear();
try // try again with just our implicit rules
{
loadImplicitRules();