diff options
author | Anthon van der Neut <anthon@mnt.org> | 2018-08-12 15:58:03 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2018-08-12 15:58:03 +0200 |
commit | 21ddf0cc5db2ef31a2852308f6c5926521b5b3a7 (patch) | |
tree | 9cde92371e23e7752f5f787f6b7372f23bafd2c9 /main.py | |
parent | bf94f1d0fe36687a09beb7a4d48564127b9d157e (diff) | |
download | ruamel.yaml-21ddf0cc5db2ef31a2852308f6c5926521b5b3a7.tar.gz |
fix issue #161 doubling comment on empty value
Diffstat (limited to 'main.py')
-rw-r--r-- | main.py | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -639,6 +639,27 @@ class YAML(object): self.constructor.add_constructor(tag, f_y) return cls + + def parse(self, stream): + # type: (StreamTextType, Any) -> Any + """ + Parse a YAML stream and produce parsing events. + """ + _, parser = self.get_constructor_parser(stream) + try: + while parser.check_event(): + yield parser.get_event() + finally: + parser.dispose() + try: + self._reader.reset_reader() # type: ignore + except AttributeError: + pass + try: + self._scanner.reset_scanner() # type: ignore + except AttributeError: + pass + # ### context manager def __enter__(self): |