forked from jasder/antlr
RuleActionFunction and RuleSempredFunction templates generate private methods
This commit is contained in:
parent
fa5332926b
commit
60cf71a564
|
@ -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">
|
||||
|
|
Loading…
Reference in New Issue