Re: [SMARTY] Re: object calls fail after upgrade to 2.6.4

Monte Ohrt <[email protected]>
Newsgroups gmane.comp.php.smarty.devel
Message-ID <[email protected]>
Hans_JXrgen_von_Lengerke wrote:

>
> I saw the regex you're working on and it looks scary.
>
> Hans


The regular expressions can look quite scary, but not so bad if they are 
kept in digestable chunks. If you take a look at the 
Smarty_Compiler.class.php you'll see that the regular expressions are 
all broken down into individual elements, and then used in sequence to 
match text patterns. For something entertaining, put this at the bottom 
of the Smarty_Compiler constructor:

echo $this->_obj_call_regexp;

This is used to match an object call.

Here is the regex:

(?:(?:\$\w+(?:\[\$?[\w\.]+\])*(?:\.\$?\w+(?:\[\$?[\w\.]+\])*)*(?:(?:[\+\*\/\%]|(?:-(?!>)))(?:\-?\d+(?:\.\d+)?|[\$\w\.\+\-\*\/\%\d\>\[\]])*)?(?:\->(?:\$?\w+(?:\[\$?[\w\.]+\])*(?:\.\$?\w+(?:\[\$?[\w\.]+\])*)*(?:(?:[\+\*\/\%]|(?:-(?!>)))(?:\-?\d+(?:\.\d+)?|[\$\w\.\+\-\*\/\%\d\>\[\]])*)?))+)(?:\((?:(?:\w+|(?:(?:(?:\$\w+(?:\[\$?[\w\.]+\])*(?:\.\$?\w+(?:\[\$?[\w\.]+\])*)*(?:(?:[\+\*\/\%]|(?:-(?!>)))(?:\-?\d+(?:\.\d+)?|[\$\w\.\+\-\*\/\%\d\>\[\]])*)?|\#\w+\#|\%\w+\.\w+\%)|\-?\d+(?:\.\d+)?|(?:"[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*'))(?:\->(?:\$?\w+(?:\[\$?[\w\.]+\])*(?:\.\$?\w+(?:\[\$?[\w\.]+\])*)*(?:(?:[\+\*\/\%]|(?:-(?!>)))(?:\-?\d+(?:\.\d+)?|[\$\w\.\+\-\*\/\%\d\>\[\]])*)?)(?:\((?:(?:(?:\$\w+(?:\[\$?[\w\.]+\])*(?:\.\$?\w+(?:\[\$?[\w\.]+\])*)*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$?[\w\.]+\])*)*(?:(?:[\+\*\/\%]|(?:-(?!>)))(?:\-?\d+(?:\.\d+)?|[\$\w\.\+\-\*\/\%\d\>\[\]])*)?|\#\w+\#|\%\w+\.\w+\%)|\-?\d+(?:\.\d+)?|(?:"[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*'))(?:\s*,\s*(?:(?:\$\w+(?:\[\$?[\w\.]+\])*(?:\.\$?\w+(?:\[\$?[\w\.]+\])*)*(?:(?:[\+\*\/\%]|(?:-(?!>)))(?:\-?\d+(?:\.\d+)?|[\$\w\.\+\-\*\/\%\d\>\[\]])*)?|\#\w+\#|\%\w+\.\w+\%)|\-?\d+(?:\.\d+)?|(?:"[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*')))*)?\))?)*))))*))*)?\))?)

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.