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

Implemented option for parsing text with an alternative entry rule #1407

Merged
merged 2 commits into from Apr 30, 2024

Conversation

spoenemann
Copy link
Contributor

See discussion #1404. This PR adds an option to LangiumParser so one can change the entry rule used for parsing a given text.

@cdietrich
Copy link
Contributor

nice

@Lotes
Copy link
Contributor

Lotes commented Apr 4, 2024

Really nice! One concern I have found is scoping. When there is a cross-reference that needs to be resolved, the scope provider writer cannot assume anymore that there are "natural" parents given. Like getContainerOfType would just return undefined, where actually a node is always expected, due to the nature of a translation unit (Like every statement is in a unit. When we only parse a statement we cannot go up to the outer scope). I am wondering how we should reflect this in the documentation...

@spoenemann spoenemann requested a review from msujew April 19, 2024 10:14
@spoenemann
Copy link
Contributor Author

If you use this new feature, you should be aware of the potentially added complexity. Scoping may be completely broken. If you want to support resolving references with a partial model, you need to consider that explicitly in your custom scope provider. The generic one shouldn't have any issues.

Copy link
Contributor

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

@spoenemann spoenemann merged commit 7a02166 into main Apr 30, 2024
5 checks passed
@spoenemann spoenemann deleted the partial-parsing branch April 30, 2024 07:49
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.

None yet

4 participants