2026-05-12 15:15:09 -05:00
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| Test.mq5 |
|
|
|
|
|
//| Copyright 2026, Niquel Mendoza. |
|
|
|
|
|
//| https://www.mql5.com/es/users/nique_372 |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
#property copyright "Copyright 2026, Niquel Mendoza."
|
|
|
|
|
#property link "https://www.mql5.com/es/users/nique_372"
|
|
|
|
|
#property version "1.00"
|
|
|
|
|
#property strict
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
#include "Tokenizer.mqh"
|
2026-05-13 16:27:54 -05:00
|
|
|
#include "StaticAst.mqh"
|
2026-05-12 15:15:09 -05:00
|
|
|
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| Script program start function |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
void OnStart()
|
|
|
|
|
{
|
|
|
|
|
//---
|
2026-05-13 16:27:54 -05:00
|
|
|
CMathExpresionEvalStatic eval;
|
2026-05-12 15:15:09 -05:00
|
|
|
CMathExpTokenizer tokenizer;
|
|
|
|
|
TokenMathExp tokns[];
|
2026-05-14 16:54:23 -05:00
|
|
|
const string text = "10 * (50 + 20 * (20 + 20))";
|
2026-05-13 16:27:54 -05:00
|
|
|
BitInterpreter bit;
|
|
|
|
|
int type;
|
2026-05-12 15:15:09 -05:00
|
|
|
|
|
|
|
|
//---
|
2026-05-14 14:13:20 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
//---
|
2026-05-14 16:54:23 -05:00
|
|
|
ulong a = GetMicrosecondCount();
|
|
|
|
|
for(int i = 0; i < 10000; i++)
|
|
|
|
|
{
|
|
|
|
|
if(!tokenizer.Tokenize(text, tokns))
|
|
|
|
|
{
|
|
|
|
|
Print(tokenizer.FormatLastError(text));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
eval.CleanCache(tokns);
|
|
|
|
|
eval.ParsNoRes(tokns, bit, type);
|
|
|
|
|
}
|
|
|
|
|
ulong d = GetMicrosecondCount() - a;
|
|
|
|
|
Print(d);
|
2026-05-12 15:15:09 -05:00
|
|
|
}
|
2026-05-14 14:13:20 -05:00
|
|
|
//+------------------------------------------------------------------+
|