Commit 605e6ad0 authored by Wyatt Alt's avatar Wyatt Alt Committed by Rob Browning

(PDB-3471) add support for ! ~

parent 96c5426c
......@@ -61,12 +61,13 @@ expr-not = ( not, [<whitespace>], expr-not ) | expr-rest;
subquery = entity, [<whitespace>], where;
(* Conditional expression *)
condexpression = (condexpregexp | condexpregexparray | condexpinequality | condexpmatch | condexpnotmatch| condexpin);
condexpression = (condexpregexp | condexpregexparray | condexpinequality | condexpmatch | condexpnotmatch| condexpnotregexp | condexpin);
<condexpregexp> = field, [<whitespace>], condregexp, [<whitespace>], valueregexp;
<condexpregexparray> = field, [<whitespace>], condregexparray, [<whitespace>], valueregexparray;
<condexpinequality> = field, [<whitespace>], condinequality, [<whitespace>], valueordered;
<condexpmatch> = field, [<whitespace>], condmatch, [<whitespace>], literal;
<condexpnotmatch> = field, [<whitespace>], condnotmatch, [<whitespace>], literal;
<condexpnotregexp> = field, [<whitespace>], condnotregexp, [<whitespace>], literal;
<condexpin> = (field | groupedfieldlist), [<whitespace>], condin, [<whitespace>], valuein;
(* Special is null/is not null expression *)
......@@ -97,6 +98,7 @@ field = #'[a-zA-Z0-9_]+\??' | (dottedfield, fieldpath);
<condinequality> = '>=' | '<=' | '<' | '>';
<condmatch> = '=';
<condnotmatch> = '!=';
<condnotregexp> = '!~';
<condin> = 'in';
<valueregexp> = string;
......
......@@ -54,8 +54,9 @@
(defn transform-condexpression
[a b c]
(if (= "!=" b)
["not" ["=" a c]]
(case b
"!=" ["not" ["=" a c]]
"!~" ["not" ["~" a c]]
[b a c]))
(defn transform-condexpnull
......
......@@ -348,6 +348,9 @@
"certname != 4"
[:condexpression [:field "certname"] "!=" [:integer "4"]]
"certname !~ 4"
[:condexpression [:field "certname"] "!~" [:integer "4"]]
"a in nodes [a] {}"
[:condexpression [:field "a"] "in" [:from "nodes" [:extract [:field "a"]]]])
......
......@@ -62,6 +62,9 @@
[:condexpression [:field "certname"] "!=" [:integer "4"]]
["not" ["=" "certname" 4]]
[:condexpression [:field "certname"] "!~" [:integer "4"]]
["not" ["~" "certname" 4]]
[:from "nodes"
[:extract "a" "b" "c"]]
["from" "nodes"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment