www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - DDoc shows $(DDOC_MEMBERS when parentheses are mismatched.

reply Don Clugston <dac nospam.com.au> writes:
I came up with a nice small test case (2 lines :) ).

--------------------------------
/// Mismatched brackets (
void func() {}
--------------------------------
Oct 27 2005
parent reply "Walter Bright" <newshound digitalmars.com> writes:
"Don Clugston" <dac nospam.com.au> wrote in message
news:djqi7j$1ruc$1 digitaldaemon.com...
 I came up with a nice small test case (2 lines :) ).

 --------------------------------
 /// Mismatched brackets (
 void func() {}
 --------------------------------
That's right. It's not a bug in Ddoc, though. You need to match the parens. To have mismatched ones, replace the mismatched ones with $(LPAREN) and $(RPAREN).
Oct 28 2005
parent reply Don Clugston <dac nospam.com.au> writes:
Walter Bright wrote:
 "Don Clugston" <dac nospam.com.au> wrote in message
 news:djqi7j$1ruc$1 digitaldaemon.com...
 
I came up with a nice small test case (2 lines :) ).

--------------------------------
/// Mismatched brackets (
void func() {}
--------------------------------
That's right. It's not a bug in Ddoc, though. You need to match the parens. To have mismatched ones, replace the mismatched ones with $(LPAREN) and $(RPAREN).
Agreed, the bug is in my comments. But DDoc doesn't help you much in tracking it down. The $(DDOC_MEMBERS shows up in front of the first function in the file, not above the function where the mismatch occured. It took me ages to work out what was causing it. It would be nice if DDoc produced an error message that was a bit less obscure. Ideally, an text output like 'DDOC ERROR: MISMATCHED PARENTHESES' appended to the end of any comment where sum[ ( ] - sum[)] is different at the beginning than at the end. Ideally with: mismatch = sum('(') - sum(')'); if (mimatch!=0) printf("DDOC ERROR: MISMATCHED PARENTHESES"); if (mismatch>0) for(int i=0; i!=mismatch; ++i) printf(")"); if (mismatch<0) for(int i=0; i!=mismatch; --i) printf("("); Not a big deal, but I wasted an hour on this.
Nov 02 2005
parent "Walter Bright" <newshound digitalmars.com> writes:
"Don Clugston" <dac nospam.com.au> wrote in message
news:dk9teq$2687$1 digitaldaemon.com...
 Walter Bright wrote:
 That's right. It's not a bug in Ddoc, though. You need to match the
parens.
 To have mismatched ones, replace the mismatched ones with $(LPAREN) and
 $(RPAREN).
Agreed, the bug is in my comments. But DDoc doesn't help you much in tracking it down. The $(DDOC_MEMBERS shows up in front of the first function in the file, not above the function where the mismatch occured. It took me ages to work out what was causing it. It would be nice if DDoc produced an error message that was a bit less obscure. Ideally, an text output like 'DDOC ERROR: MISMATCHED PARENTHESES' appended to the end of any comment where sum[ ( ] - sum[)] is different at the beginning than at the end. Ideally with: mismatch = sum('(') - sum(')'); if (mimatch!=0) printf("DDOC ERROR: MISMATCHED PARENTHESES"); if (mismatch>0) for(int i=0; i!=mismatch; ++i) printf(")"); if (mismatch<0) for(int i=0; i!=mismatch; --i) printf("("); Not a big deal, but I wasted an hour on this.
Sorry about that. But once you know it does that, it becomes a no-brainer to recognize it and fix it. For example, I use microemacs for my programmer text editor. It has an indispensible "match parentheses" command, and I use that to find the errant ) or (. The match parentheses also works for <>, [], {}, and even #if / #elif / #else / #endif.
Nov 05 2005