aboutsummaryrefslogtreecommitdiffstats
path: root/public/system/library/template/Twig/Node/Expression
diff options
context:
space:
mode:
Diffstat (limited to 'public/system/library/template/Twig/Node/Expression')
-rw-r--r--public/system/library/template/Twig/Node/Expression/Array.php81
-rw-r--r--public/system/library/template/Twig/Node/Expression/AssignName.php23
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary.php35
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/Add.php18
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/And.php18
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/BitwiseAnd.php18
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/BitwiseOr.php18
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/BitwiseXor.php18
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/Concat.php18
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/Div.php18
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/EndsWith.php30
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/Equal.php17
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/FloorDiv.php24
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/Greater.php17
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/GreaterEqual.php17
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/In.php28
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/Less.php17
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/LessEqual.php17
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/Matches.php28
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/Mod.php18
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/Mul.php18
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/NotEqual.php17
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/NotIn.php28
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/Or.php18
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/Power.php28
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/Range.php28
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/StartsWith.php30
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/Sub.php18
-rw-r--r--public/system/library/template/Twig/Node/Expression/BlockReference.php46
-rw-r--r--public/system/library/template/Twig/Node/Expression/Call.php253
-rw-r--r--public/system/library/template/Twig/Node/Expression/Conditional.php31
-rw-r--r--public/system/library/template/Twig/Node/Expression/Constant.php23
-rw-r--r--public/system/library/template/Twig/Node/Expression/ExtensionReference.php32
-rw-r--r--public/system/library/template/Twig/Node/Expression/Filter.php39
-rw-r--r--public/system/library/template/Twig/Node/Expression/Filter/Default.php43
-rw-r--r--public/system/library/template/Twig/Node/Expression/Function.php38
-rw-r--r--public/system/library/template/Twig/Node/Expression/GetAttr.php63
-rw-r--r--public/system/library/template/Twig/Node/Expression/MethodCall.php41
-rw-r--r--public/system/library/template/Twig/Node/Expression/Name.php90
-rw-r--r--public/system/library/template/Twig/Node/Expression/NullCoalesce.php23
-rw-r--r--public/system/library/template/Twig/Node/Expression/Parent.php42
-rw-r--r--public/system/library/template/Twig/Node/Expression/TempName.php26
-rw-r--r--public/system/library/template/Twig/Node/Expression/Test.php35
-rw-r--r--public/system/library/template/Twig/Node/Expression/Test/Constant.php46
-rw-r--r--public/system/library/template/Twig/Node/Expression/Test/Defined.php56
-rw-r--r--public/system/library/template/Twig/Node/Expression/Test/Divisibleby.php33
-rw-r--r--public/system/library/template/Twig/Node/Expression/Test/Even.php32
-rw-r--r--public/system/library/template/Twig/Node/Expression/Test/Null.php31
-rw-r--r--public/system/library/template/Twig/Node/Expression/Test/Odd.php32
-rw-r--r--public/system/library/template/Twig/Node/Expression/Test/Sameas.php29
-rw-r--r--public/system/library/template/Twig/Node/Expression/Unary.php27
-rw-r--r--public/system/library/template/Twig/Node/Expression/Unary/Neg.php18
-rw-r--r--public/system/library/template/Twig/Node/Expression/Unary/Not.php18
-rw-r--r--public/system/library/template/Twig/Node/Expression/Unary/Pos.php18
54 files changed, 1828 insertions, 0 deletions
diff --git a/public/system/library/template/Twig/Node/Expression/Array.php b/public/system/library/template/Twig/Node/Expression/Array.php
new file mode 100644
index 0000000..83e583b
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Array.php
@@ -0,0 +1,81 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Array extends Twig_Node_Expression
+{
+ protected $index;
+
+ public function __construct(array $elements, $lineno)
+ {
+ parent::__construct($elements, array(), $lineno);
+
+ $this->index = -1;
+ foreach ($this->getKeyValuePairs() as $pair) {
+ if ($pair['key'] instanceof Twig_Node_Expression_Constant && ctype_digit((string) $pair['key']->getAttribute('value')) && $pair['key']->getAttribute('value') > $this->index) {
+ $this->index = $pair['key']->getAttribute('value');
+ }
+ }
+ }
+
+ public function getKeyValuePairs()
+ {
+ $pairs = array();
+
+ foreach (array_chunk($this->nodes, 2) as $pair) {
+ $pairs[] = array(
+ 'key' => $pair[0],
+ 'value' => $pair[1],
+ );
+ }
+
+ return $pairs;
+ }
+
+ public function hasElement(Twig_Node_Expression $key)
+ {
+ foreach ($this->getKeyValuePairs() as $pair) {
+ // we compare the string representation of the keys
+ // to avoid comparing the line numbers which are not relevant here.
+ if ((string) $key == (string) $pair['key']) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public function addElement(Twig_Node_Expression $value, Twig_Node_Expression $key = null)
+ {
+ if (null === $key) {
+ $key = new Twig_Node_Expression_Constant(++$this->index, $value->getLine());
+ }
+
+ array_push($this->nodes, $key, $value);
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler->raw('array(');
+ $first = true;
+ foreach ($this->getKeyValuePairs() as $pair) {
+ if (!$first) {
+ $compiler->raw(', ');
+ }
+ $first = false;
+
+ $compiler
+ ->subcompile($pair['key'])
+ ->raw(' => ')
+ ->subcompile($pair['value'])
+ ;
+ }
+ $compiler->raw(')');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/AssignName.php b/public/system/library/template/Twig/Node/Expression/AssignName.php
new file mode 100644
index 0000000..ce0c5fb
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/AssignName.php
@@ -0,0 +1,23 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+class Twig_Node_Expression_AssignName extends Twig_Node_Expression_Name
+{
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->raw('$context[')
+ ->string($this->getAttribute('name'))
+ ->raw(']')
+ ;
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary.php b/public/system/library/template/Twig/Node/Expression/Binary.php
new file mode 100644
index 0000000..c821db5
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary.php
@@ -0,0 +1,35 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+abstract class Twig_Node_Expression_Binary extends Twig_Node_Expression
+{
+ public function __construct(Twig_NodeInterface $left, Twig_NodeInterface $right, $lineno)
+ {
+ parent::__construct(array('left' => $left, 'right' => $right), array(), $lineno);
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->raw('(')
+ ->subcompile($this->getNode('left'))
+ ->raw(' ')
+ ;
+ $this->operator($compiler);
+ $compiler
+ ->raw(' ')
+ ->subcompile($this->getNode('right'))
+ ->raw(')')
+ ;
+ }
+
+ abstract public function operator(Twig_Compiler $compiler);
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/Add.php b/public/system/library/template/Twig/Node/Expression/Binary/Add.php
new file mode 100644
index 0000000..0ef8e11
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/Add.php
@@ -0,0 +1,18 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_Add extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('+');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/And.php b/public/system/library/template/Twig/Node/Expression/Binary/And.php
new file mode 100644
index 0000000..d5752eb
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/And.php
@@ -0,0 +1,18 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_And extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('&&');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/BitwiseAnd.php b/public/system/library/template/Twig/Node/Expression/Binary/BitwiseAnd.php
new file mode 100644
index 0000000..9a46d84
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/BitwiseAnd.php
@@ -0,0 +1,18 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_BitwiseAnd extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('&');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/BitwiseOr.php b/public/system/library/template/Twig/Node/Expression/Binary/BitwiseOr.php
new file mode 100644
index 0000000..058a20b
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/BitwiseOr.php
@@ -0,0 +1,18 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_BitwiseOr extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('|');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/BitwiseXor.php b/public/system/library/template/Twig/Node/Expression/Binary/BitwiseXor.php
new file mode 100644
index 0000000..f4da73d
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/BitwiseXor.php
@@ -0,0 +1,18 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_BitwiseXor extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('^');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/Concat.php b/public/system/library/template/Twig/Node/Expression/Binary/Concat.php
new file mode 100644
index 0000000..f9a6462
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/Concat.php
@@ -0,0 +1,18 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_Concat extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('.');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/Div.php b/public/system/library/template/Twig/Node/Expression/Binary/Div.php
new file mode 100644
index 0000000..e0797a6
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/Div.php
@@ -0,0 +1,18 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_Div extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('/');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/EndsWith.php b/public/system/library/template/Twig/Node/Expression/Binary/EndsWith.php
new file mode 100644
index 0000000..93b3b96
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/EndsWith.php
@@ -0,0 +1,30 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2013 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_EndsWith extends Twig_Node_Expression_Binary
+{
+ public function compile(Twig_Compiler $compiler)
+ {
+ $left = $compiler->getVarName();
+ $right = $compiler->getVarName();
+ $compiler
+ ->raw(sprintf('(is_string($%s = ', $left))
+ ->subcompile($this->getNode('left'))
+ ->raw(sprintf(') && is_string($%s = ', $right))
+ ->subcompile($this->getNode('right'))
+ ->raw(sprintf(') && (\'\' === $%2$s || $%2$s === substr($%1$s, -strlen($%2$s))))', $left, $right))
+ ;
+ }
+
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/Equal.php b/public/system/library/template/Twig/Node/Expression/Binary/Equal.php
new file mode 100644
index 0000000..7b1236d
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/Equal.php
@@ -0,0 +1,17 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2010 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_Equal extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('==');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/FloorDiv.php b/public/system/library/template/Twig/Node/Expression/Binary/FloorDiv.php
new file mode 100644
index 0000000..b606f6d
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/FloorDiv.php
@@ -0,0 +1,24 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_FloorDiv extends Twig_Node_Expression_Binary
+{
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler->raw('intval(floor(');
+ parent::compile($compiler);
+ $compiler->raw('))');
+ }
+
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('/');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/Greater.php b/public/system/library/template/Twig/Node/Expression/Binary/Greater.php
new file mode 100644
index 0000000..a110bd9
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/Greater.php
@@ -0,0 +1,17 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2010 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_Greater extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('>');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/GreaterEqual.php b/public/system/library/template/Twig/Node/Expression/Binary/GreaterEqual.php
new file mode 100644
index 0000000..3754fed
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/GreaterEqual.php
@@ -0,0 +1,17 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2010 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_GreaterEqual extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('>=');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/In.php b/public/system/library/template/Twig/Node/Expression/Binary/In.php
new file mode 100644
index 0000000..9565a60
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/In.php
@@ -0,0 +1,28 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2010 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_In extends Twig_Node_Expression_Binary
+{
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->raw('twig_in_filter(')
+ ->subcompile($this->getNode('left'))
+ ->raw(', ')
+ ->subcompile($this->getNode('right'))
+ ->raw(')')
+ ;
+ }
+
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('in');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/Less.php b/public/system/library/template/Twig/Node/Expression/Binary/Less.php
new file mode 100644
index 0000000..45fd300
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/Less.php
@@ -0,0 +1,17 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2010 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_Less extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('<');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/LessEqual.php b/public/system/library/template/Twig/Node/Expression/Binary/LessEqual.php
new file mode 100644
index 0000000..e38e257
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/LessEqual.php
@@ -0,0 +1,17 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2010 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_LessEqual extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('<=');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/Matches.php b/public/system/library/template/Twig/Node/Expression/Binary/Matches.php
new file mode 100644
index 0000000..93bb292
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/Matches.php
@@ -0,0 +1,28 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2013 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_Matches extends Twig_Node_Expression_Binary
+{
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->raw('preg_match(')
+ ->subcompile($this->getNode('right'))
+ ->raw(', ')
+ ->subcompile($this->getNode('left'))
+ ->raw(')')
+ ;
+ }
+
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/Mod.php b/public/system/library/template/Twig/Node/Expression/Binary/Mod.php
new file mode 100644
index 0000000..9924114
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/Mod.php
@@ -0,0 +1,18 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_Mod extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('%');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/Mul.php b/public/system/library/template/Twig/Node/Expression/Binary/Mul.php
new file mode 100644
index 0000000..c91529c
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/Mul.php
@@ -0,0 +1,18 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_Mul extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('*');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/NotEqual.php b/public/system/library/template/Twig/Node/Expression/Binary/NotEqual.php
new file mode 100644
index 0000000..26867ba
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/NotEqual.php
@@ -0,0 +1,17 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2010 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_NotEqual extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('!=');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/NotIn.php b/public/system/library/template/Twig/Node/Expression/Binary/NotIn.php
new file mode 100644
index 0000000..49ab39e
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/NotIn.php
@@ -0,0 +1,28 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2010 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_NotIn extends Twig_Node_Expression_Binary
+{
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->raw('!twig_in_filter(')
+ ->subcompile($this->getNode('left'))
+ ->raw(', ')
+ ->subcompile($this->getNode('right'))
+ ->raw(')')
+ ;
+ }
+
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('not in');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/Or.php b/public/system/library/template/Twig/Node/Expression/Binary/Or.php
new file mode 100644
index 0000000..adba49c
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/Or.php
@@ -0,0 +1,18 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_Or extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('||');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/Power.php b/public/system/library/template/Twig/Node/Expression/Binary/Power.php
new file mode 100644
index 0000000..cd6d046
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/Power.php
@@ -0,0 +1,28 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2010 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_Power extends Twig_Node_Expression_Binary
+{
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->raw('pow(')
+ ->subcompile($this->getNode('left'))
+ ->raw(', ')
+ ->subcompile($this->getNode('right'))
+ ->raw(')')
+ ;
+ }
+
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('**');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/Range.php b/public/system/library/template/Twig/Node/Expression/Binary/Range.php
new file mode 100644
index 0000000..692ec9c
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/Range.php
@@ -0,0 +1,28 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2010 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_Range extends Twig_Node_Expression_Binary
+{
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->raw('range(')
+ ->subcompile($this->getNode('left'))
+ ->raw(', ')
+ ->subcompile($this->getNode('right'))
+ ->raw(')')
+ ;
+ }
+
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('..');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/StartsWith.php b/public/system/library/template/Twig/Node/Expression/Binary/StartsWith.php
new file mode 100644
index 0000000..d2e30d6
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/StartsWith.php
@@ -0,0 +1,30 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2013 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_StartsWith extends Twig_Node_Expression_Binary
+{
+ public function compile(Twig_Compiler $compiler)
+ {
+ $left = $compiler->getVarName();
+ $right = $compiler->getVarName();
+ $compiler
+ ->raw(sprintf('(is_string($%s = ', $left))
+ ->subcompile($this->getNode('left'))
+ ->raw(sprintf(') && is_string($%s = ', $right))
+ ->subcompile($this->getNode('right'))
+ ->raw(sprintf(') && (\'\' === $%2$s || 0 === strpos($%1$s, $%2$s)))', $left, $right))
+ ;
+ }
+
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/Sub.php b/public/system/library/template/Twig/Node/Expression/Binary/Sub.php
new file mode 100644
index 0000000..d446399
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/Sub.php
@@ -0,0 +1,18 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_Sub extends Twig_Node_Expression_Binary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('-');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/BlockReference.php b/public/system/library/template/Twig/Node/Expression/BlockReference.php
new file mode 100644
index 0000000..f6ed6ff
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/BlockReference.php
@@ -0,0 +1,46 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Represents a block call node.
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+class Twig_Node_Expression_BlockReference extends Twig_Node_Expression
+{
+ public function __construct(Twig_NodeInterface $name, $asString = false, $lineno, $tag = null)
+ {
+ parent::__construct(array('name' => $name), array('as_string' => $asString, 'output' => false), $lineno, $tag);
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ if ($this->getAttribute('as_string')) {
+ $compiler->raw('(string) ');
+ }
+
+ if ($this->getAttribute('output')) {
+ $compiler
+ ->addDebugInfo($this)
+ ->write('$this->displayBlock(')
+ ->subcompile($this->getNode('name'))
+ ->raw(", \$context, \$blocks);\n")
+ ;
+ } else {
+ $compiler
+ ->raw('$this->renderBlock(')
+ ->subcompile($this->getNode('name'))
+ ->raw(', $context, $blocks)')
+ ;
+ }
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Call.php b/public/system/library/template/Twig/Node/Expression/Call.php
new file mode 100644
index 0000000..240553f
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Call.php
@@ -0,0 +1,253 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2012 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
+{
+ protected function compileCallable(Twig_Compiler $compiler)
+ {
+ $closingParenthesis = false;
+ if ($this->hasAttribute('callable') && $callable = $this->getAttribute('callable')) {
+ if (is_string($callable)) {
+ $compiler->raw($callable);
+ } elseif (is_array($callable) && $callable[0] instanceof Twig_ExtensionInterface) {
+ $compiler->raw(sprintf('$this->env->getExtension(\'%s\')->%s', $callable[0]->getName(), $callable[1]));
+ } else {
+ $type = ucfirst($this->getAttribute('type'));
+ $compiler->raw(sprintf('call_user_func_array($this->env->get%s(\'%s\')->getCallable(), array', $type, $this->getAttribute('name')));
+ $closingParenthesis = true;
+ }
+ } else {
+ $compiler->raw($this->getAttribute('thing')->compile());
+ }
+
+ $this->compileArguments($compiler);
+
+ if ($closingParenthesis) {
+ $compiler->raw(')');
+ }
+ }
+
+ protected function compileArguments(Twig_Compiler $compiler)
+ {
+ $compiler->raw('(');
+
+ $first = true;
+
+ if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) {
+ $compiler->raw('$this->env');
+ $first = false;
+ }
+
+ if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) {
+ if (!$first) {
+ $compiler->raw(', ');
+ }
+ $compiler->raw('$context');
+ $first = false;
+ }
+
+ if ($this->hasAttribute('arguments')) {
+ foreach ($this->getAttribute('arguments') as $argument) {
+ if (!$first) {
+ $compiler->raw(', ');
+ }
+ $compiler->string($argument);
+ $first = false;
+ }
+ }
+
+ if ($this->hasNode('node')) {
+ if (!$first) {
+ $compiler->raw(', ');
+ }
+ $compiler->subcompile($this->getNode('node'));
+ $first = false;
+ }
+
+ if ($this->hasNode('arguments') && null !== $this->getNode('arguments')) {
+ $callable = $this->hasAttribute('callable') ? $this->getAttribute('callable') : null;
+
+ $arguments = $this->getArguments($callable, $this->getNode('arguments'));
+
+ foreach ($arguments as $node) {
+ if (!$first) {
+ $compiler->raw(', ');
+ }
+ $compiler->subcompile($node);
+ $first = false;
+ }
+ }
+
+ $compiler->raw(')');
+ }
+
+ protected function getArguments($callable, $arguments)
+ {
+ $callType = $this->getAttribute('type');
+ $callName = $this->getAttribute('name');
+
+ $parameters = array();
+ $named = false;
+ foreach ($arguments as $name => $node) {
+ if (!is_int($name)) {
+ $named = true;
+ $name = $this->normalizeName($name);
+ } elseif ($named) {
+ throw new Twig_Error_Syntax(sprintf('Positional arguments cannot be used after named arguments for %s "%s".', $callType, $callName));
+ }
+
+ $parameters[$name] = $node;
+ }
+
+ $isVariadic = $this->hasAttribute('is_variadic') && $this->getAttribute('is_variadic');
+ if (!$named && !$isVariadic) {
+ return $parameters;
+ }
+
+ if (!$callable) {
+ if ($named) {
+ $message = sprintf('Named arguments are not supported for %s "%s".', $callType, $callName);
+ } else {
+ $message = sprintf('Arbitrary positional arguments are not supported for %s "%s".', $callType, $callName);
+ }
+
+ throw new LogicException($message);
+ }
+
+ // manage named arguments
+ $callableParameters = $this->getCallableParameters($callable, $isVariadic);
+ $arguments = array();
+ $names = array();
+ $missingArguments = array();
+ $optionalArguments = array();
+ $pos = 0;
+ foreach ($callableParameters as $callableParameter) {
+ $names[] = $name = $this->normalizeName($callableParameter->name);
+
+ if (array_key_exists($name, $parameters)) {
+ if (array_key_exists($pos, $parameters)) {
+ throw new Twig_Error_Syntax(sprintf('Argument "%s" is defined twice for %s "%s".', $name, $callType, $callName));
+ }
+
+ if (!empty($missingArguments)) {
+ throw new Twig_Error_Syntax(sprintf(
+ 'Argument "%s" could not be assigned for %s "%s(%s)" because it is mapped to an internal PHP function which cannot determine default value for optional argument%s "%s".',
+ $name, $callType, $callName, implode(', ', $names), count($missingArguments) > 1 ? 's' : '', implode('", "', $missingArguments))
+ );
+ }
+
+ $arguments = array_merge($arguments, $optionalArguments);
+ $arguments[] = $parameters[$name];
+ unset($parameters[$name]);
+ $optionalArguments = array();
+ } elseif (array_key_exists($pos, $parameters)) {
+ $arguments = array_merge($arguments, $optionalArguments);
+ $arguments[] = $parameters[$pos];
+ unset($parameters[$pos]);
+ $optionalArguments = array();
+ ++$pos;
+ } elseif ($callableParameter->isDefaultValueAvailable()) {
+ $optionalArguments[] = new Twig_Node_Expression_Constant($callableParameter->getDefaultValue(), -1);
+ } elseif ($callableParameter->isOptional()) {
+ if (empty($parameters)) {
+ break;
+ } else {
+ $missingArguments[] = $name;
+ }
+ } else {
+ throw new Twig_Error_Syntax(sprintf('Value for argument "%s" is required for %s "%s".', $name, $callType, $callName));
+ }
+ }
+
+ if ($isVariadic) {
+ $arbitraryArguments = new Twig_Node_Expression_Array(array(), -1);
+ foreach ($parameters as $key => $value) {
+ if (is_int($key)) {
+ $arbitraryArguments->addElement($value);
+ } else {
+ $arbitraryArguments->addElement($value, new Twig_Node_Expression_Constant($key, -1));
+ }
+ unset($parameters[$key]);
+ }
+
+ if ($arbitraryArguments->count()) {
+ $arguments = array_merge($arguments, $optionalArguments);
+ $arguments[] = $arbitraryArguments;
+ }
+ }
+
+ if (!empty($parameters)) {
+ $unknownParameter = null;
+ foreach ($parameters as $parameter) {
+ if ($parameter instanceof Twig_Node) {
+ $unknownParameter = $parameter;
+ break;
+ }
+ }
+
+ throw new Twig_Error_Syntax(sprintf(
+ 'Unknown argument%s "%s" for %s "%s(%s)".',
+ count($parameters) > 1 ? 's' : '', implode('", "', array_keys($parameters)), $callType, $callName, implode(', ', $names)
+ ), $unknownParameter ? $unknownParameter->getLine() : -1);
+ }
+
+ return $arguments;
+ }
+
+ protected function normalizeName($name)
+ {
+ return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), $name));
+ }
+
+ private function getCallableParameters($callable, $isVariadic)
+ {
+ if (is_array($callable)) {
+ $r = new ReflectionMethod($callable[0], $callable[1]);
+ } elseif (is_object($callable) && !$callable instanceof Closure) {
+ $r = new ReflectionObject($callable);
+ $r = $r->getMethod('__invoke');
+ } elseif (is_string($callable) && false !== strpos($callable, '::')) {
+ $r = new ReflectionMethod($callable);
+ } else {
+ $r = new ReflectionFunction($callable);
+ }
+
+ $parameters = $r->getParameters();
+ if ($this->hasNode('node')) {
+ array_shift($parameters);
+ }
+ if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) {
+ array_shift($parameters);
+ }
+ if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) {
+ array_shift($parameters);
+ }
+ if ($this->hasAttribute('arguments') && null !== $this->getAttribute('arguments')) {
+ foreach ($this->getAttribute('arguments') as $argument) {
+ array_shift($parameters);
+ }
+ }
+ if ($isVariadic) {
+ $argument = end($parameters);
+ if ($argument && $argument->isArray() && $argument->isDefaultValueAvailable() && array() === $argument->getDefaultValue()) {
+ array_pop($parameters);
+ } else {
+ $callableName = $r->name;
+ if ($r->getDeclaringClass()) {
+ $callableName = $r->getDeclaringClass()->name.'::'.$callableName;
+ }
+
+ throw new LogicException(sprintf('The last parameter of "%s" for %s "%s" must be an array with default value, eg. "array $arg = array()".', $callableName, $this->getAttribute('type'), $this->getAttribute('name')));
+ }
+ }
+
+ return $parameters;
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Conditional.php b/public/system/library/template/Twig/Node/Expression/Conditional.php
new file mode 100644
index 0000000..edcb1e2
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Conditional.php
@@ -0,0 +1,31 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Conditional extends Twig_Node_Expression
+{
+ public function __construct(Twig_Node_Expression $expr1, Twig_Node_Expression $expr2, Twig_Node_Expression $expr3, $lineno)
+ {
+ parent::__construct(array('expr1' => $expr1, 'expr2' => $expr2, 'expr3' => $expr3), array(), $lineno);
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->raw('((')
+ ->subcompile($this->getNode('expr1'))
+ ->raw(') ? (')
+ ->subcompile($this->getNode('expr2'))
+ ->raw(') : (')
+ ->subcompile($this->getNode('expr3'))
+ ->raw('))')
+ ;
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Constant.php b/public/system/library/template/Twig/Node/Expression/Constant.php
new file mode 100644
index 0000000..a91dc69
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Constant.php
@@ -0,0 +1,23 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Constant extends Twig_Node_Expression
+{
+ public function __construct($value, $lineno)
+ {
+ parent::__construct(array(), array('value' => $value), $lineno);
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler->repr($this->getAttribute('value'));
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/ExtensionReference.php b/public/system/library/template/Twig/Node/Expression/ExtensionReference.php
new file mode 100644
index 0000000..b4882e3
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/ExtensionReference.php
@@ -0,0 +1,32 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+@trigger_error('The Twig_Node_Expression_ExtensionReference class is deprecated since version 1.23 and will be removed in 2.0.', E_USER_DEPRECATED);
+
+/**
+ * Represents an extension call node.
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ *
+ * @deprecated since 1.23 and will be removed in 2.0.
+ */
+class Twig_Node_Expression_ExtensionReference extends Twig_Node_Expression
+{
+ public function __construct($name, $lineno, $tag = null)
+ {
+ parent::__construct(array(), array('name' => $name), $lineno, $tag);
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler->raw(sprintf("\$this->env->getExtension('%s')", $this->getAttribute('name')));
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Filter.php b/public/system/library/template/Twig/Node/Expression/Filter.php
new file mode 100644
index 0000000..a906232
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Filter.php
@@ -0,0 +1,39 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Filter extends Twig_Node_Expression_Call
+{
+ public function __construct(Twig_NodeInterface $node, Twig_Node_Expression_Constant $filterName, Twig_NodeInterface $arguments, $lineno, $tag = null)
+ {
+ parent::__construct(array('node' => $node, 'filter' => $filterName, 'arguments' => $arguments), array(), $lineno, $tag);
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ $name = $this->getNode('filter')->getAttribute('value');
+ $filter = $compiler->getEnvironment()->getFilter($name);
+
+ $this->setAttribute('name', $name);
+ $this->setAttribute('type', 'filter');
+ $this->setAttribute('thing', $filter);
+ $this->setAttribute('needs_environment', $filter->needsEnvironment());
+ $this->setAttribute('needs_context', $filter->needsContext());
+ $this->setAttribute('arguments', $filter->getArguments());
+ if ($filter instanceof Twig_FilterCallableInterface || $filter instanceof Twig_SimpleFilter) {
+ $this->setAttribute('callable', $filter->getCallable());
+ }
+ if ($filter instanceof Twig_SimpleFilter) {
+ $this->setAttribute('is_variadic', $filter->isVariadic());
+ }
+
+ $this->compileCallable($compiler);
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Filter/Default.php b/public/system/library/template/Twig/Node/Expression/Filter/Default.php
new file mode 100644
index 0000000..1827c88
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Filter/Default.php
@@ -0,0 +1,43 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2011 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Returns the value or the default value when it is undefined or empty.
+ *
+ * <pre>
+ * {{ var.foo|default('foo item on var is not defined') }}
+ * </pre>
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+class Twig_Node_Expression_Filter_Default extends Twig_Node_Expression_Filter
+{
+ public function __construct(Twig_NodeInterface $node, Twig_Node_Expression_Constant $filterName, Twig_NodeInterface $arguments, $lineno, $tag = null)
+ {
+ $default = new Twig_Node_Expression_Filter($node, new Twig_Node_Expression_Constant('default', $node->getLine()), $arguments, $node->getLine());
+
+ if ('default' === $filterName->getAttribute('value') && ($node instanceof Twig_Node_Expression_Name || $node instanceof Twig_Node_Expression_GetAttr)) {
+ $test = new Twig_Node_Expression_Test_Defined(clone $node, 'defined', new Twig_Node(), $node->getLine());
+ $false = count($arguments) ? $arguments->getNode(0) : new Twig_Node_Expression_Constant('', $node->getLine());
+
+ $node = new Twig_Node_Expression_Conditional($test, $default, $false, $node->getLine());
+ } else {
+ $node = $default;
+ }
+
+ parent::__construct($node, $filterName, $arguments, $lineno, $tag);
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler->subcompile($this->getNode('node'));
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Function.php b/public/system/library/template/Twig/Node/Expression/Function.php
new file mode 100644
index 0000000..7326ede
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Function.php
@@ -0,0 +1,38 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2010 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Function extends Twig_Node_Expression_Call
+{
+ public function __construct($name, Twig_NodeInterface $arguments, $lineno)
+ {
+ parent::__construct(array('arguments' => $arguments), array('name' => $name), $lineno);
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ $name = $this->getAttribute('name');
+ $function = $compiler->getEnvironment()->getFunction($name);
+
+ $this->setAttribute('name', $name);
+ $this->setAttribute('type', 'function');
+ $this->setAttribute('thing', $function);
+ $this->setAttribute('needs_environment', $function->needsEnvironment());
+ $this->setAttribute('needs_context', $function->needsContext());
+ $this->setAttribute('arguments', $function->getArguments());
+ if ($function instanceof Twig_FunctionCallableInterface || $function instanceof Twig_SimpleFunction) {
+ $this->setAttribute('callable', $function->getCallable());
+ }
+ if ($function instanceof Twig_SimpleFunction) {
+ $this->setAttribute('is_variadic', $function->isVariadic());
+ }
+
+ $this->compileCallable($compiler);
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/GetAttr.php b/public/system/library/template/Twig/Node/Expression/GetAttr.php
new file mode 100644
index 0000000..6ce6111
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/GetAttr.php
@@ -0,0 +1,63 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_GetAttr extends Twig_Node_Expression
+{
+ public function __construct(Twig_Node_Expression $node, Twig_Node_Expression $attribute, Twig_Node_Expression $arguments = null, $type, $lineno)
+ {
+ parent::__construct(array('node' => $node, 'attribute' => $attribute, 'arguments' => $arguments), array('type' => $type, 'is_defined_test' => false, 'ignore_strict_check' => false, 'disable_c_ext' => false), $lineno);
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ if (function_exists('twig_template_get_attributes') && !$this->getAttribute('disable_c_ext')) {
+ $compiler->raw('twig_template_get_attributes($this, ');
+ } else {
+ $compiler->raw('$this->getAttribute(');
+ }
+
+ if ($this->getAttribute('ignore_strict_check')) {
+ $this->getNode('node')->setAttribute('ignore_strict_check', true);
+ }
+
+ $compiler->subcompile($this->getNode('node'));
+
+ $compiler->raw(', ')->subcompile($this->getNode('attribute'));
+
+ // only generate optional arguments when needed (to make generated code more readable)
+ $needFourth = $this->getAttribute('ignore_strict_check');
+ $needThird = $needFourth || $this->getAttribute('is_defined_test');
+ $needSecond = $needThird || Twig_Template::ANY_CALL !== $this->getAttribute('type');
+ $needFirst = $needSecond || null !== $this->getNode('arguments');
+
+ if ($needFirst) {
+ if (null !== $this->getNode('arguments')) {
+ $compiler->raw(', ')->subcompile($this->getNode('arguments'));
+ } else {
+ $compiler->raw(', array()');
+ }
+ }
+
+ if ($needSecond) {
+ $compiler->raw(', ')->repr($this->getAttribute('type'));
+ }
+
+ if ($needThird) {
+ $compiler->raw(', ')->repr($this->getAttribute('is_defined_test'));
+ }
+
+ if ($needFourth) {
+ $compiler->raw(', ')->repr($this->getAttribute('ignore_strict_check'));
+ }
+
+ $compiler->raw(')');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/MethodCall.php b/public/system/library/template/Twig/Node/Expression/MethodCall.php
new file mode 100644
index 0000000..620b02b
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/MethodCall.php
@@ -0,0 +1,41 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2012 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_MethodCall extends Twig_Node_Expression
+{
+ public function __construct(Twig_Node_Expression $node, $method, Twig_Node_Expression_Array $arguments, $lineno)
+ {
+ parent::__construct(array('node' => $node, 'arguments' => $arguments), array('method' => $method, 'safe' => false), $lineno);
+
+ if ($node instanceof Twig_Node_Expression_Name) {
+ $node->setAttribute('always_defined', true);
+ }
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->subcompile($this->getNode('node'))
+ ->raw('->')
+ ->raw($this->getAttribute('method'))
+ ->raw('(')
+ ;
+ $first = true;
+ foreach ($this->getNode('arguments')->getKeyValuePairs() as $pair) {
+ if (!$first) {
+ $compiler->raw(', ');
+ }
+ $first = false;
+
+ $compiler->subcompile($pair['value']);
+ }
+ $compiler->raw(')');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Name.php b/public/system/library/template/Twig/Node/Expression/Name.php
new file mode 100644
index 0000000..a6e0ff4
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Name.php
@@ -0,0 +1,90 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Name extends Twig_Node_Expression
+{
+ protected $specialVars = array(
+ '_self' => '$this',
+ '_context' => '$context',
+ '_charset' => '$this->env->getCharset()',
+ );
+
+ public function __construct($name, $lineno)
+ {
+ parent::__construct(array(), array('name' => $name, 'is_defined_test' => false, 'ignore_strict_check' => false, 'always_defined' => false), $lineno);
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ $name = $this->getAttribute('name');
+
+ $compiler->addDebugInfo($this);
+
+ if ($this->getAttribute('is_defined_test')) {
+ if ($this->isSpecial()) {
+ $compiler->repr(true);
+ } else {
+ $compiler->raw('array_key_exists(')->repr($name)->raw(', $context)');
+ }
+ } elseif ($this->isSpecial()) {
+ $compiler->raw($this->specialVars[$name]);
+ } elseif ($this->getAttribute('always_defined')) {
+ $compiler
+ ->raw('$context[')
+ ->string($name)
+ ->raw(']')
+ ;
+ } else {
+ // remove the non-PHP 5.4 version when PHP 5.3 support is dropped
+ // as the non-optimized version is just a workaround for slow ternary operator
+ // when the context has a lot of variables
+ if (PHP_VERSION_ID >= 50400) {
+ // PHP 5.4 ternary operator performance was optimized
+ $compiler
+ ->raw('(isset($context[')
+ ->string($name)
+ ->raw(']) ? $context[')
+ ->string($name)
+ ->raw('] : ')
+ ;
+
+ if ($this->getAttribute('ignore_strict_check') || !$compiler->getEnvironment()->isStrictVariables()) {
+ $compiler->raw('null)');
+ } else {
+ $compiler->raw('$this->getContext($context, ')->string($name)->raw('))');
+ }
+ } else {
+ $compiler
+ ->raw('$this->getContext($context, ')
+ ->string($name)
+ ;
+
+ if ($this->getAttribute('ignore_strict_check')) {
+ $compiler->raw(', true');
+ }
+
+ $compiler
+ ->raw(')')
+ ;
+ }
+ }
+ }
+
+ public function isSpecial()
+ {
+ return isset($this->specialVars[$this->getAttribute('name')]);
+ }
+
+ public function isSimple()
+ {
+ return !$this->isSpecial() && !$this->getAttribute('is_defined_test');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/NullCoalesce.php b/public/system/library/template/Twig/Node/Expression/NullCoalesce.php
new file mode 100644
index 0000000..1003913
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/NullCoalesce.php
@@ -0,0 +1,23 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_NullCoalesce extends Twig_Node_Expression_Conditional
+{
+ public function __construct(Twig_NodeInterface $left, Twig_NodeInterface $right, $lineno)
+ {
+ $test = new Twig_Node_Expression_Binary_And(
+ new Twig_Node_Expression_Test_Defined(clone $left, 'defined', new Twig_Node(), $left->getLine()),
+ new Twig_Node_Expression_Unary_Not(new Twig_Node_Expression_Test_Null($left, 'null', new Twig_Node(), $left->getLine()), $left->getLine()),
+ $left->getLine()
+ );
+
+ parent::__construct($test, $left, $right, $lineno);
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Parent.php b/public/system/library/template/Twig/Node/Expression/Parent.php
new file mode 100644
index 0000000..694c080
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Parent.php
@@ -0,0 +1,42 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Represents a parent node.
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+class Twig_Node_Expression_Parent extends Twig_Node_Expression
+{
+ public function __construct($name, $lineno, $tag = null)
+ {
+ parent::__construct(array(), array('output' => false, 'name' => $name), $lineno, $tag);
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ if ($this->getAttribute('output')) {
+ $compiler
+ ->addDebugInfo($this)
+ ->write('$this->displayParentBlock(')
+ ->string($this->getAttribute('name'))
+ ->raw(", \$context, \$blocks);\n")
+ ;
+ } else {
+ $compiler
+ ->raw('$this->renderParentBlock(')
+ ->string($this->getAttribute('name'))
+ ->raw(', $context, $blocks)')
+ ;
+ }
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/TempName.php b/public/system/library/template/Twig/Node/Expression/TempName.php
new file mode 100644
index 0000000..e6b058e
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/TempName.php
@@ -0,0 +1,26 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2011 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_TempName extends Twig_Node_Expression
+{
+ public function __construct($name, $lineno)
+ {
+ parent::__construct(array(), array('name' => $name), $lineno);
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->raw('$_')
+ ->raw($this->getAttribute('name'))
+ ->raw('_')
+ ;
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Test.php b/public/system/library/template/Twig/Node/Expression/Test.php
new file mode 100644
index 0000000..c0358c8
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Test.php
@@ -0,0 +1,35 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2010 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Test extends Twig_Node_Expression_Call
+{
+ public function __construct(Twig_NodeInterface $node, $name, Twig_NodeInterface $arguments = null, $lineno)
+ {
+ parent::__construct(array('node' => $node, 'arguments' => $arguments), array('name' => $name), $lineno);
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ $name = $this->getAttribute('name');
+ $test = $compiler->getEnvironment()->getTest($name);
+
+ $this->setAttribute('name', $name);
+ $this->setAttribute('type', 'test');
+ $this->setAttribute('thing', $test);
+ if ($test instanceof Twig_TestCallableInterface || $test instanceof Twig_SimpleTest) {
+ $this->setAttribute('callable', $test->getCallable());
+ }
+ if ($test instanceof Twig_SimpleTest) {
+ $this->setAttribute('is_variadic', $test->isVariadic());
+ }
+
+ $this->compileCallable($compiler);
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Test/Constant.php b/public/system/library/template/Twig/Node/Expression/Test/Constant.php
new file mode 100644
index 0000000..de55f5f
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Test/Constant.php
@@ -0,0 +1,46 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2011 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Checks if a variable is the exact same value as a constant.
+ *
+ * <pre>
+ * {% if post.status is constant('Post::PUBLISHED') %}
+ * the status attribute is exactly the same as Post::PUBLISHED
+ * {% endif %}
+ * </pre>
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+class Twig_Node_Expression_Test_Constant extends Twig_Node_Expression_Test
+{
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->raw('(')
+ ->subcompile($this->getNode('node'))
+ ->raw(' === constant(')
+ ;
+
+ if ($this->getNode('arguments')->hasNode(1)) {
+ $compiler
+ ->raw('get_class(')
+ ->subcompile($this->getNode('arguments')->getNode(1))
+ ->raw(')."::".')
+ ;
+ }
+
+ $compiler
+ ->subcompile($this->getNode('arguments')->getNode(0))
+ ->raw('))')
+ ;
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Test/Defined.php b/public/system/library/template/Twig/Node/Expression/Test/Defined.php
new file mode 100644
index 0000000..3dc6ff5
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Test/Defined.php
@@ -0,0 +1,56 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2011 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Checks if a variable is defined in the current context.
+ *
+ * <pre>
+ * {# defined works with variable names and variable attributes #}
+ * {% if foo is defined %}
+ * {# ... #}
+ * {% endif %}
+ * </pre>
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+class Twig_Node_Expression_Test_Defined extends Twig_Node_Expression_Test
+{
+ public function __construct(Twig_NodeInterface $node, $name, Twig_NodeInterface $arguments = null, $lineno)
+ {
+ if ($node instanceof Twig_Node_Expression_Name) {
+ $node->setAttribute('is_defined_test', true);
+ } elseif ($node instanceof Twig_Node_Expression_GetAttr) {
+ $node->setAttribute('is_defined_test', true);
+
+ $this->changeIgnoreStrictCheck($node);
+ } elseif ($node instanceof Twig_Node_Expression_Constant || $node instanceof Twig_Node_Expression_Array) {
+ $node = new Twig_Node_Expression_Constant(true, $node->getLine());
+ } else {
+ throw new Twig_Error_Syntax('The "defined" test only works with simple variables.', $this->getLine());
+ }
+
+ parent::__construct($node, $name, $arguments, $lineno);
+ }
+
+ protected function changeIgnoreStrictCheck(Twig_Node_Expression_GetAttr $node)
+ {
+ $node->setAttribute('ignore_strict_check', true);
+
+ if ($node->getNode('node') instanceof Twig_Node_Expression_GetAttr) {
+ $this->changeIgnoreStrictCheck($node->getNode('node'));
+ }
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler->subcompile($this->getNode('node'));
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Test/Divisibleby.php b/public/system/library/template/Twig/Node/Expression/Test/Divisibleby.php
new file mode 100644
index 0000000..d5bed23
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Test/Divisibleby.php
@@ -0,0 +1,33 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2011 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Checks if a variable is divisible by a number.
+ *
+ * <pre>
+ * {% if loop.index is divisible by(3) %}
+ * </pre>
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+class Twig_Node_Expression_Test_Divisibleby extends Twig_Node_Expression_Test
+{
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->raw('(0 == ')
+ ->subcompile($this->getNode('node'))
+ ->raw(' % ')
+ ->subcompile($this->getNode('arguments')->getNode(0))
+ ->raw(')')
+ ;
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Test/Even.php b/public/system/library/template/Twig/Node/Expression/Test/Even.php
new file mode 100644
index 0000000..d7853e8
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Test/Even.php
@@ -0,0 +1,32 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2011 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Checks if a number is even.
+ *
+ * <pre>
+ * {{ var is even }}
+ * </pre>
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+class Twig_Node_Expression_Test_Even extends Twig_Node_Expression_Test
+{
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->raw('(')
+ ->subcompile($this->getNode('node'))
+ ->raw(' % 2 == 0')
+ ->raw(')')
+ ;
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Test/Null.php b/public/system/library/template/Twig/Node/Expression/Test/Null.php
new file mode 100644
index 0000000..1c83825
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Test/Null.php
@@ -0,0 +1,31 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2011 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Checks that a variable is null.
+ *
+ * <pre>
+ * {{ var is none }}
+ * </pre>
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+class Twig_Node_Expression_Test_Null extends Twig_Node_Expression_Test
+{
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->raw('(null === ')
+ ->subcompile($this->getNode('node'))
+ ->raw(')')
+ ;
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Test/Odd.php b/public/system/library/template/Twig/Node/Expression/Test/Odd.php
new file mode 100644
index 0000000..421c19e
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Test/Odd.php
@@ -0,0 +1,32 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2011 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Checks if a number is odd.
+ *
+ * <pre>
+ * {{ var is odd }}
+ * </pre>
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+class Twig_Node_Expression_Test_Odd extends Twig_Node_Expression_Test
+{
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->raw('(')
+ ->subcompile($this->getNode('node'))
+ ->raw(' % 2 == 1')
+ ->raw(')')
+ ;
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Test/Sameas.php b/public/system/library/template/Twig/Node/Expression/Test/Sameas.php
new file mode 100644
index 0000000..b48905e
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Test/Sameas.php
@@ -0,0 +1,29 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2011 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Checks if a variable is the same as another one (=== in PHP).
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
+class Twig_Node_Expression_Test_Sameas extends Twig_Node_Expression_Test
+{
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler
+ ->raw('(')
+ ->subcompile($this->getNode('node'))
+ ->raw(' === ')
+ ->subcompile($this->getNode('arguments')->getNode(0))
+ ->raw(')')
+ ;
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Unary.php b/public/system/library/template/Twig/Node/Expression/Unary.php
new file mode 100644
index 0000000..1cf54c3
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Unary.php
@@ -0,0 +1,27 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+abstract class Twig_Node_Expression_Unary extends Twig_Node_Expression
+{
+ public function __construct(Twig_NodeInterface $node, $lineno)
+ {
+ parent::__construct(array('node' => $node), array(), $lineno);
+ }
+
+ public function compile(Twig_Compiler $compiler)
+ {
+ $compiler->raw(' ');
+ $this->operator($compiler);
+ $compiler->subcompile($this->getNode('node'));
+ }
+
+ abstract public function operator(Twig_Compiler $compiler);
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Unary/Neg.php b/public/system/library/template/Twig/Node/Expression/Unary/Neg.php
new file mode 100644
index 0000000..2a3937e
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Unary/Neg.php
@@ -0,0 +1,18 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Unary_Neg extends Twig_Node_Expression_Unary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ $compiler->raw('-');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Unary/Not.php b/public/system/library/template/Twig/Node/Expression/Unary/Not.php
new file mode 100644
index 0000000..f94073c
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Unary/Not.php
@@ -0,0 +1,18 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Unary_Not extends Twig_Node_Expression_Unary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ $compiler->raw('!');
+ }
+}
diff --git a/public/system/library/template/Twig/Node/Expression/Unary/Pos.php b/public/system/library/template/Twig/Node/Expression/Unary/Pos.php
new file mode 100644
index 0000000..04edb52
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Unary/Pos.php
@@ -0,0 +1,18 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2009 Fabien Potencier
+ * (c) 2009 Armin Ronacher
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Unary_Pos extends Twig_Node_Expression_Unary
+{
+ public function operator(Twig_Compiler $compiler)
+ {
+ $compiler->raw('+');
+ }
+}