Skip to content

Conversation

@markwpearce
Copy link
Collaborator

Allows:

const { ast } = Parser.parse(`
    sub main()
       'comment
       print "hello"
    end sub
`);
ast.walk(createVisitor({
    CommentToken: (comment, parent, owner, key) => {
        console.log(comment.text); // prints "'comment"
    }
}), {
    walkMode: WalkMode.visitAllRecursive | WalkMode.visitComments
});

@markwpearce markwpearce added this to the v1.0.0 milestone Apr 21, 2024
@markwpearce
Copy link
Collaborator Author

Fixes #1128

@TwitchBronBron TwitchBronBron force-pushed the find_comments_on_walker branch from 096a342 to a13a581 Compare May 6, 2024 18:48
@TwitchBronBron TwitchBronBron changed the title Modified Ast Walk to allow operations on Comments Add AstNode visitor function for createVisitor May 6, 2024
@markwpearce
Copy link
Collaborator Author

Looks great.

@markwpearce markwpearce merged commit e408953 into release-1.0.0 May 6, 2024
@markwpearce markwpearce deleted the find_comments_on_walker branch May 6, 2024 21:50
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.

3 participants