# HG changeset patch # User Olaf Wintermann # Date 1668250367 -3600 # Node ID 3df9258cd3ccdd4de04731ea4f39b8fff6e23d18 # Parent bb7cff720dd05c14b12c935c7f13103336bf6390 allow '-' in tokens, add support for negative integers diff -r bb7cff720dd0 -r 3df9258cd3cc src/server/config/serverconfig.c --- a/src/server/config/serverconfig.c Sat Nov 12 11:01:11 2022 +0100 +++ b/src/server/config/serverconfig.c Sat Nov 12 11:52:47 2022 +0100 @@ -97,7 +97,7 @@ } static int scfg_char_is_delim(char c) { - static const char *scfg_tokenizer_delim = "()+-/*%"; + static const char *scfg_tokenizer_delim = "()/*%"; for(int i=0;itype == NSAPI_EXPRESSION_INT, "wrong type"); + UCX_TEST_ASSERT(expr->value.i == -123, "wrong value"); + + UCX_TEST_END; + + pool_destroy(pool); +} + UCX_TEST(test_expr_parse_expr_value_str) { pool_handle_t *pool = pool_create(); diff -r bb7cff720dd0 -r 3df9258cd3cc src/server/test/object.h --- a/src/server/test/object.h Sat Nov 12 11:01:11 2022 +0100 +++ b/src/server/test/object.h Sat Nov 12 11:52:47 2022 +0100 @@ -38,6 +38,7 @@ #endif UCX_TEST(test_expr_parse_expr_value); +UCX_TEST(test_expr_parse_expr_neg_value); UCX_TEST(test_expr_parse_expr_value_str); UCX_TEST(test_expr_parse_expr_value_bool); UCX_TEST(test_expr_parse_expr_value_var); diff -r bb7cff720dd0 -r 3df9258cd3cc src/server/util/object.c --- a/src/server/util/object.c Sat Nov 12 11:01:11 2022 +0100 +++ b/src/server/util/object.c Sat Nov 12 11:52:47 2022 +0100 @@ -112,8 +112,11 @@ /* ------------------------------ Expression ------------------------------ */ Expression* condition_create(pool_handle_t *pool, CxList *tokens) { - - + size_t pos = 0; + NSAPIExpression *expression = expr_parse_logical_expr(pool, tokens, &pos); + if(!expression || pos != tokens->size) { + return NULL; + } return NULL; } @@ -185,7 +188,19 @@ } static int token_is_int(cxstring token) { - for(size_t i=0;i