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

Implement Graph printing in Mermaid for AST subtree and parent #1929

Open
konradweiss opened this issue Jan 13, 2025 · 0 comments
Open

Implement Graph printing in Mermaid for AST subtree and parent #1929

konradweiss opened this issue Jan 13, 2025 · 0 comments
Assignees

Comments

@konradweiss
Copy link
Collaborator

konradweiss commented Jan 13, 2025

Currently we have the printDFG function in the Mermaid printer. An implementation for printEOG exists but is commented out. In the long run we should support more printings of such subgraphs. One I would like to have is a printer for the AST subgraph that prints the AST-Subtree of a Node and its ancestor path. One attempt to implement this can be seen below, but does not return the correct types to yield a compilable solution:

fun Node.printAST(maxConnections: Int = 10): String {
 return this.printGraph(Node::astEdges, object: KProperty1<Node, MutableCollection<AstEdge<out Node>>> {
     override fun invoke(p1:Node) = p1.astParent?.astEdges?.filter { astE -> astE.end == p1 }?.toMutableList() ?: mutableListOf()
                                                                                                       },maxConnections)
}
´´´
@konradweiss konradweiss self-assigned this Jan 13, 2025
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