# HG changeset patch # User Aziz K?ksal # Date 1202570333 -3600 # Node ID 35184354a50233faea6e41b074e63f61316432ee # Parent f3dead0310ce20a483d91337ca4c64f930f1583b Added method textBody() to IdentValueParser. Applied some fixes. diff -r f3dead0310ce -r 35184354a502 trunk/src/cmd/DDoc.d --- a/trunk/src/cmd/DDoc.d Sat Feb 09 15:10:13 2008 +0100 +++ b/trunk/src/cmd/DDoc.d Sat Feb 09 16:18:53 2008 +0100 @@ -215,7 +215,7 @@ auto ps = new ParamsSection(s.name, s.text); write("\n$(DDOC_PARAMS "); foreach (i, paramName; ps.paramNames) - write("$(DDOC_PARAM_ROW ", + write("\n$(DDOC_PARAM_ROW ", "$(DDOC_PARAM_ID ", paramName, ")", "$(DDOC_PARAM_DESC ", ps.paramDescs[i], ")", ")"); @@ -254,9 +254,9 @@ void writeFuncHeader(Declaration d, FuncBodyStatement s) { auto begin = d.begin; - auto end = d.end.prev; + auto end = d.end.prevNWS; if (!s.isEmpty) - end = s.begin.prev; + end = s.begin.prevNWS; text ~= textSpan(begin, end); } @@ -395,7 +395,7 @@ DECL({ write("template "); SYMBOL(d.name.str); - write(textSpan(d.begin.next.next, d.decls.begin.prev)); + write(textSpan(d.begin.nextNWS.nextNWS, d.decls.begin.prevNWS)); }); DESC({ writeComment(); diff -r f3dead0310ce -r 35184354a502 trunk/src/dil/Unicode.d --- a/trunk/src/dil/Unicode.d Sat Feb 09 15:10:13 2008 +0100 +++ b/trunk/src/dil/Unicode.d Sat Feb 09 16:18:53 2008 +0100 @@ -21,8 +21,8 @@ } /++ - Returns true if this is one of the There are a total of 66 noncharacters. + Returns: true if this is one of them. See_also: Chapter 16.7 Noncharacters in Unicode 5.0 +/ bool isNoncharacter(dchar d) diff -r f3dead0310ce -r 35184354a502 trunk/src/dil/doc/Macro.d --- a/trunk/src/dil/doc/Macro.d Sat Feb 09 15:10:13 2008 +0100 +++ b/trunk/src/dil/doc/Macro.d Sat Feb 09 16:18:53 2008 +0100 @@ -137,7 +137,7 @@ } /// Scans until the closing ')' is found. -/// Returns [$0, $1, $2 ...]. +/// Returns: [$0, $1, $2 ...]. char[][] scanArguments(ref char* p, char* textEnd) out(args) { assert(args.length != 1); } body diff -r f3dead0310ce -r 35184354a502 trunk/src/dil/doc/Parser.d --- a/trunk/src/dil/doc/Parser.d Sat Feb 09 15:10:13 2008 +0100 +++ b/trunk/src/dil/doc/Parser.d Sat Feb 09 16:18:53 2008 +0100 @@ -46,15 +46,31 @@ // Continue. while (findNextIdent(nextIdent, nextBodyBegin)) { - idvalues ~= new IdentValue(ident, makeString(bodyBegin, nextIdent.ptr)); + idvalues ~= new IdentValue(ident, textBody(bodyBegin, nextIdent.ptr)); ident = nextIdent; bodyBegin = nextBodyBegin; } // Add last ident value. - idvalues ~= new IdentValue(ident, makeString(bodyBegin, textEnd)); + idvalues ~= new IdentValue(ident, textBody(bodyBegin, textEnd)); return idvalues; } + /// Removes trailing whitespace characters from the text body. + char[] textBody(char* begin, char* end) + { + // The body of A is empty, e.g.: + // A = + // B = some text + // ^- begin and end point to B (or to this.textEnd in the 2nd case.) + if (begin is end) + return null; + // Remove trailing whitespace. + while (isspace(*--end) || *end == '\n') + {} + end++; + return makeString(begin, end); + } + bool findNextIdent(ref string ident, ref char* bodyBegin) { while (p < textEnd)