From 254d8c378d7c5d456e292208d4906e2f76045ff4 Mon Sep 17 00:00:00 2001 From: Robert Masen Date: Tue, 18 May 2021 12:22:13 -0500 Subject: [PATCH] negative numbers as properties should not parse as a list --- samples/negative-prop.lua | 4 ++++ samples/negative-prop.yaml | 3 +++ yaml.lua | 1 + 3 files changed, 8 insertions(+) create mode 100644 samples/negative-prop.lua create mode 100644 samples/negative-prop.yaml diff --git a/samples/negative-prop.lua b/samples/negative-prop.lua new file mode 100644 index 0000000..35cef53 --- /dev/null +++ b/samples/negative-prop.lua @@ -0,0 +1,4 @@ +return { + prop1 = -1, + prop2 = -1.5, +} diff --git a/samples/negative-prop.yaml b/samples/negative-prop.yaml new file mode 100644 index 0000000..b58a70f --- /dev/null +++ b/samples/negative-prop.yaml @@ -0,0 +1,3 @@ +--- +prop1: -1 +prop2: -1.5 diff --git a/yaml.lua b/yaml.lua index 55211dc..b8ed7d3 100644 --- a/yaml.lua +++ b/yaml.lua @@ -130,6 +130,7 @@ local tokens = { {"string", "^%b[] *[^,%c]+", noinline = true}, {"[", "^%["}, {"]", "^%]"}, + {"string", "^-[^%s]+", noinline = true}, {"-", "^%-", noinline = true}, {":", "^:"}, {"pipe", "^(|)(%d*[+%-]?)", sep = "\n"},