Skip to content

A nice way to navigate AST in the inspector#38

Open
NicolasAnquetil wants to merge 3 commits intoj-brant:masterfrom
NicolasAnquetil:master
Open

A nice way to navigate AST in the inspector#38
NicolasAnquetil wants to merge 3 commits intoj-brant:masterfrom
NicolasAnquetil:master

Conversation

@NicolasAnquetil
Copy link

@NicolasAnquetil NicolasAnquetil commented Jan 8, 2025

Hello, this is something we use to navigate ASTs in Moose.
Don't know if you already saw this or if you already have something similar.

Anyway, I am showing here a small example for CPPFunctionDefinitionNode:
image

We might use your SmaCC Cpp parser in the future and if we do, I propose to generalize this to all nodes.
It requires:

  • defining inspectionSmaccAST for some "top nodes" (classes, methods, functions)
  • having children in all nodes
  • and having inspectionSmaccASTSourceCode in Smacc top node, but this is already done here for CPPProgramNode

cheers

@j-brant
Copy link
Owner

j-brant commented Jan 11, 2025

children is already defined on SmaCCParseNode so you shouldn't need to redefine it. Also, if you look at the SmaCC_Debugging_Support package, you can see some old inspector methods that used the gtInspectorPresentationOrder: pragma in SmaCCParseNode. I think these should be updated to work with newer Pharo instead of creating versions for particular parse nodes.

@NicolasAnquetil
Copy link
Author

yes, you are right
I will try to make some time to structure that better

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.

2 participants