Next / Previous / Contents / TCC Help System / NM Tech homepage

27. Scan.msgKind(): General message writer

logscan.py
# - - -   S c a n . m s g K i n d

    def msgKind ( self, kind, *L ):
        '''General messages to Log().
        '''

If this is the first message for the current line, echo the line's content. If there is a callback, it is activated only when the line is first echoed.

logscan.py
        #-- 1 --
        # [ if self.__echoed is False ->
        #     self.__echoed  :=  True
        #     Log()  :=  (description of the current file position) +
        #         (result of self.callback, if any) + (self.rawLine)
        #   else -> I ]
        if not self.__echoed:
            if self.fileName:
                where = ( "File '%s', line %d" %
                          (self.fileName, self.lineNo) )
            else:
                where = ( "Line %d" % self.lineNo )

            if self.callback:
                where = "%s [%s]" % (where, self.callback(self))

            Log().write ( "\n--- ", where, "\n", self.rawLine )
            self.__echoed = True

        #-- 2 --
        # [ Log()  +:=  (a line pointing to self.pos) +
        #       (concatenation of elements of L) ]
        Log().write ( " "*self.pos, "^" )
        Log().msgKind ( kind, *L )