www.digitalmars.com         C & C++   DMDScript  

D - BUG?

reply "Julio CÚsar Carrascal Urquijo" <adnoctum phreaker.net> writes:
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/
Oct 04 2003
parent reply "Walter" <walter digitalmars.com> writes:
"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>";
Oct 04 2003
next sibling parent reply Helmut Leitner <helmut.leitner chello.at> writes:
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
Oct 04 2003
parent "Christian Kaiser" <chk online.de> writes:
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

Oct 05 2003
prev sibling parent "Julio CÚsar Carrascal Urquijo" <adnoctum phreaker.net> writes:
 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.
Oct 05 2003