changeset 786:3b34f6a95a27

Added and revised documenation comments.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sun, 24 Feb 2008 02:41:11 +0100
parents 57ef69eced96
children 47c5099562c7
files trunk/src/cmd/Statistics.d trunk/src/common.d trunk/src/dil/CompilerInfo.d trunk/src/dil/Converter.d trunk/src/dil/Enums.d trunk/src/dil/FileBOM.d trunk/src/dil/HtmlEntities.d trunk/src/dil/Information.d trunk/src/dil/ast/Declaration.d trunk/src/dil/ast/DefaultVisitor.d trunk/src/dil/ast/Node.d trunk/src/dil/ast/NodesEnum.d trunk/src/dil/ast/Parameters.d trunk/src/dil/ast/Statement.d trunk/src/dil/doc/Doc.d trunk/src/dil/doc/Macro.d trunk/src/dil/doc/Parser.d trunk/src/dil/lexer/Funcs.d trunk/src/dil/lexer/IdTable.d trunk/src/dil/lexer/IdentsEnum.d trunk/src/dil/lexer/IdentsGenerator.d
diffstat 21 files changed, 146 insertions(+), 83 deletions(-) [+]
line wrap: on
line diff
--- a/trunk/src/cmd/Statistics.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/cmd/Statistics.d	Sun Feb 24 02:41:11 2008 +0100
@@ -12,12 +12,13 @@
 import dil.SourceText;
 import common;
 
+/// A group of statistics variables.
 struct Statistics
 {
   uint whitespaceCount; /// Counter for whitespace characters.
   uint wsTokenCount;    /// Counter for all whitespace tokens.
   uint keywordCount;    /// Counter for keywords.
-  uint identCount;      /// Counter for identifier.
+  uint identCount;      /// Counter for identifiers.
   uint numberCount;     /// Counter for number literals.
   uint commentCount;    /// Counter for comments.
   uint tokenCount;      /// Counter for all tokens produced by the Lexer.
@@ -52,6 +53,7 @@
   }
 }
 
+/// Executes the statistics command.
 void execute(string[] filePaths, bool printTokensTable, bool printNodesTable)
 {
   Statistics[] stats;
@@ -132,6 +134,7 @@
   }
 }
 
