From 481582ca09d3e2f2f5510172ee5014a2f31bc6f8 Mon Sep 17 00:00:00 2001 From: Mark Stemm Date: Tue, 20 Jun 2017 11:47:00 -0700 Subject: [PATCH] Don't trim quoted strings When parsing condition expressions, if the type of an ast node is String (aka quoted string), don't trim whitespace from the value. This ensures that conditions that want to match exact strings e.g. command lines with leading/trailing spaces will work properly. This fixes #253. --- userspace/engine/lua/parser.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/userspace/engine/lua/parser.lua b/userspace/engine/lua/parser.lua index b13ca81ea2c..00adf9dd9b9 100644 --- a/userspace/engine/lua/parser.lua +++ b/userspace/engine/lua/parser.lua @@ -130,7 +130,7 @@ end local function terminal (tag) -- Rather than trim the whitespace in this way, it would be nicer to exclude it from the capture... - return token(V(tag), tag) / function (tok) return { type = tag, value = trim(tok)} end + return token(V(tag), tag) / function (tok) val = tok; if tag ~= "String" then val = trim(tok) end; return { type = tag, value = val} end end local function unaryboolop (op, e)