sdthompson1 / babylon

An experimental new programming language with verification features.
https://www.solarflare.org.uk/babylon
Other
1 stars 0 forks source link

Support more escape sequences e.g. "\r" in string literals #7

Closed sdthompson1 closed 2 months ago

sdthompson1 commented 4 months ago

Currently we can use "\n" in string literals and I think a few other escape sequences. However "\r" (at least) is not supported yet. (e.g. "\r" would be nice for web server programming, because HTTP headers are required to end in "\r\n".)

Have a look at what other languages (e.g. C) do for this, and copy them :)

sdthompson1 commented 2 months ago

Added most of the escape sequences from C. The following are now supported: \a \b \f \n \r \t \v \" \\. We also support \x12 for raw hex codes but this is slightly different from C in that it must be exactly two hex digits in length.