]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
minor rearrangements, and update arrays for new operators
authorAlan T. DeKok <aland@freeradius.org>
Sun, 19 Dec 2021 13:23:36 +0000 (08:23 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 21 Dec 2021 17:22:13 +0000 (12:22 -0500)
src/lib/util/token.c
src/lib/util/token.h

index b6a3959293a5ca2073ef00aa60a7dff53735633c..c459c1601682e8a50777a0b942749a855193a5f3 100644 (file)
@@ -155,16 +155,20 @@ const char fr_token_quote[T_TOKEN_LAST] = {
 #define T(_x) [T_OP_ ## _x] = true
 
 const bool fr_assignment_op[T_TOKEN_LAST] = {
-       T(INCRM),
+       T(INCRM),               /* only used by LDAP :( */
+
        T(ADD_EQ),
        T(SUB_EQ),
-       T(SET),
-       T(EQ),
-       T(PREPEND),
-       T(OR_EQ),
+       T(MUL_EQ),
+       T(DIV_EQ),
        T(AND_EQ),
+       T(OR_EQ),
        T(RSHIFT_EQ),
        T(LSHIFT_EQ),
+
+       T(SET),
+       T(EQ),
+       T(PREPEND),
 };
 
 const bool fr_equality_op[T_TOKEN_LAST] = {
index 8f5f2e92c395899973648812f76d50da9c6a2be8..ba9a757fdbff508fe4d117c61cbdd73b9b835bae 100644 (file)
@@ -45,6 +45,9 @@ typedef enum fr_token {
        T_COMMA,                        /* , */
        T_SEMICOLON,                    /* ; */
 
+       /*
+        *      Binary operations
+        */
        T_ADD,                          /* + */
        T_SUB,                          /* - */
        T_MUL,                          /* * */
@@ -55,29 +58,34 @@ typedef enum fr_token {
        T_RSHIFT,                       /* >> */
        T_LSHIFT,                       /* << */
 
-       T_LAND,                         /* && */
-       T_LOR,                          /* || */
-
-       /*
-        *      Only used by LDAP ???
-        */
-       T_OP_INCRM,                     /* ++ */
-
        /*
-        *      Assignment operators.
+        *      Assignment operators associated with binary
+        *      operations.
         */
        T_OP_ADD_EQ,                    /* += */
        T_OP_SUB_EQ,                    /* -= */
-       T_OP_SET,                       /* := */
-       T_OP_PREPEND,                   /* ^= */
-#define T_OP_XOR_EQ T_OP_PREPEND
+       T_OP_MUL_EQ,                    /* *= */
+       T_OP_DIV_EQ,                    /* /= */
        T_OP_OR_EQ,                     /* |= */
        T_OP_AND_EQ,                    /* &= */
 
        T_OP_RSHIFT_EQ,                 /* >>= */
        T_OP_LSHIFT_EQ,                 /* <<= */
 
+       /*
+        *      Assignment operators associated with
+        *      other operations.
+        */
        T_OP_EQ,                        /* = */
+       T_OP_SET,                       /* := */
+       T_OP_PREPEND,                   /* ^= */
+#define T_OP_XOR_EQ T_OP_PREPEND
+
+       /*
+        *      Logical / short-circuit operators.
+        */
+       T_LAND,                         /* && */
+       T_LOR,                          /* || */
 
        /*
         *      Comparison operators.
@@ -93,6 +101,11 @@ typedef enum fr_token {
        T_OP_CMP_FALSE,                 /* !* */
        T_OP_CMP_EQ,                    /* == */
 
+       /*
+        *      Only used by LDAP ???
+        */
+       T_OP_INCRM,                     /* ++ */
+
        /*
         *      T_HASH MUST be after all of various assignment
         *      operators.  See fr_token_quote[].