|
@@ -2,8 +2,9 @@ Definitions.
|
|
|
|
|
|
|
|
Control = [()&|!=~><:*]
|
|
Control = [()&|!=~><:*]
|
|
|
White = [\s\t\n\r]+
|
|
White = [\s\t\n\r]+
|
|
|
-NonString = [^()&|!=~><:*\s\t\n\r]
|
|
|
|
|
-String = {NonString}+
|
|
|
|
|
|
|
+StringChars = [^()&|!=~><:*\t\n\r]
|
|
|
|
|
+Escape = \\{Control}|\\{White}
|
|
|
|
|
+String = ({Escape}|{StringChars})+
|
|
|
|
|
|
|
|
Rules.
|
|
Rules.
|
|
|
|
|
|
|
@@ -17,10 +18,10 @@ Rules.
|
|
|
>= : {token, {greaterOrEqual, TokenLine}}.
|
|
>= : {token, {greaterOrEqual, TokenLine}}.
|
|
|
<= : {token, {lessOrEqual, TokenLine}}.
|
|
<= : {token, {lessOrEqual, TokenLine}}.
|
|
|
\* : {token, {asterisk, TokenLine}}.
|
|
\* : {token, {asterisk, TokenLine}}.
|
|
|
|
|
+\:dn : {token, {dn, TokenLine}}.
|
|
|
\: : {token, {colon, TokenLine}}.
|
|
\: : {token, {colon, TokenLine}}.
|
|
|
-dn : {token, {dn, TokenLine}}.
|
|
|
|
|
{White} : skip_token.
|
|
{White} : skip_token.
|
|
|
-{String} : {token, {string, TokenLine, TokenChars}}.
|
|
|
|
|
|
|
+{String} : {token, {string, TokenLine, to_string(TokenChars)}}.
|
|
|
%% Leex will hang if a composite operation is missing a character
|
|
%% Leex will hang if a composite operation is missing a character
|
|
|
{Control} : {error, lists:flatten(io_lib:format("Unexpected Tokens:~ts", [TokenChars]))}.
|
|
{Control} : {error, lists:flatten(io_lib:format("Unexpected Tokens:~ts", [TokenChars]))}.
|
|
|
|
|
|
|
@@ -29,3 +30,8 @@ Erlang code.
|
|
|
%%--------------------------------------------------------------------
|
|
%%--------------------------------------------------------------------
|
|
|
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
|
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
|
|
%%--------------------------------------------------------------------
|
|
%%--------------------------------------------------------------------
|
|
|
|
|
+%% eldap does not support neither the '\28value\29' nor '\(value\)'
|
|
|
|
|
+%% so after the tokenization we should remove all escape character
|
|
|
|
|
+to_string(TokenChars) ->
|
|
|
|
|
+ String = string:trim(TokenChars),
|
|
|
|
|
+ lists:flatten(string:replace(String, "\\", "", all)).
|