Changeset 4b509ae in tol
- Timestamp:
- May 12, 2017, 11:11:25 AM (9 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 86bad57
- Parents:
- 8be3475
- File:
-
- 1 edited
-
tol/btol/bgrammar/spfuninst.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tol/btol/bgrammar/spfuninst.cpp
r8be3475 r4b509ae 885 885 BParser::Unparse(tre,"","")+","+(int)left+")\n\n"+ 886 886 BParser::treWrite((List*)tre," ",false)); */ 887 if(BSpecialFunction::TestNumArg(_name_, 2, nb, 2))888 {889 //Std(BText("\nEvElement tre=")+BParser::Unparse(tre));887 if(BSpecialFunction::TestNumArg(_name_, 2, nb, 3)) 888 { 889 //Std(BText("\nEvElement tre=")+BParser::Unparse(tre)); 890 890 if(left) uSet = GraSet()->LeftEvaluateTree(Branch(tre,1)); 891 891 else uSet = GraSet()->EvaluateTree(Branch(tre,1)); 892 892 BGrammar::PutLast(gra); 893 893 if (uSet) 894 {894 { 895 895 BSet& set = Set(uSet); 896 896 List* b2 = Branch(tre,2); 897 897 BToken* tok = BParser::treToken(b2); 898 898 if(tok->Name()[0]!='\"') 899 {899 { 900 900 bool oldEnabled = BOut::Disable(); 901 901 int oldObjNum = BSyntaxObject::NSyntaxObject(); 902 uIndex = GraReal()->EvaluateTree(b2);902 uIndex = GraReal()->EvaluateTree(b2); 903 903 BGrammar::PutLast(gra); 904 904 needCleanTree = true; 905 905 deleteUIndex = (oldObjNum < BSyntaxObject::NSyntaxObject()); 906 906 if(oldEnabled) { BOut::Enable(); } 907 }908 if (uIndex)909 {910 if (uIndex->Grammar() != GraReal())911 {912 BText msg("Unexpected result: Real Evaluate return an "913 "object of type ");914 msg += uIndex->Grammar()->Name();915 msg += BText(". Please report this to "916 "http://bugs.tol-project.org/");917 Warning(msg);918 }907 } 908 if (uIndex) 909 { 910 if (uIndex->Grammar() != GraReal()) 911 { 912 BText msg("Unexpected result: Real Evaluate return an " 913 "object of type "); 914 msg += uIndex->Grammar()->Name(); 915 msg += BText(". Please report this to " 916 "http://bugs.tol-project.org/"); 917 Warning(msg); 918 } 919 919 else 920 { 921 result = set.GetElement((BInt)Real(uIndex)); 922 } 923 } 920 { 921 bool oldEnabled; 922 if(nb>=3) 923 { 924 oldEnabled = BOut::Disable(); 925 } 926 result = set.GetElement((BInt)Real(uIndex)); 927 if (nb>=3) 928 { 929 if(oldEnabled) 930 { 931 BOut::Enable(); 932 } 933 result = GraAnything()->EvaluateTree(Branch(tre,3)); 934 } 935 } 936 } 924 937 else 925 {938 { 926 939 int oldObjNum = BSyntaxObject::NSyntaxObject(); 927 940 if(needCleanTree) { BGrammar::CleanTreeCache(b2, true); } 928 uIndex = GraText()->EvaluateTree(b2);941 uIndex = GraText()->EvaluateTree(b2); 929 942 BGrammar::PutLast(gra); 930 943 deleteUIndex = (oldObjNum < BSyntaxObject::NSyntaxObject()); 931 if (uIndex) 932 { 933 if (uIndex->Grammar() != GraText()) 934 { 935 BText msg("Unexpected result: Text Evaluate return " 936 "an object of type "); 937 msg += uIndex->Grammar()->Name(); 938 msg += BText(". Please report this to " 939 "http://bugs.tol-project.org/"); 940 Warning(msg); 941 } 942 else 943 { 944 result = set.GetElement(Text(uIndex).String()); 945 } 946 } 947 else 948 { 949 BText msg(_name_); 950 Error(I2(msg + ": invalid Set index type, must be " 951 "Real or Text", msg + ":Indice de conjunto " 952 "inválido, debe ser Real o Text")); 953 } 944 if (uIndex) 945 { 946 if (uIndex->Grammar() != GraText()) 947 { 948 BText msg("Unexpected result: Text Evaluate return " 949 "an object of type "); 950 msg += uIndex->Grammar()->Name(); 951 msg += BText(". Please report this to " 952 "http://bugs.tol-project.org/"); 953 Warning(msg); 954 } 955 else 956 { 957 bool oldEnabled; 958 if(nb>=3) 959 { 960 oldEnabled = BOut::Disable(); 961 } 962 result = set.GetElement(Text(uIndex).String()); 963 if (nb>=3) 964 { 965 if(oldEnabled) 966 { 967 BOut::Enable(); 968 } 969 result = GraAnything()->EvaluateTree(Branch(tre,3)); 970 } 954 971 } 972 } 973 else 974 { 975 BText msg(_name_); 976 Error(I2(msg + ": invalid Set index type, must be " 977 "Real or Text", msg + ":Indice de conjunto " 978 "inválido, debe ser Real o Text")); 955 979 } 956 } 957 result = BSpecialFunction::TestResult(_name_, result, tre, NIL, BFALSE); 958 BText resGraName = (result)?result->Grammar()->Name():""; 959 if (result && gra!=GraAnything() && result->Grammar() != gra) 960 { 961 BSyntaxObject *cast = gra->Casting(result); 962 if(cast) result = cast; 963 else 964 { 965 BText msg(_name_); 966 Error(I2("Incompatible types in " ,"Tipos incompatibles en ") + 967 msg + ": " + result->Identify() + I2(" is a ", " es de tipo ") + 968 result->Grammar()->Name() + 969 I2(" but not a ", ", pero no de tipo ") + gra->Name() + "."); 970 result = NIL; 971 } 972 } 980 } 981 } 982 } 983 984 result = BSpecialFunction::TestResult(_name_, result, tre, NIL, BFALSE); 985 BText resGraName = (result)?result->Grammar()->Name():""; 986 if (result && gra!=GraAnything() && result->Grammar() != gra) 987 { 988 BSyntaxObject *cast = gra->Casting(result); 989 if(cast) result = cast; 990 else 991 { 992 BText msg(_name_); 993 Error(I2("Incompatible types in " ,"Tipos incompatibles en ") + 994 msg + ": " + result->Identify() + I2(" is a ", " es de tipo ") + 995 result->Grammar()->Name() + 996 I2(" but not a ", ", pero no de tipo ") + gra->Name() + "."); 997 result = NIL; 998 } 999 } 973 1000 if(uIndex && deleteUIndex) { SAFE_DESTROY(uIndex,result); } 974 1001 if(!left) { SAFE_DESTROY(uSet,result); }
Note: See TracChangeset
for help on using the changeset viewer.
