Skip to content

Commit

Permalink
add proxy del-prec-method to PHP
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Lüpges <[email protected]>
  • Loading branch information
luepges committed Nov 30, 2023
1 parent b085759 commit 3dcb01f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tool/resources/org/antlr/v4/tool/templates/codegen/PHP/PHP.stg
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,16 @@ private function sempred<r.name; format="cap">(?Context\\<r.ctxType> $localConte
>>

RuleFunction(currentRule,args,code,locals,ruleCtx,altLabelCtxs,namedActions,finallyAction,exceptions,postamble) ::= <<
<if(currentRule.hasDelegatedPrecedence)>
/**
* InvokeRule references the recursive function in case a p option is present - which we re-use for delegated precedence
* @throws RecognitionException
*/
<if(currentRule.modifiers)><currentRule.modifiers:{f | <f> }><endif>public function recursive<currentRule.name; format="cap">(<[args, currentRule.hasDelegatedPrecedence:{_|$_dp=0}]; separator=",">): Context\\<currentRule.ctxType>
{
return $this-><currentRule.name>(<[args:{a|<a.name>}, {$_dp}]; separator=",">);
}
<endif>
/**
* @throws RecognitionException
*/
Expand Down Expand Up @@ -701,7 +711,7 @@ cases(tokens) ::= <<

InvokeRule(r, argExprsChunks) ::= <<
$this->setState(<r.stateNumber>);
<if(r.labels)><r.labels:{l | <labelref(l)> = }><endif>$this-><if(r.ast.options.p&&!r.ast.options.pv)>recursive<r.name; format="cap"><else><r.name><endif>(<[{<if(r.ast.options.pv)>$<endif><r.ast.options.p>}, argExprsChunks, r.ast.options.dp]; separator=",">);
<if(r.labels)><r.labels:{l | <labelref(l)> = }><endif>$this-><if(r.ast.options.p)>recursive<r.name; format="cap"><else><r.name><endif>(<[{<if(r.ast.options.pv)>$<endif><r.ast.options.p>}, argExprsChunks, r.ast.options.dp]; separator=",">);
>>

MatchToken(m) ::= <<
Expand Down

0 comments on commit 3dcb01f

Please sign in to comment.