WYSIWYG string still limited

Swer swer at yoyocowo.com.nb
Sat Dec 15 13:28:35 PST 2007


"Kirk McDonald" <kirklin.mcdonald at gmail.com> Swer wrote:
> > The D 2.x series has already added a few new forms of string literals,
> including delimited strings. They look like this:
>
> q"(foo(xxx))"   // "foo(xxx)"
> q"[foo{]"       // "foo{"
> q"/foo"bar/"    // "foo\"bar"

hmm thats still not enough, and complex for compiler to implement. I 
modified my poposal as below:

const char [] code_demo = {{anystr{
 q"(foo(xxx))"   // "foo(xxx)"
 q"[foo{]"       // "foo{"
 q"/foo"bar/"    // "foo\"bar"
}anystr}}

or

const char [] code_demo = {{{
 q"(foo(xxx))"   // "foo(xxx)"
 q"[foo{]"       // "foo{"
 q"/foo"bar/"    // "foo\"bar"
}}}

if there is no }}} in text.

'anystr' can be replaced to any string you like. '{{'  '}}'  '{{{'  '}}}' 
are easier for compiler to detect.





More information about the Digitalmars-d mailing list