Skip to content

Commit

Permalink
Fixed bug in RecordParser. Now recognizes '\t' as a valid character
Browse files Browse the repository at this point in the history
for line continuations.
  • Loading branch information
jchang committed May 14, 2000
1 parent 209ea28 commit 5bd0668
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Bio/Medline/Medline.py
Expand Up @@ -278,7 +278,7 @@ def feed(self, handle, consumer):
def _scan_record(self, uhandle, consumer):
consumer.start_record()

prev_qualifier = ''
prev_qualifier = None
while 1:
line = uhandle.readline()
if is_blank_line(line):
Expand All @@ -289,15 +289,18 @@ def _scan_record(self, uhandle, consumer):
# tuberculosis).
# 1) qualifier + '-' + data
# 2) continuation, with just data


# Check to see if it's a continuation line.
qualifier = string.rstrip(line[:4])
if qualifier != '': # has a qualifier
if line[0] == '\t' or qualifier == '':
if prev_qualifier is None:
raise SyntaxError, "Continuation on first line\n%s" % line
qualifier = prev_qualifier
else:
# Make sure it contains a '-'
if line[4] != '-':
raise SyntaxError, \
"I don't understand the format of line %s" % line
else: # continuation line
qualifier = prev_qualifier
prev_qualifier = qualifier

try:
Expand Down

0 comments on commit 5bd0668

Please sign in to comment.