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.
This commit is contained in:
Mark Stemm 2017-06-20 11:47:00 -07:00
parent 38f488bfda
commit 481582ca09

View File

@ -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)