Re: [SMARTY] Re: object calls fail after upgrade to 2.6.4
| From: | Monte Ohrt | Date: | Thu, 09 Sep 2004 22:31:07 +0000 |
| Subject: | Re: [SMARTY] Re: object calls fail after upgrade to 2.6.4 | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-2556@lists.php.net to get a copy of this message | ||
Hans_JXrgen_von_Lengerke wrote:
I saw the regex you're working on and it looks scary. HansThe 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\.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