Mercurial > projects > dil
comparison trunk/src/dil/doc/Doc.d @ 728:41cad5ca4863
Added ParamsSection and MacrosSection.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sat, 02 Feb 2008 23:17:14 +0100 |
parents | ceaac6a24258 |
children | ca7607226caa |
comparison
equal
deleted
inserted
replaced
727:c204b6a9e0ef | 728:41cad5ca4863 |
---|---|
2 Author: Aziz Köksal | 2 Author: Aziz Köksal |
3 License: GPL3 | 3 License: GPL3 |
4 +/ | 4 +/ |
5 module dil.doc.Doc; | 5 module dil.doc.Doc; |
6 | 6 |
7 import dil.doc.Parser; | |
7 import dil.ast.Node; | 8 import dil.ast.Node; |
8 import dil.lexer.Funcs; | 9 import dil.lexer.Funcs; |
9 import dil.Unicode; | 10 import dil.Unicode; |
10 import common; | 11 import common; |
11 | 12 |
147 this.name = name; | 148 this.name = name; |
148 this.text = text; | 149 this.text = text; |
149 } | 150 } |
150 } | 151 } |
151 | 152 |
152 char[] makeString(char* begin, char* end) | 153 class ParamsSection : Section |
153 { | 154 { |
154 return begin[0 .. end - begin]; | 155 string[] paramNames; /// Parameter names. |
156 string[] paramDescs; /// Parameter descriptions. | |
157 this(string name, string text) | |
158 { | |
159 super(name, text); | |
160 IdentValueParser parser; | |
161 auto idvalues = parser.parse(text); | |
162 this.paramNames = new string[idvalues.length]; | |
163 this.paramDescs = new string[idvalues.length]; | |
164 foreach (i, idvalue; idvalues) | |
165 { | |
166 this.paramNames[i] = idvalue.ident; | |
167 this.paramDescs[i] = idvalue.value; | |
168 } | |
169 } | |
170 } | |
171 | |
172 class MacrosSection : Section | |
173 { | |
174 string[] macroNames; /// Parameter names. | |
175 string[] macroTexts; /// Parameter descriptions. | |
176 this(string name, string text) | |
177 { | |
178 super(name, text); | |
179 IdentValueParser parser; | |
180 auto idvalues = parser.parse(text); | |
181 this.macroNames = new string[idvalues.length]; | |
182 this.macroTexts = new string[idvalues.length]; | |
183 foreach (i, idvalue; idvalues) | |
184 { | |
185 this.macroNames[i] = idvalue.ident; | |
186 this.macroTexts[i] = idvalue.value; | |
187 } | |
188 } | |
155 } | 189 } |
156 | 190 |
157 bool isDoxygenComment(Token* token) | 191 bool isDoxygenComment(Token* token) |
158 { // Doxygen: '/+!' '/*!' '//!' | 192 { // Doxygen: '/+!' '/*!' '//!' |
159 return token.kind == TOK.Comment && token.start[2] == '!'; | 193 return token.kind == TOK.Comment && token.start[2] == '!'; |
275 } | 309 } |
276 } | 310 } |
277 // Copy character. | 311 // Copy character. |
278 result[j++] = result[i]; | 312 result[j++] = result[i]; |
279 } | 313 } |
280 result.length = j; // Adjust length. | 314 result.length = j - 1; // Adjust length. -1 removes '\0'. |
281 // Lastly, strip trailing commentChars. | 315 // Lastly, strip trailing commentChars. |
282 i = result.length - (1 + 1); | 316 i = result.length; |
283 while (i && result[i] == commentChar) | 317 while (--i && result[i] == commentChar) |
284 { i--; } | 318 {} |
319 result.length = i + 1; | |
285 return result; | 320 return result; |
286 } | 321 } |