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

Idiomatic way to do partial (prefix) parses #484

Open
anton-trunov opened this issue Jul 6, 2024 · 0 comments
Open

Idiomatic way to do partial (prefix) parses #484

anton-trunov opened this issue Jul 6, 2024 · 0 comments

Comments

@anton-trunov
Copy link

anton-trunov commented Jul 6, 2024

I'm probably missing it from the docs, but how do I parse only a prefix of the input? For instance, I have some preamble in my input that I need to parse separately, so I should get my CST and the rest of the input, much like in the style of parser combinators. E.g. parsing a comma-separated list from the following input string [4, 2]rest-of-input would give me the CST representation of the valid prefix [4, 2] and rest-of-input.

My current workaround includes something like PrefixRule' = PrefixRule any* and creating a separate parser starting with PrefixRule'.

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

1 participant