diff options
author | Anthon van der Neut <anthon@mnt.org> | 2021-05-30 09:25:32 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2021-05-30 09:25:32 +0200 |
commit | 73f4bec5f498b31fd7ce7c2ac7ced187b4fc4920 (patch) | |
tree | e2318c5891b58aecebdb178636c61b7aa6a84193 /parser.py | |
parent | 17b35c376fd0fc9a94ba0adfdbf5bf63a6177dc9 (diff) | |
download | ruamel.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.py | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -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 - - |