MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / ParseTerm

Method ParseTerm

ngstd/evalfunc.cpp:668–717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

666
667
668 EvalFunction::ResultType EvalFunction :: ParseTerm ()
669 {
670 ResultType result = ParsePrimary();
671
672 while (1)
673 {
674 switch (GetToken())
675 {
676 case MULT:
677 {
678 ReadNext(); // '*'
679 ResultType result2 = ParsePrimary();
680 result.iscomplex |= result2.iscomplex;
681 if (result.vecdim == 1 && result2.vecdim == 1)
682 {
683 AddOperation (MULT);
684 }
685 else if (result.vecdim == 1 && result2.vecdim > 1)
686 {
687 AddOperation (SCAL_VEC_MULT);
688 program.Last().vecdim = result2.vecdim;
689 result.vecdim = result2.vecdim;
690 }
691 else if (result.vecdim > 1 && result2.vecdim > 1)
692 {
693 AddOperation (VEC_VEC_MULT);
694 program.Last().vecdim = result.vecdim;
695 result.vecdim = 1;
696 }
697 break;
698 }
699 case DIV:
700 {
701 ReadNext();
702 ParsePrimary();
703 AddOperation (DIV);
704 break;
705 }
706 case AND:
707 {
708 ReadNext();
709 ParsePrimary();
710 AddOperation (AND);
711 break;
712 }
713 default:
714 return result;
715 }
716 }
717 }
718
719
720

Callers

nothing calls this directly

Calls 2

GetTokenFunction · 0.85
AddOperationFunction · 0.85

Tested by

no test coverage detected