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

String should not contain control characters. #31

Closed
ExtReMLapin opened this issue Mar 5, 2024 · 5 comments
Closed

String should not contain control characters. #31

ExtReMLapin opened this issue Mar 5, 2024 · 5 comments

Comments

@ExtReMLapin
Copy link

ExtReMLapin commented Mar 5, 2024

Right now, strings can for example contain a new line, not an escaped one.

Which will lead to incorrect json generation

Here is my suggestion :

string ::= "\"" (char | escapeSequence)* "\""
char ::= [^"\\\x7F\x00-\x1F]
escapeSequence ::= "\\\"" | "\\\\" | "\\n" | "\\r" | "\\t" | "\\b" | "\\f" 


I could open a PR but I could be missing something so I open an issue to discuss this

@ExtReMLapin
Copy link
Author

I met this issue because on rare cases (15% of generations) i had this kind of json generated :

{"entities": [

{"type": "Geo-Political Entity", "name": "Paris 2024"},
{"type": "Location", "name": "Paris"}],
"relations": [{"type_from": "G',
eographic Feature", "name_from": "Paris", "type_to": "Event", "name_to": "Paris 2024", "relation_type": "occurs_in"}]}

@ExtReMLapin
Copy link
Author

Entering manually \r and \n isn't enough, I ended up with having another control character getting outputed as JSON, which made my json un-usable

@ExtReMLapin
Copy link
Author

Updated it to exclude singlequote

a10y added a commit that referenced this issue Apr 10, 2024
Addresses #31 

Also drive-by: add support for negative `number`s
@a10y
Copy link
Contributor

a10y commented Apr 10, 2024

Fixed in #37

@a10y a10y closed this as completed Apr 10, 2024
@ExtReMLapin
Copy link
Author

🖖🏻

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

No branches or pull requests

2 participants