Skip to content

Parsing a string with escape characters #85

@senyai

Description

@senyai

Hi!

I want to parse (lex) "He\"llo" "𝑤𝑜𝑟𝑙𝑑!" as two tokens He"llo and 𝑤𝑜𝑟𝑙𝑑!. I couldn't find anything that would work. I think #79 is a similar issue.
r'"(?:\\.|[^"\\])*"' idea from so didn't work as expected as it merged two strings.
@_(r'''("[^"\\]*(\\.[^"\\]*)*"|'[^'\\]*(\\.[^'\\]*)*')''') trick from medium.com didn't work.
All sly json parsers out there use r"\".*?\"" which is wrong.
Is it even possible?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions