Skip to content

Commit

Permalink
Parser changes to support new sysdig changes.
Browse files Browse the repository at this point in the history
Support "glob" as an operator and allow pathnames to be the index into
bracketed selectors of fields.
  • Loading branch information
mstemm committed Sep 8, 2016
1 parent 33b9ef5 commit b40e17f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions userspace/engine/lua/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,16 @@ local G = {
idRest = alnum + P("_");
Identifier = V"idStart" * V"idRest"^0;
Macro = V"idStart" * V"idRest"^0 * -P".";
FieldName = V"Identifier" * (P"." + V"Identifier")^1 * (P"[" * V"Int" * P"]")^-1;
Int = digit^1;
PathString = (alnum + S'-_/*?')^1;
Index = V"Int" + V"PathString";
FieldName = V"Identifier" * (P"." + V"Identifier")^1 * (P"[" * V"Index" * P"]")^-1;
Name = C(V"Identifier") * -V"idRest";
Hex = (P("0x") + P("0X")) * xdigit^1;
Expo = S("eE") * S("+-")^-1 * digit^1;
Float = (((digit^1 * P(".") * digit^0) +
(P(".") * digit^1)) * V"Expo"^-1) +
(digit^1 * V"Expo");
Int = digit^1;
Number = C(V"Hex" + V"Float" + V"Int") /
function (n) return tonumber(n) end;
String = (P'"' * C(((P'\\' * P(1)) + (P(1) - P'"'))^0) * P'"' + P"'" * C(((P"\\" * P(1)) + (P(1) - P"'"))^0) * P"'") / function (s) return fix_str(s) end;
Expand All @@ -243,6 +245,7 @@ local G = {
symb(">") / ">" +
symb("contains") / "contains" +
symb("icontains") / "icontains" +
symb("glob") / "glob" +
symb("startswith") / "startswith";
InOp = kw("in") / "in";
UnaryBoolOp = kw("not") / "not";
Expand Down

0 comments on commit b40e17f

Please sign in to comment.