[fpc-devel] FPDoc imports
Michael Van Canneyt
michael at freepascal.org
Wed Feb 1 21:09:49 CET 2012
On Wed, 1 Feb 2012, Hans-Peter Diettrich wrote:
> michael.vancanneyt at wisa.be schrieb:
>> Why do you need this ? You make it quite complicated.
>> All you need is a FindModule(Const AName,AFileHint : String) : TPasModule
>> call in TPasTreeContainer which must be overridden in a descendent (such as
>> TFPDocEngine). The default implementation returns nil.
>> This call can search the module list if it has one.
> But it does not have such a list :-(
It does not need it. A descendent that needs recursive parsing needs it.
Likewise, the FindElement returns nil.
Only the FPDoc engine implementation contains a search.
>> If it doesn't find it, it can then decide to parse it anyway and return the
>> just-parsed instance.
> This requires a list of the Inputs (compiler parameters), which only exists
> in TFPDocCreator. It also requires a list of units being or having been
> parsed. When a parser is started for a new unit, it doesn't return the
> created TPasModule until finished, so that TPasTreeContainer cannot tell
> whether FindModule addresses a module that has not been parsed yet, or one
> that already is being parsed, but not finished.
Correct. This needs to be done by descendants.
TPasTreeContainer itself and the parser class just need the hook.
>> All the parser needs to do is call FindModule whenever it encounters a unit
>> in a uses clause; The rest will happen then automagically.
> I found it much more complicated, after a look at the existing code.
Well, It took me about 15 lines to implement it in dglobals.pas of fpdoc.
I moved one function out of fpdocoptsxml to mkfpdoc to split the input line.
First tests work fine. See revision 20213.
More information about the fpc-devel