MCPcopy Create free account
hub / github.com/F-Stack/f-stack / db_add_expr

Function db_add_expr

freebsd/ddb/db_expr.c:205–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205static bool
206db_add_expr(db_expr_t *valuep)
207{
208 db_expr_t lhs, rhs;
209 int t;
210
211 if (!db_mult_expr(&lhs))
212 return (false);
213
214 t = db_read_token();
215 while (t == tPLUS || t == tMINUS || t == tBIT_OR) {
216 if (!db_mult_expr(&rhs)) {
217 db_printf("Expression syntax error after '%c'\n",
218 t == tPLUS ? '+' : t == tMINUS ? '-' : '|');
219 db_error(NULL);
220 /*NOTREACHED*/
221 }
222 switch (t) {
223 case tPLUS:
224 lhs += rhs;
225 break;
226 case tMINUS:
227 lhs -= rhs;
228 break;
229 case tBIT_OR:
230 lhs |= rhs;
231 break;
232 default:
233 __assert_unreachable();
234 }
235 t = db_read_token();
236 }
237 db_unread_token(t);
238 *valuep = lhs;
239 return (true);
240}
241
242static bool
243db_shift_expr(db_expr_t *valuep)

Callers 1

db_shift_exprFunction · 0.85

Calls 5

db_mult_exprFunction · 0.85
db_read_tokenFunction · 0.85
db_printfFunction · 0.85
db_errorFunction · 0.85
db_unread_tokenFunction · 0.85

Tested by

no test coverage detected