Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Klaus via Digitalmars-d-learn
I mean when writing a D lexer, you necessarly reach the moment when you think: Oh no! is this feature just here to suck ?

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread H. S. Teoh via Digitalmars-d-learn
of the things I *like* about D, in fact. Nobody wants to manually parenthesize every quoted line with '...\n' when the program need to incorporate several pages of built-in help text, for example. Delimited strings are useful when writing code/text generators when you need to be able to use

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Philippe Sigaud via Digitalmars-d-learn
On Mon, Aug 11, 2014 at 10:09 PM, H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Mon, Aug 11, 2014 at 07:47:44PM +, Klaus via Digitalmars-d-learn wrote: I mean when writing a D lexer, you necessarly reach the moment when you think: Oh no! is this feature

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Aug 11, 2014 at 10:50:34PM +0200, Philippe Sigaud via Digitalmars-d-learn wrote: On Mon, Aug 11, 2014 at 10:09 PM, H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Mon, Aug 11, 2014 at 07:47:44PM +, Klaus via Digitalmars-d-learn wrote: I mean

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Klaus via Digitalmars-d-learn
heredocs every now and then when I need to embed long strings in my program. It's one of the things I *like* about D, in fact. Nobody wants to manually parenthesize every quoted line with '...\n' when the program need to incorporate several pages of built-in help text, for example. Delimited

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Philippe Sigaud via Digitalmars-d-learn
On Mon, Aug 11, 2014 at 10:58 PM, H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: In Flex, one way you can implement heredocs is to have a separate mode where the lexer is scanning for the ending string. So basically you have a sub-lexer that treats the heredoc as

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Brian Schott via Digitalmars-d-learn
On Monday, 11 August 2014 at 19:47:46 UTC, Klaus wrote: I mean when writing a D lexer, you necessarly reach the moment when you think: Oh no! is this feature just here to suck ? They are and they do.

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Brian Schott via Digitalmars-d-learn
On Monday, 11 August 2014 at 22:20:54 UTC, Brian Schott wrote: On Monday, 11 August 2014 at 19:47:46 UTC, Klaus wrote: I mean when writing a D lexer, you necessarly reach the moment when you think: Oh no! is this feature just here to suck ? They are and they do. Also, use this:

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Klaus via Digitalmars-d-learn
On Monday, 11 August 2014 at 22:24:28 UTC, Brian Schott wrote: On Monday, 11 August 2014 at 22:20:54 UTC, Brian Schott wrote: On Monday, 11 August 2014 at 19:47:46 UTC, Klaus wrote: I mean when writing a D lexer, you necessarly reach the moment when you think: Oh no! is this feature just

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Klaus via Digitalmars-d-learn
On Monday, 11 August 2014 at 22:56:27 UTC, Klaus wrote: On Monday, 11 August 2014 at 22:24:28 UTC, Brian Schott wrote: On Monday, 11 August 2014 at 22:20:54 UTC, Brian Schott wrote: On Monday, 11 August 2014 at 19:47:46 UTC, Klaus wrote: I mean when writing a D lexer, you necessarly reach the

Delimited strings

2012-02-14 Thread H. S. Teoh
I've finally got my lexer to the point where it can successfully tokenize /usr/include/d2/4.3.2/std/*.d. Yay! :-) Now I'm going back to fill in the gaps that still haven't been implemented yet. Among which are delimited strings. According to the online specs, delimited strings start with q

Re: Delimited strings

2012-02-14 Thread Timon Gehr
On 02/15/2012 01:38 AM, H. S. Teoh wrote: I've finally got my lexer to the point where it can successfully tokenize /usr/include/d2/4.3.2/std/*.d. Yay! :-) Now I'm going back to fill in the gaps that still haven't been implemented yet. Among which are delimited strings. According to the online

Re: Delimited strings

2012-02-14 Thread H. S. Teoh
On Wed, Feb 15, 2012 at 01:46:51AM +0100, Timon Gehr wrote: [...] No, qabca is illegal. The pattern is qidentifier string identifier (The terminating new line is kept, so the string in this case is string\n) I see. The online specs need to be clarified, then. [...] So does this mean

