//+------------------------------------------------------------------+ //| TestDyn.mq5 | //| Copyright 2026, Niquel Mendoza. | //| https://www.mql5.com/es/users/nique_372/news | //+------------------------------------------------------------------+ #property copyright "Copyright 2026, Niquel Mendoza." #property link "https://www.mql5.com/es/users/nique_372/news" #property version "1.00" #property strict //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ #include "AST.mqh" #include "Tokenizer.mqh" #include "..\\Common\\NodeUtils.mqh" //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- CMathExpTokenizer tokenizer; TokenMathExp tokns[]; const string text = "$suma * $producto "; if(!tokenizer.Tokenize(text, tokns)) { Print(tokenizer.FormatLastError(text)); return; } else { tokenizer.PrintValues(tokns); } //--- CMathExpresionEvalDync eval; CHashMap variables; variables.Add("suma", new IValorSimpleValVal(10)); variables.Add("producto", new IValorSimpleValVal(10)); //--- eval.TableSymbols(&variables); ValueNode bit; eval.CleanCache(tokns); Print(eval.ParsNoRes(tokns, bit)); Print(bit.type); if(bit.type == MATH_EXP_NODE_TYPE_STATIC) { Print("Valor: ", (bit.s_val_type == AST_LOGIC_NUMBER_DOUBLE ? bit.s_val.double_value : bit.s_val.long_value)); } else { CNodeUtils::PrintValue(bit.d_val); delete bit.d_val; } //--- string t[]; IValor* p[]; const int to = variables.CopyTo(t, p); for(int i = 0; i < to; i++) { delete p[i]; } } //+------------------------------------------------------------------+