Thread overview
BUG?
Oct 05, 2003
Walter
Oct 05, 2003
Helmut Leitner
Oct 05, 2003
Christian Kaiser
October 05, 2003
According to documentation the following should work:

void main()
{
    char[] data = r"<p align="center">someText</p>";
}

but fails with:

test.d(3): semicolon expected, not 'center'
test.d(3): found '>someText</p>' when expecting ';'

I'm using DMD 0.73 on Windows


--
Julio César Carrascal Urquijo
http://www.artelogico.com/


October 05, 2003
"Julio César Carrascal Urquijo" <adnoctum@phreaker.net> wrote in message news:blnrue$24t4$1@digitaldaemon.com...
> According to documentation the following should work:
>
> void main()
> {
>     char[] data = r"<p align="center">someText</p>";
> }
>
> but fails with:
>
> test.d(3): semicolon expected, not 'center'
> test.d(3): found '>someText</p>' when expecting ';'
>
> I'm using DMD 0.73 on Windows

You can't have a " in an r"string". Write it as: "<p align=\"center\">someText</p>";


October 05, 2003

Walter wrote:
> 
> "Julio César Carrascal Urquijo" <adnoctum@phreaker.net> wrote in message news:blnrue$24t4$1@digitaldaemon.com...
> > According to documentation the following should work:
> >
> > void main()
> > {
> >     char[] data = r"<p align="center">someText</p>";
> > }
> >
> > but fails with:
> >
> > test.d(3): semicolon expected, not 'center'
> > test.d(3): found '>someText</p>' when expecting ';'
> >
> > I'm using DMD 0.73 on Windows
> 
> You can't have a " in an r"string". Write it as: "<p align=\"center\">someText</p>";

Would it be a problem to allow
   r'...............'
in addition to the existing
   r"..............."
as alternative syntax for wysiwig strings?

Using it the example became:
  char[] data = r'<p align="center">someText</p>';

It's not only good for HTML, but also be a blessing for
SQL programming, consider:

   cmd=r'SELECT .... WHERE customer="ThisName" ....;'

-- 
Helmut Leitner    leitner@hls.via.at
Graz, Austria   www.hls-software.com
October 05, 2003
May I cite the manual:

 An alternate form of wysiwyg strings are enclosed by backquotes, the `
character. The ` character is not available on some keyboards and the font
rendering of it is sometimes indistinguishable from the regular ' character.
Since, however, the ` is rarely used, it is useful to delineate strings with
" in them.
	`hello`
	`c:\root\foo.exe`
	`ab\n`			string is 4 characters, 'a', 'b', '\', 'n'
	Christian"Helmut Leitner" <helmut.leitner@chello.at> wrote in message
news:3F7FC110.9ABEE8D1@chello.at...
>
>
> Walter wrote:
> >
> > "Julio César Carrascal Urquijo" <adnoctum@phreaker.net> wrote in message news:blnrue$24t4$1@digitaldaemon.com...
> > > According to documentation the following should work:
> > >
> > > void main()
> > > {
> > >     char[] data = r"<p align="center">someText</p>";
> > > }
> > >
> > > but fails with:
> > >
> > > test.d(3): semicolon expected, not 'center'
> > > test.d(3): found '>someText</p>' when expecting ';'
> > >
> > > I'm using DMD 0.73 on Windows
> >
> > You can't have a " in an r"string". Write it as: "<p align=\"center\">someText</p>";
>
> Would it be a problem to allow
>    r'...............'
> in addition to the existing
>    r"..............."
> as alternative syntax for wysiwig strings?
>
> Using it the example became:
>   char[] data = r'<p align="center">someText</p>';
>
> It's not only good for HTML, but also be a blessing for
> SQL programming, consider:
>
>    cmd=r'SELECT .... WHERE customer="ThisName" ....;'
>
> -- 
> Helmut Leitner    leitner@hls.via.at
> Graz, Austria   www.hls-software.com


October 05, 2003
> You can't have a " in an r"string". Write it as: "<p align=\"center\">someText</p>";


That's right. I was so tired last night. Don't know what was I thinking.

I'm sorry.