changes.mady.by.user TerenceP
Saved on Jun 29, 2011
...
grammar fragment
code
A
kids.add($A); _localctx.tree = _adaptor.createWithChildrenaddChildren(root, kids); // A
A B
kids.add($A); kids.add($B); _localctx.tree = _adaptor.createWithChildrenaddChildren(root, kids); // ^(nil A B)
A^ B
root = root==null ? $A : _adaptor.becomeRoot(root, $A, kids); kids.add($ID); _localctx.tree = _adaptor.createWithChildrenaddChildren(root, kids); // ^(A B)
A B^
kids.add($A); root = root==null ? $B : _adaptor.becomeRoot(root, $B, kids); _localctx.tree = _adaptor.createWithChildrenaddChildren(root, kids); // ^(B A)
A B^ C
kids.add($A); root = root==null ? $B : _adaptor.becomeRoot(root, $B, kids); kids.add($C); _localctx.tree = _adaptor.createWithChildrenaddChildren(root, kids); // ^(B A C)
A B^ C^ D
kids.add($A); root = root==null ? $B : _adaptor.becomeRoot(root, $B, kids); root = root==null ? $C : _adaptor.becomeRoot(root, $C, kids); kids.add($D); _localctx.tree = _adaptor.create(root, kids); // ^(C ^(B A) D)