mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 18:23:15 +02:00
Report lexer issues through error reporter.
This commit is contained in:
parent
4b436fa573
commit
834c7bbe05
@ -671,7 +671,8 @@ L_read:
|
|||||||
|
|
||||||
// L_unterminated:
|
// L_unterminated:
|
||||||
wxString errtxt( _( "Un-terminated delimited string" ) );
|
wxString errtxt( _( "Un-terminated delimited string" ) );
|
||||||
THROW_PARSE_ERROR( errtxt, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
THROW_PARSE_ERROR( errtxt, CurSource(), CurLine(), CurLineNumber(),
|
||||||
|
cur - start + curText.length() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +70,8 @@ void PARSE_ERROR::init( const wxString& aProblem, const char* aThrowersFile,
|
|||||||
const wxString& aSource, const char* aInputLine, int aLineNumber,
|
const wxString& aSource, const char* aInputLine, int aLineNumber,
|
||||||
int aByteIndex )
|
int aByteIndex )
|
||||||
{
|
{
|
||||||
|
parseProblem = aProblem;
|
||||||
|
|
||||||
problem.Printf( _( "%s in \"%s\", line %d, offset %d" ),
|
problem.Printf( _( "%s in \"%s\", line %d, offset %d" ),
|
||||||
aProblem,
|
aProblem,
|
||||||
aSource,
|
aSource,
|
||||||
|
@ -154,8 +154,17 @@ struct PARSE_ERROR : public IO_ERROR
|
|||||||
|
|
||||||
~PARSE_ERROR() throw () {}
|
~PARSE_ERROR() throw () {}
|
||||||
|
|
||||||
|
const wxString ParseProblem() { return parseProblem; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PARSE_ERROR(): IO_ERROR(), lineNumber( 0 ), byteIndex( 0 ) {}
|
PARSE_ERROR() :
|
||||||
|
IO_ERROR(),
|
||||||
|
lineNumber( 0 ),
|
||||||
|
byteIndex( 0 )
|
||||||
|
{}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxString parseProblem;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -336,7 +336,13 @@ void PANEL_SETUP_RULES::OnCompile( wxCommandEvent& event )
|
|||||||
}
|
}
|
||||||
catch( PARSE_ERROR& pe )
|
catch( PARSE_ERROR& pe )
|
||||||
{
|
{
|
||||||
m_Parent->SetError( pe.What(), this, m_textEditor, pe.lineNumber, pe.byteIndex );
|
wxString msg = wxString::Format( _( "ERROR: <a href='%d:%d'>%s</a>%s" ),
|
||||||
|
pe.lineNumber,
|
||||||
|
pe.byteIndex,
|
||||||
|
pe.ParseProblem(),
|
||||||
|
wxEmptyString );
|
||||||
|
|
||||||
|
m_errorsReport->Report( msg, RPT_SEVERITY_ERROR );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_errorsReport->Flush();
|
m_errorsReport->Flush();
|
||||||
@ -404,20 +410,6 @@ bool PANEL_SETUP_RULES::TransferDataFromWindow()
|
|||||||
if( m_frame->Prj().IsNullProject() )
|
if( m_frame->Prj().IsNullProject() )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
std::vector<DRC_RULE*> dummyRules;
|
|
||||||
|
|
||||||
DRC_RULES_PARSER parser( m_textEditor->GetText(), _( "DRC rules" ) );
|
|
||||||
|
|
||||||
parser.Parse( dummyRules, m_errorsReport );
|
|
||||||
}
|
|
||||||
catch( PARSE_ERROR& pe )
|
|
||||||
{
|
|
||||||
m_Parent->SetError( pe.What(), this, m_textEditor, pe.lineNumber, pe.byteIndex );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString rulesFilepath = m_frame->GetDesignRulesPath();
|
wxString rulesFilepath = m_frame->GetDesignRulesPath();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
Loading…
x
Reference in New Issue
Block a user