1 /* $NetBSD: lsym_binary_op.c,v 1.2 2021/11/25 17:46:51 rillig Exp $ */ 2 /* $FreeBSD$ */ 3 4 /* 5 * Tests for the token lsym_binary_op, which represents a binary operator in 6 * an expression. Examples for binary operators are '>>', '=', '+', '&&'. 7 * 8 * Binary operators are surrounded by blanks. 9 * 10 * Some tokens like '+', '*' or '&' can be either binary or unary operators, 11 * with an entirely different meaning. 12 * 13 * The token '*' is not only a binary or a unary operator, it is used in types 14 * as well, to derive a pointer type. 15 * 16 * See also: 17 * lsym_postfix_op.c for postfix unary operators 18 * lsym_unary_op.c for prefix unary operators 19 * lsym_colon.c for ':' 20 * lsym_question.c for '?' 21 * lsym_comma.c for ',' 22 * C99 6.4.6 "Punctuators" 23 */ 24 25 #indent input 26 // TODO: add input 27 #indent end 28 29 #indent run-equals-input 30 31 32 /* 33 * If a '*' is immediately followed by another '*', they still form separate 34 * operators. The first is a binary operator, the second is unary. 35 */ 36 #indent input 37 int var = expr**ptr; 38 #indent end 39 40 #indent run -di0 41 int var = expr * *ptr; 42 #indent end 43