Browse Source
DRC rules parser and engine.
DRC rules parser and engine.
Fixes https://gitlab.com/kicad/code/kicad/issues/2182 Fixes https://gitlab.com/kicad/code/kicad/issues/2116 Fixes https://gitlab.com/kicad/code/kicad/issues/1958 Fixes https://gitlab.com/kicad/code/kicad/issues/1965pull/16/head
31 changed files with 1083 additions and 140 deletions
-
2.gitignore
-
10common/CMakeLists.txt
-
25common/drc_rules.keywords
-
15include/board_design_settings.h
-
15include/core/typeinfo.h
-
1pcbnew/CMakeLists.txt
-
49pcbnew/board_connected_item.cpp
-
5pcbnew/board_connected_item.h
-
57pcbnew/board_design_settings.cpp
-
14pcbnew/class_dimension.h
-
16pcbnew/class_drawsegment.h
-
16pcbnew/class_edge_mod.h
-
17pcbnew/class_pad.cpp
-
26pcbnew/class_pad.h
-
14pcbnew/class_pcb_text.h
-
14pcbnew/class_text_mod.h
-
2pcbnew/class_track.cpp
-
23pcbnew/class_track.h
-
36pcbnew/class_zone.cpp
-
3pcbnew/class_zone.h
-
29pcbnew/dialogs/dialog_drc.cpp
-
4pcbnew/dialogs/dialog_drc.h
-
122pcbnew/drc/drc.cpp
-
4pcbnew/drc/drc.h
-
105pcbnew/drc/drc_clearance_test_functions.cpp
-
1pcbnew/drc/drc_item.cpp
-
172pcbnew/drc/drc_rule.cpp
-
72pcbnew/drc/drc_rule.h
-
278pcbnew/drc/drc_rule_parser.cpp
-
62pcbnew/drc/drc_rule_parser.h
-
14pcbnew/zone_filler.cpp
@ -0,0 +1,25 @@ |
|||
allow |
|||
annulus_width |
|||
blind_via |
|||
board_edge |
|||
clearance |
|||
track_width |
|||
graphic |
|||
hole |
|||
match_area |
|||
match_layer |
|||
match_netclass |
|||
match_type |
|||
micro_via |
|||
npth |
|||
pad |
|||
priority |
|||
pth |
|||
relaxed |
|||
rule |
|||
selector |
|||
text |
|||
track |
|||
version |
|||
via |
|||
zone |
@ -0,0 +1,172 @@ |
|||
/*
|
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2020 KiCad Developers, see change_log.txt for contributors. |
|||
* |
|||
* This program is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU General Public License |
|||
* as published by the Free Software Foundation; either version 2 |
|||
* of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, you may find one here: |
|||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
|
|||
#include <fctsys.h>
|
|||
#include <drc/drc_rule.h>
|
|||
#include <board_design_settings.h>
|
|||
#include <class_board.h>
|
|||
#include <class_board_item.h>
|
|||
|
|||
/*
|
|||
* Match tokens: |
|||
* match_netclass |
|||
* match_type |
|||
* match_layer |
|||
* match_all |
|||
* match_area |
|||
* |
|||
* (selector (match_area "$board") (rule "OSHParkClass3") (priority 100)) |
|||
* |
|||
* (selector (match_netclass "HV") (rule "HV_internal")) |
|||
* (selector (match_netclass "HV") (match_layer "F_Cu") (rule "HV_external")) |
|||
* (selector (match_netclass "HV") (match_layer "B_Cu") (rule "HV_external")) |
|||
* |
|||
* (selector (match_netclass "HV") (match_netclass "HV") (rule "HV2HV")) |
|||
* (selector (match_netclass "HV") (match_netclass "HV") (match_layer "F_Cu") (rule "HV2HV_external")) |
|||
* (selector (match_netclass "HV") (match_netclass "HV") (match_layer "B_Cu") (rule "HV2HV_external")) |
|||
* |
|||
* TODO: pads for connector pins or wire pads have even larger clearances. How to encode? |
|||
* User attributes on parent footprint? |
|||
* |
|||
* (selector (match_netclass "HV") (match_type "pad") (match_netclass "HV") (match_type "pad") (rule "pad2PadHV")) |
|||
* |
|||
* (selector (match_netclass "signal") (match_area "BGA") (rule "neckdown")) |
|||
* |
|||
* Type tokens: |
|||
* track |
|||
* via |
|||
* micro_via |
|||
* blind_via |
|||
* pad |
|||
* zone |
|||
* text |
|||
* graphic |
|||
* board_edge |
|||
* hole |
|||
* npth |
|||
* pth |
|||
* |
|||
* Rule tokens: |
|||
* allow |
|||
* clearance |
|||
* annulus_width |
|||
* track_width |
|||
* hole |
|||
* |
|||
* Rule modifiers: |
|||
* relaxed |
|||
* |
|||
* (rule "HV" (clearance 200) (priority 200)) |
|||
* (rule "HV_external" (clearance 400) (priority 200)) |
|||
* (rule "HV2HV" (clearance 200) (priority 200)) |
|||
* (rule "HV2HV_external" (clearance 500) (priority 200)) |
|||
* (rule "pad2padHV" (clearance 500) (priority 200)) |
|||
* |
|||
* (rule "signal" (clearance 20)) // implied priority of 1
|
|||
* (rule "neckdown" (clearance relaxed 15) (priority 2)) |
|||
* |
|||
* (rule "allowMicrovias" (allow microvia)) |
|||
*/ |
|||
|
|||
|
|||
void MatchSelectors( const std::vector<DRC_SELECTOR*>& aSelectors, |
|||
const BOARD_ITEM* aItem, const NETCLASS* aNetclass, |
|||
const BOARD_ITEM* bItem, const NETCLASS* bNetclass, |
|||
std::vector<DRC_SELECTOR*>* aSelected ) |
|||
{ |
|||
for( DRC_SELECTOR* candidate : aSelectors ) |
|||
{ |
|||
if( candidate->m_MatchNetclasses.size() == 2 ) |
|||
{ |
|||
if( !bItem ) |
|||
continue; |
|||
|
|||
NETCLASS* firstNetclass = candidate->m_MatchNetclasses[0]; |
|||
NETCLASS* secondNetclass = candidate->m_MatchNetclasses[1]; |
|||
|
|||
if( !( aNetclass == firstNetclass && bNetclass == secondNetclass ) |
|||
&& !( aNetclass == secondNetclass && bNetclass == firstNetclass ) ) |
|||
{ |
|||
continue; |
|||
} |
|||
} |
|||
else if( candidate->m_MatchNetclasses.size() == 1 ) |
|||
{ |
|||
NETCLASS* matchNetclass = candidate->m_MatchNetclasses[0]; |
|||
|
|||
if( matchNetclass != aNetclass && !( bItem && matchNetclass == bNetclass ) ) |
|||
continue; |
|||
} |
|||
|
|||
if( candidate->m_MatchTypes.size() == 2 ) |
|||
{ |
|||
if( !bItem ) |
|||
continue; |
|||
|
|||
KICAD_T firstType[2] = { candidate->m_MatchTypes[0], EOT }; |
|||
KICAD_T secondType[2] = { candidate->m_MatchTypes[1], EOT }; |
|||
|
|||
if( !( aItem->IsType( firstType ) && bItem->IsType( secondType ) ) |
|||
&& !( aItem->IsType( secondType ) && bItem->IsType( firstType ) ) ) |
|||
{ |
|||
continue; |
|||
} |
|||
} |
|||
else if( candidate->m_MatchTypes.size() == 1 ) |
|||
{ |
|||
KICAD_T matchType[2] = { candidate->m_MatchTypes[0], EOT }; |
|||
|
|||
if( !aItem->IsType( matchType ) && !( bItem && bItem->IsType( matchType ) ) ) |
|||
continue; |
|||
} |
|||
|
|||
if( candidate->m_MatchLayers.size() ) |
|||
{ |
|||
PCB_LAYER_ID matchLayer = candidate->m_MatchLayers[0]; |
|||
|
|||
if( !aItem->GetLayerSet().test( matchLayer ) |
|||
&& !( bItem && bItem->GetLayerSet().test( matchLayer ) ) ) |
|||
{ |
|||
continue; |
|||
} |
|||
} |
|||
|
|||
if( candidate->m_MatchAreas.size() ) |
|||
{ |
|||
if( candidate->m_MatchAreas[0] == "$board" ) |
|||
{ |
|||
// matches everything
|
|||
} |
|||
else |
|||
{ |
|||
// TODO: area/room matches...
|
|||
} |
|||
} |
|||
|
|||
// All tests done; if we're still here then it matches
|
|||
aSelected->push_back( candidate ); |
|||
} |
|||
} |
|||
|
|||
|
@ -0,0 +1,72 @@ |
|||
/* |
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2020 KiCad Developers, see change_log.txt for contributors. |
|||
* |
|||
* This program is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU General Public License |
|||
* as published by the Free Software Foundation; either version 2 |
|||
* of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, you may find one here: |
|||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|||
* or you may search the http://www.gnu.org website for the version 2 license, |
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
#ifndef DRC_RULE_H |
|||
#define DRC_RULE_H |
|||
|
|||
#include <core/typeinfo.h> |
|||
#include <netclass.h> |
|||
#include <layers_id_colors_and_visibility.h> |
|||
|
|||
|
|||
class BOARD_ITEM; |
|||
|
|||
|
|||
class DRC_RULE |
|||
{ |
|||
public: |
|||
wxString m_Name; |
|||
|
|||
// A 0 value means the property is not modified by this rule. |
|||
// A positive value is a minimum. A negative value is a relaxed constraint: the minimum |
|||
// is reduced to the absolute value of the constraint. |
|||
int m_Clearance; |
|||
int m_AnnulusWidth; |
|||
int m_TrackWidth; |
|||
int m_Hole; |
|||
}; |
|||
|
|||
|
|||
class DRC_SELECTOR |
|||
{ |
|||
public: |
|||
std::vector<NETCLASS*> m_MatchNetclasses; |
|||
std::vector<KICAD_T> m_MatchTypes; |
|||
std::vector<PCB_LAYER_ID> m_MatchLayers; |
|||
std::vector<wxString> m_MatchAreas; |
|||
|
|||
int m_Priority; // 0 indicates automatic priority generation |
|||
DRC_RULE* m_Rule; |
|||
|
|||
public: |
|||
}; |
|||
|
|||
|
|||
void MatchSelectors( const std::vector<DRC_SELECTOR*>& aSelectors, |
|||
const BOARD_ITEM* aItem, const NETCLASS* aNetclass, |
|||
const BOARD_ITEM* bItem, const NETCLASS* bNetclass, |
|||
std::vector<DRC_SELECTOR*>* aSelected ); |
|||
|
|||
|
|||
|
|||
#endif // DRC_RULE_H |
@ -0,0 +1,278 @@ |
|||
/*
|
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2020 KiCad Developers, see change_log.txt for contributors. |
|||
* |
|||
* This program is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU General Public License |
|||
* as published by the Free Software Foundation; either version 2 |
|||
* of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, you may find one here: |
|||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
|
|||
#include <fctsys.h>
|
|||
#include <drc/drc_rule_parser.h>
|
|||
#include <drc_rules_lexer.h>
|
|||
#include <class_board.h>
|
|||
#include <class_board_item.h>
|
|||
|
|||
using namespace DRCRULE_T; |
|||
|
|||
|
|||
DRC_RULES_PARSER::DRC_RULES_PARSER( BOARD* aBoard, FILE* aFile, const wxString& aFilename ) : |
|||
DRC_RULES_LEXER( aFile, aFilename ), |
|||
m_board( aBoard ), |
|||
m_requiredVersion( 0 ), |
|||
m_tooRecent( false ) |
|||
{ |
|||
for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer ) |
|||
{ |
|||
std::string untranslated = TO_UTF8( wxString( LSET::Name( PCB_LAYER_ID( layer ) ) ) ); |
|||
m_layerMap[ untranslated ] = PCB_LAYER_ID( layer ); |
|||
} |
|||
} |
|||
|
|||
|
|||
void DRC_RULES_PARSER::Parse( std::vector<DRC_SELECTOR*>& aSelectors, |
|||
std::vector<DRC_RULE*>& aRules ) |
|||
{ |
|||
std::vector< std::pair<DRC_SELECTOR*, wxString> > selectorRules; |
|||
|
|||
T token; |
|||
|
|||
NeedLEFT(); |
|||
|
|||
if( NextTok() != T_version ) |
|||
Expecting( "version" ); |
|||
|
|||
NeedNUMBER( "version" ); |
|||
m_requiredVersion = (int)strtol( CurText(), NULL, 10 ); |
|||
m_tooRecent = ( m_requiredVersion > DRC_RULE_FILE_VERSION ); |
|||
NeedRIGHT(); |
|||
|
|||
for( token = NextTok(); token != T_EOF; token = NextTok() ) |
|||
{ |
|||
if( token != T_LEFT ) |
|||
Expecting( T_LEFT ); |
|||
|
|||
token = NextTok(); |
|||
|
|||
switch( token ) |
|||
{ |
|||
case T_selector: |
|||
{ |
|||
wxString ruleName; |
|||
|
|||
aSelectors.push_back( parseDRC_SELECTOR( &ruleName ) ); |
|||
selectorRules.emplace_back( aSelectors.back(), ruleName ); |
|||
} |
|||
break; |
|||
|
|||
case T_rule: |
|||
aRules.push_back( parseDRC_RULE() ); |
|||
break; |
|||
|
|||
default: |
|||
Expecting( "selector or rule" ); |
|||
} |
|||
} |
|||
|
|||
// Hook up the selectors to their rules
|
|||
std::map<wxString, DRC_RULE*> ruleMap; |
|||
|
|||
for( DRC_RULE* rule : aRules ) |
|||
ruleMap[ rule->m_Name ] = rule; |
|||
|
|||
for( const std::pair<DRC_SELECTOR*, wxString>& entry : selectorRules ) |
|||
entry.first->m_Rule = ruleMap[ entry.second ]; |
|||
} |
|||
|
|||
|
|||
DRC_SELECTOR* DRC_RULES_PARSER::parseDRC_SELECTOR( wxString* aRuleName ) |
|||
{ |
|||
NETCLASSES& netclasses = m_board->GetDesignSettings().m_NetClasses; |
|||
DRC_SELECTOR* selector = new DRC_SELECTOR(); |
|||
T token; |
|||
|
|||
for( token = NextTok(); token != T_RIGHT; token = NextTok() ) |
|||
{ |
|||
if( token != T_LEFT ) |
|||
Expecting( T_LEFT ); |
|||
|
|||
token = NextTok(); |
|||
|
|||
switch( token ) |
|||
{ |
|||
case T_match_netclass: |
|||
NeedSYMBOL(); |
|||
selector->m_MatchNetclasses.push_back( netclasses.Find( FromUTF8() ).get() ); |
|||
NeedRIGHT(); |
|||
break; |
|||
|
|||
case T_match_type: |
|||
switch( NextTok() ) |
|||
{ |
|||
case T_track: selector->m_MatchTypes.push_back( PCB_TRACE_T ); break; |
|||
case T_via: selector->m_MatchTypes.push_back( PCB_LOCATE_STDVIA_T ); break; |
|||
case T_micro_via: selector->m_MatchTypes.push_back( PCB_LOCATE_UVIA_T ); break; |
|||
case T_blind_via: selector->m_MatchTypes.push_back( PCB_LOCATE_BBVIA_T ); break; |
|||
case T_pad: selector->m_MatchTypes.push_back( PCB_PAD_T ); break; |
|||
case T_zone: selector->m_MatchTypes.push_back( PCB_ZONE_AREA_T ); break; |
|||
case T_text: selector->m_MatchTypes.push_back( PCB_LOCATE_TEXT_T ); break; |
|||
case T_graphic: selector->m_MatchTypes.push_back( PCB_LOCATE_GRAPHIC_T ); break; |
|||
case T_hole: selector->m_MatchTypes.push_back( PCB_LOCATE_HOLE_T ); break; |
|||
case T_npth: selector->m_MatchTypes.push_back( PCB_LOCATE_NPTH_T ); break; |
|||
case T_pth: selector->m_MatchTypes.push_back( PCB_LOCATE_PTH_T ); break; |
|||
case T_board_edge: selector->m_MatchTypes.push_back( PCB_LOCATE_BOARD_EDGE_T ); break; |
|||
default: Expecting( "track, via, micro_via, blind_via, pad, zone, text, " |
|||
"graphic, hole, npth, pth, or board_edge" ); |
|||
} |
|||
NeedRIGHT(); |
|||
break; |
|||
|
|||
case T_match_layer: |
|||
NeedSYMBOL(); |
|||
selector->m_MatchLayers.push_back( m_layerMap[ curText ] ); |
|||
NeedRIGHT(); |
|||
break; |
|||
|
|||
case T_match_area: |
|||
// TODO
|
|||
break; |
|||
|
|||
case T_rule: |
|||
NeedSYMBOL(); |
|||
*aRuleName = FromUTF8(); |
|||
NeedRIGHT(); |
|||
break; |
|||
|
|||
case T_priority: |
|||
NeedNUMBER( "priority" ); |
|||
selector->m_Priority = (int)strtol( CurText(), NULL, 10 ); |
|||
NeedRIGHT(); |
|||
break; |
|||
|
|||
default: |
|||
Expecting( "match_netclass, match_type, match_layer, match_area, rule, or priority" ); |
|||
} |
|||
} |
|||
|
|||
return selector; |
|||
} |
|||
|
|||
|
|||
DRC_RULE* DRC_RULES_PARSER::parseDRC_RULE() |
|||
{ |
|||
DRC_RULE* rule = new DRC_RULE(); |
|||
T token; |
|||
|
|||
NeedSYMBOL(); |
|||
rule->m_Name = FromUTF8(); |
|||
|
|||
for( token = NextTok(); token != T_RIGHT; token = NextTok() ) |
|||
{ |
|||
if( token != T_LEFT ) |
|||
Expecting( T_LEFT ); |
|||
|
|||
int sign = 1; |
|||
token = NextTok(); |
|||
|
|||
switch( token ) |
|||
{ |
|||
case T_allow: |
|||
// TODO
|
|||
break; |
|||
|
|||
case T_clearance: |
|||
if( NextTok() == T_relaxed ) |
|||
{ |
|||
sign = -1; |
|||
NextTok(); |
|||
} |
|||
|
|||
rule->m_Clearance = parseValue( T_clearance ) * sign; |
|||
NeedRIGHT(); |
|||
break; |
|||
|
|||
case T_track_width: |
|||
if( NextTok() == T_relaxed ) |
|||
{ |
|||
sign = -1; |
|||
NextTok(); |
|||
} |
|||
|
|||
rule->m_TrackWidth = parseValue( T_track_width ) * sign; |
|||
NeedRIGHT(); |
|||
break; |
|||
|
|||
case T_annulus_width: |
|||
if( NextTok() == T_relaxed ) |
|||
{ |
|||
sign = -1; |
|||
NextTok(); |
|||
} |
|||
|
|||
rule->m_AnnulusWidth = parseValue( T_annulus_width ) * sign; |
|||
NeedRIGHT(); |
|||
break; |
|||
|
|||
case T_hole: |
|||
if( NextTok() == T_relaxed ) |
|||
{ |
|||
sign = -1; |
|||
NextTok(); |
|||
} |
|||
|
|||
rule->m_Hole = parseValue( T_hole ) * sign; |
|||
NeedRIGHT(); |
|||
break; |
|||
|
|||
default: |
|||
Expecting( "allow, clearance, track_width, annulus_width, or hole" ); |
|||
} |
|||
} |
|||
|
|||
return rule; |
|||
} |
|||
|
|||
|
|||
int DRC_RULES_PARSER::parseValue( DRCRULE_T::T aToken ) |
|||
{ |
|||
char* tmp; |
|||
|
|||
errno = 0; |
|||
|
|||
double fval = strtod( CurText(), &tmp ); |
|||
|
|||
if( errno ) |
|||
{ |
|||
wxString error; |
|||
error.Printf( _( "Invalid floating point number in\nfile: \"%s\"\nline: %d\noffset: %d" ), |
|||
GetChars( CurSource() ), CurLineNumber(), CurOffset() ); |
|||
|
|||
THROW_IO_ERROR( error ); |
|||
} |
|||
|
|||
if( CurText() == tmp ) |
|||
{ |
|||
wxString error; |
|||
error.Printf( _( "Missing floating point number in\nfile: \"%s\"\nline: %d\noffset: %d" ), |
|||
GetChars( CurSource() ), CurLineNumber(), CurOffset() ); |
|||
|
|||
THROW_IO_ERROR( error ); |
|||
} |
|||
|
|||
return KiROUND( fval * IU_PER_MM ); |
|||
} |
@ -0,0 +1,62 @@ |
|||
/* |
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2020 KiCad Developers, see change_log.txt for contributors. |
|||
* |
|||
* This program is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU General Public License |
|||
* as published by the Free Software Foundation; either version 2 |
|||
* of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, you may find one here: |
|||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|||
* or you may search the http://www.gnu.org website for the version 2 license, |
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
#ifndef DRC_RULE_PARSER_H |
|||
#define DRC_RULE_PARSER_H |
|||
|
|||
#include <core/typeinfo.h> |
|||
#include <netclass.h> |
|||
#include <layers_id_colors_and_visibility.h> |
|||
#include <drc/drc_rule.h> |
|||
#include <drc_rules_lexer.h> |
|||
|
|||
|
|||
class BOARD_ITEM; |
|||
|
|||
|
|||
#define DRC_RULE_FILE_VERSION 20200515 |
|||
|
|||
|
|||
class DRC_RULES_PARSER : public DRC_RULES_LEXER |
|||
{ |
|||
public: |
|||
DRC_RULES_PARSER( BOARD* aBoard, FILE* aFile, const wxString& aFilename ); |
|||
|
|||
void Parse( std::vector<DRC_SELECTOR*>& aSelectors, std::vector<DRC_RULE*>& aRules ); |
|||
|
|||
private: |
|||
DRC_SELECTOR* parseDRC_SELECTOR( wxString* aRuleName ); |
|||
|
|||
DRC_RULE* parseDRC_RULE(); |
|||
|
|||
int parseValue( DRCRULE_T::T aToken ); |
|||
|
|||
private: |
|||
BOARD* m_board; |
|||
int m_requiredVersion; |
|||
bool m_tooRecent; |
|||
|
|||
std::unordered_map<std::string, PCB_LAYER_ID> m_layerMap; |
|||
}; |
|||
|
|||
#endif // DRC_RULE_PARSER_H |
Write
Preview
Loading…
Cancel
Save
Reference in new issue