Improve parse error messages.

This commit is contained in:
Jeff Young 2020-05-25 01:15:08 +01:00
parent 90c4249de5
commit c415130de9
2 changed files with 6 additions and 4 deletions

View File

@ -419,7 +419,7 @@ int DSNLEXER::NeedSYMBOLorNUMBER()
{ {
int tok = NextTok(); int tok = NextTok();
if( !IsSymbol( tok ) && tok!=DSN_NUMBER ) if( !IsSymbol( tok ) && tok!=DSN_NUMBER )
Expecting( "symbol|number" ); Expecting( "a symbol or number" );
return tok; return tok;
} }
@ -430,7 +430,7 @@ int DSNLEXER::NeedNUMBER( const char* aExpectation )
if( tok != DSN_NUMBER ) if( tok != DSN_NUMBER )
{ {
wxString errText = wxString::Format( wxString errText = wxString::Format(
_( "need a NUMBER for \"%s\"" ), wxString::FromUTF8( aExpectation ).GetData() ); _( "need a number for '%s'" ), wxString::FromUTF8( aExpectation ).GetData() );
THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() ); THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
} }
return tok; return tok;

View File

@ -195,9 +195,11 @@ DRC_SELECTOR* DRC_RULES_PARSER::parseDRC_SELECTOR( wxString* aRuleName )
DRC_RULE* DRC_RULES_PARSER::parseDRC_RULE() DRC_RULE* DRC_RULES_PARSER::parseDRC_RULE()
{ {
DRC_RULE* rule = new DRC_RULE(); DRC_RULE* rule = new DRC_RULE();
T token; T token = NextTok();
if( !IsSymbol( token ) )
Expecting( "rule name" );
NeedSYMBOL();
rule->m_Name = FromUTF8(); rule->m_Name = FromUTF8();
for( token = NextTok(); token != T_RIGHT; token = NextTok() ) for( token = NextTok(); token != T_RIGHT; token = NextTok() )