parser: Fix crash with latest PyYAML

There is a backwards-incompatible change in PyYAML that induces a crash
if `check_token()` is not called before `peek_token()`. See commit
a02d17a in PyYAML or https://github.com/yaml/pyyaml/pull/150.

Closes #105.
pull/110/head
Adrien Vergé 7 years ago
parent 36b4776778
commit 54f21c0514

@ -125,7 +125,8 @@ def token_or_comment_generator(buffer):
curr = yaml_loader.get_token() curr = yaml_loader.get_token()
while curr is not None: while curr is not None:
next = yaml_loader.get_token() next = yaml_loader.get_token()
nextnext = yaml_loader.peek_token() nextnext = (yaml_loader.peek_token()
if yaml_loader.check_token() else None)
yield Token(curr.start_mark.line + 1, curr, prev, next, nextnext) yield Token(curr.start_mark.line + 1, curr, prev, next, nextnext)

Loading…
Cancel
Save