From bd9aabdc64ffa3f758b33f4e81ea3a6b65e25d39 Mon Sep 17 00:00:00 2001 From: mohrt Date: Wed, 12 Feb 2003 22:34:05 +0000 Subject: [PATCH] dropped support for modifiers on object parameters, added support for objects as modifier parameters --- NEWS | 3 +++ Smarty_Compiler.class.php | 30 +++++++++++++++--------------- libs/Smarty_Compiler.class.php | 30 +++++++++++++++--------------- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/NEWS b/NEWS index 635cf539..6fa2cae5 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ + - dropped support for modifers on object parameters, + added support for objects as modifier parameters + Version 2.4.2 (Feb 11, 2003) ---------------------------- - support embedded variables in objects (Monte) diff --git a/Smarty_Compiler.class.php b/Smarty_Compiler.class.php index d3e2c518..6c8df1f0 100644 --- a/Smarty_Compiler.class.php +++ b/Smarty_Compiler.class.php @@ -121,17 +121,6 @@ class Smarty_Compiler extends Smarty { $this->_avar_regexp = '(?:' . $this->_dvar_regexp . '|' . $this->_cvar_regexp . '|' . $this->_svar_regexp . ')'; - // matches valid modifier syntax: - // |foo - // |@foo - // |foo:"bar" - // |foo:$bar - // |foo:"bar":$foobar - // |foo|bar - // |foo - $this->_mod_regexp = '(?:\|@?\w+(?::(?>\w+|' - . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)'; - // matches valid variable syntax: // $foo // $foo @@ -146,16 +135,27 @@ class Smarty_Compiler extends Smarty { // $foo->bar() // $foo->bar("text") // $foo->bar($foo, $bar, "text") - // $foo->bar($foo|bar, "foo"|bar) + // $foo->bar($foo, "foo") // $foo->bar->foo() // $foo->bar->foo->bar() $this->_obj_ext_regexp = '\->(?:\w+|' . $this->_dvar_regexp . ')'; $this->_obj_params_regexp = '\((?:\w+|' - . $this->_var_regexp . '(?>' . $this->_mod_regexp . '*)(?:\s*,\s*(?:(?:\w+|' - . $this->_var_regexp . '(?>' . $this->_mod_regexp . '*))))*)?\)'; + . $this->_var_regexp . '(?:\s*,\s*(?:(?:\w+|' + . $this->_var_regexp . ')))*)?\)'; $this->_obj_start_regexp = '(?:' . $this->_dvar_regexp . '(?:' . $this->_obj_ext_regexp . ')+)'; $this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp . '(?:' . $this->_obj_params_regexp . ')?)'; - + + // matches valid modifier syntax: + // |foo + // |@foo + // |foo:"bar" + // |foo:$bar + // |foo:"bar":$foobar + // |foo|bar + // |foo:$foo->bar + $this->_mod_regexp = '(?:\|@?\w+(?::(?>\w+|' + . $this->_obj_call_regexp . '|' . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)'; + // matches valid function name: // foo123 // _foo_bar diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index d3e2c518..6c8df1f0 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -121,17 +121,6 @@ class Smarty_Compiler extends Smarty { $this->_avar_regexp = '(?:' . $this->_dvar_regexp . '|' . $this->_cvar_regexp . '|' . $this->_svar_regexp . ')'; - // matches valid modifier syntax: - // |foo - // |@foo - // |foo:"bar" - // |foo:$bar - // |foo:"bar":$foobar - // |foo|bar - // |foo - $this->_mod_regexp = '(?:\|@?\w+(?::(?>\w+|' - . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)'; - // matches valid variable syntax: // $foo // $foo @@ -146,16 +135,27 @@ class Smarty_Compiler extends Smarty { // $foo->bar() // $foo->bar("text") // $foo->bar($foo, $bar, "text") - // $foo->bar($foo|bar, "foo"|bar) + // $foo->bar($foo, "foo") // $foo->bar->foo() // $foo->bar->foo->bar() $this->_obj_ext_regexp = '\->(?:\w+|' . $this->_dvar_regexp . ')'; $this->_obj_params_regexp = '\((?:\w+|' - . $this->_var_regexp . '(?>' . $this->_mod_regexp . '*)(?:\s*,\s*(?:(?:\w+|' - . $this->_var_regexp . '(?>' . $this->_mod_regexp . '*))))*)?\)'; + . $this->_var_regexp . '(?:\s*,\s*(?:(?:\w+|' + . $this->_var_regexp . ')))*)?\)'; $this->_obj_start_regexp = '(?:' . $this->_dvar_regexp . '(?:' . $this->_obj_ext_regexp . ')+)'; $this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp . '(?:' . $this->_obj_params_regexp . ')?)'; - + + // matches valid modifier syntax: + // |foo + // |@foo + // |foo:"bar" + // |foo:$bar + // |foo:"bar":$foobar + // |foo|bar + // |foo:$foo->bar + $this->_mod_regexp = '(?:\|@?\w+(?::(?>\w+|' + . $this->_obj_call_regexp . '|' . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)'; + // matches valid function name: // foo123 // _foo_bar