[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

raw string literal reader extension

From: Daniel Llorens
Subject: raw string literal reader extension
Date: Sun, 12 Nov 2017 14:25:58 +0100


is a reader extension to be able to write string literals verbatim, without 
escapes. E.g. you can write

#R-(quotes " and escapes \ and newlines
           can " freely be used " here)-

where you'd normally need escapes:

"quotes \" and escapes \\ and newlines\n           can \" freely be used \" 

This comes in handy for docstrings, regexps, etc.

The delimiters are arbitrary strings (so - above). I took this from one of the 
varieties of C++ raw string literals [variant (6) in] as it seems to be the 
most flexible take. In other variants the delimiters are fixed, so one would 
still need to escape certain characters.

On the Scheme/Lisp side I'm not aware of anything standard, but a quick search 
shows stuff like or, where the delimiters are either 
single characters or certain delimiter pairs. It's trivial to modify the 
present extension to work in that way.

Anyway, I hope some of you can find this useful.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]