-
I'm integrating SystemRDL on a tool, and I'd like to capture RDL syntax error details (e.g. line number, mismatched symbol, etc). The exception raised by RDLCompiler.compile_file doesn't capture such details (it just includes the message 'Parse aborted due to previous errors'). Is there some workaround to capture these details? they are indeed printed directly on STDERR when the error takes place!... Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Correct that by default, the compiler prints all messages to the Extend the MessagePrinter class and customize with your own implementation. You can look at the default |
Beta Was this translation helpful? Give feedback.
Correct that by default, the compiler prints all messages to the
stderr
stream.However if you need to, you can override the
MessagePrinter
class that is used when creating theRDLCompiler
object.See the
message_printer
argument to the compiler's constructor: https://systemrdl-compiler.readthedocs.io/en/latest/api/compiler.html#systemrdl.RDLCompilerExtend the MessagePrinter class and customize with your own implementation.
You can look at the default
MessagePrinter
implementation for more guidance on how it works: https://github.com/SystemRDL/systemrdl-compiler/blob/master/systemrdl/messages.py#L41The
src_ref
object that is passed into the printer will provide file and line number cont…