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

43. Scan.fixed(): Parse a float constant

logscan.py
# - - -   S c a n . f i x e d

    def fixed ( self ):
        '''Parse a fixed-point constant.
        '''

For the regular expression used in this logic, see Section 8.6, “FLOAT_PATTERN.

logscan.py
        #-- 1 --
        # [ if the line in self starts with a string that matches
        #   FLOAT_PATTERN ->
        #       self  :=  self advanced past the match
        #       m  :=  a MatchObject representing the match
        #   else ->
        #       rawFloat  :=  None ]
        m = self.tabReMatch ( FLOAT_PATTERN )

        #-- 2 --
        if m is None:
            return None
        else:
            return float(m.group())