+/// Returns the statistics for a D source file.
 Statistics getStatistics(string filePath, bool printTokensTable, bool printNodesTable)
 {
   // Create a new record.
--- a/trunk/src/common.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/common.d	Sun Feb 24 02:41:11 2008 +0100
@@ -7,10 +7,12 @@
 public import tango.io.Stdout;
 public import tango.text.convert.Layout;
 
+/// String aliases.
 alias char[] string;
-alias wchar[] wstring;
-alias dchar[] dstring;
+alias wchar[] wstring; /// ditto
+alias dchar[] dstring; /// ditto
 
+/// Global formatter instance.
 static Layout!(char) Format;
 static this()
 {
--- a/trunk/src/dil/CompilerInfo.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/CompilerInfo.d	Sun Feb 24 02:41:11 2008 +0100
@@ -32,7 +32,7 @@
 const VERSION = FormatT!("%s.%s", VERSION_MAJOR, Pad!(VERSION_MINOR, 3));
 const VENDOR = "dil";
 
-/// Used in main help message.
+/// Used in the main help message.
 const COMPILED_WITH = __VENDOR__;
 /// ditto
 const COMPILED_VERSION = FormatT!("%s.%s", __VERSION__/1000, Pad!(__VERSION__%1000, 3));
@@ -42,11 +42,11 @@
 /// The global, default alignment size for struct fields.
 const DEFAULT_ALIGN_SIZE = 4;
 
+version(DDoc)
+  const PTR_SIZE = 0; /// The pointer size depending on the platform.
+else
 version(X86_64)
-{
   const PTR_SIZE = 8; /// Pointer size on 64-bit platforms.
-}
 else
-{
   const PTR_SIZE = 4; /// Pointer size on 32-bit platforms.
-}
+
--- a/trunk/src/dil/Converter.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/Converter.d	Sun Feb 24 02:41:11 2008 +0100
@@ -26,6 +26,7 @@
     return conv;
   }
 
+  /// Byte-swaps c.
   dchar swapBytes(dchar c)
   {
     return c = (c << 24) |
@@ -34,12 +35,14 @@
               (c >> 24);
   }
 
+  /// Byte-swaps c.
   wchar swapBytes(wchar c)
   {
     return (c << 8) | (c >> 8);
   }
 
-  wchar BEtoMachineDword(dchar c)
+  /// Swaps the bytes of c on a little-endian machine.
+  dchar BEtoMachineDword(dchar c)
   {
     version(LittleEndian)
       return swapBytes(c);
@@ -47,7 +50,8 @@
       return c;
   }
 
-  wchar LEtoMachineDword(dchar c)
+  /// Swaps the bytes of c on a big-endian machine.
+  dchar LEtoMachineDword(dchar c)
   {
     version(LittleEndian)
       return c;
@@ -55,6 +59,7 @@
       return swapBytes(c);
   }
 
+  /// Swaps the bytes of c on a little-endian machine.
   wchar BEtoMachineWord(wchar c)
   {
     version(LittleEndian)
@@ -63,6 +68,7 @@
       return c;
   }
 
+  /// Swaps the bytes of c on a big-endian machine.
   wchar LEtoMachineWord(wchar c)
   {
     version(LittleEndian)
@@ -71,6 +77,7 @@
       return swapBytes(c);
   }
 
+  /// Converts a UTF-32 text to UTF-8.
   char[] UTF32toUTF8(bool isBigEndian)(ubyte[] data)
   {
     if (data.length == 0)
@@ -109,9 +116,10 @@
     return result;
   }
 
-  alias UTF32toUTF8!(true) UTF32BEtoUTF8;
-  alias UTF32toUTF8!(false) UTF32LEtoUTF8;
+  alias UTF32toUTF8!(true) UTF32BEtoUTF8; /// Instantiation for UTF-32 BE.
+  alias UTF32toUTF8!(false) UTF32LEtoUTF8; /// Instantiation for UTF-32 LE.
 
+  /// Converts a UTF-16 text to UTF-8.
   char[] UTF16toUTF8(bool isBigEndian)(ubyte[] data)
   {
     if (data.length == 0)
@@ -170,9 +178,11 @@
     return result;
   }
 
-  alias UTF16toUTF8!(true) UTF16BEtoUTF8;
-  alias UTF16toUTF8!(false) UTF16LEtoUTF8;
+  alias UTF16toUTF8!(true) UTF16BEtoUTF8; /// Instantiation for UTF-16 BE.
+  alias UTF16toUTF8!(false) UTF16LEtoUTF8; /// Instantiation for UTF-16 LE.
 
+  /// Converts the text in data to UTF-8.
+  /// Leaves data unchanged if it is in UTF-8 already.
   char[] data2UTF8(ubyte[] data)
   {
     if (data.length == 0)
--- a/trunk/src/dil/Enums.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/Enums.d	Sun Feb 24 02:41:11 2008 +0100
@@ -6,6 +6,7 @@
 
 import common;
 
+/// Enumeration of storage classes.
 enum StorageClass
 {
   None         = 0,
@@ -27,6 +28,7 @@
   Variadic     = 1<<16,
 }
 
+/// Enumeration of protection attributes.
 enum Protection
 {
   None,
@@ -37,6 +39,7 @@
   Export/+    = 1<<4+/
 }
 
+/// Enumeration of linkage types.
 enum LinkageType
 {
   None,
@@ -48,6 +51,7 @@
   System
 }
 
+/// Returns the string for prot.
 string toString(Protection prot)
 {
   switch (prot)
@@ -89,7 +93,7 @@
   }
 }
 
-/// Returns the string . Any number of bits may be set.
+/// Returns the strings for stc. Any number of bits may be set.
 string[] toStrings(StorageClass stc)
 {
   string[] result;
@@ -99,6 +103,7 @@
   return result;
 }
 
+/// Returns the string for ltype.
 string toString(LinkageType ltype)
 {
   switch (ltype)
--- a/trunk/src/dil/FileBOM.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/FileBOM.d	Sun Feb 24 02:41:11 2008 +0100
@@ -5,7 +5,7 @@
 module dil.FileBOM;
 import common;
 
-/// Byte Order Mark
+/// Enumeration of byte order marks.
 enum BOM
 {
   None,    /// No BOM
@@ -16,6 +16,7 @@
   UTF32LE  /// UTF-32 Little Endian: FF FE 00 00
 }
 
+/// Looks at the first bytes of data and returns the corresponding BOM.
 BOM tellBOM(ubyte[] data)
 {
   BOM bom = BOM.None;
--- a/trunk/src/dil/HtmlEntities.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/HtmlEntities.d	Sun Feb 24 02:41:11 2008 +0100
@@ -6,12 +6,14 @@
 
 import common;
 
+/// A named HTML entity.
 struct Entity
 {
   char[] name;
-  uint value;
+  dchar value;
 }
 
+/// The table of named HTML entities.
 static const Entity[] namedEntities = [
   {"Aacute", '\u00C1'},
   {"aacute", '\u00E1'},
@@ -289,7 +291,7 @@
 char[] generateHashAndValueArrays()
 {
   uint[] hashes; // String hashes.
-  uint[] values; // Unicode codepoints.
+  dchar[] values; // Unicode codepoints.
   // Build arrays:
   foreach (entity; namedEntities)
   {
@@ -330,16 +332,19 @@
   return hashesText ~"\n"~ valuesText;
 }
 
-// Mixin:
-// private static const uint[] hashes;
-// private static const dchar[] values;
-mixin(generateHashAndValueArrays);
+version(DDoc)
+{
+  /// Table of hash values of the entities' names.
+  private static const uint[] hashes;
+  /// Table of Unicode codepoints.
+  private static const dchar[] values;
+}
+else
+  mixin(generateHashAndValueArrays);
 // pragma(msg, generateHashAndValueArrays());
 
-/++
-  Converts a named HTML entity into its equivalent Unicode codepoint.
-  Returns 0xFFFF if entity doesn't exist.
-+/
+/// Converts a named HTML entity into its equivalent Unicode codepoint.
+/// Returns: the entity's value or 0xFFFF if it doesn't exist.
 dchar entity2Unicode(char[] entity)
 {
   auto hash = stringToHash(entity);
--- a/trunk/src/dil/Information.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/Information.d	Sun Feb 24 02:41:11 2008 +0100
@@ -9,11 +9,13 @@
 
 public import dil.Location;
 
+/// Information that can be displayed to the user.
 class Information
 {
 
 }
 
+/// Collects information.
 class InfoManager
 {
   Information[] info;
@@ -34,6 +36,7 @@
   }
 }
 
+/// For reporting a problem in the compilation process.
 class Problem : Information
 {
   Location location;
@@ -47,6 +50,7 @@
     this.message = message;
   }
 
+  /// Returns the message.
   string getMsg()
   {
     return this.message;
@@ -73,6 +77,7 @@
   }
 }
 
+/// For reporting warnings.
 class Warning : Problem
 {
   this(Location location, string message)
@@ -81,6 +86,7 @@
   }
 }
 
+/// For reporting a compiler error.
 class Error : Problem
 {
   this(Location location, string message)
@@ -89,6 +95,7 @@
   }
 }
 
+/// An error reported by the Lexer.
 class LexerError : Error
 {
   this(Location location, string message)
@@ -97,6 +104,7 @@
   }
 }
 
+/// An error reported by the Parser.
 class ParserError : Error
 {
   this(Location location, string message)
@@ -105,6 +113,7 @@
   }
 }
 
