DMD 1.021 and 2.004 releases

Kirk McDonald kirklin.mcdonald at gmail.com
Wed Sep 12 02:35:40 PDT 2007


Aziz K. wrote:
> Kirk McDonald wrote:
> 
>> I would expect it to represent foo/bar, in the same way that  
>> q"(foo(bar))" represents foo(bar).
>>
> 
> '/' is not a nesting delimiter. I think q"/foo/bar/" should be scanned as:
> q"/foo/ // Error: expected '"' after closing delimiter. "foo" would be 
> the  actual value of the literal.
> bar // Identifier token
> / // Division token
> " // Start of a new, normal string literal

When I updated the Pygments lexer, I interpreted it like this: It sees 
q"/, and matches a string until it sees /".

As Pygments is merely a syntax highlighter, it is not really that 
important for it to correctly flag invalid code as erroneous. Obviously, 
it /should/ do so in the optimum case, and I may get around to fixing 
this at some point, but it would be nice for the lexical docs to be a 
little more clear on this subject. Primarily, I see no reason why 
q"/foo/bar/" shouldn't be scanned as the string foo/bar. (Though I 
hasten to add that I recognize we are speaking of edge-cases, probably 
of interest only to people writing D lexers.)

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



More information about the Digitalmars-d-announce mailing list