-/* $OpenBSD: bt_parse.y,v 1.53 2023/09/11 19:01:26 mpi Exp $ */
+/* $OpenBSD: bt_parse.y,v 1.54 2023/10/12 15:16:44 cheloha Exp $ */
/*
* Copyright (c) 2019-2023 Martin Pieuchot <mpi@openbsd.org>
* Give higher precedence to:
* 1. && and ||
* 2. ==, !=, <<, <, >=, >, +, =, &, ^, |
- * 3. * and /
+ * 3. *, /, %
*/
expr : expr OP_LAND term { $$ = ba_op(B_AT_OP_LAND, $1, $3); }
| expr OP_LOR term { $$ = ba_op(B_AT_OP_LOR, $1, $3); }
fterm : fterm '*' factor { $$ = ba_op(B_AT_OP_MULT, $1, $3); }
| fterm '/' factor { $$ = ba_op(B_AT_OP_DIVIDE, $1, $3); }
+ | fterm '%' factor { $$ = ba_op(B_AT_OP_MODULO, $1, $3); }
| factor
;
-/* $OpenBSD: bt_parser.h,v 1.24 2023/09/11 19:01:26 mpi Exp $ */
+/* $OpenBSD: bt_parser.h,v 1.25 2023/10/12 15:16:44 cheloha Exp $ */
/*
* Copyright (c) 2019-2021 Martin Pieuchot <mpi@openbsd.org>
B_AT_OP_MINUS,
B_AT_OP_MULT,
B_AT_OP_DIVIDE,
+ B_AT_OP_MODULO,
B_AT_OP_BAND,
B_AT_OP_XOR,
B_AT_OP_BOR,
-/* $OpenBSD: btrace.c,v 1.78 2023/09/15 10:59:02 claudio Exp $ */
+/* $OpenBSD: btrace.c,v 1.79 2023/10/12 15:16:44 cheloha Exp $ */
/*
* Copyright (c) 2019 - 2023 Martin Pieuchot <mpi@openbsd.org>
case B_AT_OP_DIVIDE:
result = lval / rval;
break;
+ case B_AT_OP_MODULO:
+ result = lval % rval;
+ break;
case B_AT_OP_BAND:
result = lval & rval;
break;
return "*";
case B_AT_OP_DIVIDE:
return "/";
+ case B_AT_OP_MODULO:
+ return "%";
case B_AT_OP_BAND:
return "&";
case B_AT_OP_XOR: