diff options
author | Anthon van der Neut <anthon@mnt.org> | 2016-09-03 17:17:18 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2016-09-03 17:17:18 +0200 |
commit | c593474bea67a29bab8dcd8091962acc7693bf35 (patch) | |
tree | 8e84d3e1c4989fb835f3902b007b7c3019227956 /scanner.py | |
parent | 7de7006dce68990a9c82b44418f0e6dfcd8ad065 (diff) | |
download | ruamel.yaml-c593474bea67a29bab8dcd8091962acc7693bf35.tar.gz |
fix issue 36: gobbled empty lines in top-level mapping0.12.6
reported by Alex Harvey
Diffstat (limited to 'scanner.py')
-rw-r--r-- | scanner.py | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -1645,6 +1645,16 @@ class RoundTripScanner(Scanner): if self.scan_line_break(): if not self.flow_level: self.allow_simple_key = True + ch = self.peek() + if ch == '\n': # empty toplevel lines + start_mark = self.get_mark() + comment = '' + while ch: + ch = self.scan_line_break() + comment += ch + # print('ch', repr(comment)) + end_mark = self.get_mark() + return comment, start_mark, end_mark else: found = True |