+/// An error reported by a semantic analyzer.
 class SemanticError : Error
 {
   this(Location location, string message)
--- a/trunk/src/dil/ast/Declaration.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/ast/Declaration.d	Sun Feb 24 02:41:11 2008 +0100
@@ -17,7 +17,7 @@
   }
 
   // Members relevant to semantic phase.
-  StorageClass stc; /// The storage class of this declaration.
+  StorageClass stc; /// The storage classes of this declaration.
   Protection prot;  /// The protection attribute of this declaration.
 
   final bool isStatic()
--- a/trunk/src/dil/ast/DefaultVisitor.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/ast/DefaultVisitor.d	Sun Feb 24 02:41:11 2008 +0100
@@ -359,12 +359,14 @@
   char[] text;
   foreach (className; classNames)
     text ~= "private mixin .visitDefault!("~className~") _"~className~";\n"
-            "override returnType!(\""~className~"\") visit("~className~" node){return _"~className~".visitDefault(node);}\n";
+            "override returnType!(\""~className~"\") visit("~className~" node)"
+            "{return _"~className~".visitDefault(node);}\n";
   return text;
 }
 // pragma(msg, generateDefaultVisitMethods());
 
-/// This class provides default methods for traversing nodes in a syntax tree.
+/// This class provides default methods for
+/// traversing nodes and their sub-nodes.
 class DefaultVisitor : Visitor
 {
   // Comment out if too many errors are shown.
--- a/trunk/src/dil/ast/Node.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/ast/Node.d	Sun Feb 24 02:41:11 2008 +0100
@@ -9,7 +9,7 @@
 public import dil.lexer.Token;
 public import dil.ast.NodesEnum;
 
-/// The root class of all nodes that can form a D syntax tree.
+/// The root class of all D syntax tree elements.
 abstract class Node
 {
   NodeCategory category; /// The category of this node.
@@ -64,7 +64,7 @@
     children is null || addChildren(children);
   }
 
-  /// Returns a pointer to Class if this node can be cast to it.
+  /// Returns a reference to Class if this node can be cast to it.
   Class Is(Class)()
   {
     if (kind == mixin("NodeKind." ~ typeof(Class).stringof))
--- a/trunk/src/dil/ast/NodesEnum.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/ast/NodesEnum.d	Sun Feb 24 02:41:11 2008 +0100
@@ -222,7 +222,10 @@
 }
 // pragma(msg, generateNodeKindMembers());
 
-// enum NodeKind;
+version(DDoc)
+  /// The node kind identifies every class that inherits from Node.
+  enum NodeKind : ushort;
+else
 mixin(
   "enum NodeKind : ushort"
   "{"
--- a/trunk/src/dil/ast/Parameters.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/ast/Parameters.d	Sun Feb 24 02:41:11 2008 +0100
@@ -10,12 +10,13 @@
 import dil.lexer.Identifier;
 import dil.Enums;
 
+/// A function or foreach parameter.
 class Parameter : Node
 {
-  StorageClass stc;
-  TypeNode type;
-  Identifier* name;
-  Expression defValue;
+  StorageClass stc; /// The storage classes of the parameter.
+  TypeNode type; /// The parameter's type.
+  Identifier* name; /// The name of the parameter.
+  Expression defValue; /// The default initialization value.
 
   this(StorageClass stc, TypeNode type, Identifier* name, Expression defValue)
   {
@@ -31,26 +32,29 @@
     this.defValue = defValue;
   }
 
-  /// func(...) or func(int[] values ...)
-  bool isVariadic()
-  {
-    return !!(stc & StorageClass.Variadic);
-  }
-
-  /// func(int[] values ...)
+  /// Returns true if this is a D-style variadic parameter.
+  /// E.g.: func(int[] values ...)
   bool isDVariadic()
   {
     return isVariadic && !isCVariadic;
   }
 
-  /// func(...)
+  /// Returns true if this is a C-style variadic parameter.
+  /// E.g.: func(...)
   bool isCVariadic()
   {
     return stc == StorageClass.Variadic &&
            type is null && name is null;
   }
+
+  /// Returns true if this is a D- or C-style variadic parameter.
+  bool isVariadic()
+  {
+    return !!(stc & StorageClass.Variadic);
+  }
 }
 
+/// Array of parameters.
 class Parameters : Node
 {
   this()
@@ -80,6 +84,7 @@
 ~ Template parameters: ~
 ~~~~~~~~~~~~~~~~~~~~~~*/
 
+/// Abstract base class for all template parameters.
 abstract class TemplateParameter : Node
 {
   Identifier* ident;
@@ -90,6 +95,7 @@
   }
 }
 
+/// E.g.: (alias T)
 class TemplateAliasParameter : TemplateParameter
 {
   TypeNode specType, defType;
@@ -105,6 +111,7 @@
   }
 }
 
+/// E.g.: (T t)
 class TemplateTypeParameter : TemplateParameter
 {
   TypeNode specType, defType;
@@ -122,6 +129,7 @@
 
 // version(D2)
 // {
+/// E.g.: (this T)
 class TemplateThisParameter : TemplateParameter
 {
   TypeNode specType, defType;
@@ -138,6 +146,7 @@
 }
 // }
 
+/// E.g.: (T)
 class TemplateValueParameter : TemplateParameter
 {
   TypeNode valueType;
@@ -156,6 +165,7 @@
   }
 }
 
+/// E.g.: (T...)
 class TemplateTupleParameter : TemplateParameter
 {
   this(Identifier* ident)
@@ -166,6 +176,7 @@
   }
 }
 
