JsonParserByLeo/Test/Err.mq5

65 строки
2,4 КиБ
MQL5
ИсходныйПостоянная ссылкаОбычный видИстория

2026-09-18 14:11:09 -05:00
//+------------------------------------------------------------------+
//| Err.mq5 |
//| Copyright 2026, Niquel Mendoza. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Niquel Mendoza."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
2026-10-19 13:26:09 -05:00
#define JSONPARSERBYLEO_DLL
#define JSONPARSERBYLEO_DLL_AVX2
2026-10-08 13:39:44 -05:00
#include "..\\Src\\JsonNode\\JsonNode.mqh"
2026-09-18 14:11:09 -05:00
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
TSN::CJsonParser parser;
2026-10-02 22:01:54 -05:00
/*
//---
// Len has superated reading json, finding comma or context close (], }) [Line 1, Col 10]
parser.Assing("{\"a\":1.0");
parser.CorrectPadding();
parser.Parse();
parser.ErrorInfo();
2026-10-01 13:36:22 -05:00
2026-10-02 22:01:54 -05:00
//---
// A numeric value was expected after the decimal point. [Line 1, Col 9]
parser.Assing("{\"a\":1.}");
parser.CorrectPadding();
parser.Parse();
parser.ErrorInfo();
2026-10-01 13:36:22 -05:00
2026-10-02 22:01:54 -05:00
//---
// A number in JSON notation cannot have leading zeros. [Line 1, Col 8]
parser.Assing("{\"a\":007}");
parser.CorrectPadding();
parser.Parse();
parser.ErrorInfo();
2026-10-01 13:36:22 -05:00
2026-10-02 22:01:54 -05:00
//---
// Len has superated reading json, finding comma or context close (], }) [Line 2, Col 1]
parser.Assing("{\"a\":\"a}");
parser.CorrectPadding();
parser.Parse();
parser.ErrorInfo();*/
2026-10-08 21:55:21 -05:00
2026-10-19 13:26:09 -05:00
const string s = "{\"ae\":[[10,10],[20,20],[]],\"comida\":\"\\ud83d\\ude00\",\"trapo\":10.05,\"a\":true,\"invalid\":\"<a href=\\\"https://twitter.com/shiawaseomamori\\\" rel=\\\"nofollow\\\">幸せの☆お守り</a>\",\"precios\":[10,20,30,40,50],\"va\":1"
",\"interpolado\":\"${{valor}}\"}";
2026-10-17 15:35:59 -05:00
Print(s);
parser.Assing(s);
2026-10-19 13:26:09 -05:00
parser.CorrectPaddingSimd();
Print(parser.ParseSimd());
2026-10-02 22:01:54 -05:00
parser.PrintCintaTypes(0, WHOLE_ARRAY);
2026-10-01 13:36:22 -05:00
parser.ErrorInfo();
2026-10-02 22:01:54 -05:00
2026-10-17 15:35:59 -05:00
2026-09-18 14:11:09 -05:00
}
//+------------------------------------------------------------------+