...
Code gen templates for operators; assume root=null (not nil), kids=_adaptor.createChildList()nil. This is v3 compatible.
grammar fragment | code |
---|
A | Code Block |
---|
_adaptor.addChild(_root0, _adaptor.create($A));
root = _adaptor.rulePostProcessing(root, kids); // A
_localctx.tree = root;
|
|
A B | Code Block |
---|
_adaptor.addChild(_root0, _adaptor.create($A));
_adaptor.addChild(_root0, _adaptor.create($B));
root = _adaptor.rulePostProcessing(root, kids); // ^(nil A B)
_localctx.tree = root;
|
|
A^ B | Code Block |
---|
_root0 = _adaptor.becomeRoot(_adaptor.create($A), _root0);
_adaptor.addChild(_root0, _adaptor.create($B));
root = _adaptor.rulePostProcessing(root, kids); // ^(A B)
_localctx.tree = root;
|
|
A B^ | Code Block |
---|
_adaptor.addChild(_root0, _adaptor.create($A));
_root0 = _adaptor.becomeRoot(_adaptor.create($B), _root0);
root = _adaptor.rulePostProcessing(root, kids); // ^(B A)
_localctx.tree = root;
|
|
A B^ C | Code Block |
---|
_adaptor.addChild(_root0, _adaptor.create($A));
_root0 = _adaptor.becomeRoot(_adaptor.create($B), _root0);
_adaptor.addChild(_root0, _adaptor.create($C));
root = _adaptor.rulePostProcessing(root, kids);// ^(B A C)
_localctx.tree = root;
|
|
A B^ C^ D | Code Block |
---|
_adaptor.addChild(_root0, _adaptor.create($A));
_root0 = _adaptor.becomeRoot(_adaptor.create($B), _root0);
_root0 = _adaptor.becomeRoot(_adaptor.create($C), _root0);
_adaptor.addChild(_root0, _adaptor.create($D));
root = _adaptor.rulePostProcessing(root, kids); // ^(C ^(B A) D)
_localctx.tree = root;
|
|
a^ b | Code Block |
---|
_root0 = _adaptor.becomeRoot($a.tree, _root0);
_adaptor.addChild(_root0, $b.tree);
root = _adaptor.rulePostProcessing(root, kids); // ^(A B)
_localctx.tree = root;
|
|
...