+/// Array of template parameters.
 class TemplateParameters : Node
 {
   this()
@@ -185,6 +196,7 @@
   }
 }
 
+/// Array of template arguments.
 class TemplateArguments : Node
 {
   this()
--- a/trunk/src/dil/ast/Statement.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/ast/Statement.d	Sun Feb 24 02:41:11 2008 +0100
@@ -6,6 +6,7 @@
 
 import dil.ast.Node;
 
+/// The root class of all statements.
 abstract class Statement : Node
 {
   this()
--- a/trunk/src/dil/doc/Doc.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/doc/Doc.d	Sun Feb 24 02:41:11 2008 +0100
@@ -127,7 +127,7 @@
     return sections;
   }
 
-  /// Removes trailing whitespace characters from the text body.
+  /// Returns the text body. Trailing whitespace characters are not included.
   char[] textBody(char* begin, char* end)
   {
     // The body of A is empty, e.g.:
--- a/trunk/src/dil/doc/Macro.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/doc/Macro.d	Sun Feb 24 02:41:11 2008 +0100
@@ -30,9 +30,11 @@
 /// Macro definitions in the current table override the ones in the parent tables.
 class MacroTable
 {
+  /// The parent in the hierarchy. Or null if this is the root.
   MacroTable parent;
-  Macro[string] table;
+  Macro[string] table; /// The associative array that holds the macro definitions.
 
+  /// Constructs a MacroTable instance.
   this(MacroTable parent = null)
   {
     this.parent = parent;
--- a/trunk/src/dil/doc/Parser.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/doc/Parser.d	Sun Feb 24 02:41:11 2008 +0100
@@ -58,7 +58,7 @@
     return idvalues;
   }
 
-  /// Removes trailing whitespace characters from the text body.
+  /// Returns the text body. Trailing whitespace characters are not included.
   char[] textBody(char* begin, char* end)
   {
     // The body of A is empty, e.g.:
@@ -123,6 +123,7 @@
   }
 }
 
+/// Returns a string slice ranging from begin to end.
 char[] makeString(char* begin, char* end)
 {
   assert(begin && end && begin <= end);
--- a/trunk/src/dil/lexer/Funcs.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/lexer/Funcs.d	Sun Feb 24 02:41:11 2008 +0100
@@ -5,12 +5,12 @@
 module dil.lexer.Funcs;
 
 const char[3] LS = \u2028; /// Unicode line separator.
+const dchar LSd = 0x2028;  /// ditto
 const char[3] PS = \u2029; /// Unicode paragraph separator.
-const dchar LSd = 0x2028;
-const dchar PSd = 0x2029;
+const dchar PSd = 0x2029;  /// ditto
 static assert(LS[0] == PS[0] && LS[1] == PS[1]);
 
-const uint _Z_ = 26; /// Control+Z
+const dchar _Z_ = 26; /// Control+Z.
 
 /// Returns: true if d is a Unicode line or paragraph separator.
 bool isUnicodeNewlineChar(dchar d)
@@ -93,17 +93,18 @@
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 ];
 
+/// Enumeration of character property flags.
 enum CProperty
 {
-       Octal = 1,
-       Digit = 1<<1,
-         Hex = 1<<2,
-       Alpha = 1<<3,
-  Underscore = 1<<4,
-  Whitespace = 1<<5
+       Octal = 1,    /// 0-7
+       Digit = 1<<1, /// 0-9
+         Hex = 1<<2, /// 0-9a-fA-F
+       Alpha = 1<<3, /// a-zA-Z
+  Underscore = 1<<4, /// _
+  Whitespace = 1<<5  /// ' ' \t \v \f
 }
 
-const uint EVMask = 0xFF00; // Bit mask for escape value
+const uint EVMask = 0xFF00; // Bit mask for escape value.
 
 private alias CProperty CP;
 /// Returns: true if c is an octal digit.
--- a/trunk/src/dil/lexer/IdTable.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/lexer/IdTable.d	Sun Feb 24 02:41:11 2008 +0100
@@ -33,13 +33,11 @@
   /// A set of common, predefined identifiers for fast lookups.
   private Identifier*[string] staticTable;
   /// A table that grows with every newly found, unique identifier.
-  /// Access must be synchronized.
   private Identifier*[string] growingTable;
 
-  /// Initializes the static table.
+  /// Loads keywords and predefined identifiers into the static table.
   static this()
   {
-    // Load keywords and pre-defined identifiers into the static table.
     foreach (ref k; keywords)
       staticTable[k.str] = &k;
     foreach (id; Ident.allIds())
@@ -47,7 +45,7 @@
     staticTable.rehash;
   }
 
-  /// Looks in both tables.
+  /// Looks up idString in both tables.
   Identifier* lookup(string idString)
   {
     auto id = inStatic(idString);
@@ -56,7 +54,7 @@
     return inGrowing(idString);
   }
 
-  /// Look up idString in the static table.
+  /// Looks up idString in the static table.
   Identifier* inStatic(string idString)
   {
     auto id = idString in staticTable;
@@ -64,27 +62,27 @@
   }
 
   alias Identifier* function(string idString) LookupFunction;
-  /// Look up idString in the growing table.
+  /// Looks up idString in the growing table.
   LookupFunction inGrowing = &_inGrowing_unsafe; // Default to unsafe function.
 
-  /++
-    Set the thread safety mode of this table.
-    Call this function only if you can be sure
-    that this table is not being accessed
-    (like during lexing, parsing and semantic phase.)
-  +/
+  /// Sets the thread safety mode of the growing table.
   void setThreadsafe(bool b)
   {
     if (b)
-      IdTable.inGrowing = &_inGrowing_safe;
+      inGrowing = &_inGrowing_safe;
     else
-      IdTable.inGrowing = &_inGrowing_unsafe;
+      inGrowing = &_inGrowing_unsafe;
   }
 
-  /++
-    Returns the Identifier for idString.
-    Adds idString to the table if not found.
-  +/
+  /// Returns true if access to the growing table is thread-safe.
+  bool isThreadsafe()
+  {
+    return inGrowing is &_inGrowing_safe;
+  }
+
+  /// Looks up idString in the table.
+  ///
+  /// Adds idString to the table if not found.
   private Identifier* _inGrowing_unsafe(string idString)
   out(id)
   { assert(id !is null); }
@@ -98,11 +96,10 @@
     return newID;
   }
 
-  /++
-    Returns the Identifier for idString.
-    Adds idString to the table if not found.
-    Access to the data structure is synchronized.
-  +/
+  /// Looks up idString in the table.
+  ///
+  /// Adds idString to the table if not found.
+  /// Access to the data structure is synchronized.
   private Identifier* _inGrowing_safe(string idString)
   {
     synchronized
@@ -127,8 +124,13 @@
   }
   +/
 
-  static uint anonCount;
-  Identifier* genAnonymousID(char[] prefix)
+  static uint anonCount; /// Counter for anonymous identifiers.
+
+  /// Generates an anonymous identifier.
+  ///
+  /// Concatenates prefix with anonCount.
+  /// The identifier is not inserted into the table.
+  Identifier* genAnonymousID(string prefix)
   {
     ++anonCount;
     auto x = anonCount;
@@ -140,6 +142,7 @@
     return Identifier(prefix ~ num, TOK.Identifier);
   }
 
+  /// Generates an identifier for an anonymous enum.
   Identifier* genAnonEnumID()
   {
     return genAnonymousID("__anonenum");
--- a/trunk/src/dil/lexer/IdentsEnum.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/lexer/IdentsEnum.d	Sun Feb 24 02:41:11 2008 +0100
@@ -6,6 +6,9 @@
 
 import dil.lexer.IdentsGenerator;
 
+version(DDoc)
+  enum IDK : ushort; /// Enumeration of predefined identifier kinds.
+else
 mixin(
   // Enumerates predefined identifiers.
   "enum IDK : ushort {"
--- a/trunk/src/dil/lexer/IdentsGenerator.d	Sat Feb 23 21:15:56 2008 +0100
+++ b/trunk/src/dil/lexer/IdentsGenerator.d	Sun Feb 24 02:41:11 2008 +0100
@@ -11,7 +11,7 @@
   char[] idStr; /// In table.
 }
 
-/// Array of predefined identifiers.
+/// Table of predefined identifiers.
 static const StrPair[] identPairs = [
   // Predefined version identifiers:
   {"DigitalMars"}, {"X86"}, {"X86_64"},