Mercurial > projects > dil
comparison trunk/src/dil/doc/Macro.d @ 769:5e3ef1b2011c
Added and improved documentation.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sun, 17 Feb 2008 02:21:55 +0100 |
parents | 6efa938dbef7 |
children | 3b34f6a95a27 |
comparison
equal
deleted
inserted
replaced
768:d84349a60f5c | 769:5e3ef1b2011c |
---|---|
13 | 13 |
14 /// The DDoc macro class. | 14 /// The DDoc macro class. |
15 class Macro | 15 class Macro |
16 { | 16 { |
17 string name; /// The name of the macro. | 17 string name; /// The name of the macro. |
18 string text; /// Substitution text. | 18 string text; /// The substitution text. |
19 uint callLevel; /// Recursive call level. | 19 uint callLevel; /// Recursive call level. |
20 this (string name, string text) | 20 this (string name, string text) |
21 { | 21 { |
22 this.name = name; | 22 this.name = name; |
23 this.text = text; | 23 this.text = text; |
97 foreach (i, idvalue; idvalues) | 97 foreach (i, idvalue; idvalues) |
98 macros[i] = new Macro(idvalue.ident, idvalue.value); | 98 macros[i] = new Macro(idvalue.ident, idvalue.value); |
99 return macros; | 99 return macros; |
100 } | 100 } |
101 | 101 |
102 /// Scans for a macro invocation. E.g.: $(DDOC) | 102 /// Scans for a macro invocation. E.g.: $(DDOC) |
103 /// Returns: a pointer set to one char past the closing parenthesis, | 103 /// Returns: a pointer set to one char past the closing parenthesis, |
104 /// or null if this isn't a macro invocation. | 104 /// or null if this isn't a macro invocation. |
105 static char* scanMacro(char* p, char* textEnd) | 105 static char* scanMacro(char* p, char* textEnd) |
106 { | 106 { |
107 assert(*p == '$'); | 107 assert(*p == '$'); |
294 // Add last argument. | 294 // Add last argument. |
295 args ~= makeString(argBegin, p); | 295 args ~= makeString(argBegin, p); |
296 return arg0 ~ args; | 296 return arg0 ~ args; |
297 } | 297 } |
298 | 298 |
299 /// Expands "$ +", "$ 0" - "$ 9" with args[n] in text. | 299 /// Expands "$+", "$0" - "$9" with args[n] in text. |
300 /// Params: | 300 /// Params: |
301 /// text = the text to scan for argument placeholders. | 301 /// text = the text to scan for argument placeholders. |
302 /// args = the first element, args[0], is the whole argument string and | 302 /// args = the first element, args[0], is the whole argument string and |
303 /// the following elements are slices into it. | 303 /// the following elements are slices into it.$(BR) |
304 /// The array is empty if there are no arguments. | 304 /// The array is empty if there are no arguments. |
305 char[] expandArguments(char[] text, char[][] args) | 305 char[] expandArguments(char[] text, char[][] args) |
306 in { assert(args.length != 1, "zero or more than 1 args expected"); } | 306 in { assert(args.length != 1, "zero or more than 1 args expected"); } |
307 body | 307 body |
308 { | 308 { |