Commit Graph

63 Commits

Author SHA1 Message Date
Fabien Potencier 103e857290 refactored code 2011-11-01 11:56:04 +01:00
Fabien Potencier 9117fc1ce0 added Twig_Function_Node to allow more complex functions to have their own Node class 2011-11-01 11:49:04 +01:00
Fabien Potencier 3427adc7ec added Twig_Filter_Node to allow more complex tests to have their own Node class (the default filter has been converted to use this new feature) 2011-11-01 11:48:05 +01:00
Fabien Potencier 846a2c134d added a Twig_Node_Expression_DefaultFilter to replace the current way of dealing with default filters 2011-10-16 05:46:09 +02:00
Fabien Potencier 4a91f4ff34 refactored 'defined' test and 'default' filter
Node manipulations have been moved outside the compile() method.
That's needed if we want to be able to visit all nodes that will be
compiled.
2011-10-08 14:27:18 +02:00
Fabien Potencier d101a05976 added traits support for the parent function 2011-09-22 14:06:20 +02:00
Fabien Potencier 39774a1118 made a markup refactoring 2011-09-01 10:33:25 +02:00
Fabien Potencier c609060f94 added the "attribute" function to allow getting dynamic attributes on variables 2011-08-27 09:46:06 +02:00
nikic da4d964047 Do not use Node_Expression_Name for function names, just use strings for those 2011-08-06 11:21:23 +02:00
Fabien Potencier 17f814223b updated email address 2011-04-29 17:18:51 +02:00
Fabien Potencier 76205f1eaa added null as an alias to none and made TRUE, FALSE, and NONE equivalent to true, false, and none 2011-04-14 07:35:58 +02:00
nikic 587063efbf add some more DocComments / type hints 2011-02-18 09:32:28 +01:00
nikic 8b0d71fb33 swap GetAttr constructor arguments for from .. import macros 2011-02-09 06:48:48 +01:00
Fabien Potencier d479a704c6 fixed typos 2011-02-08 15:39:03 +01:00
Fabien Potencier 4501984e5d fixed filter tag 2011-02-05 23:57:22 +01:00
Fabien Potencier 64f63bef19 removed coupling between Twig_Node and Twig_Template
This coupling was bad as Twig_Node should only be useful
during compilation.

So, the Twig_Node_Expression_GetAttr constants have been moved
to Twig_TemplateInterface.
2011-01-16 07:49:01 +01:00
Martin Hason 05a12f0820 fix line number in error exceptions 2011-01-07 17:27:17 +01:00
Leon van der Ree 024b9367eb improved error messages 2010-12-30 21:23:58 +01:00
Fabien Potencier 98edcd0cb6 replaced {% display foo %} with {{ block('foo') }} 2010-12-30 11:20:20 +01:00
Fabien Potencier a958ada7d3 replaced {% parent %} with {{ parent() }} 2010-12-30 11:20:20 +01:00
Arnaud Le Blanc b247452ec5 Resolve imported functions at compile time
{% from %} is compiled as {% import %}, the imported module is placed in
a local variable, and calls to imported functions are compiled as calls
to module functions.
2010-12-30 09:31:08 +01:00
nikic 6d030c266a disallow {% set %}{% endset %} 2010-12-22 18:04:45 +01:00
nikic 4ebbc5e43e rename $parser to $stream in parseArguments 2010-12-22 18:04:34 +01:00
Fabien Potencier 592834f7f6 fixed typo 2010-12-22 11:34:23 +01:00
nikic d88a3c805f remove $is_multitarget return in parseMultitargetExpression
Furthermore slightly reordered code thus removing redundant expect()
2010-12-20 19:06:42 +01:00
nikic ad8375ac4b One should only be able to assign to variables 2010-12-20 19:03:15 +01:00
nikic 06753220b9 remove unused $lineno variable 2010-12-20 19:01:33 +01:00
nikic f1583ce353 change while(1) to while(true) 2010-12-20 19:01:23 +01:00
nikic 59f45ba11d remove "(,)" hint from syntax error messages (the expect function will do that already) 2010-12-20 19:01:11 +01:00
nikic f14e0a37ca use the passed $token in isUnary and isBinary of ExpressionParser 2010-12-20 19:00:22 +01:00
Fabien Potencier 8e96487ada changed error messages to be more friendly 2010-12-20 14:48:07 +01:00
Fabien Potencier 1621435b89 added support for functions 2010-12-19 19:48:02 +01:00
Fabien Potencier 20970419b4 removed support for foo.% which does not make sense 2010-12-14 16:23:56 +01:00
Fabien Potencier 3c01290c66 fixed usage of operators as method names (like is, in, and not) 2010-12-14 15:20:49 +01:00
Fabien Potencier c202b2891f enhanced error messages when an unexpected token is parsed in an expression 2010-12-14 09:47:56 +01:00
Fabien Potencier 4505200d9f changed array/hashes notation 2010-12-14 09:33:07 +01:00
Fabien Potencier 031bf84b25 fixed parentheses placement for the ternary operator 2010-12-02 14:33:10 +01:00
Arnaud Le Blanc 7284fa9829 fix parsing of postfix expressions 2010-11-29 08:05:26 +01:00
Fabien Potencier dc71bf1a82 made operators configurable 2010-11-26 20:57:53 +01:00
Fabien Potencier 9d8583efcc rewrote expression parser with a new algorithm to limit the depth of nested calls
This change has no impact for the end user, but many internal benefits:

* less nested calls (was the primary reason for the change as xdebug limits the depth of nested calls);
* less code;
* code is much cleaner (I have removed all the parsing "hacks");
* faster;
* more flexible (we will now be able to expose an API to add new operators);
* easier to maintain.
2010-11-26 16:35:59 +01:00
Arnaud Le Blanc 15e46e598d Changed Twig_Node_Expression_Filter to accept only one filter
Chained filters are now represented by nested
Twig_Node_Expression_Filter nodes internally.

This makes it easier to analyse the tree
2010-11-19 08:06:32 +01:00
Fabien Potencier 7ea98b6c90 moved all exceptions to Twig_Error_* 2010-11-07 22:18:31 +01:00
Fabien Potencier 011e727b22 fixed documentation and added infix notation for in (already supported for is) 2010-11-07 14:21:10 +01:00
Fabien Potencier 2d1b78e849 removed @version phpdoc attribute 2010-11-07 09:26:25 +01:00
Fabien Potencier 47c44e477c fixed is operator (lexer did not tokenize 'foo.isactive' properly -- closes #102) 2010-08-17 07:50:52 +02:00
Fabien Potencier 5d6e7e2e01 added 'test' feature via the 'is' operator (closes #88) 2010-08-13 16:22:54 +02:00
Fabien Potencier 68b966516c made parseArguments autonomous 2010-06-08 11:38:55 +02:00
Fabien Potencier 3c22324909 made parseArrayExpression autonomous 2010-06-08 11:23:30 +02:00
Fabien Potencier dc37698ce0 changed order of Twig_Node_Expression_GetAttr constructor arguments 2010-06-07 14:28:22 +02:00
Fabien Potencier f2bb0aa911 made Resource::getAttribute() more generic (WIP) 2010-06-07 10:41:15 +02:00