forked from jasder/antlr
improved funcs; args back in; push/pop to func def.
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 6868]
This commit is contained in:
parent
5a1607e884
commit
dfffbe7ef3
|
@ -37,25 +37,17 @@ public class <p.name> {
|
||||||
RuleFunction(f,code,decls,context) ::= <<
|
RuleFunction(f,code,decls,context) ::= <<
|
||||||
<context>
|
<context>
|
||||||
|
|
||||||
<if(f.isStartRule)>
|
<if(f.modifiers)><f.modifiers:{f | <f> }><else>public final <endif><if(f.retType)><f.retType><else>void<endif> <f.name>(<f.args:{a|<a>, }>BitSet _follow) {
|
||||||
<if(f.modifiers)><f.modifiers:{f | <f> }><else>public final <endif><if(f.retType)><f.retType><else>void<endif> <f.name>(<f.args; separator=", ">) {
|
<! <if(f.scope)><f.scope.name>.push(new <f.scope.name>);<endif> !>
|
||||||
<if(f.retType)>
|
<if(f.retType)>
|
||||||
_ctx.push(new <f.context.name>(<f.args:{a|<a.name>}; separator=",">));
|
_ctx.push(new <f.context.name>(<f.args:{a|<a.name>}; separator=",">));
|
||||||
_<f.name>(null);
|
|
||||||
return _ctx.pop();
|
|
||||||
<else>
|
|
||||||
_<f.name>(null);
|
|
||||||
<endif>
|
<endif>
|
||||||
}
|
|
||||||
|
|
||||||
<endif>
|
|
||||||
<if(f.modifiers)><f.modifiers:{f | <f> }><else>public final <endif><if(f.retType)><f.retType><else>void<endif> <if(f.isStartRule)>_<endif><f.name>(BitSet _follow) {
|
|
||||||
<! <if(f.scope)><f.scope.name>.push(new <f.scope.name>);<endif> !>
|
|
||||||
<decls; separator="\n">
|
<decls; separator="\n">
|
||||||
try {
|
try {
|
||||||
<code>
|
<code>
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
<if(f.retType)>return _ctx.pop();<endif>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>>
|
>>
|
||||||
|
@ -148,9 +140,7 @@ cases(ttypes) ::= <<
|
||||||
>>
|
>>
|
||||||
|
|
||||||
InvokeRule(r) ::= <<
|
InvokeRule(r) ::= <<
|
||||||
<if(r.ctxName)>_ctx.push(new <r.ctxName>(<r.argExprs; separator=",">));<endif>
|
<if(r.label)><r.label> = <endif><r.name>(<r.argExprs:{a|<a>, }><r.follow.name>);
|
||||||
<if(r.label)><r.label> = <endif><r.name>(<r.follow.name>);
|
|
||||||
<if(r.ctxName)>_ctx.pop();<endif>
|
|
||||||
>>
|
>>
|
||||||
|
|
||||||
MatchToken(m) ::= <<
|
MatchToken(m) ::= <<
|
||||||
|
|
Loading…
Reference in New Issue