[Issue 3554] Ddoc generats invalid output for documentation comments with non paired paranthasis

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 17 03:38:04 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3554



--- Comment #3 from Johannes Pfau <johannespfau at gmail.com> 2010-08-17 03:37:48 PDT ---
Created an attachment (id=720)
proposed patch

This patch fixes all occurrences of stray parenthesis which could be produced
by the user. This includes comment section bodies and headers. Basically with
this patch the user cannot break the ddoc output anymore. I emphasize 'user'
because the compiler can still break it. std.random shows one of these
examples: A function with an string default argument like this : = "(}". This
will still break the documentation output, but that's another issue and I'll
provide a fix for that soon.

What the path does is:
1. If there's a stray ( or ) in the comments, replace it with $(LPAREN ) /
$(RPAREN )
2. If the user has warnings enabled, emit a warning about the stray
parenthesis. The loc is set to the corresponding dsymbol location. More
detailed line information is not possible, because the parser does not pass
this info to the DocComment structure.

Note that automatically replacing the stray parenthesis is not the ultimate
solution, it just limits damage to the current section. For example:
"$(Test ) )" becomes  "$(Test ) $(LPAREN )" but you might want "$(Test $(LPAREN
) )". The compiler cannot know this. Therefore parenthesis should be escaped
manually if one needs stray parenthesis.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list