[Python-checkins] CVS: python/dist/src/Lib pyclbr.py,1.22,1.23

Tim Peters tim_one@users.sourceforge.net
Wed, 24 Oct 2001 13:22:42 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv13797/python/Lib

Modified Files:
	pyclbr.py 
Log Message:
SF bug #473525 pyclbr broken
As the comments in the module implied, pyclbr was easily confused by
"strange stuff" inside single- (but not triple-) quoted strings.  It
isn't anymore.  Its behavior remains flaky in the presence of nested
functions and classes, though.
Bugfix candidate.


Index: pyclbr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pyclbr.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** pyclbr.py	2001/08/13 20:20:51	1.22
--- pyclbr.py	2001/10/24 20:22:40	1.23
***************
*** 30,38 ****
  
  BUGS
! - Continuation lines are not dealt with at all.
! - While triple-quoted strings won't confuse it, lines that look like
!   def, class, import or "from ... import" stmts inside backslash-continued
!   single-quoted strings are treated like code.  The expense of stopping
!   that isn't worth it.
  - Code that doesn't pass tabnanny or python -t will confuse it, unless
    you set the module TABWIDTH vrbl (default 8) to the correct tab width
--- 30,35 ----
  
  BUGS
! - Continuation lines are not dealt with at all, except inside strings.
! - Nested classes and functions can confuse it.
  - Code that doesn't pass tabnanny or python -t will confuse it, unless
    you set the module TABWIDTH vrbl (default 8) to the correct tab width
***************
*** 76,79 ****
--- 73,80 ----
                      )*
          '''
+ 
+     |   " [^"\\\n]* (?: \\. [^"\\\n]*)* "
+ 
+     |   ' [^'\\\n]* (?: \\. [^'\\\n]*)* '
      )