Allow only upper case operator names

Allow only upper case predefined selector literals and operator names.

The JMS spec states:
> Predefined selector literals and operator names are written here in upper case; however, they are case insensitive.

However, the AMQP SQL spec does not include such a statement.
The EBNF notation with single quotes ('AND') typically implies exact literal matching.
This commit follows the AMQP SQL's EBNF notation and therefore disallows
lower case predefined selector literals or operator names.
This commit is contained in:
David Ansari 2025-07-07 11:22:25 +02:00
parent c5eeced28d
commit ccdb82b687
5 changed files with 79 additions and 231 deletions

View File

@ -77,7 +77,7 @@ has_binary_identifier_test() ->
false = has_binary_identifier("properties.group-sequence * 10 < 100"),
false = has_binary_identifier("properties.creation-time >= 12345 OR properties.subject = 'test'"),
true = has_binary_identifier("user_key = 'g1' AND header.priority > 5"),
true = has_binary_identifier("header.priority > 5 and user_key = 'g1'"),
true = has_binary_identifier("header.priority > 5 AND user_key = 'g1'"),
true = has_binary_identifier("custom_metric * 10 < 100"),
true = has_binary_identifier("properties.creation-time >= 12345 OR user_data = 'test'"),

View File

@ -57,15 +57,13 @@ to_float(Chars) ->
$. ->
Chars ++ "0";
_ ->
Chars1 = string:lowercase(Chars),
Chars2 = string:replace(Chars1, ".e", ".0e"),
lists:flatten(Chars2)
Chars1 = string:replace(Chars, ".E", ".0E"),
lists:flatten(Chars1)
end.
parse_scientific_notation(Chars) ->
Str = string:lowercase(Chars),
{Before, After0} = lists:splitwith(fun(C) -> C =/= $e end, Str),
[$e | After] = After0,
{Before, After0} = lists:splitwith(fun(C) -> C =/= $E end, Chars),
[$E | After] = After0,
Base = list_to_integer(Before),
Exp = list_to_integer(After),
Base * math:pow(10, Exp).
@ -436,11 +434,9 @@ tab_size() -> 8.
%% return signal either an unrecognised character or end of current
%% input.
-file("rabbit_amqp_sql_lexer.erl", 404).
-file("rabbit_amqp_sql_lexer.erl", 402).
yystate() -> 62.
yystate(65, [100|Ics], Line, Col, Tlen, _, _) ->
yystate(63, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(65, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(65, [68|Ics], Line, Col, Tlen, _, _) ->
@ -457,9 +453,7 @@ yystate(65, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 67 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(65, [C|Ics], Line, Col, Tlen, _, _) when C >= 69, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(65, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 99 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(65, [C|Ics], Line, Col, Tlen, _, _) when C >= 101, C =< 122 ->
yystate(65, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(65, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,65};
@ -481,22 +475,6 @@ yystate(63, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 1, Tlen);
yystate(63, Ics, Line, Col, Tlen, _, _) ->
{1,Tlen,Ics,Line,Col,63};
yystate(62, [116|Ics], Line, Col, Tlen, Action, Alen) ->
yystate(58, Ics, Line, Col, Tlen+1, Action, Alen);
yystate(62, [111|Ics], Line, Col, Tlen, Action, Alen) ->
yystate(42, Ics, Line, Col, Tlen+1, Action, Alen);
yystate(62, [110|Ics], Line, Col, Tlen, Action, Alen) ->
yystate(34, Ics, Line, Col, Tlen+1, Action, Alen);
yystate(62, [108|Ics], Line, Col, Tlen, Action, Alen) ->
yystate(10, Ics, Line, Col, Tlen+1, Action, Alen);
yystate(62, [105|Ics], Line, Col, Tlen, Action, Alen) ->
yystate(5, Ics, Line, Col, Tlen+1, Action, Alen);
yystate(62, [102|Ics], Line, Col, Tlen, Action, Alen) ->
yystate(17, Ics, Line, Col, Tlen+1, Action, Alen);
yystate(62, [101|Ics], Line, Col, Tlen, Action, Alen) ->
yystate(37, Ics, Line, Col, Tlen+1, Action, Alen);
yystate(62, [97|Ics], Line, Col, Tlen, Action, Alen) ->
yystate(61, Ics, Line, Col, Tlen+1, Action, Alen);
yystate(62, [96|Ics], Line, Col, Tlen, Action, Alen) ->
yystate(64, Ics, Line, Col, Tlen+1, Action, Alen);
yystate(62, [95|Ics], Line, Col, Tlen, Action, Alen) ->
@ -583,14 +561,12 @@ yystate(62, [C|Ics], Line, Col, Tlen, Action, Alen) when C >= 66, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, Action, Alen);
yystate(62, [C|Ics], Line, Col, Tlen, Action, Alen) when C >= 91, C =< 94 ->
yystate(64, Ics, Line, Col, Tlen+1, Action, Alen);
yystate(62, [C|Ics], Line, Col, Tlen, Action, Alen) when C >= 98, C =< 122 ->
yystate(62, [C|Ics], Line, Col, Tlen, Action, Alen) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, Action, Alen);
yystate(62, [C|Ics], Line, Col, Tlen, Action, Alen) when C >= 123 ->
yystate(64, Ics, Line, Col, Tlen+1, Action, Alen);
yystate(62, Ics, Line, Col, Tlen, Action, Alen) ->
{Action,Alen,Tlen,Ics,Line,Col,62};
yystate(61, [110|Ics], Line, Col, Tlen, _, _) ->
yystate(65, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(61, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(61, [78|Ics], Line, Col, Tlen, _, _) ->
@ -607,9 +583,7 @@ yystate(61, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 77 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(61, [C|Ics], Line, Col, Tlen, _, _) when C >= 79, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(61, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 109 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(61, [C|Ics], Line, Col, Tlen, _, _) when C >= 111, C =< 122 ->
yystate(61, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(61, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,61};
@ -629,8 +603,6 @@ yystate(59, [61|Ics], Line, Col, Tlen, _, _) ->
yystate(55, Ics, Line, Col, Tlen+1, 16, Tlen);
yystate(59, Ics, Line, Col, Tlen, _, _) ->
{16,Tlen,Ics,Line,Col,59};
yystate(58, [114|Ics], Line, Col, Tlen, _, _) ->
yystate(54, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(58, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(58, [82|Ics], Line, Col, Tlen, _, _) ->
@ -647,9 +619,7 @@ yystate(58, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 81 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(58, [C|Ics], Line, Col, Tlen, _, _) when C >= 83, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(58, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 113 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(58, [C|Ics], Line, Col, Tlen, _, _) when C >= 115, C =< 122 ->
yystate(58, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(58, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,58};
@ -673,8 +643,6 @@ yystate(56, Ics, Line, Col, Tlen, _, _) ->
{12,Tlen,Ics,Line,Col};
yystate(55, Ics, Line, Col, Tlen, _, _) ->
{14,Tlen,Ics,Line,Col};
yystate(54, [117|Ics], Line, Col, Tlen, _, _) ->
yystate(50, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(54, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(54, [85|Ics], Line, Col, Tlen, _, _) ->
@ -691,14 +659,10 @@ yystate(54, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 84 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(54, [C|Ics], Line, Col, Tlen, _, _) when C >= 86, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(54, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 116 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(54, [C|Ics], Line, Col, Tlen, _, _) when C >= 118, C =< 122 ->
yystate(54, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(54, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,54};
yystate(53, [101|Ics], Line, Col, Tlen, _, _) ->
yystate(57, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(53, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(53, [69|Ics], Line, Col, Tlen, _, _) ->
@ -715,9 +679,7 @@ yystate(53, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 68 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(53, [C|Ics], Line, Col, Tlen, _, _) when C >= 70, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(53, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 100 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(53, [C|Ics], Line, Col, Tlen, _, _) when C >= 102, C =< 122 ->
yystate(53, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(53, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,53};
@ -727,8 +689,6 @@ yystate(52, Ics, Line, Col, Tlen, _, _) ->
{31,Tlen,Ics,Line,Col,52};
yystate(51, Ics, Line, Col, Tlen, _, _) ->
{13,Tlen,Ics,Line,Col};
yystate(50, [101|Ics], Line, Col, Tlen, _, _) ->
yystate(46, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(50, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(50, [69|Ics], Line, Col, Tlen, _, _) ->
@ -745,14 +705,10 @@ yystate(50, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 68 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(50, [C|Ics], Line, Col, Tlen, _, _) when C >= 70, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(50, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 100 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(50, [C|Ics], Line, Col, Tlen, _, _) when C >= 102, C =< 122 ->
yystate(50, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(50, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,50};
yystate(49, [112|Ics], Line, Col, Tlen, _, _) ->
yystate(53, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(49, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(49, [80|Ics], Line, Col, Tlen, _, _) ->
@ -769,9 +725,7 @@ yystate(49, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 79 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(49, [C|Ics], Line, Col, Tlen, _, _) when C >= 81, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(49, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 111 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(49, [C|Ics], Line, Col, Tlen, _, _) when C >= 113, C =< 122 ->
yystate(49, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(49, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,49};
@ -813,8 +767,6 @@ yystate(46, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 9, Tlen);
yystate(46, Ics, Line, Col, Tlen, _, _) ->
{9,Tlen,Ics,Line,Col,46};
yystate(45, [97|Ics], Line, Col, Tlen, _, _) ->
yystate(49, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(45, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(45, [65|Ics], Line, Col, Tlen, _, _) ->
@ -829,7 +781,7 @@ yystate(45, [C|Ics], Line, Col, Tlen, _, _) when C >= 48, C =< 57 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(45, [C|Ics], Line, Col, Tlen, _, _) when C >= 66, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(45, [C|Ics], Line, Col, Tlen, _, _) when C >= 98, C =< 122 ->
yystate(45, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(45, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,45};
@ -837,8 +789,6 @@ yystate(44, Ics, Line, Col, Tlen, _, _) ->
{22,Tlen,Ics,Line,Col};
yystate(43, Ics, Line, Col, Tlen, _, _) ->
{11,Tlen,Ics,Line,Col};
yystate(42, [114|Ics], Line, Col, Tlen, _, _) ->
yystate(38, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(42, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(42, [82|Ics], Line, Col, Tlen, _, _) ->
@ -855,18 +805,10 @@ yystate(42, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 81 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(42, [C|Ics], Line, Col, Tlen, _, _) when C >= 83, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(42, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 113 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(42, [C|Ics], Line, Col, Tlen, _, _) when C >= 115, C =< 122 ->
yystate(42, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(42, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,42};
yystate(41, [99|Ics], Line, Col, Tlen, _, _) ->
yystate(45, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(41, [97|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(41, [98|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(41, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(41, [67|Ics], Line, Col, Tlen, _, _) ->
@ -885,7 +827,7 @@ yystate(41, [C|Ics], Line, Col, Tlen, _, _) when C >= 48, C =< 57 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(41, [C|Ics], Line, Col, Tlen, _, _) when C >= 68, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(41, [C|Ics], Line, Col, Tlen, _, _) when C >= 100, C =< 122 ->
yystate(41, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(41, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,41};
@ -919,8 +861,6 @@ yystate(38, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 2, Tlen);
yystate(38, Ics, Line, Col, Tlen, _, _) ->
{2,Tlen,Ics,Line,Col,38};
yystate(37, [115|Ics], Line, Col, Tlen, _, _) ->
yystate(41, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(37, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(37, [83|Ics], Line, Col, Tlen, _, _) ->
@ -937,9 +877,7 @@ yystate(37, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 82 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(37, [C|Ics], Line, Col, Tlen, _, _) when C >= 84, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(37, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 114 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(37, [C|Ics], Line, Col, Tlen, _, _) when C >= 116, C =< 122 ->
yystate(37, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(37, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,37};
@ -955,10 +893,6 @@ yystate(35, [C|Ics], Line, Col, Tlen, Action, Alen) when C >= 48, C =< 57 ->
yystate(31, Ics, Line, Col, Tlen+1, Action, Alen);
yystate(35, Ics, Line, Col, Tlen, Action, Alen) ->
{Action,Alen,Tlen,Ics,Line,Col,35};
yystate(34, [117|Ics], Line, Col, Tlen, _, _) ->
yystate(30, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(34, [111|Ics], Line, Col, Tlen, _, _) ->
yystate(18, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(34, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(34, [85|Ics], Line, Col, Tlen, _, _) ->
@ -979,11 +913,7 @@ yystate(34, [C|Ics], Line, Col, Tlen, _, _) when C >= 80, C =< 84 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(34, [C|Ics], Line, Col, Tlen, _, _) when C >= 86, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(34, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 110 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(34, [C|Ics], Line, Col, Tlen, _, _) when C >= 112, C =< 116 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(34, [C|Ics], Line, Col, Tlen, _, _) when C >= 118, C =< 122 ->
yystate(34, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(34, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,34};
@ -1019,8 +949,6 @@ yystate(31, [C|Ics], Line, Col, Tlen, _, _) when C >= 48, C =< 57 ->
yystate(31, Ics, Line, Col, Tlen+1, 28, Tlen);
yystate(31, Ics, Line, Col, Tlen, _, _) ->
{28,Tlen,Ics,Line,Col,31};
yystate(30, [108|Ics], Line, Col, Tlen, _, _) ->
yystate(26, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(30, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(30, [76|Ics], Line, Col, Tlen, _, _) ->
@ -1037,14 +965,10 @@ yystate(30, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 75 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(30, [C|Ics], Line, Col, Tlen, _, _) when C >= 77, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(30, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 107 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(30, [C|Ics], Line, Col, Tlen, _, _) when C >= 109, C =< 122 ->
yystate(30, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(30, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,30};
yystate(29, [101|Ics], Line, Col, Tlen, _, _) ->
yystate(33, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(29, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(29, [69|Ics], Line, Col, Tlen, _, _) ->
@ -1061,9 +985,7 @@ yystate(29, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 68 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(29, [C|Ics], Line, Col, Tlen, _, _) when C >= 70, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(29, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 100 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(29, [C|Ics], Line, Col, Tlen, _, _) when C >= 102, C =< 122 ->
yystate(29, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(29, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,29};
@ -1073,8 +995,6 @@ yystate(27, [C|Ics], Line, Col, Tlen, Action, Alen) when C >= 48, C =< 57 ->
yystate(31, Ics, Line, Col, Tlen+1, Action, Alen);
yystate(27, Ics, Line, Col, Tlen, Action, Alen) ->
{Action,Alen,Tlen,Ics,Line,Col,27};
yystate(26, [108|Ics], Line, Col, Tlen, _, _) ->
yystate(22, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(26, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(26, [76|Ics], Line, Col, Tlen, _, _) ->
@ -1091,14 +1011,10 @@ yystate(26, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 75 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(26, [C|Ics], Line, Col, Tlen, _, _) when C >= 77, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(26, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 107 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(26, [C|Ics], Line, Col, Tlen, _, _) when C >= 109, C =< 122 ->
yystate(26, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(26, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,26};
yystate(25, [115|Ics], Line, Col, Tlen, _, _) ->
yystate(29, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(25, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(25, [83|Ics], Line, Col, Tlen, _, _) ->
@ -1115,16 +1031,12 @@ yystate(25, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 82 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(25, [C|Ics], Line, Col, Tlen, _, _) when C >= 84, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(25, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 114 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(25, [C|Ics], Line, Col, Tlen, _, _) when C >= 116, C =< 122 ->
yystate(25, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(25, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,25};
yystate(24, Ics, Line, Col, Tlen, _, _) ->
{24,Tlen,Ics,Line,Col};
yystate(23, [101|Ics], Line, Col, Tlen, _, _) ->
yystate(35, Ics, Line, Col, Tlen+1, 26, Tlen);
yystate(23, [69|Ics], Line, Col, Tlen, _, _) ->
yystate(35, Ics, Line, Col, Tlen+1, 26, Tlen);
yystate(23, [46|Ics], Line, Col, Tlen, _, _) ->
@ -1149,8 +1061,6 @@ yystate(22, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 7, Tlen);
yystate(22, Ics, Line, Col, Tlen, _, _) ->
{7,Tlen,Ics,Line,Col,22};
yystate(21, [108|Ics], Line, Col, Tlen, _, _) ->
yystate(25, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(21, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(21, [76|Ics], Line, Col, Tlen, _, _) ->
@ -1167,9 +1077,7 @@ yystate(21, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 75 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(21, [C|Ics], Line, Col, Tlen, _, _) when C >= 77, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(21, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 107 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(21, [C|Ics], Line, Col, Tlen, _, _) when C >= 109, C =< 122 ->
yystate(21, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(21, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,21};
@ -1183,8 +1091,6 @@ yystate(19, [C|Ics], Line, Col, Tlen, Action, Alen) when C >= 48, C =< 57 ->
yystate(15, Ics, Line, Col, Tlen+1, Action, Alen);
yystate(19, Ics, Line, Col, Tlen, Action, Alen) ->
{Action,Alen,Tlen,Ics,Line,Col,19};
yystate(18, [116|Ics], Line, Col, Tlen, _, _) ->
yystate(14, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(18, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(18, [84|Ics], Line, Col, Tlen, _, _) ->
@ -1201,14 +1107,10 @@ yystate(18, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 83 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(18, [C|Ics], Line, Col, Tlen, _, _) when C >= 85, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(18, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 115 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(18, [C|Ics], Line, Col, Tlen, _, _) when C >= 117, C =< 122 ->
yystate(18, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(18, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,18};
yystate(17, [97|Ics], Line, Col, Tlen, _, _) ->
yystate(21, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(17, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(17, [65|Ics], Line, Col, Tlen, _, _) ->
@ -1223,7 +1125,7 @@ yystate(17, [C|Ics], Line, Col, Tlen, _, _) when C >= 48, C =< 57 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(17, [C|Ics], Line, Col, Tlen, _, _) when C >= 66, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(17, [C|Ics], Line, Col, Tlen, _, _) when C >= 98, C =< 122 ->
yystate(17, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(17, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,17};
@ -1271,8 +1173,6 @@ yystate(11, [C|Ics], Line, Col, Tlen, Action, Alen) when C >= 48, C =< 57 ->
yystate(15, Ics, Line, Col, Tlen+1, Action, Alen);
yystate(11, Ics, Line, Col, Tlen, Action, Alen) ->
{Action,Alen,Tlen,Ics,Line,Col,11};
yystate(10, [105|Ics], Line, Col, Tlen, _, _) ->
yystate(6, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(10, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(10, [73|Ics], Line, Col, Tlen, _, _) ->
@ -1289,9 +1189,7 @@ yystate(10, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 72 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(10, [C|Ics], Line, Col, Tlen, _, _) when C >= 74, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(10, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 104 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(10, [C|Ics], Line, Col, Tlen, _, _) when C >= 106, C =< 122 ->
yystate(10, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(10, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,10};
@ -1313,16 +1211,12 @@ yystate(9, Ics, Line, Col, Tlen, _, _) ->
{6,Tlen,Ics,Line,Col,9};
yystate(8, Ics, Line, Col, Tlen, _, _) ->
{19,Tlen,Ics,Line,Col};
yystate(7, [101|Ics], Line, Col, Tlen, _, _) ->
yystate(19, Ics, Line, Col, Tlen+1, 27, Tlen);
yystate(7, [69|Ics], Line, Col, Tlen, _, _) ->
yystate(19, Ics, Line, Col, Tlen+1, 27, Tlen);
yystate(7, [C|Ics], Line, Col, Tlen, _, _) when C >= 48, C =< 57 ->
yystate(7, Ics, Line, Col, Tlen+1, 27, Tlen);
yystate(7, Ics, Line, Col, Tlen, _, _) ->
{27,Tlen,Ics,Line,Col,7};
yystate(6, [107|Ics], Line, Col, Tlen, _, _) ->
yystate(2, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(6, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(6, [75|Ics], Line, Col, Tlen, _, _) ->
@ -1339,16 +1233,10 @@ yystate(6, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 74 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(6, [C|Ics], Line, Col, Tlen, _, _) when C >= 76, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(6, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 106 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(6, [C|Ics], Line, Col, Tlen, _, _) when C >= 108, C =< 122 ->
yystate(6, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(6, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,6};
yystate(5, [115|Ics], Line, Col, Tlen, _, _) ->
yystate(9, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(5, [110|Ics], Line, Col, Tlen, _, _) ->
yystate(13, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(5, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(5, [83|Ics], Line, Col, Tlen, _, _) ->
@ -1369,16 +1257,10 @@ yystate(5, [C|Ics], Line, Col, Tlen, _, _) when C >= 79, C =< 82 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(5, [C|Ics], Line, Col, Tlen, _, _) when C >= 84, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(5, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 109 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(5, [C|Ics], Line, Col, Tlen, _, _) when C >= 111, C =< 114 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(5, [C|Ics], Line, Col, Tlen, _, _) when C >= 116, C =< 122 ->
yystate(5, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(5, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,5};
yystate(4, [101|Ics], Line, Col, Tlen, _, _) ->
yystate(19, Ics, Line, Col, Tlen+1, 27, Tlen);
yystate(4, [69|Ics], Line, Col, Tlen, _, _) ->
yystate(19, Ics, Line, Col, Tlen+1, 27, Tlen);
yystate(4, [C|Ics], Line, Col, Tlen, _, _) when C >= 48, C =< 57 ->
@ -1387,8 +1269,6 @@ yystate(4, Ics, Line, Col, Tlen, _, _) ->
{27,Tlen,Ics,Line,Col,4};
yystate(3, Ics, Line, Col, Tlen, _, _) ->
{21,Tlen,Ics,Line,Col};
yystate(2, [101|Ics], Line, Col, Tlen, _, _) ->
yystate(1, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(2, [95|Ics], Line, Col, Tlen, _, _) ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(2, [69|Ics], Line, Col, Tlen, _, _) ->
@ -1405,9 +1285,7 @@ yystate(2, [C|Ics], Line, Col, Tlen, _, _) when C >= 65, C =< 68 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(2, [C|Ics], Line, Col, Tlen, _, _) when C >= 70, C =< 90 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(2, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 100 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(2, [C|Ics], Line, Col, Tlen, _, _) when C >= 102, C =< 122 ->
yystate(2, [C|Ics], Line, Col, Tlen, _, _) when C >= 97, C =< 122 ->
yystate(48, Ics, Line, Col, Tlen+1, 30, Tlen);
yystate(2, Ics, Line, Col, Tlen, _, _) ->
{30,Tlen,Ics,Line,Col,2};

View File

@ -9,9 +9,9 @@ WHITESPACE = [\s\t\f\n\r]
DIGIT = [0-9]
INT = {DIGIT}+
% Approximate numeric literal with a decimal
FLOAT = ({DIGIT}+\.{DIGIT}*|\.{DIGIT}+)([eE][\+\-]?{INT})?
FLOAT = ({DIGIT}+\.{DIGIT}*|\.{DIGIT}+)(E[\+\-]?{INT})?
% Approximate numeric literal in scientific notation without a decimal
EXPONENT = {DIGIT}+[eE][\+\-]?{DIGIT}+
EXPONENT = {DIGIT}+E[\+\-]?{DIGIT}+
% We extend the allowed JMS identifier syntax with '.' and '-' even though
% these two characters return false for Character.isJavaIdentifierPart()
% to allow identifiers such as properties.group-id
@ -22,52 +22,52 @@ Rules.
{WHITESPACE}+ : skip_token.
% Logical operators (case insensitive)
[aA][nN][dD] : {token, {'AND', TokenLine}}.
[oO][rR] : {token, {'OR', TokenLine}}.
[nN][oO][tT] : {token, {'NOT', TokenLine}}.
AND : {token, {'AND', TokenLine}}.
OR : {token, {'OR', TokenLine}}.
NOT : {token, {'NOT', TokenLine}}.
% Special operators (case insensitive)
[lL][iI][kK][eE] : {token, {'LIKE', TokenLine}}.
[iI][nN] : {token, {'IN', TokenLine}}.
[iI][sS] : {token, {'IS', TokenLine}}.
[nN][uU][lL][lL] : {token, {'NULL', TokenLine}}.
[eE][sS][cC][aA][pP][eE] : {token, {'ESCAPE', TokenLine}}.
LIKE : {token, {'LIKE', TokenLine}}.
IN : {token, {'IN', TokenLine}}.
IS : {token, {'IS', TokenLine}}.
NULL : {token, {'NULL', TokenLine}}.
ESCAPE : {token, {'ESCAPE', TokenLine}}.
% Boolean literals (case insensitive)
[tT][rR][uU][eE] : {token, {boolean, TokenLine, true}}.
[fF][aA][lL][sS][eE] : {token, {boolean, TokenLine, false}}.
TRUE : {token, {boolean, TokenLine, true}}.
FALSE : {token, {boolean, TokenLine, false}}.
% Comparison operators
% "The <> operator is synonymous to the != operator."
<> : {token, {'<>', TokenLine}}.
!= : {token, {'<>', TokenLine}}.
= : {token, {'=', TokenLine}}.
>= : {token, {'>=', TokenLine}}.
<= : {token, {'<=', TokenLine}}.
> : {token, {'>', TokenLine}}.
< : {token, {'<', TokenLine}}.
<> : {token, {'<>', TokenLine}}.
!= : {token, {'<>', TokenLine}}.
= : {token, {'=', TokenLine}}.
>= : {token, {'>=', TokenLine}}.
<= : {token, {'<=', TokenLine}}.
> : {token, {'>', TokenLine}}.
< : {token, {'<', TokenLine}}.
% Arithmetic operators
\+ : {token, {'+', TokenLine}}.
- : {token, {'-', TokenLine}}.
\* : {token, {'*', TokenLine}}.
/ : {token, {'/', TokenLine}}.
\% : {token, {'%', TokenLine}}.
\+ : {token, {'+', TokenLine}}.
- : {token, {'-', TokenLine}}.
\* : {token, {'*', TokenLine}}.
/ : {token, {'/', TokenLine}}.
\% : {token, {'%', TokenLine}}.
% Parentheses and comma
\( : {token, {'(', TokenLine}}.
\) : {token, {')', TokenLine}}.
, : {token, {',', TokenLine}}.
\( : {token, {'(', TokenLine}}.
\) : {token, {')', TokenLine}}.
, : {token, {',', TokenLine}}.
% Literals
{INT} : {token, {integer, TokenLine, list_to_integer(TokenChars)}}.
{FLOAT} : {token, {float, TokenLine, list_to_float(to_float(TokenChars))}}.
{EXPONENT} : {token, {float, TokenLine, parse_scientific_notation(TokenChars)}}.
{STRING} : {token, {string, TokenLine, process_string(TokenChars)}}.
{IDENTIFIER} : {token, {identifier, TokenLine, unicode:characters_to_binary(TokenChars)}}.
{INT} : {token, {integer, TokenLine, list_to_integer(TokenChars)}}.
{FLOAT} : {token, {float, TokenLine, list_to_float(to_float(TokenChars))}}.
{EXPONENT} : {token, {float, TokenLine, parse_scientific_notation(TokenChars)}}.
{STRING} : {token, {string, TokenLine, process_string(TokenChars)}}.
{IDENTIFIER} : {token, {identifier, TokenLine, unicode:characters_to_binary(TokenChars)}}.
% Catch any other characters as errors
. : {error, {illegal_character, TokenChars}}.
. : {error, {illegal_character, TokenChars}}.
Erlang code.
@ -81,15 +81,13 @@ to_float(Chars) ->
$. ->
Chars ++ "0";
_ ->
Chars1 = string:lowercase(Chars),
Chars2 = string:replace(Chars1, ".e", ".0e"),
lists:flatten(Chars2)
Chars1 = string:replace(Chars, ".E", ".0E"),
lists:flatten(Chars1)
end.
parse_scientific_notation(Chars) ->
Str = string:lowercase(Chars),
{Before, After0} = lists:splitwith(fun(C) -> C =/= $e end, Str),
[$e | After] = After0,
{Before, After0} = lists:splitwith(fun(C) -> C =/= $E end, Chars),
[$E | After] = After0,
Base = list_to_integer(Before),
Exp = list_to_integer(After),
Base * math:pow(10, Exp).

View File

@ -239,7 +239,7 @@ filter_few_messages_from_many(Config) ->
%% Our filter should cause us to receive only the first and
%% last message out of the 1002 messages in the stream.
Filter = filter(<<"properties.group-id is not null">>),
Filter = filter(<<"properties.group-id IS NOT NULL">>),
{ok, Receiver} = amqp10_client:attach_receiver_link(
Session, <<"receiver">>, Address,
unsettled, configuration, Filter),

View File

@ -162,9 +162,9 @@ comparison_operators(_Config) ->
%% "Boolean comparison is restricted to = and <>."
%% "If the comparison of non-like type values is attempted, the value of the operation is false."
true = match("active = true", app_props()),
true = match("premium = false", app_props()),
false = match("premium <> false", app_props()),
true = match("active = TRUE", app_props()),
true = match("premium = FALSE", app_props()),
false = match("premium <> FALSE", app_props()),
false = match("premium >= 'false'", app_props()),
false = match("premium <= 'false'", app_props()),
false = match("premium >= 0", app_props()),
@ -173,8 +173,8 @@ comparison_operators(_Config) ->
false = match("weight = '5'", app_props()),
false = match("weight >= '5'", app_props()),
false = match("weight <= '5'", app_props()),
false = match("country <= true", app_props()),
false = match("country >= true", app_props()),
false = match("country <= TRUE", app_props()),
false = match("country >= TRUE", app_props()),
false = match("country > 1", app_props()),
false = match("country >= 1", app_props()),
false = match("country < 1", app_props()),
@ -575,38 +575,10 @@ complex_expressions(_Config) ->
app_props()
).
%% "Predefined selector literals and operator names are [...] case insensitive."
%% "Identifiers are case sensitive."
case_sensitivity(_Config) ->
AppProps = app_props(),
%% 1. Test that operators and literals are case insensitive
true = match("country = 'UK' AnD weight = 5", AppProps),
true = match("country = 'UK' and weight = 5", AppProps),
true = match("country = 'France' Or weight < 6", AppProps),
true = match("country = 'France' or weight < 6", AppProps),
true = match("NoT country = 'France'", AppProps),
true = match("not country = 'France'", AppProps),
true = match("description LiKe '%test%'", AppProps),
true = match("description like '%test%'", AppProps),
true = match("country In ('US', 'UK', 'France')", AppProps),
true = match("country in ('US', 'UK', 'France')", AppProps),
true = match("missing Is NuLl", AppProps),
true = match("missing is null", AppProps),
true = match("active = TrUe", AppProps),
true = match("active = true", AppProps),
true = match("premium = FaLsE", AppProps),
true = match("premium = false", AppProps),
true = match("distance = 1.2e6", app_props()),
true = match("tiny_value = 3.5e-4", app_props()),
true = match("3 = 3e0", app_props()),
true = match("3 = 3e-0", app_props()),
true = match("300 = 3e2", app_props()),
true = match("0.03 = 3e-2", app_props()),
%% 2. Test that identifiers are case sensitive
AppPropsCaseSensitiveKeys = AppProps ++ [{{utf8, <<"COUNTRY">>}, {utf8, <<"France">>}},
{{utf8, <<"Weight">>}, {uint, 10}}],
%% Test that identifiers are case sensitive
AppPropsCaseSensitiveKeys = app_props() ++ [{{utf8, <<"COUNTRY">>}, {utf8, <<"France">>}},
{{utf8, <<"Weight">>}, {uint, 10}}],
true = match("country = 'UK'", AppPropsCaseSensitiveKeys),
true = match("COUNTRY = 'France'", AppPropsCaseSensitiveKeys),
@ -618,7 +590,7 @@ case_sensitivity(_Config) ->
false = match("WEIGHT = 5", AppPropsCaseSensitiveKeys),
true = match(
"country = 'UK' aNd COUNTRY = 'France' and weight < 6 AND Weight = 10",
"country = 'UK' AND COUNTRY = 'France' AND weight < 6 AND Weight = 10",
AppPropsCaseSensitiveKeys
).
@ -767,8 +739,8 @@ properties_section(_Config) ->
true = match("p.reply-to-group-id IS NOT NULL", Ps, APs),
false = match("p.reply-to-group-id IS NULL", Ps, APs),
true = match("p.message-id = 'id-123' and 'some subject' = p.subject", Ps, APs),
true = match("p.group-sequence < 500 or p.correlation-id > 700", Ps, APs),
true = match("p.message-id = 'id-123' AND 'some subject' = p.subject", Ps, APs),
true = match("p.group-sequence < 500 OR p.correlation-id > 700", Ps, APs),
true = match("(p.content-type LIKE 'text/%') AND p.content-encoding = 'deflate'", Ps, APs),
true = match("p.subject IS NULL", #'v1_0.properties'{}, APs),