From eaeb360b315792f00c23666b892c1ec145d9b257 Mon Sep 17 00:00:00 2001 From: Henri DF Date: Thu, 25 Feb 2016 10:54:28 -0800 Subject: [PATCH 1/2] Fix macro expansion --- userspace/digwatch/lua/compiler.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/userspace/digwatch/lua/compiler.lua b/userspace/digwatch/lua/compiler.lua index 043660fd..910f34b7 100644 --- a/userspace/digwatch/lua/compiler.lua +++ b/userspace/digwatch/lua/compiler.lua @@ -350,7 +350,7 @@ function expand_macros(ast, defs, changed) end if (ast.type == "Rule") then - macros = expand_macros(ast.filter, defs, changed) + return expand_macros(ast.filter, defs, changed) elseif ast.type == "Filter" then if (ast.value.type == "Macro") then if (defs[ast.value.value] == nil) then @@ -514,6 +514,8 @@ function compiler.compile_line(line, macro_defs) check_macros(ast) if (ast.type == "MacroDef") then + expand_in(ast.value) + -- Parsed line is a macro definition, so update our dictionary of macros and -- return macro_defs[ast.name] = ast.value From 4053b7241e38f898ca99c0b09e3d304633729eb6 Mon Sep 17 00:00:00 2001 From: Henri DF Date: Thu, 25 Feb 2016 10:54:42 -0800 Subject: [PATCH 2/2] Fix 'in' clause expansion --- userspace/digwatch/lua/compiler.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/userspace/digwatch/lua/compiler.lua b/userspace/digwatch/lua/compiler.lua index 910f34b7..e9a0215f 100644 --- a/userspace/digwatch/lua/compiler.lua +++ b/userspace/digwatch/lua/compiler.lua @@ -300,7 +300,7 @@ function expand_in(node) local mapper = function(element) return { type = "BinaryRelOp", - operator = "eq", + operator = "=", left = node.left, right = element }