This method scans a type N (new band) encounter record. For the format of this record, see the specification.
# - - - B a s e E n c o u n t e r . s c a n N e w B a n d - - -
def scanNewBand(self, scan):
'''Scan a new-band encounter line.
[ scan is a Scan object ->
if CAPTURE_NEW_BAND + (line in scan) is a valid new
band encounter line in the context of self.compiler ->
scan := scan advanced to end of line
self := self with all fields from that line added
using names in self.OUT_FIELD_LIST
else ->
scan := scan advanced no further than end of line
Log() +:= error messages
raise SyntaxError ]
'''
First we parse the band number suffix. For that, we use a
class method of BandNoSuffix, which parses just
the suffix, but expands and stores the full band number.
See Section 33.1, “BandNoSuffix.scanField()”.
#-- 1 --
# [ if scan starts with a valid band number suffix in
# the context of self.compiler ->
# scan := scan advanced past that suffix
# self := self with the full band number stored in
# attribute BAND_NO_ATTR
# else ->
# Log() +:= error message
# raise SyntaxError ]
BandNoSuffix.scanField(self, scan, BAND_NO_ATTR)
The rest of the line consists of the body (fixed-field
part) and tail (free-format part); these are parsed by
Section 74.13, “BaseEncounter.scanBody(): Scan encounter
line body and tail sections”.
#-- 2 --
# [ if scan contains a valid encounter body and tail in
# the context of self ->
# scan := scan advanced to end of line
# self := self with all fields from that line added
# else ->
# Log() +:= error message(s)
# raise SyntaxError ]
self.scanBody(scan)