fail and warn are painful, because they access the global clinic object (in order to fetch the current line number). We should really try to simplify this. A more pythonic way would IMO to just use exceptions. We could add a basal set of exceptions (parse errors, programming errors, converter error, etc.), and use these instead. For parse errors, we could catch these in the parser state machine, add the line number, and re-raise.
fail
andwarn
are painful, because they access the globalclinic
object (in order to fetch the current line number). We should really try to simplify this. A more pythonic way would IMO to just use exceptions. We could add a basal set of exceptions (parse errors, programming errors, converter error, etc.), and use these instead. For parse errors, we could catch these in the parser state machine, add the line number, and re-raise.