cvs: smarty / NEWS /libs Smarty_Compiler.class.php
"Messju Mohr" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.smarty |
|---|---|
| Message-ID | <cvsmessju1095274735@cvsserver> |
messju Wed Sep 15 14:58:55 2004 EDT
Modified files:
/smarty NEWS
/smarty/libs Smarty_Compiler.class.php
Log:
moved $this->_num_const_regexp out of $this->_var_regexp and added it
to the places that affect $this->_var_regexp
this should fix some problems parsing plugin-names endings with digits
http://cvs.php.net/diff.php/smarty/NEWS?r1=1.475&r2=1.476&ty=u
Index: smarty/NEWS
diff -u smarty/NEWS:1.475 smarty/NEWS:1.476
--- smarty/NEWS:1.475 Mon Sep 13 12:11:04 2004
+++ smarty/NEWS Wed Sep 15 14:58:55 2004
@@ -1,3 +1,5 @@
+ - fixed more parsing problems (messju)
+
Version 2.6.5 (Sept 13, 2004)
-----------------------------
http://cvs.php.net/diff.php/smarty/libs/Smarty_Compiler.class.php?r1=1.344&r2=1.345&ty=u
Index: smarty/libs/Smarty_Compiler.class.php
diff -u smarty/libs/Smarty_Compiler.class.php:1.344 smarty/libs/Smarty_Compiler.class.php:1.345
--- smarty/libs/Smarty_Compiler.class.php:1.344 Tue Sep 14 03:39:01 2004
+++ smarty/libs/Smarty_Compiler.class.php Wed Sep 15 14:58:55 2004
@@ -26,7 +26,7 @@
* @package Smarty
*/
-/* $Id: Smarty_Compiler.class.php,v 1.344 2004/09/14 07:39:01 messju Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.345 2004/09/15 18:58:55 messju Exp $ */
/**
* Template compiling class
@@ -101,7 +101,7 @@
// 30
// -12
// 13.22
- $this->_num_const_regexp = '\-?\d+(?:\.\d+)?';
+ $this->_num_const_regexp = '(?:\-?\d+(?:\.\d+)?)';
// matches $ vars (not objects):
// $foo
@@ -137,7 +137,7 @@
// #foo#
// "text"
// "text"
- $this->_var_regexp = '(?:' . $this->_avar_regexp . '|' . $this->_num_const_regexp . '|' . $this->_qstr_regexp . ')';
+ $this->_var_regexp = '(?:' . $this->_avar_regexp . '|' . $this->_qstr_regexp . ')';
// matches valid object call (one level of object nesting allowed in parameters):
// $foo->bar
@@ -152,8 +152,8 @@
// $foo->bar($foo->bar($blah,$foo,44,"foo",$foo[0].bar))
$this->_obj_ext_regexp = '\->(?:\$?' . $this->_dvar_guts_regexp . ')';
$this->_obj_restricted_param_regexp = '(?:'
- . $this->_var_regexp . '(?:' . $this->_obj_ext_regexp . '(?:\((?:' . $this->_var_regexp
- . '(?:\s*,\s*' . $this->_var_regexp . ')*)?\))?)*)';
+ . '(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')(?:' . $this->_obj_ext_regexp . '(?:\((?:(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')'
+ . '(?:\s*,\s*(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . '))*)?\))?)*)';
$this->_obj_single_param_regexp = '(?:\w+|' . $this->_obj_restricted_param_regexp . '(?:\s*,\s*(?:(?:\w+|'
. $this->_var_regexp . $this->_obj_restricted_param_regexp . ')))*)';
$this->_obj_params_regexp = '\((?:' . $this->_obj_single_param_regexp
@@ -169,7 +169,7 @@
// |foo:"bar":$foobar
// |foo|bar
// |foo:$foo->bar
- $this->_mod_regexp = '(?:\|@?\w+(?::(?>-?\w+|'
+ $this->_mod_regexp = '(?:\|@?\w+(?::(?:\w+|' . $this->_num_const_regexp . '|'
. $this->_obj_call_regexp . '|' . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)';
// matches valid function name:
@@ -191,7 +191,7 @@
// "text"|bar
// $foo->bar
$this->_param_regexp = '(?:\s*(?:' . $this->_obj_call_regexp . '|'
- . $this->_var_regexp . '|\w+)(?>' . $this->_mod_regexp . '*)\s*)';
+ . $this->_var_regexp . '|' . $this->_num_const_regexp . '|\w+)(?>' . $this->_mod_regexp . '*)\s*)';
// matches valid parenthesised function parameters:
//
@@ -1528,7 +1528,7 @@
$token = 'false';
} else if ($token == 'null') {
$token = 'null';
- } else if (preg_match('~^-?([0-9]+|0[xX][0-9a-fA-F]+)$~', $token)) {
+ } else if (preg_match('~^' . $this->_num_const_regexp . '|0[xX][0-9a-fA-F]+$~', $token)) {
/* treat integer literally */
} else if (!preg_match('~^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . ')*$~', $token)) {
/* treat as a string, double-quote it escaping quotes */
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php