rokucommunity / brighterscript

A superset of Roku's BrightScript language
MIT License
158 stars 46 forks source link

Add comments to the AST walker #1128

Closed TwitchBronBron closed 4 months ago

TwitchBronBron commented 5 months ago

Now that we removed CommentStatement from the AST as nodes, we need a way to discover all comments when walking the AST.

Maybe a new WalkMode option that includes comments?

markwpearce commented 4 months ago

Goal for usage:

file.ast.walk(createVisitor({
   CommentToken: (comment) -> {
       // this is a comment!

   }),
   { walkMode: WalkMode.visitAllRecursive & WalkMode.VisitComments }
);