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

Method ParsePrimary

ngstd/evalfunc.cpp:721–869  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

719
720
721 EvalFunction::ResultType EvalFunction :: ParsePrimary()
722 {
723 ResultType result;
724
725 switch (GetToken())
726 {
727 case CONSTANT:
728 {
729 AddConstant (GetNumValue());
730 ReadNext();
731 break;
732 }
733 case SUB:
734 {
735 ReadNext(); // '-'
736 AddConstant (-1);
737 result = ParsePrimary();
738 if (result.vecdim == 1)
739 AddOperation (MULT);
740 else
741 {
742 AddOperation (SCAL_VEC_MULT);
743 program.Last().vecdim = result.vecdim;
744 }
745 break;
746 }
747 case LP:
748 {
749 ReadNext(); // '('
750 result = ParseCommaExpression();
751 ReadNext(); // ')'
752 break;
753 }
754 case VARIABLE:
755 {
756 AddVariable (GetVariableNumber());
757 program.Last().vecdim = GetVariableDimension();
758 result.vecdim = GetVariableDimension();
759 result.iscomplex = GetVariableIsComplex();
760 ReadNext();
761 break;
762 }
763 case GLOBVAR:
764 {
765 AddGlobVariable (globvar);
766 ReadNext();
767 break;
768 }
769 case GLOBGENVAR:
770 {
771 ReadNext();
772 AddGlobVariable (globgenvar);
773 program.Last().vecdim = globgenvar -> Dimension();
774 result.iscomplex = globgenvar -> IsComplex();
775 result.vecdim = globgenvar -> Dimension();
776
777 if (GetToken() == '(')
778 {

Callers

nothing calls this directly

Calls 12

GetTokenFunction · 0.85
AddConstantFunction · 0.85
GetNumValueFunction · 0.85
AddOperationFunction · 0.85
AddVariableFunction · 0.85
GetVariableNumberFunction · 0.85
GetVariableDimensionFunction · 0.85
GetVariableIsComplexFunction · 0.85
AddGlobVariableFunction · 0.85
AddFunctionFunction · 0.85
DimensionMethod · 0.45
IsComplexMethod · 0.45

Tested by

no test coverage detected