MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / parse_mfactor

Method parse_mfactor

erpcgen/src/cpptemplate/cpptempl.cpp:1419–1460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1417}
1418
1419data_ptr ExprParser::parse_mfactor()
1420{
1421 data_ptr ldata = parse_factor();
1422
1423 token_type_t tokType = m_tok->get_type();
1424 if (tokType == token_type_t::TIMES_TOKEN || tokType == token_type_t::DIVIDE_TOKEN || tokType == token_type_t::MOD_TOKEN)
1425 {
1426 m_tok.next();
1427
1428 data_ptr rdata = parse_mfactor();
1429
1430 switch (tokType)
1431 {
1432 case token_type_t::TIMES_TOKEN:
1433 ldata = ldata->getint() * rdata->getint();
1434 break;
1435 case token_type_t::DIVIDE_TOKEN:
1436 if (rdata->getint() == 0)
1437 {
1438 ldata = 0;
1439 }
1440 else
1441 {
1442 ldata = ldata->getint() / rdata->getint();
1443 }
1444 break;
1445 case token_type_t::MOD_TOKEN:
1446 if (rdata->getint() == 0)
1447 {
1448 ldata = 0;
1449 }
1450 else
1451 {
1452 ldata = ldata->getint() % rdata->getint();
1453 }
1454 break;
1455 default:
1456 break;
1457 }
1458 }
1459 return ldata;
1460}
1461
1462data_ptr ExprParser::parse_bterm()
1463{

Callers

nothing calls this directly

Calls 3

get_typeMethod · 0.80
getintMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected