More lexer questions

Jonathan M Davis jmdavisProg at gmx.com
Sat Feb 11 16:21:26 PST 2012


On Sunday, February 12, 2012 01:00:07 simendsjo wrote:
> Another thing.. Using /+ and +/ in strings gives unexpected results when
> commented out:
> /+
> auto a = "/+";
> +/
> everything from this point is commented out.
> 
> /+
> auto a = "+/";
> +/ // already terminated by the string value.
> 
> Is this a bug, or as designed? /++/ is meant to comment out code, so it
> would have been nice if it was able to handle this, but I guess it would
> complicate the lexer a great deal.

It's by design. Everything between /+ and +/ is a comment. It doesn't matter 
what it is. There's nothing special about " which would make it ignore the 
characters following it when looking for the +/ to end the comment.

- Jonathan M Davis


More information about the Digitalmars-d mailing list