KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drc_rule_parser.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2020-2022 KiCad Developers, see change_log.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24
25#include <board.h>
26#include <zones.h>
27#include <drc/drc_rule_parser.h>
29#include <drc_rules_lexer.h>
30#include <pcbexpr_evaluator.h>
31#include <reporter.h>
32
33using namespace DRCRULE_T;
34
35
36DRC_RULES_PARSER::DRC_RULES_PARSER( const wxString& aSource, const wxString& aSourceDescr ) :
37 DRC_RULES_LEXER( aSource.ToStdString(), aSourceDescr ),
38 m_requiredVersion( 0 ),
39 m_tooRecent( false ),
40 m_reporter( nullptr )
41{
42}
43
44
45DRC_RULES_PARSER::DRC_RULES_PARSER( FILE* aFile, const wxString& aFilename ) :
46 DRC_RULES_LEXER( aFile, aFilename ),
47 m_requiredVersion( 0 ),
48 m_tooRecent( false ),
49 m_reporter( nullptr )
50{
51}
52
53
54void DRC_RULES_PARSER::reportError( const wxString& aMessage )
55{
56 wxString rest;
57 wxString first = aMessage.BeforeFirst( '|', &rest );
58
59 if( m_reporter )
60 {
61 wxString msg = wxString::Format( _( "ERROR: <a href='%d:%d'>%s</a>%s" ), CurLineNumber(),
62 CurOffset(), first, rest );
63
65 }
66 else
67 {
68 wxString msg = wxString::Format( _( "ERROR: %s%s" ), first, rest );
69
70 THROW_PARSE_ERROR( msg, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
71 }
72}
73
74
75void DRC_RULES_PARSER::reportDeprecation( const wxString& oldToken, const wxString newToken )
76{
77 if( m_reporter )
78 {
79 wxString msg = wxString::Format( _( "The '%s' keyword has been deprecated. "
80 "Please use '%s' instead." ),
81 oldToken,
82 newToken);
83
85 }
86}
87
88
90{
91 int depth = 1;
92
93 for( T token = NextTok(); token != T_EOF; token = NextTok() )
94 {
95 if( token == T_LEFT )
96 depth++;
97
98 if( token == T_RIGHT )
99 {
100 if( --depth == 0 )
101 break;
102 }
103 }
104}
105
106
107void DRC_RULES_PARSER::Parse( std::vector<std::shared_ptr<DRC_RULE>>& aRules, REPORTER* aReporter )
108{
109 bool haveVersion = false;
110 wxString msg;
111
112 m_reporter = aReporter;
113
114 for( T token = NextTok(); token != T_EOF; token = NextTok() )
115 {
116 if( token != T_LEFT )
117 reportError( _( "Missing '('." ) );
118
119 token = NextTok();
120
121 if( !haveVersion && token != T_version )
122 {
123 reportError( _( "Missing version statement." ) );
124 haveVersion = true; // don't keep on reporting it
125 }
126
127 switch( token )
128 {
129 case T_version:
130 haveVersion = true;
131 token = NextTok();
132
133 if( (int) token == DSN_RIGHT )
134 {
135 reportError( _( "Missing version number." ) );
136 break;
137 }
138
139 if( (int) token == DSN_NUMBER )
140 {
141 m_requiredVersion = (int)strtol( CurText(), nullptr, 10 );
143 token = NextTok();
144 }
145 else
146 {
147 msg.Printf( _( "Unrecognized item '%s'.| Expected version number." ),
148 FromUTF8() );
149 reportError( msg );
150 }
151
152 if( (int) token != DSN_RIGHT )
153 {
154 msg.Printf( _( "Unrecognized item '%s'." ),
155 FromUTF8() );
156 reportError( msg );
157 parseUnknown();
158 }
159
160 break;
161
162 case T_rule:
163 aRules.emplace_back( parseDRC_RULE() );
164 break;
165
166 case T_EOF:
167 reportError( _( "Incomplete statement." ) );
168 break;
169
170 default:
171 msg.Printf( _( "Unrecognized item '%s'.| Expected %s." ), FromUTF8(),
172 wxT( "rule or version" ) );
173 reportError( msg );
174 parseUnknown();
175 }
176 }
177
178 if( m_reporter && !m_reporter->HasMessage() )
179 m_reporter->Report( _( "No errors found." ), RPT_SEVERITY_INFO );
180
181 m_reporter = nullptr;
182}
183
184
185std::shared_ptr<DRC_RULE> DRC_RULES_PARSER::parseDRC_RULE()
186{
187 std::shared_ptr<DRC_RULE> rule = std::make_shared<DRC_RULE>();
188
189 T token = NextTok();
190 wxString msg;
191
192 if( !IsSymbol( token ) )
193 reportError( _( "Missing rule name." ) );
194
195 rule->m_Name = FromUTF8();
196
197 for( token = NextTok(); token != T_RIGHT && token != T_EOF; token = NextTok() )
198 {
199 if( token != T_LEFT )
200 reportError( _( "Missing '('." ) );
201
202 token = NextTok();
203
204 switch( token )
205 {
206 case T_constraint:
207 parseConstraint( rule.get() );
208 break;
209
210 case T_condition:
211 token = NextTok();
212
213 if( (int) token == DSN_RIGHT )
214 {
215 reportError( _( "Missing condition expression." ) );
216 break;
217 }
218
219 if( IsSymbol( token ) )
220 {
221 rule->m_Condition = new DRC_RULE_CONDITION( FromUTF8() );
222 rule->m_Condition->Compile( m_reporter, CurLineNumber(), CurOffset() );
223 }
224 else
225 {
226 msg.Printf( _( "Unrecognized item '%s'.| Expected quoted expression." ),
227 FromUTF8() );
228 reportError( msg );
229 }
230
231 if( (int) NextTok() != DSN_RIGHT )
232 {
233 reportError( wxString::Format( _( "Unrecognized item '%s'." ), FromUTF8() ) );
234 parseUnknown();
235 }
236
237 break;
238
239 case T_layer:
240 if( rule->m_LayerCondition != LSET::AllLayersMask() )
241 reportError( _( "'layer' keyword already present." ) );
242 rule->m_LayerSource = FromUTF8();
243 rule->m_LayerCondition = parseLayer();
244 break;
245
246 case T_severity:
247 rule->m_Severity = parseSeverity();
248 break;
249
250 case T_EOF:
251 reportError( _( "Incomplete statement." ) );
252 return rule;
253
254 default:
255 msg.Printf( _( "Unrecognized item '%s'.| Expected %s." ), FromUTF8(),
256 wxT( "constraint, condition, or disallow" ) );
257 reportError( msg );
258 parseUnknown();
259 }
260 }
261
262 if( (int) CurTok() != DSN_RIGHT )
263 reportError( _( "Missing ')'." ) );
264
265 return rule;
266}
267
268
270{
272 int value;
273 wxString msg;
274
275 T token = NextTok();
276
277 if( token == T_mechanical_clearance )
278 {
279 reportDeprecation( wxT( "mechanical_clearance" ), wxT( "physical_clearance" ) );
280 token = T_physical_clearance;
281 }
282 else if( token == T_mechanical_hole_clearance )
283 {
284 reportDeprecation( wxT( "mechanical_hole_clearance" ), wxT( "physical_hole_clearance" ) );
285 token = T_physical_hole_clearance;
286 }
287 else if( token == T_hole )
288 {
289 reportDeprecation( wxT( "hole" ), wxT( "hole_size" ) );
290 token = T_hole_size;
291 }
292 else if( (int) token == DSN_RIGHT || token == T_EOF )
293 {
294 msg.Printf( _( "Missing constraint type.| Expected %s." ),
295 wxT( "assertion, clearance, hole_clearance, edge_clearance, "
296 "physical_clearance, physical_hole_clearance, courtyard_clearance, "
297 "silk_clearance, hole_size, hole_to_hole, track_width, annular_width, "
298 "via_diameter, disallow, zone_connection, thermal_relief_gap, "
299 "thermal_spoke_width, min_resolved_spokes, length, skew, via_count, "
300 "diff_pair_gap or diff_pair_uncoupled" ) );
301 reportError( msg );
302 return;
303 }
304
305 switch( token )
306 {
307 case T_assertion: c.m_Type = ASSERTION_CONSTRAINT; break;
308 case T_clearance: c.m_Type = CLEARANCE_CONSTRAINT; break;
309 case T_hole_clearance: c.m_Type = HOLE_CLEARANCE_CONSTRAINT; break;
310 case T_edge_clearance: c.m_Type = EDGE_CLEARANCE_CONSTRAINT; break;
311 case T_hole_size: c.m_Type = HOLE_SIZE_CONSTRAINT; break;
312 case T_hole_to_hole: c.m_Type = HOLE_TO_HOLE_CONSTRAINT; break;
313 case T_courtyard_clearance: c.m_Type = COURTYARD_CLEARANCE_CONSTRAINT; break;
314 case T_silk_clearance: c.m_Type = SILK_CLEARANCE_CONSTRAINT; break;
315 case T_text_height: c.m_Type = TEXT_HEIGHT_CONSTRAINT; break;
316 case T_text_thickness: c.m_Type = TEXT_THICKNESS_CONSTRAINT; break;
317 case T_track_width: c.m_Type = TRACK_WIDTH_CONSTRAINT; break;
318 case T_connection_width: c.m_Type = CONNECTION_WIDTH_CONSTRAINT; break;
319 case T_annular_width: c.m_Type = ANNULAR_WIDTH_CONSTRAINT; break;
320 case T_via_diameter: c.m_Type = VIA_DIAMETER_CONSTRAINT; break;
321 case T_zone_connection: c.m_Type = ZONE_CONNECTION_CONSTRAINT; break;
322 case T_thermal_relief_gap: c.m_Type = THERMAL_RELIEF_GAP_CONSTRAINT; break;
323 case T_thermal_spoke_width: c.m_Type = THERMAL_SPOKE_WIDTH_CONSTRAINT; break;
324 case T_min_resolved_spokes: c.m_Type = MIN_RESOLVED_SPOKES_CONSTRAINT; break;
325 case T_disallow: c.m_Type = DISALLOW_CONSTRAINT; break;
326 case T_length: c.m_Type = LENGTH_CONSTRAINT; break;
327 case T_skew: c.m_Type = SKEW_CONSTRAINT; break;
328 case T_via_count: c.m_Type = VIA_COUNT_CONSTRAINT; break;
329 case T_diff_pair_gap: c.m_Type = DIFF_PAIR_GAP_CONSTRAINT; break;
330 case T_diff_pair_uncoupled: c.m_Type = MAX_UNCOUPLED_CONSTRAINT; break;
331 case T_physical_clearance: c.m_Type = PHYSICAL_CLEARANCE_CONSTRAINT; break;
332 case T_physical_hole_clearance: c.m_Type = PHYSICAL_HOLE_CLEARANCE_CONSTRAINT; break;
333 default:
334 msg.Printf( _( "Unrecognized item '%s'.| Expected %s." ), FromUTF8(),
335 wxT( "assertion, clearance, hole_clearance, edge_clearance, "
336 "physical_clearance, physical_hole_clearance, courtyard_clearance, "
337 "silk_clearance, hole_size, hole_to_hole, track_width, annular_width, "
338 "disallow, zone_connection, thermal_relief_gap, thermal_spoke_width, "
339 "min_resolved_spokes, length, skew, via_count, via_diameter, "
340 "diff_pair_gap or diff_pair_uncoupled" ) );
341 reportError( msg );
342 }
343
344 if( aRule->FindConstraint( c.m_Type ) )
345 {
346 msg.Printf( _( "Rule already has a '%s' constraint." ), FromUTF8() );
347 reportError( msg );
348 }
349
350 bool unitless = c.m_Type == VIA_COUNT_CONSTRAINT
352
353 if( c.m_Type == DISALLOW_CONSTRAINT )
354 {
355 for( token = NextTok(); token != T_RIGHT; token = NextTok() )
356 {
357 if( (int) token == DSN_STRING )
358 token = GetCurStrAsToken();
359
360 switch( token )
361 {
362 case T_track: c.m_DisallowFlags |= DRC_DISALLOW_TRACKS; break;
363 case T_via: c.m_DisallowFlags |= DRC_DISALLOW_VIAS; break;
364 case T_micro_via: c.m_DisallowFlags |= DRC_DISALLOW_MICRO_VIAS; break;
365 case T_buried_via: c.m_DisallowFlags |= DRC_DISALLOW_BB_VIAS; break;
366 case T_pad: c.m_DisallowFlags |= DRC_DISALLOW_PADS; break;
367 case T_zone: c.m_DisallowFlags |= DRC_DISALLOW_ZONES; break;
368 case T_text: c.m_DisallowFlags |= DRC_DISALLOW_TEXTS; break;
369 case T_graphic: c.m_DisallowFlags |= DRC_DISALLOW_GRAPHICS; break;
370 case T_hole: c.m_DisallowFlags |= DRC_DISALLOW_HOLES; break;
371 case T_footprint: c.m_DisallowFlags |= DRC_DISALLOW_FOOTPRINTS; break;
372
373 case T_EOF:
374 reportError( _( "Missing ')'." ) );
375 return;
376
377 default:
378 msg.Printf( _( "Unrecognized item '%s'.| Expected %s." ), FromUTF8(),
379 wxT( "track, via, micro_via, buried_via, pad, zone, text, graphic, "
380 "hole, or footprint." ) );
381 reportError( msg );
382 break;
383 }
384 }
385
386 if( (int) CurTok() != DSN_RIGHT )
387 reportError( _( "Missing ')'." ) );
388
389 aRule->AddConstraint( c );
390 return;
391 }
392 else if( c.m_Type == ZONE_CONNECTION_CONSTRAINT )
393 {
394 token = NextTok();
395
396 if( (int) token == DSN_STRING )
397 token = GetCurStrAsToken();
398
399 switch( token )
400 {
401 case T_solid: c.m_ZoneConnection = ZONE_CONNECTION::FULL; break;
402 case T_thermal_reliefs: c.m_ZoneConnection = ZONE_CONNECTION::THERMAL; break;
403 case T_none: c.m_ZoneConnection = ZONE_CONNECTION::NONE; break;
404
405 case T_EOF:
406 reportError( _( "Missing ')'." ) );
407 return;
408
409 default:
410 msg.Printf( _( "Unrecognized item '%s'.| Expected %s." ), FromUTF8(),
411 "solid, thermal_reliefs or none." );
412 reportError( msg );
413 break;
414 }
415
416 if( (int) NextTok() != DSN_RIGHT )
417 reportError( _( "Missing ')'." ) );
418
419 aRule->AddConstraint( c );
420 return;
421 }
423 {
424 // We don't use a min/max/opt structure here because it would give a strong implication
425 // that you could specify the optimal number of spokes. We don't want to open that door
426 // because the spoke generator is highly optimized around being able to "cheat" off of a
427 // cartesian coordinate system.
428
429 token = NextTok();
430
431 if( (int) token == DSN_NUMBER )
432 {
433 value = (int) strtol( CurText(), nullptr, 10 );
434 c.m_Value.SetMin( value );
435 }
436 else
437 {
438 reportError( _( "Expecting number." ) );
439 parseUnknown();
440 }
441
442 if( (int) NextTok() != DSN_RIGHT )
443 reportError( _( "Missing ')'." ) );
444
445 aRule->AddConstraint( c );
446 return;
447 }
448 else if( c.m_Type == ASSERTION_CONSTRAINT )
449 {
450 token = NextTok();
451
452 if( (int) token == DSN_RIGHT )
453 reportError( _( "Missing assertion expression." ) );
454
455 if( IsSymbol( token ) )
456 {
457 c.m_Test = new DRC_RULE_CONDITION( FromUTF8() );
458 c.m_Test->Compile( m_reporter, CurLineNumber(), CurOffset() );
459 }
460 else
461 {
462 msg.Printf( _( "Unrecognized item '%s'.| Expected quoted expression." ), FromUTF8() );
463 reportError( msg );
464 }
465
466 if( (int) NextTok() != DSN_RIGHT )
467 {
468 reportError( wxString::Format( _( "Unrecognized item '%s'." ), FromUTF8() ) );
469 parseUnknown();
470 }
471
472 aRule->AddConstraint( c );
473 return;
474 }
475
476 for( token = NextTok(); token != T_RIGHT && token != T_EOF; token = NextTok() )
477 {
478 if( token != T_LEFT )
479 reportError( _( "Missing '('." ) );
480
481 token = NextTok();
482
483 switch( token )
484 {
485 case T_min:
486 token = NextTok();
487
488 if( (int) token == DSN_RIGHT )
489 {
490 reportError( _( "Missing min value." ) );
491 break;
492 }
493
494 parseValueWithUnits( FromUTF8(), value, unitless );
495 c.m_Value.SetMin( value );
496
497 if( (int) NextTok() != DSN_RIGHT )
498 {
499 reportError( wxString::Format( _( "Unrecognized item '%s'." ), FromUTF8() ) );
500 parseUnknown();
501 }
502
503 break;
504
505 case T_max:
506 token = NextTok();
507
508 if( (int) token == DSN_RIGHT )
509 {
510 reportError( _( "Missing max value." ) );
511 break;
512 }
513
514 parseValueWithUnits( FromUTF8(), value, unitless );
515
516 c.m_Value.SetMax( value );
517
518 if( (int) NextTok() != DSN_RIGHT )
519 {
520 reportError( wxString::Format( _( "Unrecognized item '%s'." ), FromUTF8() ) );
521 parseUnknown();
522 }
523
524 break;
525
526 case T_opt:
527 token = NextTok();
528
529 if( (int) token == DSN_RIGHT )
530 {
531 reportError( _( "Missing opt value." ) );
532 break;
533 }
534
535 parseValueWithUnits( FromUTF8(), value, unitless );
536 c.m_Value.SetOpt( value );
537
538 if( (int) NextTok() != DSN_RIGHT )
539 {
540 reportError( wxString::Format( _( "Unrecognized item '%s'." ), FromUTF8() ) );
541 parseUnknown();
542 }
543
544 break;
545
546 case T_EOF:
547 reportError( _( "Incomplete statement." ) );
548 return;
549
550 default:
551 msg.Printf( _( "Unrecognized item '%s'.| Expected %s." ),
552 FromUTF8(),
553 wxT( "min, max, or opt" ) );
554 reportError( msg );
555 parseUnknown();
556 }
557 }
558
559 if( (int) CurTok() != DSN_RIGHT )
560 reportError( _( "Missing ')'." ) );
561
562 aRule->AddConstraint( c );
563}
564
565
566void DRC_RULES_PARSER::parseValueWithUnits( const wxString& aExpr, int& aResult, bool aUnitless )
567{
568 auto errorHandler = [&]( const wxString& aMessage, int aOffset )
569 {
570 wxString rest;
571 wxString first = aMessage.BeforeFirst( '|', &rest );
572
573 if( m_reporter )
574 {
575 wxString msg = wxString::Format( _( "ERROR: <a href='%d:%d'>%s</a>%s" ),
576 CurLineNumber(), CurOffset() + aOffset, first, rest );
577
579 }
580 else
581 {
582 wxString msg = wxString::Format( _( "ERROR: %s%s" ), first, rest );
583
584 THROW_PARSE_ERROR( msg, CurSource(), CurLine(), CurLineNumber(),
585 CurOffset() + aOffset );
586 }
587 };
588
591 evaluator.SetErrorCallback( errorHandler );
592
593 evaluator.Evaluate( aExpr );
594 aResult = evaluator.Result();
595}
596
597
599{
600 LSET retVal;
601 int token = NextTok();
602
603 if( (int) token == DSN_RIGHT )
604 {
605 reportError( _( "Missing layer name or type." ) );
606 return LSET::AllCuMask();
607 }
608 else if( token == T_outer )
609 {
610 retVal = LSET::ExternalCuMask();
611 }
612 else if( token == T_inner )
613 {
614 retVal = LSET::InternalCuMask();
615 }
616 else
617 {
618 wxString layerName = FromUTF8();
619 wxPGChoices& layerMap = ENUM_MAP<PCB_LAYER_ID>::Instance().Choices();
620
621 for( unsigned ii = 0; ii < layerMap.GetCount(); ++ii )
622 {
623 wxPGChoiceEntry& entry = layerMap[ii];
624
625 if( entry.GetText().Matches( layerName ) )
626 retVal.set( ToLAYER_ID( entry.GetValue() ) );
627 }
628
629 if( !retVal.any() )
630 {
631 reportError( wxString::Format( _( "Unrecognized layer '%s'." ), layerName ) );
632 retVal.set( Rescue );
633 }
634 }
635
636 if( (int) NextTok() != DSN_RIGHT )
637 {
638 reportError( wxString::Format( _( "Unrecognized item '%s'." ), FromUTF8() ) );
639 parseUnknown();
640 }
641
642 return retVal;
643}
644
645
647{
649 wxString msg;
650
651 T token = NextTok();
652
653 if( (int) token == DSN_RIGHT || token == T_EOF )
654 {
655 reportError( _( "Missing severity name." ) );
657 }
658
659 switch( token )
660 {
661 case T_ignore: retVal = RPT_SEVERITY_IGNORE; break;
662 case T_warning: retVal = RPT_SEVERITY_WARNING; break;
663 case T_error: retVal = RPT_SEVERITY_ERROR; break;
664 case T_exclusion: retVal = RPT_SEVERITY_EXCLUSION; break;
665
666 default:
667 msg.Printf( _( "Unrecognized item '%s'.| Expected %s." ),
668 FromUTF8(),
669 wxT( "ignore, warning, error, or exclusion" ) );
670 reportError( msg );
671 parseUnknown();
672 }
673
674 if( (int) NextTok() != DSN_RIGHT )
675 reportError( _( "Missing ')'." ) );
676
677 return retVal;
678}
BASE_SET & set(size_t pos=std::numeric_limits< size_t >::max(), bool value=true)
Definition: base_set.h:61
bool any() const
Definition: base_set.h:55
DRC_RULE_CONDITION * m_Test
Definition: drc_rule.h:176
int m_DisallowFlags
Definition: drc_rule.h:174
ZONE_CONNECTION m_ZoneConnection
Definition: drc_rule.h:175
MINOPTMAX< int > m_Value
Definition: drc_rule.h:173
DRC_CONSTRAINT_T m_Type
Definition: drc_rule.h:172
SEVERITY parseSeverity()
void parseValueWithUnits(const wxString &aExpr, int &aResult, bool aUnitless=false)
void Parse(std::vector< std::shared_ptr< DRC_RULE > > &aRules, REPORTER *aReporter)
REPORTER * m_reporter
std::shared_ptr< DRC_RULE > parseDRC_RULE()
void parseConstraint(DRC_RULE *aRule)
void reportError(const wxString &aMessage)
DRC_RULES_PARSER(const wxString &aSource, const wxString &aSourceDescr)
void reportDeprecation(const wxString &oldToken, const wxString newToken)
bool Compile(REPORTER *aReporter, int aSourceLine=0, int aSourceOffset=0)
void AddConstraint(DRC_CONSTRAINT &aConstraint)
Definition: drc_rule.cpp:60
std::optional< DRC_CONSTRAINT > FindConstraint(DRC_CONSTRAINT_T aType)
Definition: drc_rule.cpp:67
static ENUM_MAP< T > & Instance()
Definition: property.h:663
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:35
static LSET ExternalCuMask()
Return a mask holding the Front and Bottom layers.
Definition: lset.cpp:760
static LSET AllLayersMask()
Definition: lset.cpp:767
static LSET InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
Definition: lset.cpp:721
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:732
void SetMin(T v)
Definition: minoptmax.h:41
void SetOpt(T v)
Definition: minoptmax.h:43
void SetMax(T v)
Definition: minoptmax.h:42
bool Evaluate(const wxString &aExpr)
void SetErrorCallback(std::function< void(const wxString &aMessage, int aOffset)> aCallback)
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:71
virtual bool HasMessage() const =0
Returns true if the reporter client is non-empty.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
@ DRC_DISALLOW_PADS
Definition: drc_rule.h:84
@ DRC_DISALLOW_VIAS
Definition: drc_rule.h:80
@ DRC_DISALLOW_TEXTS
Definition: drc_rule.h:86
@ DRC_DISALLOW_ZONES
Definition: drc_rule.h:85
@ DRC_DISALLOW_HOLES
Definition: drc_rule.h:88
@ DRC_DISALLOW_GRAPHICS
Definition: drc_rule.h:87
@ DRC_DISALLOW_FOOTPRINTS
Definition: drc_rule.h:89
@ DRC_DISALLOW_TRACKS
Definition: drc_rule.h:83
@ DRC_DISALLOW_MICRO_VIAS
Definition: drc_rule.h:81
@ DRC_DISALLOW_BB_VIAS
Definition: drc_rule.h:82
@ ANNULAR_WIDTH_CONSTRAINT
Definition: drc_rule.h:58
@ COURTYARD_CLEARANCE_CONSTRAINT
Definition: drc_rule.h:53
@ VIA_DIAMETER_CONSTRAINT
Definition: drc_rule.h:64
@ ZONE_CONNECTION_CONSTRAINT
Definition: drc_rule.h:59
@ DIFF_PAIR_GAP_CONSTRAINT
Definition: drc_rule.h:67
@ DISALLOW_CONSTRAINT
Definition: drc_rule.h:63
@ TRACK_WIDTH_CONSTRAINT
Definition: drc_rule.h:57
@ SILK_CLEARANCE_CONSTRAINT
Definition: drc_rule.h:54
@ EDGE_CLEARANCE_CONSTRAINT
Definition: drc_rule.h:51
@ MIN_RESOLVED_SPOKES_CONSTRAINT
Definition: drc_rule.h:62
@ TEXT_THICKNESS_CONSTRAINT
Definition: drc_rule.h:56
@ LENGTH_CONSTRAINT
Definition: drc_rule.h:65
@ VIA_COUNT_CONSTRAINT
Definition: drc_rule.h:70
@ PHYSICAL_HOLE_CLEARANCE_CONSTRAINT
Definition: drc_rule.h:72
@ CLEARANCE_CONSTRAINT
Definition: drc_rule.h:48
@ THERMAL_SPOKE_WIDTH_CONSTRAINT
Definition: drc_rule.h:61
@ CONNECTION_WIDTH_CONSTRAINT
Definition: drc_rule.h:74
@ THERMAL_RELIEF_GAP_CONSTRAINT
Definition: drc_rule.h:60
@ MAX_UNCOUPLED_CONSTRAINT
Definition: drc_rule.h:68
@ ASSERTION_CONSTRAINT
Definition: drc_rule.h:73
@ SKEW_CONSTRAINT
Definition: drc_rule.h:66
@ HOLE_CLEARANCE_CONSTRAINT
Definition: drc_rule.h:49
@ HOLE_SIZE_CONSTRAINT
Definition: drc_rule.h:52
@ TEXT_HEIGHT_CONSTRAINT
Definition: drc_rule.h:55
@ PHYSICAL_CLEARANCE_CONSTRAINT
Definition: drc_rule.h:71
@ HOLE_TO_HOLE_CONSTRAINT
Definition: drc_rule.h:50
#define DRC_RULE_FILE_VERSION
@ DSN_RIGHT
Definition: dsnlexer.h:68
@ DSN_NUMBER
Definition: dsnlexer.h:67
@ DSN_STRING
Definition: dsnlexer.h:70
#define _(s)
#define THROW_PARSE_ERROR(aProblem, aSource, aInputLine, aLineNumber, aByteIndex)
Definition: ki_exception.h:165
@ Rescue
Definition: layer_ids.h:133
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:875
SEVERITY
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_UNDEFINED
@ RPT_SEVERITY_EXCLUSION
@ RPT_SEVERITY_IGNORE
@ RPT_SEVERITY_INFO