]> granicus.if.org Git - python/commitdiff
Added doubled word warnings.
authorRaymond Hettinger <python@rcn.com>
Mon, 25 Aug 2003 04:39:55 +0000 (04:39 +0000)
committerRaymond Hettinger <python@rcn.com>
Mon, 25 Aug 2003 04:39:55 +0000 (04:39 +0000)
Doc/ref/ref3.tex
Misc/NEWS
Tools/scripts/texcheck.py

index 36c8c3871a4d5cf66a7b4f9fb79772ff1bbd52fb..2ab1a0165b733fefa16098ad98faf013b442a6ba 100644 (file)
@@ -1740,7 +1740,7 @@ in a negative index); this is the customary handling of negative
 indexes by the built-in sequence types, and the \method{__*item__()}
 methods are expected to do this as well.  However, since they should
 already be doing that, negative indexes cannot be passed in; they must
-be be constrained to the bounds of the sequence before being passed to
+be constrained to the bounds of the sequence before being passed to
 the \method{__*item__()} methods.
 Calling \code{max(0, i)} conveniently returns the proper value.
 
index f6ea9a09176c9c3ec3abfef712e35c32ed52c1fa..cc2b858ff5feaa23b1bbe52be2ea63f2803ce40e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -55,6 +55,8 @@ Library
 Tools/Demos
 -----------
 
+- texcheck.py now detects double word errors.
+
 - md5sum.py mistakenly opened input files in text mode by default, a
   silent and dangerous change from previous releases.  It once again
   opens input files in binary mode by default.  The -t and -b flags
index 6da437061018690705af3194966da4eb09cbc639..68be4511d2533760ba6a02e2bfe1ca16fe8d8b21 100644 (file)
@@ -98,6 +98,7 @@ def checkit(source, opts, morecmds=[]):
 
     delimiters = re.compile(r'\\(begin|end){([_a-zA-Z]+)}|([()\[\]])')
     braces = re.compile(r'({)|(})')
+    doubledwords = re.compile(r'(\b[A-za-z]+\b) \b\1\b')
 
     openers = []                            # Stack of pending open delimiters
     bracestack = []                         # Stack of pending open braces
@@ -175,6 +176,8 @@ def checkit(source, opts, morecmds=[]):
         if 'e.g.' in line or 'i.e.' in line:
             print r'Style warning, avoid use of i.e or e.g. on line %d' % (lineno,)
 
+        for dw in doubledwords.findall(line):
+            print r'Doubled word warning.  "%s" on line %d' % (dw, lineno)
 
     lastline = lineno
     for lineno, symbol in openers: