mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
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:
parent
45166bf5c3
commit
8035a66152
@ -527,10 +527,9 @@ void DRC_ENGINE::loadRules( const wxFileName& aPath )
|
|||||||
void DRC_ENGINE::compileRules()
|
void DRC_ENGINE::compileRules()
|
||||||
{
|
{
|
||||||
if( m_logReporter )
|
if( m_logReporter )
|
||||||
{
|
m_logReporter->Report( wxT( "Compiling Rules" ) );
|
||||||
m_logReporter->Report( ( wxString::Format( wxT( "Compiling Rules (%d rules): " ),
|
|
||||||
(int) m_rules.size() ) ) );
|
REPORTER error_semaphore;
|
||||||
}
|
|
||||||
|
|
||||||
for( std::shared_ptr<DRC_RULE>& rule : m_rules )
|
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() )
|
if( rule->m_Condition && !rule->m_Condition->GetExpression().IsEmpty() )
|
||||||
{
|
{
|
||||||
condition = rule->m_Condition;
|
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 )
|
for( const DRC_CONSTRAINT& constraint : rule->m_Constraints )
|
||||||
{
|
{
|
||||||
if( !m_constraintMap.count( constraint.m_Type ) )
|
if( !m_constraintMap.count( constraint.m_Type ) )
|
||||||
@ -594,6 +596,8 @@ void DRC_ENGINE::InitEngine( const wxFileName& aRulePath )
|
|||||||
}
|
}
|
||||||
catch( PARSE_ERROR& original_parse_error )
|
catch( PARSE_ERROR& original_parse_error )
|
||||||
{
|
{
|
||||||
|
m_rules.clear();
|
||||||
|
|
||||||
try // try again with just our implicit rules
|
try // try again with just our implicit rules
|
||||||
{
|
{
|
||||||
loadImplicitRules();
|
loadImplicitRules();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user