std.d.lexer requirements

Walter Bright newshound2 at digitalmars.com
Fri Aug 3 03:15:33 PDT 2012


On 8/3/2012 3:07 AM, Walter Bright wrote:
> On 8/3/2012 1:21 AM, Christophe Travert wrote:
>> This range does not have to be a string, it can be a something over a
>> file, stream, socket. It can also be the result of an algorithm, because
>> you *can* use algorithm on ranges of char, and it makes sense if you
>> know what you are doing.
>
> Correct, that's the whole point of using a range - it can come from anything.

For example, let's suppose we want to do D syntax highlighting in our IDE. It is 
highly unlikely that the text editor's data structure is a simple string. It's 
likely to be an array of lines, or something like that. It's simple to provide a 
range interface to that, where it presents the data structure as a sequence of 
chars.

But that wouldn't work with Jonathan's string specialization.

Nor would the string specialization work if the input was a 1024 byte file buffer.


More information about the Digitalmars-d mailing list