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

Parsing fragments that are only valid in specific contexts #38

Open
ethan-leba opened this issue Dec 9, 2021 · 0 comments
Open

Parsing fragments that are only valid in specific contexts #38

ethan-leba opened this issue Dec 9, 2021 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@ethan-leba
Copy link
Owner

ethan-leba commented Dec 9, 2021

There are many node types that are only valid in a specific context. For example, a dictionary pair (key : value) is only valid within a dictionary node. Sometimes the error recovery can handle these cases, but in other cases it can't.

Possible solutions

Use the outer node when parsing

We can try to somehow use the syntax snippets in order to create the proper context, i.e. put the pair in a {} if the outer node is a dictionary.

Custom parser

We can define a parser where all node types are valid at the top level. This would require a custom parser, which is not viable currently, but may be down the line.

Temporary solution: store the type of a fragment on copy

This would only work for nodes copied with a tree-edit function, but would be an easier temporary fix. Would be a good optimization as well

@ethan-leba ethan-leba added the bug Something isn't working label Dec 13, 2021
@ethan-leba ethan-leba added this to the 1.0 milestone Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant