Re: [myhdl-list] " Error in user defined VHDL code" should show line, and column for err
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2010-07-04 10:44:26
|
Kevin Stanton wrote: > Perhaps I am oversimplifying a complex problem, but why couldn't a > filter function be written like this: > > def get_error_line_col(code_str, error_index, line_delimiter='\n'): The problem would be to get the 'index' in a simple, general way. Python's error messages are not standardized. Anyway, starting to parse Python's error messages to "improve" upon them in MyHDL is obviously the wrong way (it goes completely against MyHDL's minimalistic design philosophy). The correct way in principle is equally obvious: use a technique such that Python gives you a better error message. In fact, thinking about it, complex user-defined strings are used like templates, and a direct template approach may be much better. There is a whole array of templating solutions available, but the string.Template from the standard libary may be just fine, albeit less powerful than format strings. Jan -- Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com Python as a HDL: http://www.myhdl.org VHDL development, the modern way: http://www.sigasi.com Analog design automation: http://www.mephisto-da.com World-class digital design: http://www.easics.com |