From a4565e88edbc8e3bd092a475469769c86a4c350c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 2 Aug 2013 22:40:51 +0200 Subject: add Twig & refactor poche --- inc/Twig/Extensions/Grammar/Boolean.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 inc/Twig/Extensions/Grammar/Boolean.php (limited to 'inc/Twig/Extensions/Grammar/Boolean.php') diff --git a/inc/Twig/Extensions/Grammar/Boolean.php b/inc/Twig/Extensions/Grammar/Boolean.php new file mode 100644 index 00000000..c0048090 --- /dev/null +++ b/inc/Twig/Extensions/Grammar/Boolean.php @@ -0,0 +1,24 @@ +', $this->name); + } + + public function parse(Twig_Token $token) + { + $this->parser->getStream()->expect(Twig_Token::NAME_TYPE, array('true', 'false')); + + return new Twig_Node_Expression_Constant('true' === $token->getValue() ? true : false, $token->getLine()); + } +} -- cgit v1.2.3