Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support parsing escaped characters for PX_Lexer #133

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

woodzn
Copy link

@woodzn woodzn commented Mar 2, 2025

Solve the problem that escaped characters cannot be parsed in JSON

test code

#include "PX_Core.h"
#include "PX_Kernel.h"
char buff[1024*1024];
int main() {
	PX_Json json;
	px_memorypool mp;
	char *p="{\"hello\":\"\\\"\"}";
	mp=MP_Create(buff, 1024*1024);
	PX_JsonInitialize(&mp,&json);
	px_bool ok=PX_JsonParse(&json,p);
	if (!ok) {
		printf("JSON parse error\n");
	}
	else {
		const char* v=PX_JsonGetString(&json,"hello");
		printf("%s:%s\n","hello",v);
	}
}

Program output before repair

JSON parse error

Now the program outputs

hello:"

添加转义字符解析
@woodzn woodzn changed the title Update PX_Lexer.c Support parsing escaped characters for PX_Lexer Mar 2, 2025
Sign up for free to 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