PasDoc's autodoc |
Pasdoc Sources OverviewThis is the documentation of the pasdoc sources, intended for pasdoc developers. For user's documentation see [http://pasdoc.sourceforge.net/]. Contents: General overview of the data flow in pasdoc: ParsingTTokenizer reads the source file, and converts it to a series of TTokens. TScanner uses an underlying TTokenizer and also returns a series of TTokens, but in addition it understands and interprets $define, $ifdef and similar compiler directives. While TTokenizer simply returns all tokens, TScanner returns only those tokens that are not "$ifdefed out". E.g. if WIN32 is not defined then the TScanner returns only tokens " const LineEnding = {$ifdef WIN32} #13#10 {$else} #10 {$endif};
Finally TParser uses an underlying TScanner and interprets the series of tokens, as e.g. "here I see a declaration of variable Foo, of type Integer". The Parser stores everything it reads in a TPasUnit instance. If you ever wrote a program that interprets a text language, you will see that there is nothing special here: We have a lexer (TScanner, a simplified lexer in TTokenizer) and a parser (TParser). It is important to note that pasdoc's parser is somewhat unusual, compared to "normal" parsers that are used e.g. in Pascal compilers.
StoringThe unit PasDoc_Items provides a comfortable class hierarchy to store a parsed Pascal source tree. TPasUnit is a "root class" (container-wise), it contains references to all other items within a unit, every item is some instance of TPasItem. GeneratorsThe last link in the chain are the generators. A generator uses the stored TPasItem tree and generates the final documentation. The base abstract class for a generator is TDocGenerator, this provides some general mechanisms used by all generators. From TDocGenerator descend more specialized generator classes, like TGenericHTMLDocGenerator, THTMLDocGenerator, TTexDocGenerator and others. NotesNote that the parser and the generators do not communicate with each other directly. The parser stores things in the TPasItem tree. Generators read and process the TPasItem tree. So the parser cannot do any stupid thing like messing with some HTML-specific or LaTeX-specific issues of generating documentation. And the generator cannot deal with parsing Pascal source code. Actually, this makes the implementation of the generator independent enough to be used in other cases, e.g. to generate an "introduction" file for the final documentation, like the one you are reading right now. Generated by PasDoc 0.15.0. |