From 5401ff08a26e11649d282c5c8fe11d9d8c199c53 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sun, 20 Oct 2013 17:08:06 +0200 Subject: Fixed parse_tag and parse_var Now everything seems to work fine. The output code very noisy, though... --- stupid_template_engine.php | 13 +++++-------- 1 file 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]; } } } -- cgit v1.2.3-54-g00ecf