Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
October 05, 2003 BUG? | ||||
---|---|---|---|---|
| ||||
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 Re: BUG? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Julio César Carrascal Urquijo | "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 Re: BUG? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | 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 Re: BUG? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Helmut Leitner | 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 |
Copyright © 1999-2021 by the D Language Foundation