Mercurial > projects > dil
changeset 728:41cad5ca4863
Added ParamsSection and MacrosSection.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sat, 02 Feb 2008 23:17:14 +0100 |
parents | c204b6a9e0ef |
children | ec8dd7b8bf0c |
files | trunk/src/dil/doc/Doc.d |
diffstat | 1 files changed, 41 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/trunk/src/dil/doc/Doc.d Sat Feb 02 22:51:20 2008 +0100 +++ b/trunk/src/dil/doc/Doc.d Sat Feb 02 23:17:14 2008 +0100 @@ -4,6 +4,7 @@ +/ module dil.doc.Doc; +import dil.doc.Parser; import dil.ast.Node; import dil.lexer.Funcs; import dil.Unicode; @@ -149,9 +150,42 @@ } } -char[] makeString(char* begin, char* end) +class ParamsSection : Section { - return begin[0 .. end - begin]; + string[] paramNames; /// Parameter names. + string[] paramDescs; /// Parameter descriptions. + this(string name, string text) + { + super(name, text); + IdentValueParser parser; + auto idvalues = parser.parse(text); + this.paramNames = new string[idvalues.length]; + this.paramDescs = new string[idvalues.length]; + foreach (i, idvalue; idvalues) + { + this.paramNames[i] = idvalue.ident; + this.paramDescs[i] = idvalue.value; + } + } +} + +class MacrosSection : Section +{ + string[] macroNames; /// Parameter names. + string[] macroTexts; /// Parameter descriptions. + this(string name, string text) + { + super(name, text); + IdentValueParser parser; + auto idvalues = parser.parse(text); + this.macroNames = new string[idvalues.length]; + this.macroTexts = new string[idvalues.length]; + foreach (i, idvalue; idvalues) + { + this.macroNames[i] = idvalue.ident; + this.macroTexts[i] = idvalue.value; + } + } } bool isDoxygenComment(Token* token) @@ -277,10 +311,11 @@ // Copy character. result[j++] = result[i]; } - result.length = j; // Adjust length. + result.length = j - 1; // Adjust length. -1 removes '\0'. // Lastly, strip trailing commentChars. - i = result.length - (1 + 1); - while (i && result[i] == commentChar) - { i--; } + i = result.length; + while (--i && result[i] == commentChar) + {} + result.length = i + 1; return result; }