Ignore:
Timestamp:
05/22/06 15:49:54 (8 years ago)
Author:
xi
Message:

Revamp the inf/nan handling again.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pyyaml/trunk/lib/yaml/reader.py

    r136 r173  
    121121 
    122122    def peek(self, index=0): 
    123         if self.pointer+index+1 >= len(self.buffer): 
     123        try: 
     124            return self.buffer[self.pointer+index] 
     125        except IndexError: 
    124126            self.update(index+1) 
    125         return self.buffer[self.pointer+index] 
     127            return self.buffer[self.pointer+index] 
    126128 
    127129    def prefix(self, length=1): 
     
    133135        if self.pointer+length+1 >= len(self.buffer): 
    134136            self.update(length+1) 
    135         for k in range(length): 
     137        while length: 
    136138            ch = self.buffer[self.pointer] 
    137139            self.pointer += 1 
     
    143145            elif ch != u'\uFEFF': 
    144146                self.column += 1 
     147            length -= 1 
    145148 
    146149    def get_mark(self): 
Note: See TracChangeset for help on using the changeset viewer.