I've been writing a parser for a compiler and wish to trace the generated syntax objects' source locations. The documentation told me to simply replace lexer
with lexer-src-pos
. Doing so does make the procedure produce position-token
, but all the line
and col
fields of position
s are set to #f
. I've also tried an example distributed with parser-tools
package: calc
. The results are the same:
<pkgs>/parser-tools-lib/parser-tools/examples/calc> (calcl (open-input-string "1"))
(position-token (token 'NUM 1) (position 1 #f #f) (position 2 #f #f))
<pkgs>/parser-tools-lib/parser-tools/examples/calc>
What should I do to let it count lines automatically?