Skip to content

Commit 1d8610c

Browse files
committed
bug_647654 Special command \fn fails when first argument of PHP function is call-by-reference
The handling of `(&$var` for php was not included at all places. It was handled with the rules (in scanner.l): ``` <FindMembers>"("/{BN}*"::"*{BN}*({TSCOPE}{BN}*"::")*{TSCOPE}{BN}*")"{BN}*"(" | /* typedef void (A<int>::func_t)(args...) */$ <FindMembers>("("({BN}*"::"*{BN}*{TSCOPE}{BN}*"::")*({BN}*[*&\^]{BN}*)+)+ { /* typedef void (A::*ptr_t)(args...) or int (*fun c(int))[], the ^ is for Obj-C blocks */$ ```
1 parent 63dc5b9 commit 1d8610c

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/declinfo.l

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ ID "$"?([a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]*)|(@[0-9]+)
149149
addType(yyscanner);
150150
}
151151
<Start>{B}*"("({ID}"::")*{B}*[&*]({B}*("const"|"volatile"){B}+)? {
152+
if (yyextra->insidePHP) REJECT;
152153
addType(yyscanner);
153154
QCString text=yytext;
154155
yyextra->type+=text.stripWhiteSpace();

src/scanner.l

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6505,10 +6505,17 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
65056505
BEGIN( ReadFuncArgType ) ;
65066506
}
65076507
<Prototype>"("({ID}"::")*({B}*[&*])+ {
6508-
yyextra->current->type+=yyextra->current->name+yytext;
6509-
yyextra->current->name.resize(0);
6510-
BEGIN( PrototypePtr );
6511-
}
6508+
if (yyextra->insidePHP) // reference parameter
6509+
{
6510+
REJECT;
6511+
}
6512+
else
6513+
{
6514+
yyextra->current->type+=yyextra->current->name+yytext;
6515+
yyextra->current->name.resize(0);
6516+
BEGIN( PrototypePtr );
6517+
}
6518+
}
65126519
<PrototypePtr>{SCOPENAME} {
65136520
yyextra->current->name+=yytext;
65146521
}

0 commit comments

Comments
 (0)