Skip to content

Support parsing escaped characters for PX_Lexer - #133

Open
woodzn wants to merge 2 commits into
matrixcascade:masterfrom
woodzn:master
Open

Support parsing escaped characters for PX_Lexer#133
woodzn wants to merge 2 commits into
matrixcascade:masterfrom
woodzn:master

Conversation

@woodzn

@woodznwoodzn commented Mar 2, 2025

Copy link
Copy Markdown

Solve the problem that escaped characters cannot be parsed in JSON

test code

#include"PX_Core.h"#include"PX_Kernel.h"charbuff[1024*1024];
intmain() {
PX_Jsonjson;
px_memorypoolmp;
char*p="{\"hello\":\"\\\"\"}";
mp=MP_Create(buff, 1024*1024);
PX_JsonInitialize(&mp,&json);
px_boolok=PX_JsonParse(&json,p);
if (!ok) {
printf("JSON parse error\n");
}
else {
constchar*v=PX_JsonGetString(&json,"hello");
printf("%s:%s\n","hello",v);
}
}

Program output before repair

JSON parse error

Now the program outputs

hello:"

添加转义字符解析
@woodznwoodzn changed the title Update PX_Lexer.cSupport parsing escaped characters for PX_LexerMar 2, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@woodzn@wood0zn