Commit 11ad7005 by Seldaek

* Fixes parsing bug with |modifier:param|modifier2} with:colon after it

git-svn-id: svn://dwoo.org/dwoo/trunk@151 0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent 3c603a81
......@@ -2296,24 +2296,18 @@ class Dwoo_Compiler implements Dwoo_ICompiler
}
$cmdstr = $cmdstrsrc;
$paramsep = ':';
$paramspos = strpos($cmdstr, $paramsep);
$funcsep = strpos($cmdstr, '|');
if ($funcsep !== false && ($paramspos === false || $paramspos > $funcsep)) {
$paramspos = false;
$cmdstr = substr($cmdstr, 0, $funcsep);
if (!preg_match('/^(@{0,2}[a-z][a-z0-9_]*)(:)?/', $cmdstr, $match)) {
throw new Dwoo_Compilation_Exception($this, 'Invalid modifier name, started with : '.substr($cmdstr, 0, 10));
}
$paramspos = !empty($match[2]) ? strlen($match[1]) : false;
$func = $match[1];
$state = 0;
if ($paramspos === false) {
if (!preg_match('/^(@{0,2}[a-z][a-z0-9_]*)/', $cmdstr, $match)) {
throw new Dwoo_Compilation_Exception($this, 'Invalid modifier name, started with : '.substr($cmdstr, 0, 10));
}
$func = $match[1];
$cmdstrsrc = substr($cmdstrsrc, strlen($func));
$params = array();
if ($this->debug) echo 'MODIFIER ('.$func.') CALLED WITH NO PARAMS<br/>';
} else {
$func = substr($cmdstr, 0, $paramspos);
$paramstr = substr($cmdstr, $paramspos+1);
if (substr($paramstr, -1, 1) === $paramsep) {
$paramstr = substr($paramstr, 0, -1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment