The allowable content of this two-character field is any two characters. Technically, there should be only two digits, but banders will put other stuff here. See the specification.
# - - - - - c l a s s N o t e F i e l d - - - - -
class NoteField(FieldItem):
'''Represents a note number.
Exports: as inherited.
'''
Scans a note-number field. We don't care what's there, so long as it has the right length.
# - - - N o t e F i e l d . s c a n F i e l d - - -
@staticmethod
def scanField(encounter, scan, fieldName):
'''Scan a note-number field.
'''
#-- 1 --
# [ if the line in scan has at least NOTE_L characters ->
# scan := scan advanced NOTE_L
# text := next NOTE_L characters from scan, uppercased
# else ->
# Log() +:= error message
# raise SyntaxError ]
try:
text = scan.move(NOTE_L).upper()
except IndexError:
scan.syntax("Expecting a %d-digit note number." %
NOTE_L)
#-- 2 --
# [ encounter.(fieldName) := a new NoteField object with
# text=(text) ]
setattr(encounter, fieldName,
NoteField(encounter, text))