From 787be517d83efe4dbb4219256a9fab09bbd99734 Mon Sep 17 00:00:00 2001 From: LukeTemp Date: Sun, 9 Oct 2022 17:08:04 +0100 Subject: [PATCH] Parse decimal shorthand as number rather than string --- slpp.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/slpp.py b/slpp.py index 3286e2a..9abe39e 100644 --- a/slpp.py +++ b/slpp.py @@ -145,7 +145,7 @@ def value(self): self.next_chr() if self.ch in ['"', "'", '[']: return self.string(self.ch) - if self.ch.isdigit() or self.ch == '-': + if self.ch.isdigit() or self.ch == '-' or self.ch == '.': return self.number() return self.word() @@ -242,6 +242,8 @@ def next_digit(err): raise ParseError(err) return n n = '' + if self.ch == '.': + n += '0' try: if self.ch == '-': n += next_digit(ERRORS['mfnumber_minus'])