summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2014-05-24 01:26:33 +0200
committerKevin Chabowski <kevin@kch42.de>2014-05-24 01:26:33 +0200
commit7a8dd0b67c207516ee6c4d597002e26574f5811f (patch)
treee2a19784aee2b30e3cdfa91c2f9c2a8f2b1a62c5
parentc4aad7a5216becdb09976f37bcaac1b720a1532d (diff)
downloadste-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.
-rw-r--r--Parser.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/Parser.php b/Parser.php
index 1ca0798..e3b8d07 100644
--- a/Parser.php
+++ b/Parser.php
@@ -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);