From: Jordi Boggiano Date: Tue, 24 Jan 2012 17:53:53 +0000 (+0100) Subject: Add comments X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=0d656f53afcb2784a341423a34442461cfc365b1;p=web%2Fkonrad%2Ftwig.git Add comments --- diff --git a/lib/Twig/Parser.php b/lib/Twig/Parser.php index 15325da..4b85259 100644 --- a/lib/Twig/Parser.php +++ b/lib/Twig/Parser.php @@ -62,6 +62,7 @@ class Twig_Parser implements Twig_ParserInterface */ public function parse(Twig_TokenStream $stream) { + // push all variables into the stack to keep the current state of the parser $vars = get_object_vars($this); unset($vars['stack'], $vars['env']); $this->stack[] = $vars; @@ -109,6 +110,7 @@ class Twig_Parser implements Twig_ParserInterface $node = $traverser->traverse($node); + // restore previous stack so previous parse() call can resume working foreach (array_pop($this->stack) as $key => $val) { $this->$key = $val; }