-
Notifications
You must be signed in to change notification settings - Fork 290
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
AST visitor pattern? #8
Comments
Hey! In Node node = parser.parse("...");
MyVisitor visitor = new MyVisitor();
node.accept(visitor);
class MyVisitor extends AbstractVisitor {
@Override
public void visit(Paragraph paragraph) {
// Do something with paragraph (override other methods for other nodes):
log.debug("visit {}", paragraph);
// Descend into children:
visitChildren(paragraph);
}
} Does that help? I guess this should be documented with an example in the README (and also do #4). |
Yes that's it. Looks pretty obvious from the source now. Example in the README a good idea. Thanks! |
robinst
added a commit
that referenced
this issue
Aug 17, 2015
Done now. |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great that you are implementing the commonmark spec in java.
I like the way pegdown implements the Visitor Pattern to be able to modify or interpret the AST once constructed. Is there a similar or planned facility for commonmark-java? For example, in pegdown:
Thanks,
Paul
The text was updated successfully, but these errors were encountered: