(self, ins)
Return the value of a numeric literal (no leading blanks).
Return the value of a numeric literal (no leading blanks).
Return the value of a numeric literal ( no leading blanks ) .
def read_number_literal(self, ins):
        """Return the value of a numeric literal (no leading blanks)."""
        d = ins.peek()
        # number literals as ASCII are accepted in tokenised streams. only if they start with a figure (not & or .)
        # this happens e.g. after non-keywords like AS. They are not acceptable as line numbers.
        if d in DIGITS:
            return self._values.from_repr(ins.read_number(), allow_nonnum=False)
        # number literals
        elif d in tk.NUMBER:
            return self._values.from_token(ins.read_number_token())
        elif d == tk.T_UINT:
            # gw-basic allows adding line numbers to numbers
            # drop 0E token, interpret payload to unsigned integer
            value = struct.unpack('<bH', ins.read(3))[1]
            # we need to convert to single to ensure it is interpreted as the unsigned value
            return self._values.new_single().from_int(value)
        else:
            raise error.BASICError(error.STX)
def read_number_literal ( self , ins ) : d = ins . peek ( ) # number literals as ASCII are accepted in tokenised streams. only if they start with a figure (not & or .) # this happens e.g. after non-keywords like AS. They are not acceptable as line numbers. if d in DIGITS : return self . _values . from_repr ( ins . read_number ( ) , allow_nonnum = False ) # number literals elif d in tk . NUMBER : return self . _values . from_token ( ins . read_number_token ( ) ) elif d == tk . T_UINT : # gw-basic allows adding line numbers to numbers # drop 0E token, interpret payload to unsigned integer value = struct . unpack ( '<bH' , ins . read ( 3 ) ) [ 1 ] # we need to convert to single to ensure it is interpreted as the unsigned value return self . _values . new_single ( ) . from_int ( value ) else : raise error . BASICError ( error . STX )