2026-10-05 17:54:12 -05:00 | | | //+------------------------------------------------------------------+
|
| | | //| Def.mqh |
|
| | | //| Copyright 2026, Niquel Mendoza. |
|
| | | //| https://www.mql5.com |
|
| | | //+------------------------------------------------------------------+
|
| | | #property copyright "Copyright 2026, Niquel Mendoza."
|
| | | #property link "https://www.mql5.com"
|
| | | #property strict
|
| | |
|
| | | #ifndef BASESPARSERSLAN_SRC_EXTRADEF_POINTER_DEF_MQH
|
| | | #define BASESPARSERSLAN_SRC_EXTRADEF_POINTER_DEF_MQH
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | #include "..\\..\\Utils\\Number.mqh"
|
| | | #include "..\\..\\Utils\\ErrorFormat.mqh"
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | namespace TSN
|
| | | {
|
2026-10-05 21:57:35 -05:00 | | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | struct BSFLPointerCompiler;
|
2026-10-05 17:54:12 -05:00 | | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | // Codigos de error sugeridos
|
| | | enum ENUM_BSFL_POINTER_ERR
|
| | | {
|
| | | BSFL_POINTER_ERR_NOT,
|
| | | BSFL_POINTER_ERR_KEY_NOT_EXIST,
|
| | | BSFL_POINTER_ERR_ARRAY_OUT_RANGE,
|
| | | BSFL_POINTER_ERR_INVALID_NODE_TYPE
|
| | | };
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | enum ENUM_BSFL_POINTER_PARSE_RES
|
| | | {
|
| | | BSFL_POINTER_PARSE_RES_EXITO,
|
| | | BSFL_POINTER_PARSE_RES_ERR_QUERY_MUST_START_WITH_BR, // /
|
| | | BSFL_POINTER_PARSE_RES_ERR_INVALID_ESCAPE,
|
| | | };
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | #define BSFLPTR_I_NUMBER (0)
|
| | | #define BSFLPTR_I_KEY (1)
|
| | |
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | // start (16 bits de len psra setr)
|
| | | #define BSFLPOINTER_BIT_START_H (32)
|
| | | #define BSFLPOINTER_BIT_MASK_H (0xffff)
|
| | | #define BSFLPOINTER_BIT_GET_START(v) int((v>>BSFLPOINTER_BIT_START_H) & BSFLPOINTER_BIT_MASK_H)
|
| | |
|
| | | // len (tambien 16 bits)
|
| | | #define BSFLPOINTER_BIT_START_LEN (48)
|
| | | #define BSFLPOINTER_BIT_GET_LEN(v) int(v>>BSFLPOINTER_BIT_START_LEN)
|
| | |
|
| | | //#define BSFLPOINTER_BITS_START_H_MASK (0x7fff) // quizas no haga falta por que solo jala noma
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | struct BSFLPointerQuery
|
| | | {
|
| | | //---
|
2026-10-05 21:57:35 -05:00 | | | BSFLPointerQuery(const string& query, BSFLPointerCompiler& compiler);
|
2026-10-05 17:54:12 -05:00 | | | BSFLPointerQuery() : m_i(0), m_last_err(BSFL_POINTER_ERR_NOT), m_size(0) {}
|
| | | BSFLPointerQuery(ulong& _ins[], int _ins_size, uchar& _raw[])
|
| | | : m_i(0), m_last_err(BSFL_POINTER_ERR_NOT), m_size(_ins_size)
|
| | | {
|
| | | // rotamos
|
| | | ArraySwap(m_raw, _raw);
|
| | | ArraySwap(m_ins, _ins);
|
| | | }
|
| | |
|
| | | //---
|
| | | uchar m_raw[]; // texto crudo (opcional para debugging print de erroers hacer swap con el compíoler para zero copy)
|
| | | ulong m_ins[]; // instrucciones
|
| | | int m_size; // tamaño de instrucciones
|
| | | ENUM_BSFL_POINTER_ERR m_last_err; // ultimo err
|
| | | int m_i; // indice de iteracion
|
| | |
|
| | |
|
| | | //---
|
| | | void ErrorFormat(string& desc);
|
| | | void ErrorInfo();
|
2026-10-05 21:57:35 -05:00 | | |
|
| | | //---
|
| | | void CintaTypesInfo();
|
| | | __forceinline void Set(const string& query, BSFLPointerCompiler& compiler);
|
| | |
|
| | | //---
|
| | | const static BSFLPointerQuery EMPTY_QUERY;
|
2026-10-05 17:54:12 -05:00 | | | };
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | const BSFLPointerQuery BSFLPointerQuery::EMPTY_QUERY;
|
| | |
|
| | | //---
|
| | | }
|
| | | #endif // BASESPARSERSLAN_SRC_EXTRADEF_POINTER_DEF_MQH
|
| | | //+------------------------------------------------------------------+
|