[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kdoc
Subject:    Problem with destructors
From:       Wolfgang Bangerth <Wolfgang.Bangerth () IWR ! Uni-Heidelberg ! De>
Date:       1999-12-01 10:39:50
[Download RAW message or body]


Hi there,
I have another patch, which fixes a problem with destructors. First the
patch (look at the first part, the second part is only a beautification
of output, but I thought I'd submit this anyway...):

*** kdoc.2	Wed Dec  1 11:01:02 1999
--- kdoc	Wed Dec  1 11:29:45 1999
***************
*** 610,616 ****
  		my $pure = $4 eq "" ? 0 : 1;
  
  		if ( $tpn =~ /((:?\S+::)?operator.*?)\s*$/ 	 # operator
! 				|| $tpn =~ /(~?[-\w:]+)\s*$/ ) { # normal
  			
  			my $name = $1;
  			$tpn = $`;
--- 610,616 ----
  		my $pure = $4 eq "" ? 0 : 1;
  
  		if ( $tpn =~ /((:?\S+::)?operator.*?)\s*$/ 	 # operator
! 				|| $tpn =~ /((?:::~)?[-\w:]+)\s*$/ ) { # normal
  			
  			my $name = $1;
  			$tpn = $`;
***************
*** 1094,1100 ****
  		# check if stuff before :: got into rettype by mistake.
  		$retType = $`;
  		($name = $1."::".$name);
! 		$name =~ s/\s+//g;
  		print "New name = \"$name\" and type = '$retType'\n"
  		    if $debug;
  	}
--- 1094,1100 ----
  		# check if stuff before :: got into rettype by mistake.
  		$retType = $`;
  		($name = $1."::".$name);
! 		$name =~ s/\s+/ /g;
  		print "New name = \"$name\" and type = '$retType'\n"
  		    if $debug;
  	}


When we have a destructor
   X::~X,
then the ~ at the beginning of the old regexp prevented the inclusion of
:: as for every other method. Maybe this was the reason for the inclusion
of the weird first 'if' in newMethod, which I never fully understood.
Anyway, if the :: was not included in the function name due to the ~, then
that block seems to have eaten everything right to the start of the line
(is there something that ([\w\s_<>,]+)\s*:: does not eat before the :: ??),
but in my example, that was not only the class name, but also 'inline' and
some 'template <class X>', so that the new function name ended up way too
long and incomprehensible to the following parts of kdoc.

Regards
  Wolfgang



Testcase:
  template <typename T>
  class SmartPointer
  {};

  template <typename T>
  SmartPointer<T>::~SmartPointer ()
  {};

Old output:
tmp/t> ../kdoc/kdoc-2.a22/bin/kdoc -a -p -D shorttest.h 
kdoc: processing shorttest.h
getRoot: call for CXX

Decl: </**
>

Decl: <template <typename T> class SmartPointer { >
Class: [template <typename T>]
        [class]
        [SmartPointer]
        [ ]
        [{]
ClassName: SmartPointer
newClass: Pushing Global

Decl: <}; >
end decl: popped Global

Decl: <template <typename T> void SmartPointer<T>::f ()  {}; >
Method: R+N:[template <typename T> void SmartPointer<T>::f ]
        P:[]
        []
Cracked: [template <typename T> void SmartPointer<T>] [::f]
        []
        [0]
lastLine: '{};
'
Decl: <template <typename T> SmartPointer<T>::~SmartPointer () {}; >
Method: R+N:[template <typename T> SmartPointer<T>::~SmartPointer ]
        P:[]
        []
New name = "template<typenameT>SmartPointer<T>::~SmartPointer" and type =
''
Cracked: [] [template<typenameT>SmartPointer<T>::~SmartPointer]
        []
        [0]
kdoc: Unidentified class: template<typenameT>SmartPointer<T> in
shorttest.h:17
lastLine: '{};
'Generating HTML documentation. 
Items in docQueue: 0 
Enter: SmartPointer
findRef: 5 calls, 0 iterations.

-------------------------------------------------------------------------
Wolfgang Bangerth          email: wolfgang.bangerth@iwr.uni-heidelberg.de
                             www: http://gaia.iwr.uni-heidelberg.de/~wolf

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic