fixing bug #24147, error parsing formula

git-svn-id: https://svn.php.net/repository/pear/packages/Spreadsheet_Excel_Writer/trunk@134155 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Xavier Noguer Gallego 2003-07-04 08:53:53 +00:00
parent 2a7d42b31b
commit 9c99e5a91b
1 changed files with 11 additions and 4 deletions

View File

@ -1017,11 +1017,17 @@ class Spreadsheet_Excel_Writer_Parser extends PEAR
while ($i < strlen($this->_formula)) while ($i < strlen($this->_formula))
{ {
$token .= $this->_formula{$i}; $token .= $this->_formula{$i};
if ($i < strlen($this->_formula) - 1) {
$this->_lookahead = $this->_formula{$i+1};
}
else {
$this->_lookahead = '';
}
if ($this->_match($token) != '') if ($this->_match($token) != '')
{ {
if ($i < strlen($this->_formula) - 1) { //if ($i < strlen($this->_formula) - 1) {
$this->_lookahead = $this->_formula{$i+1}; // $this->_lookahead = $this->_formula{$i+1};
} //}
$this->_current_char = $i + 1; $this->_current_char = $i + 1;
$this->_current_token = $token; $this->_current_token = $token;
return 1; return 1;
@ -1130,7 +1136,8 @@ class Spreadsheet_Excel_Writer_Parser extends PEAR
return $token; return $token;
} }
// If it's a number (check that it's not a sheet name or range) // If it's a number (check that it's not a sheet name or range)
elseif (is_numeric($token) and !is_numeric($token.$this->_lookahead) and elseif (is_numeric($token) and
(!is_numeric($token.$this->_lookahead)) or ($this->_lookahead == '')) and
($this->_lookahead != '!') and (($this->_lookahead != ':'))) ($this->_lookahead != '!') and (($this->_lookahead != ':')))
{ {
return $token; return $token;