Infinite loop while parsing \\
Brought to you by:
tbryan
Submitted by Raymond PO Tang on Fri, 13 Aug 1999
18:28:13 -0500 (CDT)
Hi Tom,
I found a bug in the perceps 3.5. It will hang
(loop forever) when parse the following code:
///////////////////////////////////
class myclass
{
public:
myclass()
{
putchar('\\');
}
/*
** it's not good to fail this!
*/
};
///////////////////////////////////
The single quote inside the comment confuse the
program. I may come up with a fix later on. Please
let me know if some already reported this problem
and had a fix already.
Thanks.
Logged In: YES
user_id=1197
Submitted by Raymond PO Tang on Mon, 16 Aug 1999 18:39:18
-0500 (CDT)
I made a fix for this and it works fine for my
case. I basically encode "\\" before the the
'$str' got messed around. Here are the changes in
case you are interested.
######################################################################
# at about line 1518
# Mask special characters in arglists & quoted strings
sub MASKSPECIAL {
local($str)=@_;
local($tmp1,$tmp2);
# Raymond Tang
# Handle escaped backslash, '\\'
$str=~s/\\\\/&&DSLASH/g;
...
# at about line 1600, before the end of function
MASKSPECIAL
# Raymond Tang
$str=~s/&&DSLASH/\\\\/g;
return $str;
}