Zulip Chat Archive

Stream: lean4

Topic: Incorrect escaping of \r ?


Siddharth Bhat (Oct 11 2021 at 13:06):

(deleted, moved to lean4)

Siddharth Bhat (Oct 11 2021 at 13:07):

The program below which uses \rf... parses strangely:

def main : IO Unit := do
    IO.eprintln $ "\rfailed at counter-example:"

on compiling, one gets the C compiler warning:

/home/bollu/temp$ lean escaper.lean
/home/bollu/temp$ lean escaper.lean -c escaper.c
/home/bollu/temp$ leanc escaper.c -o a.out
escaper.c: In function _init_l_main___closed__1:
escaper.c:23:54: warning: hex escape sequence out of range
   23 | x_1 = lean_mk_string("\x0dfailed at counter-example:");

And on running, one gets the string:

/home/bollu/temp$ ./a.out
iled at counter-example:

I would expect the program to print:

failed at counter-example

Leonardo de Moura (Oct 11 2021 at 13:15):

Thanks for reporting the issue. I am going to push a fix soon. The \t is also broken.

Leonardo de Moura (Oct 11 2021 at 13:18):

https://github.com/leanprover/lean4/commit/48a40c4d0a974e7f25565c09feb1536390a73c83


Last updated: Dec 20 2023 at 11:08 UTC