RuleActionFunction and RuleSempredFunction templates generate private methods

This commit is contained in:
Sam Harwell 2012-11-26 11:04:30 -06:00
parent fa5332926b
commit 60cf71a564
1 changed files with 8 additions and 2 deletions

View File

@ -183,8 +183,11 @@ public <p.name>(TokenStream input) {
}
>>
/* This generates a private method since the actionIndex is generated, making an
* overriding implementation impossible to maintain.
*/
RuleActionFunction(r, actions) ::= <<
public void <r.name>_action(<r.ctxType> _localctx, int actionIndex) {
private void <r.name>_action(<r.ctxType> _localctx, int actionIndex) {
switch (actionIndex) {
<actions:{index|
case <index>: <actions.(index)> break;}; separator="\n">
@ -192,8 +195,11 @@ case <index>: <actions.(index)> break;}; separator="\n">
}
>>
/* This generates a private method since the predIndex is generated, making an
* overriding implementation impossible to maintain.
*/
RuleSempredFunction(r, actions) ::= <<
public boolean <r.name>_sempred(<r.ctxType> _localctx, int predIndex) {
private boolean <r.name>_sempred(<r.ctxType> _localctx, int predIndex) {
switch (predIndex) {
<actions:{index|
case <index>: return <actions.(index)>;}; separator="\n">