chaos-lang / chaos

The Chaos Programming Language
https://chaos-lang.org
GNU General Public License v3.0
280 stars 17 forks source link

[Bug] Escape sequences not respected in echo/print of String literals in REPL #79

Closed naltun closed 3 years ago

naltun commented 3 years ago

Describe the bug echo and print do not respect escape sequences in String literals.

To Reproduce Steps to reproduce the behavior:

  1. Start the REPL
  2. Call echo or print with a string literal

Expected behavior The escape sequences should be respected.

Screenshots If applicable, add screenshots to help explain your problem.

image

Environment:

Additional context This is a REPL bug.

Here is a small program to demonstrate how this is not a bug when compiling:

/tmp $ cat hello.kaos
str a = "Hello\n\tWorld!"

echo a
print a

echo "Hello\n\tWorld!"
print "Hello\n\tWorld!"
/tmp $ ./build/hello
Hello
        World!Hello
        World!
Hello
        World!Hello
        World!
mertyildiran commented 3 years ago

@naltun it was actually not only a REPL bug but an interpreter bug in general. I've fixed it with https://github.com/chaos-lang/chaos/commit/8dc78d0e2fe030c89e2be1689cd54c3a27deb674