Re: [SMARTY-DEV] New syntax allowed for the compiler
| From: | Monte Ohrt | Date: | Tue, 04 Feb 2003 14:22:10 +0000 |
| Subject: | Re: [SMARTY-DEV] New syntax allowed for the compiler | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-662@lists.php.net to get a copy of this message | ||
CVS was already patched yesterday to accomodate this. You can put any
valid varible syntax in. example:
$foo->bar[$x].foo.bar[0]
On Tue, 2003-02-04 at 05:16, Renaud Binse wrote:
> Hi,
>
> Here is a little patch to allow the compiler to recognize the following
> syntax :
>
> $foo->bar[$foo]
> $foo->bar[$foo]->bar
> $foo->bar[$bar]->foo->bar()
> $foo->bar[$foo]->foo[$bar]->bar()
> etc
>
> These modifications recognize all the standard samples given in the file
> Smarty_Compiler.class.php If anyone see a wrong recognized syntax
>
> Renaud
>
> 57a58
> > var $_arvar_regexp = null;
> 96c97,98
> < $this->_dvar_regexp =
> '\$\w+(?:\[\$?[\w\.]+\])*(?:\.\$?\w+(?:\[\$?[\w\.]+\])*)*';
> ---
> > $this->_arvar_regexp =
> '\w+(?:\[\$?[\w\.]+\])*(?:\.\$?\w+(?:\[\$?[\w\.]+\])*)*';
> > $this->_dvar_regexp = '\$'.$this->_arvar_regexp;
> 132a135,136
> > // $foo->bar[$foo]
> > // $foo->bar[$foo]->bar
> 139,140c143,146
> < $this->_obj_start_regexp = '(?:' . $this->_dvar_regexp .
> '(?:\->\w+)+)';
> < $this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp .
> '(?:\((?:\w+|'
> ---
> > // $foo->bar[$bar]->foo->bar()
> > // $foo->bar[$foo]->foo[$bar]->bar()
> > $this->_obj_start_regexp = '(?:' . $this->_dvar_regexp .
> '(?:\->'.$this->_arvar_regexp.')*)';
> > $this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp .
> '(?:\w+\((?:\w+|'
--
Monte Ohrt <monte@ispi.net>