Replies: 1 comment
-
This is how vscode-messenger does it:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I had an idea that can be implemented in several ways. I presented in the Langium Dev meeting and we decided to start a discussion here.
Usecase:
I am sometimes in the situation that I want to understand what the parser has decided during the parsing: What rules were called and what tokens were recognized by the lexer.
This information is already there (CST+AST). I just suggest some helpers to improve analysis and visualization of this information.
There are two approaches I see:
API-ideas:
DebugUtils.getTokens(document: LangiumDocument): Token[]
will show you all leaves of the CST tree (should be a simple CST traversal, only outputting the leaves)DebugUtils.getStacktrace(node: CstNode): AbstractRule[]
will give you the decisions of the parser as a list of rules that were parsed to create this particular CST node. This can be achieved by traversing the CST node and looking at thegrammarSource
property.UI-Ideas:
UI-Implementation:
Beta Was this translation helpful? Give feedback.
All reactions