Skip to content

Commit

Permalink
Merge pull request #123 from robertleeplummerjr/master
Browse files Browse the repository at this point in the history
PHP: better null tracking, wrong var reference fixed
  • Loading branch information
zaach committed Nov 30, 2012
2 parents 746a829 + 1e40770 commit 2bf8f93
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ports/php/template.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function parse($input)
} }
} }


$errStr = "Parse error on line " . ($yylineno + 1) . ":\n" . $this->showPosition() . "\nExpecting " . implode(", ", $expected) . ", got '" . $this->terminals_[$symbol] . "'"; $errStr = "Parse error on line " . ($this->yylineno + 1) . ":\n" . $this->showPosition() . "\nExpecting " . implode(", ", $expected) . ", got '" . (isset($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : 'NOTHING') . "'";


$this->parseError($errStr, array( $this->parseError($errStr, array(
"text"=> $this->match, "text"=> $this->match,
Expand Down Expand Up @@ -214,7 +214,7 @@ function parse($input)


$r = $this->parser_performAction($yyval->S, $yytext, $yyleng, $yylineno, $action[1], $vstack, $lstack, $vstackCount - 1); $r = $this->parser_performAction($yyval->S, $yytext, $yyleng, $yylineno, $action[1], $vstack, $lstack, $vstackCount - 1);


if (empty($r) == false) { if (isset($r)) {
return $r; return $r;
} }


Expand Down Expand Up @@ -271,7 +271,8 @@ function parse($input)
"first_line"=> 1, "first_line"=> 1,
"first_column"=> 0, "first_column"=> 0,
"last_line"=> 1, "last_line"=> 1,
"last_column"=> 0 "last_column"=> 0,
"range"=> array()
); );
var $conditionsStack = array(); var $conditionsStack = array();
var $conditionStackCount = 0; var $conditionStackCount = 0;
Expand All @@ -295,7 +296,7 @@ function setInput($input)
$this->yyloc["first_column"] = 0; $this->yyloc["first_column"] = 0;
$this->yyloc["last_line"] = 1; $this->yyloc["last_line"] = 1;
$this->yyloc["last_column"] = 0; $this->yyloc["last_column"] = 0;
if ($this->options->ranges) { if (isset($this->options->ranges)) {
$this->yyloc['range'] = array(0,0); $this->yyloc['range'] = array(0,0);
} }
$this->offset = 0; $this->offset = 0;
Expand All @@ -317,7 +318,7 @@ function input()
} else { } else {
$this->yyloc['last_column']++; $this->yyloc['last_column']++;
} }
if ($this->options->ranges) $this->yyloc['range'][1]++; if (isset($this->options->ranges)) $this->yyloc['range'][1]++;


$this->_input = array_slice($this->_input, 1); $this->_input = array_slice($this->_input, 1);
return $ch; return $ch;
Expand Down Expand Up @@ -423,7 +424,7 @@ function next()
$this->match .= $match[0]; $this->match .= $match[0];
$this->matches = $match; $this->matches = $match;
$this->yyleng = strlen($this->yytext); $this->yyleng = strlen($this->yytext);
if ($this->options.ranges) { if (isset($this->options->ranges)) {
$this->yyloc['range'] = array($this->offset, $this->offset += $this->yyleng); $this->yyloc['range'] = array($this->offset, $this->offset += $this->yyleng);
} }
$this->more = false; $this->more = false;
Expand Down

0 comments on commit 2bf8f93

Please sign in to comment.