(self, default=None)
return step
Parse a value in a macro-language string.
Parse a value in a macro-language string.
Parse a value in a macro - language string .
def parse_number(self, default=None):
        """Parse a value in a macro-language string."""
        c = self.skip_blank()
        sgn = -1 if c == b'-' else 1
        if c in (b'+', b'-'):
            self.read(1)
            c = self.peek()
            # don't allow default if sign is given
            default = None
        if c == b'=':
            self.read(1)
            c = self.peek()
            if len(c) == 0:
                raise error.BASICError(error.IFC)
            elif ord(c) > 8:
                step = self._parse_variable().to_int()
                self.require_read((b';',), err=error.IFC)
            else:
                # varptr$
                step = self.memory.get_value_for_varptrstr(self.read(3)).to_int()
        elif c and c in DIGITS:
            step = self._parse_const()
        elif default is not None:
            step = default
        else:
            raise error.BASICError(error.IFC)
        if sgn == -1:
            step = -step  # pylint: disable=invalid-unary-operand-type
        return step
def parse_number ( self , default = None ) : c = self . skip_blank ( ) sgn = - 1 if c == b'-' else 1 if c in ( b'+' , b'-' ) : self . read ( 1 ) c = self . peek ( ) # don't allow default if sign is given default = None if c == b'=' : self . read ( 1 ) c = self . peek ( ) if len ( c ) == 0 : raise error . BASICError ( error . IFC ) elif ord ( c ) > 8 : step = self . _parse_variable ( ) . to_int ( ) self . require_read ( ( b';' , ) , err = error . IFC ) else : # varptr$ step = self . memory . get_value_for_varptrstr ( self . read ( 3 ) ) . to_int ( ) elif c and c in DIGITS : step = self . _parse_const ( ) elif default is not None : step = default else : raise error . BASICError ( error . IFC ) if sgn == - 1 : step = - step # pylint: disable=invalid-unary-operand-type return step