On SWI-prolog 8.1.0 I’m using phrase_from_file to parse a file.
When I detect an error I need to report the line number. Unfortunately line_count/2 reports the wrong number, apparently the last line of the last file compiled?
This used to work - or perhaps I’ve never advanced that many lines before realizing I can’t advance the parse and reporting the error? I describe using line_count/2 and phrase_from_file in the DCG tutorial. And the SimGen code was using it (though it might have been broken, we stopped work rather abruptly on it while I was in middle of some major work).
I hate to say it but line_count/2 with phrase_from_file has not been working for many months. I learned of it from your tutorial but after trying it, it did not work. I chalked it up to the tutorial being out of date and threaded my own line counter routines into the DCG. It would be nice if it did work, but I can manage without it.