diff options
author | Kevin Chabowski <kevin@kch42.de> | 2014-05-24 01:26:33 +0200 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2014-05-24 01:26:33 +0200 |
commit | 7a8dd0b67c207516ee6c4d597002e26574f5811f (patch) | |
tree | e2a19784aee2b30e3cdfa91c2f9c2a8f2b1a62c5 /Parser.php | |
parent | c4aad7a5216becdb09976f37bcaac1b720a1532d (diff) | |
download | ste-7a8dd0b67c207516ee6c4d597002e26574f5811f.tar.gz ste-7a8dd0b67c207516ee6c4d597002e26574f5811f.tar.bz2 ste-7a8dd0b67c207516ee6c4d597002e26574f5811f.zip |
Fixed parsing variables
If a variable was the very last thing in a template, the last charater of
the variable was duplicated as a text node.
Diffstat (limited to 'Parser.php')
-rw-r--r-- | Parser.php | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -34,6 +34,9 @@ class Parser { return $c; } + private function eof() { + return ($this->off == $this->len); + } private function back($n = 1) { if($n <= 0) { @@ -349,7 +352,9 @@ class Parser { private function parse_var($openedat, $curly) { $varnode = new VariableNode($this->name, $openedat); $varnode->name = $this->get_name(); - $varnode->arrayfields = $this->parse_array(); + if(!$this->eof()) { + $varnode->arrayfields = $this->parse_array(); + } if(($curly) && ($this->next() != "}")) { throw new ParseCompileError("Unclosed '\${'", $this->name, $openedat); |