Mercurial > projects > dil
changeset 741:35184354a502
Added method textBody() to IdentValueParser.
Applied some fixes.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sat, 09 Feb 2008 16:18:53 +0100 |
parents | f3dead0310ce |
children | fc8f0e61bc42 |
files | trunk/src/cmd/DDoc.d trunk/src/dil/Unicode.d trunk/src/dil/doc/Macro.d trunk/src/dil/doc/Parser.d |
diffstat | 4 files changed, 24 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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();
--- 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)
--- 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
--- 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)