Fix some minor bugs in the spellchecker scanner.

This commit is contained in:
Eric S. Raymond 2008-11-03 04:51:15 +00:00
parent bfaf097c1d
commit 2dee5c7a2b

View file

@ -1156,7 +1156,7 @@ def spellcheck(fn, d):
for nav in WmlIterator(filename=fn):
# Recognize local spelling exceptions
if not nav.element and "#" in nav.text:
comment = nav.text[nav.text.index("#")-1:]
comment = nav.text[nav.text.index("#"):]
words = re.search("wmllint: local spellings? (.*)", comment)
if words:
for word in words.group(1).split():
@ -1172,8 +1172,7 @@ def spellcheck(fn, d):
value = value[1:].strip()
value = string_strip(value)
value = value.replace("...", " ")
#value = value.replace("_ ", " ")
#value = value.replace(" _", " ")
value = value.replace("''", "")
value = value.replace("female^", " ")
value = value.replace("male^", " ")
if '<' in value:
@ -1184,14 +1183,14 @@ def spellcheck(fn, d):
for token in value.split():
if d.check(token):
continue
while token and token[0] in " \t(`@*'":
while token and token[0] in " \t(`@*'_":
token = token[1:]
while token and token[-1] in "-*').,:;?!& \t":
while token and token[-1] in "_-*').,:;?!& \t":
token = token[:-1]
if token.startswith("$"):
continue
if token.startswith("%"):
continue
if token.startswith("$"):
continue
if token and token[0].isdigit():
continue
if not token:
@ -1209,6 +1208,7 @@ def spellcheck(fn, d):
continue
if re.match("[+-][0-9]", token):
continue
# Match various onomatopoetic exclamations of variable form
if re.match("hm+", token):
continue
if re.match("a+[ur]*g+h*", token):