DMD 1.021 and 2.004 releases

Kirk McDonald kirklin.mcdonald at gmail.com
Tue Sep 11 00:26:47 PDT 2007


Chris Nicholson-Sauls wrote:
> Kirk McDonald wrote:
> 
>> Walter Bright wrote:
>>
>>> Kirk McDonald wrote:
>>>
>>>> Walter Bright wrote:
>>>>
>>>>> The more unusual feature is the token delimited strings.
>>>>
>>>>
>>>>
>>>> Which, since there's no nesting going on, are actually very easy to 
>>>> match. The Pygments lexer matches them with the following regex:
>>>>
>>>> q"([a-zA-Z_]\w*)\n.*?\n\1"
>>>
>>>
>>>
>>> I meant the:
>>>
>>>     q{ these must be valid D tokens { and brackets nest } /* ignore 
>>> this } */ };
>>>
>>
>> Those are also fairly easy. The Pygments lexer only highlights the 
>> opening q{ and the closing }. The tokens inside of the string are 
>> highlighted normally.
>>
>> Since this lexer is the one used by Dsource, I've thrown together a 
>> wiki page showing it off:
>>
>> http://www.dsource.org/projects/dsource/wiki/DelimitedStringHighlighting
>>
> 
> That's pretty danged nifty.  Any chance, however, that it could apply a 
> slight background color to the token string?
> 
> -- Chris Nicholson-Sauls

Not really. It would require defining a new token which highlights the 
background for every existing token, and then updating all of the styles 
to provide coloring for that background... Pygments simply isn't set up 
to do that kind of manipulation. In fact, it would even be harder to 
highlight the whole thing as a string, than to highlight it the way it 
is now. (Unless I simply ignored the limitation that its contents 
consist only of valid tokens.)

-- 
Kirk McDonald
http://kirkmcdonald.blogspot.com
Pyd: Connecting D and Python
http://pyd.dsource.org



More information about the Digitalmars-d-announce mailing list