From f4f0b84fd84265b296312153628cd9dbd5961664 Mon Sep 17 00:00:00 2001 From: salmangano <42071471+salmangano@users.noreply.github.com> Date: Fri, 3 Jan 2020 15:10:51 -0500 Subject: [PATCH] Fix the issue where the parser fails on time attr with no space after = (#266) * Fix the issue where the parser fails on time attr with no space after = like time=10:00:00 * Fix trailing whitespace in break * Add tests for this issue --- test.toml | 6 ++++++ toml/decoder.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/test.toml b/test.toml index f0e44a8..2649d1e 100644 --- a/test.toml +++ b/test.toml @@ -40,6 +40,12 @@ hosts = [ "omega" ] +[meeting] +[meeting.inspace] +time = 10:00:00 +[meeting.nospace] +time=10:00:00 + [[fruit]] name = "apple" diff --git a/toml/decoder.py b/toml/decoder.py index 34075f1..a24c04a 100644 --- a/toml/decoder.py +++ b/toml/decoder.py @@ -724,6 +724,8 @@ def load_line(self, line, currentlevel, multikey, multibackslash): pass if _load_date(pair[-1]) is not None: break + if TIME_RE.match(pair[-1]): + break i += 1 prev_val = pair[-1] pair = line.split('=', i)