Skip to content

Commit

Permalink
Don't trim quoted strings
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mstemm committed Jun 20, 2017
1 parent 38f488b commit 481582c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion userspace/engine/lua/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 481582c

Please sign in to comment.