diff options
author | Kevin Chabowski <kevin@kch42.de> | 2013-10-20 17:08:06 +0200 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2013-10-20 17:08:06 +0200 |
commit | 5401ff08a26e11649d282c5c8fe11d9d8c199c53 (patch) | |
tree | 32e883d3bf7e661172eb27a19ac2484b6d7b8a03 | |
parent | f18070853c4c82247ec8e153dbf2a4a1b43e730d (diff) | |
download | ste-5401ff08a26e11649d282c5c8fe11d9d8c199c53.tar.gz ste-5401ff08a26e11649d282c5c8fe11d9d8c199c53.tar.bz2 ste-5401ff08a26e11649d282c5c8fe11d9d8c199c53.zip |
Fixed parse_tag and parse_var
Now everything seems to work fine. The output code very noisy, though...
-rw-r--r-- | stupid_template_engine.php | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/stupid_template_engine.php b/stupid_template_engine.php index 840e0ce..1cd21fc 100644 --- a/stupid_template_engine.php +++ b/stupid_template_engine.php @@ -423,14 +423,9 @@ class Parser { $varnode->name = $this->get_name(); $varnode->arrayfields = $this->parse_array(); - if(!$curly) { - return $varnode; - } - - if($this->next() != "}") { + if(($curly) && ($this->next() != "}")) { throw new ParseCompileError("Unclosed '\${'", $this->name, $openedat); } - $varnode->arrayfields = array_merge($varnode->arrayfields, $this->parse_array()); return $varnode; } @@ -480,7 +475,7 @@ class Parser { return $tag; case '>': - $tag->sub = $this->parse_text( + $sub = $this->parse_text( self::ESCAPES_DEFAULT, /* Escapes */ self::PARSE_SHORT | self::PARSE_TAG, /* Flags */ NULL, /* Break on */ @@ -491,6 +486,7 @@ class Parser { $tag->name, /* Open tag */ $openedat /* Opened at */ ); + $tag->sub = $sub[0]; return $tag; default: $this->back(); @@ -509,7 +505,7 @@ class Parser { } $off = $this->off - 1; - $tag->params[$param] = $this->parse_text( + $paramval = $this->parse_text( self::ESCAPES_DEFAULT . $quot, /* Escapes */ 0, /* Flags */ $quot, /* Break on */ @@ -520,6 +516,7 @@ class Parser { NULL, /* Open tag */ $off /* Opened at */ ); + $tag->params[$param] = $paramval[0]; } } } |