From 69345854ee8255fa121ae5f13f375536541e3762 Mon Sep 17 00:00:00 2001 From: dmiller Date: Wed, 12 Aug 2015 14:29:20 +0000 Subject: [PATCH] Fix script matching patterns that start with category names The keyword patterns like "categories" or K "true" were consuming the first part of patterns like --script 'broadcast-*' resulting in the error "'broadcast-*' did not match a category, filename, or directory" Changed to add a lookahead match for space, parentheses, or end-of-line before considering a keyword to have matched. --- nse_main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nse_main.lua b/nse_main.lua index 9c464f424..fa97edcb0 100644 --- a/nse_main.lua +++ b/nse_main.lua @@ -278,7 +278,7 @@ end -- Return a pattern which matches a "keyword" literal, case insensitive. local function K (a) local insensitize = Cf((P(1) / function (a) return S(lower(a)..upper(a)) end)^1, function (a, b) return a * b end); - return assert(insensitize:match(a)) * -(locale().alnum + P "_"); -- "keyword" token + return assert(insensitize:match(a)) * #(V "space" + S"()," + P(-1)); -- "keyword" token end local REQUIRE_ERROR = {};