21. Scan.__init__(): The constructor
logscan.py
# - - - S c a n . _ _ i n i t _ _
def __init__ ( self, inFile, commentPrefix=None, callback=None ):
'''Constructor
'''
#-- 1 --
self.commentPrefix = commentPrefix
self.callback = callback
self.atEndFile = False
self.line = ""
self.rawLine = ""
self.lineNo = 0
self.pos = 0
self.__echoed = False
#-- 2 --
# [ if inFile is a string ->
# if inFile can be opened for reading ->
# self.fileName := inFile
# self.file := that file, so opened
# else -> raise IOError
# self.fileName = None
# self.file := inFile ]
self.__findInput ( inFile )
#-- 3 --
# [ if self.file is nonempty ->
# self.file := self.file advanced past the first line
# self := self with the first line positioned at
# the first character
# else ->
# self := self at end of file ]
self.nextLine()