diff -r edbbb3000494 -r ce359a2b51fe src/server/util/object.c --- a/src/server/util/object.c Sun Dec 04 10:20:21 2022 +0100 +++ b/src/server/util/object.c Sun Dec 04 13:01:00 2022 +0100 @@ -168,13 +168,15 @@ return NSAPI_EXPRESSION_DIV; } else if(!cx_strcmp(token, cx_str("%"))) { return NSAPI_EXPRESSION_MOD; - } else if(!cx_strcmp(token, cx_str("not"))) { + } else if(!cx_strcmp(token, cx_str("."))) { + return NSAPI_EXPRESSION_STRCAT; + } else if(!cx_strcmp(token, cx_str("not")) || !cx_strcmp(token, cx_str("!"))) { return NSAPI_EXPRESSION_NOT; - } else if(!cx_strcmp(token, cx_str("and"))) { + } else if(!cx_strcmp(token, cx_str("and")) || !cx_strcmp(token, cx_str("&&"))) { return NSAPI_EXPRESSION_AND; - } else if(!cx_strcmp(token, cx_str("or"))) { + } else if(!cx_strcmp(token, cx_str("or")) || !cx_strcmp(token, cx_str("||"))) { return NSAPI_EXPRESSION_OR; - } else if(!cx_strcmp(token, cx_str("xor"))) { + } else if(!cx_strcmp(token, cx_str("xor")) || !cx_strcmp(token, cx_str("^"))) { return NSAPI_EXPRESSION_XOR; } else if(!cx_strcmp(token, cx_str("=="))) { return NSAPI_EXPRESSION_EQ; @@ -188,6 +190,26 @@ return NSAPI_EXPRESSION_GE; } else if(!cx_strcmp(token, cx_str("<="))) { return NSAPI_EXPRESSION_LE; + } else if(!cx_strcmp(token, cx_str("="))) { + return NSAPI_EXPRESSION_WILDCARD_MATCH; + } else if(!cx_strcmp(token, cx_str("=~"))) { + return NSAPI_EXPRESSION_REGEX_MATCH; + } else if(!cx_strcmp(token, cx_str("!~"))) { + return NSAPI_EXPRESSION_REGEX_MISMATCH; + } else if(!cx_strcmp(token, cx_str("defined"))) { + return NSAPI_EXPRESSION_VALUE_DEFINED; + } else if(!cx_strcmp(token, cx_str("-d"))) { + return NSAPI_EXPRESSION_DIR_EXISTS; + } else if(!cx_strcmp(token, cx_str("-e"))) { + return NSAPI_EXPRESSION_FILE_DIR_EXISTS; + } else if(!cx_strcmp(token, cx_str("-f"))) { + return NSAPI_EXPRESSION_FILE_EXISTS; + } else if(!cx_strcmp(token, cx_str("-l"))) { + return NSAPI_EXPRESSION_SYMLINK_EXISTS; + } else if(!cx_strcmp(token, cx_str("-r"))) { + return NSAPI_EXPRESSION_FILE_READABLE; + } else if(!cx_strcmp(token, cx_str("-s"))) { + return NSAPI_EXPRESSION_FILE_SIZE; } return NSAPI_EXPRESSION_NOOP; } @@ -280,6 +302,14 @@ exp->type = NSAPI_EXPRESSION_UNARY; exp->left = expr_parser_pop(parser); exp->right = NULL; + } else if(exp->operator == NSAPI_EXPRESSION_CALL) { + // identifiers are added as call, but if they land here, it is + // actually just an identifier + exp->operator = NSAPI_EXPRESSION_NOOP; + exp->left = NULL; + exp->right = NULL; + exp->type = NSAPI_EXPRESSION_IDENTIFIER; + exp->value.identifier = op->identifier; } else { // binary operator exp->type = NSAPI_EXPRESSION_BINARY; @@ -287,7 +317,7 @@ exp->left = expr_parser_pop(parser); } - if(!exp->left && !exp->right) { + if(!exp->left && !exp->right && exp->operator != NSAPI_EXPRESSION_NOOP) { return 1; // error }