[Lxr-dev] Re: [Lxr-general] LXR 09 and fortran
Brought to you by:
ajlittoz
From: Malcolm B. <ma...@br...> - 2002-01-14 15:11:33
|
Hi Paul, Paul Ogranovich wrote: > The question I have is about possibility of configuring LXR for > processing Fortran source. If I am not mistaken, I remember reading > _somewhere_ that version 09 either supports Fortran already or can > be configured to support it... Is this correct ? If the answer is "yes", > how do I configure LXR ? The answer is that theoretically all you need to support Fortran is in place, but the actual setup and testing of it has not been done. To explain in more detail, lxr uses the Exuberant Ctags program to find identifiers in source files. Ctags (http://sf.net/projects/ctags) does support Fortran, so that part is fine. Lxr has a perl module to interface to ctags called Generic.pm that is capable of handling every language that ctags can handle. Generic.pm is configured via the generic.conf file in lib/LXR/Lang with details of how to deal with the output of ctags for different languages. However, the relevant entries for Fortran have not yet been written into this file. So to make Fortran work with lxr, you would need to fill in the details in generic.conf. The required details are as follows: Fill in the 'langmap' variable. This is a hash with keys being language names and values being hashes. You would need to fill in the Fortran hash as follows: 'Fortran' => { 'reserved' => [ array of reserved words in Fortran ], 'spec' => [ Set of regexps to parse Fortran (see below) ], 'typemap' => { Hash mapping ctags type codes to strings, see ctags man page for details on what type codes it uses for Fortran, already filled in }, 'langid' => '4' } The typemap values have already been filled in in the latest CVS version. 'spec' is the slightly tricky one to write. The format is: 'token type', 'stat regexp', 'end regexp'. The token type is one of "atom", "string", "include" and "comment". You can ignore "atom", and the others are reasonably self-explanatory. For example, if strings are deliminated with double quotes, the entry would be: 'string', '"', '"' and for C style comments the entry is: 'comment', '/\*', '\*/' You can have as many of each token type as needed to find all the occurances (e.g. C++ has two comment entries for C and C++ style comments). The "include" token regexps should match the entire include directive, not just the included filename. Once generic.conf has been filled in, the only remaining configuration required is to associate the Fortran files with Generic.pm. This is done in lxr.conf, simply uncomment the existing line. That should be it - Fortran should now work for you. If you do get this working, please could you send the relevant patches to lxr-developer? Cheers, Malcolm > > Thanks for your help, > > Paul Ogranovich. > (pau...@ms...) > > _______________________________________________ > Lxr-general mailing list > Lxr...@li... > https://lists.sourceforge.net/lists/listinfo/lxr-general |