This method handles long tail, also known as the extended tail, of the MAPS 2004 protocol.
# - - - M a p s 2 0 0 4 E n c o u n t e r . s c a n L o n g T a i l - - -
def scanLongTail(self, scan):
'''Scan the extended tail section.
[ scan is a Scan object ->
if the line in scan is a valid extended tail) ->
scan := scan advanced to end of line
self := self with values from that tail stored
using attribute names from self.OUT_FIELD_LIST
return
else ->
scan := scan advanced not past end of line
Log() +:= error message(s)
raise SyntaxError ]
'''
Our current scan position is just past the LONG_TAIL_CUE character. The first part to scan
is the two-digit note number field. See Section 70.1, “NoteField.scanField()”.
#-- 1 --
# [ if the line in scan starts with a note-number field ->
# scan := scan advanced past that field
# self.(NOTE_ATTR) := that note number
# else ->
# Log() +:= error message
# raise SyntaxError ]
NoteField.scanField(self, scan, NOTE_ATTR)
Next up is the disposition code. This can be blank, in
which case we don't call DispositionField.scanField()—that method
does not accept a blank disposition code. See
Section 69.1, “DispositionField.scanField()”.
#-- 2 --
# [ if the line in scan starts with a space ->
# scan := scan advanced 1
# else if the line in scan starts with a disposition code ->
# scan := scan advanced past that code
# self.(DISPOSITION_ATTR) := that code
# else ->
# Log() +:= error message
# raise SyntaxError ]
if scan.tabMatch(' '):
pass
else:
DispositionField.scanField(self, scan,
DISPOSITION_ATTR)
What follows must be either ALIGNMENT_CHAR
or OLD_PULL_INPUT. We already have a
method that handles this: Section 76.4, “Maps2004Encounter.scanOldAlign():
Scan old alignment or feather-pulled field”.
#-- 3 --
# [ if the line in scan starts with ALIGNMENT_CHAR ->
# scan := scan advanced 1
# else if the line in scan starts with OLD_PULL_INPUT ->
# scan := scan advanced 1
# self.(PULLED_ATTR) := OLD_PULL_OUTPUT
# else ->
# Log() +:= error message
# raise SyntaxError ]
self.scanOldAlign(scan)
The line had better be exhausted here.
#-- 4 --
# [ if scan is at end of line ->
# I
# else ->
# Log() +:= error message
# raise SyntaxError ]
if not scan.atEndLine():
scan.syntax("Expecting end of line.")