diff options
author | João Valverde <j@v6e.pt> | 2022-12-22 18:31:32 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2022-12-22 23:51:16 +0000 |
commit | 4e1211de90ec0b382043a526ea2f4600da3033b5 (patch) | |
tree | 10b1e8798f4818287c8d6b2b6b854bec094f207e /epan/dfilter | |
parent | 5dcefc77777f47407801f8c51d3951fcb675da6e (diff) |
dfilter: Add support for negation of arithmetic expressions
Diffstat (limited to 'epan/dfilter')
-rw-r--r-- | epan/dfilter/dfvm.c | 2 | ||||
-rw-r--r-- | epan/dfilter/grammar.lemon | 4 | ||||
-rw-r--r-- | epan/dfilter/semcheck.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/epan/dfilter/dfvm.c b/epan/dfilter/dfvm.c index ad1f41bbcd..1571d8f8f1 100644 --- a/epan/dfilter/dfvm.c +++ b/epan/dfilter/dfvm.c @@ -438,7 +438,7 @@ dfvm_dump_str(wmem_allocator_t *alloc, dfilter_t *df, gboolean print_references) break; case DFVM_UNARY_MINUS: - wmem_strbuf_append_printf(buf, "%05d %s\t\t-%s -> %s\n", + wmem_strbuf_append_printf(buf, "%05d %s\t-%s -> %s\n", id, opcode_str, arg1_str, arg2_str); break; diff --git a/epan/dfilter/grammar.lemon b/epan/dfilter/grammar.lemon index 4742520ef5..9a729a16d1 100644 --- a/epan/dfilter/grammar.lemon +++ b/epan/dfilter/grammar.lemon @@ -234,12 +234,12 @@ arithmetic_expr(T) ::= entity(N). T = N; } -arithmetic_expr(T) ::= PLUS entity(N). [UNARY_PLUS] +arithmetic_expr(T) ::= PLUS arithmetic_expr(N). [UNARY_PLUS] { T = N; } -arithmetic_expr(T) ::= MINUS(M) entity(N). [UNARY_MINUS] +arithmetic_expr(T) ::= MINUS(M) arithmetic_expr(N). [UNARY_MINUS] { T = M; sttype_oper_set1(T, STNODE_OP_UNARY_MINUS, N); diff --git a/epan/dfilter/semcheck.c b/epan/dfilter/semcheck.c index e680a3113c..fee1e3d37a 100644 --- a/epan/dfilter/semcheck.c +++ b/epan/dfilter/semcheck.c @@ -1206,7 +1206,7 @@ check_arithmetic_expr(dfwork_t *dfw, stnode_t *st_node, ftenum_t lhs_ftype) } if (st_op == STNODE_OP_UNARY_MINUS) { - ftype1 = check_arithmetic_entity(dfw, st_arg1, lhs_ftype); + ftype1 = check_arithmetic_expr(dfw, st_arg1, lhs_ftype); if (!ftype_can_unary_minus(ftype1)) { FAIL(dfw, st_arg1, "%s %s.", ftype_name(ftype1), op_to_error_msg(st_op)); |