Next / Previous / Contents / Shipman's homepage

25. class Prefix: Band number prefix line

An object of this class contains the seven-character band number prefix that is available to fill out the band number of any following type n encounter line. For the format of this line, see the specification.

baseclasses.py
# - - - - -   c l a s s   P r e f i x   - - - - -

class Prefix:
    '''Represents one band number prefix line.

      Exports:
        Prefix(text):
          [ text is a string of exactly 7 characters ->
              return a new Prefix object with that text ]
        .text:     [ as passed to constructor, read-only ]
        Prefix.scanLine(scan):   # Static method
          [ scan is a Scan object ->
            just after a PREFIX_SYMBOL ->
              if (PREFIX_SYMBOL+the line in scan) is a valid
              band prefix line ->
                return a new Prefix object representing that
                line
              else ->
                Log()  +:=  error message(s)
                raise SyntaxError ]
    '''

25.1. Prefix.__init__(): Constructor

This trivial constructor just stores its argument in the instance.

baseclasses.py
# - - -   P r e f i x . _ _ i n i t _ _   - - -

    def __init__(self, text):
        '''Constructor for Prefix.
        '''
        self.text = text