The design of GitHub - janestreet/sexplib: Automated S-expression conversion uses types:
type sexp = Atom of string | List of sexp list
This is great so far. I’m writing code that processes this, and I get to an invalid sexp. (I.e. not all valid sexps are valid data formats for me.)
I now want to extract a line number / column number so I can throw an useful exception. How do I do that ?
README.md mentions:
In most cases users may therefore want to use functions like
load_sexp_conv
orload_sexp_conv_exn
, which load s-expressions from files and convert them. They initially read the file without location annotations for performance reasons. Only if conversions fail will the file be reparsed with location annotations. Type errors can then be reported accurately with file name, line number, column, and file position.
But it is not obvious to me how to do that.
Thanks!