Mercurial > projects > dil
comparison trunk/src/dil/doc/Doc.d @ 731:ca7607226caa
Added new module cmd.DDoc.
Added command 'ddoc'.
Fixed scanArguments() in dil.doc.Macro.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sun, 03 Feb 2008 19:56:47 +0100 |
parents | 41cad5ca4863 |
children | f88b5285b86b |
comparison
equal
deleted
inserted
replaced
730:5cb236c6fe52 | 731:ca7607226caa |
---|---|
8 import dil.ast.Node; | 8 import dil.ast.Node; |
9 import dil.lexer.Funcs; | 9 import dil.lexer.Funcs; |
10 import dil.Unicode; | 10 import dil.Unicode; |
11 import common; | 11 import common; |
12 | 12 |
13 import tango.text.Ascii : toLower; | |
14 | |
13 class DDocComment | 15 class DDocComment |
14 { | 16 { |
15 Section[] sections; | 17 Section[] sections; |
16 Section summary; /// Optional summary section. | 18 Section summary; /// Optional summary section. |
17 Section description; /// Optional description section. | 19 Section description; /// Optional description section. |
20 { | 22 { |
21 this.sections = sections; | 23 this.sections = sections; |
22 this.summary = summary; | 24 this.summary = summary; |
23 this.description = description; | 25 this.description = description; |
24 } | 26 } |
27 | |
28 Section getCopyright() | |
29 { | |
30 foreach (section; sections) | |
31 if (toLower(section.name) == "copyright") | |
32 return section; | |
33 return null; | |
34 } | |
35 } | |
36 | |
37 /// Returns a node's DDocComment. | |
38 DDocComment getDDocComment(Node node) | |
39 { | |
40 DDocParser p; | |
41 p.parse(getDDocText(getDocTokens(node))); | |
42 return new DDocComment(p.sections, p.summary, p.description); | |
25 } | 43 } |
26 | 44 |
27 struct DDocParser | 45 struct DDocParser |
28 { | 46 { |
29 char* p; | 47 char* p; |
169 } | 187 } |
170 } | 188 } |
171 | 189 |
172 class MacrosSection : Section | 190 class MacrosSection : Section |
173 { | 191 { |
174 string[] macroNames; /// Parameter names. | 192 string[] macroNames; /// Macro names. |
175 string[] macroTexts; /// Parameter descriptions. | 193 string[] macroTexts; /// Macro texts. |
176 this(string name, string text) | 194 this(string name, string text) |
177 { | 195 { |
178 super(name, text); | 196 super(name, text); |
179 IdentValueParser parser; | 197 IdentValueParser parser; |
180 auto idvalues = parser.parse(text); | 198 auto idvalues = parser.parse(text); |