[antlr-interest] Method equals in class ParseTree

Terence Parr parrt at cs.usfca.edu
Sat Oct 13 15:27:14 PDT 2012


see org.antlr.v4.runtime.tree.gui.TreeViewer. 

Just call inspect on any tree node:

/** Call this method to view a parse tree in a dialog box visually. */
	public void inspect(Parser parser) {
		TreeViewer viewer = new TreeViewer(parser, this);
		viewer.open();
	}

Ter
On Oct 13, 2012, at 12:02 PM, Claude Moulin wrote:

> Hi all,
> 
> Thank you Terence for the new version Antlr v4.
> 
> I want to display a ParseTree in a Java swing JTree.
> 
> For that I create a class that implements TreeModel.
> 
> But some nodes are not displayed in the JTree because the method
> equals() is called for comparing two child nodes of the same parent.
> 
> If two nodes are considered "equals" using this method
> (ParseTree.equals()) only one is displayed (the second and the last when
> more nodes are considered equal).
> 
> Is there any reason why two different ParseTree may be "equals" ?
> 
> Is there an elegant solution to this problem ?
> 
> 
> 
> Thank you.
> 
> Claude
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list