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

Function db_logical_relation_expr

freebsd/ddb/db_expr.c:276–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276static bool
277db_logical_relation_expr(
278 db_expr_t *valuep)
279{
280 db_expr_t lhs, rhs;
281 int t;
282
283 if (!db_shift_expr(&lhs))
284 return (false);
285
286 t = db_read_token();
287 while (t == tLOG_EQ || t == tLOG_NOT_EQ || t == tGREATER ||
288 t == tGREATER_EQ || t == tLESS || t == tLESS_EQ) {
289 if (!db_shift_expr(&rhs)) {
290 db_printf("Expression syntax error after '%s'\n",
291 t == tLOG_EQ ? "==" : t == tLOG_NOT_EQ ? "!=" :
292 t == tGREATER ? ">" : t == tGREATER_EQ ? ">=" :
293 t == tLESS ? "<" : "<=");
294 db_error(NULL);
295 /*NOTREACHED*/
296 }
297 switch(t) {
298 case tLOG_EQ:
299 lhs = (lhs == rhs);
300 break;
301 case tLOG_NOT_EQ:
302 lhs = (lhs != rhs);
303 break;
304 case tGREATER:
305 lhs = (lhs > rhs);
306 break;
307 case tGREATER_EQ:
308 lhs = (lhs >= rhs);
309 break;
310 case tLESS:
311 lhs = (lhs < rhs);
312 break;
313 case tLESS_EQ:
314 lhs = (lhs <= rhs);
315 break;
316 default:
317 __assert_unreachable();
318 }
319 t = db_read_token();
320 }
321 db_unread_token(t);
322 *valuep = lhs;
323 return (true);
324}
325
326static bool
327db_logical_and_expr(

Callers 1

db_logical_and_exprFunction · 0.85

Calls 5

db_shift_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