summaryrefslogtreecommitdiff
path: root/scanner.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2023-05-06 12:29:03 +0200
committerAnthon van der Neut <anthon@mnt.org>2023-05-06 12:29:03 +0200
commita7e27772f48e9e7f1040344739f680081da50a41 (patch)
tree0887b210272f81e1a01e6404e1e1aac25e4558f3 /scanner.py
parenta4e09a2ba0d2adb1b2e63b6bf8fa39c055b9c99b (diff)
downloadruamel.yaml-a7e27772f48e9e7f1040344739f680081da50a41.tar.gz
fix issue: 453, 4470.17.24
Diffstat (limited to 'scanner.py')
-rw-r--r--scanner.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/scanner.py b/scanner.py
index 2bc199f..c09ae9c 100644
--- a/scanner.py
+++ b/scanner.py
@@ -822,8 +822,9 @@ class Scanner:
srf()
found = False
_the_end = _THE_END
+ white_space = ' \t' if self.flow_level > 0 else ' '
while not found:
- while srp() == ' ':
+ while srp() in white_space:
srf()
if srp() == '#':
while srp() not in _the_end:
@@ -1837,14 +1838,14 @@ class RoundTripScanner(Scanner):
# We also need to add the check for `allow_simple_keys == True` to
# `unwind_indent` before issuing BLOCK-END.
# Scanners for block, flow, and plain scalars need to be modified.
-
srp = self.reader.peek
srf = self.reader.forward
if self.reader.index == 0 and srp() == '\uFEFF':
srf()
found = False
+ white_space = ' \t' if self.flow_level > 0 else ' '
while not found:
- while srp() == ' ':
+ while srp() in white_space:
srf()
ch = srp()
if ch == '#':