Re: Delimited strings

2012-02-14 Thread Timon Gehr
On 02/15/2012 02:03 AM, H. S. Teoh wrote: On Wed, Feb 15, 2012 at 01:46:51AM +0100, Timon Gehr wrote: [...] No, qabca is illegal. The pattern is qidentifier string identifier (The terminating new line is kept, so the string in this case is string\n) I see. The online specs need to be

Re: What are delimited strings good for?

2011-04-11 Thread Stewart Gordon
On 10/04/2011 21:51, Jonathan M Davis wrote: snip If that had been `something instead of 'something, _then_ the delimited string becomes useful, but given how rarely backticks are needed, it does seem rather odd to have delimited strings just for that. So, I definitely have to wonder why

What are delimited strings good for?

2011-04-10 Thread simendsjo
Ref http://digitalmars.com/d/2.0/lex.html What are some possible use cases for delimited strings? What is solved by having this in the language?

Re: What are delimited strings good for?

2011-04-10 Thread Jonathan M Davis
Ref http://digitalmars.com/d/2.0/lex.html What are some possible use cases for delimited strings? What is solved by having this in the language? It's probably so that you can still use characters that require escaping in the string without having to escape everywhere. WYSIWYGS don't allow

Re: What are delimited strings good for?

2011-04-10 Thread Spacen Jasset
On 10/04/2011 17:51, Jonathan M Davis wrote: Ref http://digitalmars.com/d/2.0/lex.html What are some possible use cases for delimited strings? What is solved by having this in the language? It's probably so that you can still use characters that require escaping in the string without having

Re: What are delimited strings good for?

2011-04-10 Thread Jonathan M Davis
On 10/04/2011 17:51, Jonathan M Davis wrote: Ref http://digitalmars.com/d/2.0/lex.html What are some possible use cases for delimited strings? What is solved by having this in the language? It's probably so that you can still use characters that require escaping in the string

Re: What are delimited strings good for?

2011-04-10 Thread Andrej Mitrovic
Are we forgetting the fact that using delimited strings allows us to have syntax highlighting in editors? E.g.: void stringParser(string str)() { mixin(str); } void main() { stringParser!(q{ int x = 1; int y = 2; writefln(%s %s, x, y); }); } This is a huge

Re: What are delimited strings good for?

2011-04-10 Thread simendsjo
On 10.04.2011 21:17, Andrej Mitrovic wrote: Are we forgetting the fact that using delimited strings allows us to have syntax highlighting in editors? E.g.: void stringParser(string str)() { mixin(str); } void main() { stringParser!(q{ int x = 1; int y = 2

Re: What are delimited strings good for?

2011-04-10 Thread Andrej Mitrovic
Hmm.. Well then, those I've never seen used before. :)

Re: What are delimited strings good for?

2011-04-10 Thread Ary Manzana
On 4/10/11 11:03 AM, simendsjo wrote: Ref http://digitalmars.com/d/2.0/lex.html What are some possible use cases for delimited strings? What is solved by having this in the language? Readability. auto s = This is 'something' that \could\ have been made easier to read; auto t = q

Re: What are delimited strings good for?

2011-04-10 Thread Jonathan M Davis
On 4/10/11 11:03 AM, simendsjo wrote: Ref http://digitalmars.com/d/2.0/lex.html What are some possible use cases for delimited strings? What is solved by having this in the language? Readability. auto s = This is 'something' that \could\ have been made easier to read; auto t

Re: What are delimited strings good for?

2011-04-10 Thread Ary Manzana
On 4/10/11 5:51 PM, Jonathan M Davis wrote: On 4/10/11 11:03 AM, simendsjo wrote: Ref http://digitalmars.com/d/2.0/lex.html What are some possible use cases for delimited strings? What is solved by having this in the language? Readability. auto s = This is 'something' that \could\ have been