mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Accept empty "(fp)" statements.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20002
This commit is contained in:
parent
f3050bd7ed
commit
70dfc9215d
@ -333,6 +333,12 @@ bool DSNLEXER::IsSymbol( int aTok )
|
||||
}
|
||||
|
||||
|
||||
bool DSNLEXER::IsNumber( int aTok )
|
||||
{
|
||||
return aTok == DSN_NUMBER;
|
||||
}
|
||||
|
||||
|
||||
void DSNLEXER::Expecting( int aTok ) const
|
||||
{
|
||||
wxString errText = wxString::Format( _( "Expecting %s" ), GetTokenString( aTok ) );
|
||||
@ -410,7 +416,7 @@ int DSNLEXER::NeedSYMBOLorNUMBER()
|
||||
{
|
||||
int tok = NextTok();
|
||||
|
||||
if( !IsSymbol( tok ) && tok!=DSN_NUMBER )
|
||||
if( !IsSymbol( tok ) && !IsNumber( tok ) )
|
||||
Expecting( "a symbol or number" );
|
||||
|
||||
return tok;
|
||||
@ -421,7 +427,7 @@ int DSNLEXER::NeedNUMBER( const char* aExpectation )
|
||||
{
|
||||
int tok = NextTok();
|
||||
|
||||
if( tok != DSN_NUMBER )
|
||||
if( !IsNumber( tok ) )
|
||||
{
|
||||
wxString errText = wxString::Format( _( "need a number for '%s'" ),
|
||||
wxString::FromUTF8( aExpectation ).GetData() );
|
||||
|
@ -332,6 +332,8 @@ public:
|
||||
*/
|
||||
static bool IsSymbol( int aTok );
|
||||
|
||||
static bool IsNumber( int aTok );
|
||||
|
||||
/**
|
||||
* Throw an #IO_ERROR exception with an input file specific error message.
|
||||
*
|
||||
|
@ -743,7 +743,15 @@ void KICAD_NETLIST_PARSER::parseLibPartList()
|
||||
if( token != T_fp )
|
||||
Expecting( T_fp );
|
||||
|
||||
NeedSYMBOLorNUMBER();
|
||||
token = NextTok();
|
||||
|
||||
// Accept an empty (fp) sexpr. We do write them out.
|
||||
if( token == T_RIGHT )
|
||||
continue;
|
||||
|
||||
if( !IsSymbol( token ) && !IsNumber( token ) )
|
||||
Expecting( "footprint ID" );
|
||||
|
||||
footprintFilters.Add( From_UTF8( CurText() ) );
|
||||
NeedRIGHT();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user