Skip to content

Support parsing escaped characters for PX_Lexer#133

Open
woodzn wants to merge 2 commits intomatrixcascade:masterfrom
woodzn:master
Open

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

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