Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions lib/yaml/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,10 @@ def check_key(self):

# KEY(block context): '?' (' '|'\n')
else:
return self.peek(1) in '\0 \t\r\n\x85\u2028\u2029'
if self.pointer + 1 < len(self.buffer):
return self.peek(1) in '\0 \t\r\n\x85\u2028\u2029'
else:
return self.peek() == '\0'

def check_value(self):

Expand All @@ -726,7 +729,10 @@ def check_value(self):

# VALUE(block context): ':' (' '|'\n')
else:
return self.peek(1) in '\0 \t\r\n\x85\u2028\u2029'
if self.pointer + 1 < len(self.buffer):
return self.peek(1) in '\0 \t\r\n\x85\u2028\u2029'
else:
return self.peek() == '\0'

def check_plain(self):

Expand Down Expand Up @@ -935,7 +941,10 @@ def scan_anchor(self, TokenClass):
def scan_tag(self):
# See the specification for details.
start_mark = self.get_mark()
ch = self.peek(1)
if self.pointer + 1 < len(self.buffer):
ch = self.peek(1)
else:
ch = self.peek()
if ch == '<':
handle = None
self.forward(2)
Expand Down Expand Up @@ -965,7 +974,10 @@ def scan_tag(self):
handle = '!'
self.forward()
suffix = self.scan_tag_uri('tag', start_mark)
ch = self.peek()
if self.pointer < len(self.buffer):
ch = self.peek()
else:
ch = '\0'
if ch not in '\0 \r\n\x85\u2028\u2029':
raise ScannerError("while scanning a tag", start_mark,
"expected ' ', but found %r" % ch, self.get_mark())
Expand Down