summaryrefslogtreecommitdiff
path: root/parser.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2021-05-30 09:25:32 +0200
committerAnthon van der Neut <anthon@mnt.org>2021-05-30 09:25:32 +0200
commit73f4bec5f498b31fd7ce7c2ac7ced187b4fc4920 (patch)
treee2318c5891b58aecebdb178636c61b7aa6a84193 /parser.py
parent17b35c376fd0fc9a94ba0adfdbf5bf63a6177dc9 (diff)
downloadruamel.yaml-73f4bec5f498b31fd7ce7c2ac7ced187b4fc4920.tar.gz
fix for issue 3840.17.5
aliased scalars in !!set would not round trip with ?
Diffstat (limited to 'parser.py')
-rw-r--r--parser.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/parser.py b/parser.py
index 8e2f54e..db225a1 100644
--- a/parser.py
+++ b/parser.py
@@ -92,6 +92,7 @@ def xprintf(*args, **kw):
return nprintf(*args, **kw)
pass
+
class ParserError(MarkedYAMLError):
pass
@@ -834,8 +835,8 @@ class RoundTripParser(Parser):
class RoundTripParserSC(RoundTripParser):
"""roundtrip is a safe loader, that wants to see the unmangled tag"""
-
- # some of the differences are based on the superclass testing if self.loader.comment_handling is not None
+ # some of the differences are based on the superclass testing
+ # if self.loader.comment_handling is not None
def move_token_comment(self, token, nt=None, empty=False):
token.move_new_comment(self.scanner.peek_token() if nt is None else nt, empty=empty)
@@ -846,11 +847,11 @@ class RoundTripParserSC(RoundTripParser):
return None
if not comment[0]:
return None
- if comment[0][0] != line + 1:
+ if comment[0][0] != line + 1:
nprintf('>>>dcxxx', comment, line, typ)
assert comment[0][0] == line + 1
- #if comment[0] - line > 1:
- # return
+ # if comment[0] - line > 1:
+ # return
typ = self.loader.comment_handling & 0b11
# nprintf('>>>dca', comment, line, typ)
if typ == C_POST:
@@ -860,7 +861,7 @@ class RoundTripParserSC(RoundTripParser):
comment[0] = None
return c
# nprintf('>>>dcb', comment[0])
- for idx, cmntidx in enumerate(comment[0]):
+ for cmntidx in comment[0]:
# nprintf('>>>dcb', cmntidx)
if isinstance(self.scanner.comments[cmntidx], BlankLineComment):
break
@@ -874,5 +875,3 @@ class RoundTripParserSC(RoundTripParser):
comment[0] = comment[0][idx:]
return c
raise NotImplementedError # reserved
-
-