DDocHTMLEmitter

Traverses the syntax tree and writes DDoc macros to a string buffer.

Constructors

this
this(Module modul, MacroTable mtable, bool includeUndocumented, bool includePrivate, Diagnostics reportDiag, Highlighter tokenHL)

Constructs a DDocHTMLEmitter object.

Inherited Members

From DDocEmitter

text
CharArray text;

The buffer that is written to.

includeUndocumented
bool includeUndocumented;

Include undocumented symbols?

includePrivate
bool includePrivate;

Include symbols with private protection?

mtable
MacroTable mtable;

The macro table.

modul
Module modul;

The module.

tokenHL
Highlighter tokenHL;

The token highlighter.

reportDiag
Diagnostics reportDiag;

Collects problem messages.

astPrinter
ASTPrinter astPrinter;

Used to print Types/Expressions/etc.

codeExamplesCounter
uint codeExamplesCounter;

Counts code examples in comments. This is used to make the code lines targetable in HTML.

emit
char[] emit()

Entry method.

locationOf
Location locationOf(Token* t, cstring filePath = null)

Returns the location of t.

reportUndocumented
void reportUndocumented()

Reports an undocumented symbol.

reportEmptyComment
void reportEmptyComment()

Reports an empty comment.

reportDDocProblem
void reportDDocProblem(Location loc, DDocProblem.Kind kind, MID mid, ...)

Reports a problem.

reportParameters
void reportParameters(Parameters params)
void reportParameters(TemplateParameters params)

Reports a missing params section or undocumented parameters.

reportParameters
void reportParameters(Token* paramsBegin, Token*[] params)
isDDocFile
bool isDDocFile(Module mod)

Returns true if the source text starts with "Ddoc\n" (ignores letter case.)

getDDocText
cstring getDDocText(Module mod)

Returns the DDoc text of this module.

currentDecl
Node currentDecl;

The current declaration.

currentTParams
TemplateParameters currentTParams;

The template parameters of the current declaration.

parentFQN
cstring parentFQN;

Reflects the fully qualified name of the current symbol's parent.

fqnCount
uint[hash_t] fqnCount;

Counts symbols with the same FQN. This is useful for anchor names that require unique strings.

pushFQN
void pushFQN(cstring name)

Appends to parentFQN.

getSymbolFQN
cstring getSymbolFQN(cstring name)

Returns a unique, identifying string for the current symbol.

cmnt
DDocComment cmnt;

Current comment.

prevCmnt
DDocComment prevCmnt;

Previous comment in scope.

emptyCmnt
DDocComment emptyCmnt;

An empty comment. Used for undocumented symbols.

DDocScope
class DDocScope

Keeps track of previous comments in each scope.

cmntIsDitto
bool cmntIsDitto;

True if current comment is "ditto".

ddoc
bool ddoc(Declaration node)

Sets some members and returns true if a comment was found.

specialSections
string[hash_t] specialSections;

List of predefined, special sections.

writeComment
void writeComment()

Writes the DDoc comment to the text buffer.

writeCommentText
void writeCommentText(cstring comment)

Scans the comment text and:

  • skips HTML tags
  • escapes '<', '>' and '&' with named HTML entities
  • inserts $(DDOC_BLANKLINE) in place of '\n\n'
  • highlights the tokens in code sections
write
void write(char c)

Writes a character to the buffer.

write
void write(cstring[] strings...)

Writes an array of strings to the text buffer.

write
void write(Node n)

Writes a Node tree to the buffer.

writeHL
void writeHL(Token[] tokens)

Write highlighted tokens to the buffer.

writeParams
void writeParams(Parameters params)

Writes params to the text buffer.

writeTemplateParams
void writeTemplateParams()

Writes the current template parameters to the text buffer.

writeInheritanceList
void writeInheritanceList(BaseClassType[] bases)

Writes bases to the text buffer.

prevDeclOffset
size_t prevDeclOffset;

Offset at which to insert a declaration with a "ditto" comment.

DECL
void DECL(void delegate() dg, Declaration d, bool writeSemicolon = true)

Writes a declaration to the text buffer.

DESC
void DESC(void delegate() dg = null)

Wraps the DDOC_DECL_DD macro around the text written by dg(). Writes the comment before dg() is called.

currentSymbolParams
cstring currentSymbolParams;

Saves the attributes of the current symbol.

SYMBOL
void SYMBOL(cstring name, K kind, Declaration d)

Writes a symbol to the text buffer. E.g: $(DIL_SYMBOL scan, Lexer.scan, func, 229, 646);

symbolTree
DocSymbol[hash_t] symbolTree;

The symbols that will appear in the result document.

addSymbol
void addSymbol(cstring name, cstring fqn, K kind, Location begin, Location end)

Adds a symbol to the symbol tree.

MEMBERS
void MEMBERS(cstring kind, cstring name, D members)

Wraps the DDOC_kind_MEMBERS macro around the text written by visit(members).

writeClassOrInterface
void writeClassOrInterface(T d)

Writes a class or interface declaration.

writeStructOrUnion
void writeStructOrUnion(T d)

Writes a struct or union declaration.

writeAliasOrTypedef
void writeAliasOrTypedef(T d)

Writes an alias or typedef declaration.

SymbolAttributes
struct SymbolAttributes

All attributes a symbol can have.

currentAttributes
SymbolAttributes currentAttributes;

The attributes of the current symbol.

storeAttributes
void storeAttributes(Declaration d)

Stores the attributes of the current symbol.

writeAttributes
void writeAttributes(Declaration d)

Writes the attributes of a declaration in brackets.

Meta