Add Fenom::ACCESSOR_CALL parser

This commit is contained in:
bzick 2015-06-03 11:31:53 +03:00
parent c6dbdfff95
commit 48e4931506
3 changed files with 6 additions and 5 deletions

View File

@ -7,7 +7,8 @@ require_once __DIR__.'/../tests/tools.php';
$fenom = Fenom::factory(__DIR__.'/templates', __DIR__.'/compiled'); $fenom = Fenom::factory(__DIR__.'/templates', __DIR__.'/compiled');
$fenom->setOptions(Fenom::AUTO_RELOAD | Fenom::FORCE_COMPILE); $fenom->setOptions(Fenom::AUTO_RELOAD | Fenom::FORCE_COMPILE);
//var_dump($fenom->compileCode('{set $z = "A"~~"B"}')->getBody()); $fenom->addAccessorSmart('g', 'App::$q->get', Fenom::ACCESSOR_CALL);
var_dump($fenom->compileCode('{$.g("env")}')->getBody());
//var_dump($fenom->compile("bug158/main.tpl", [])->getTemplateCode()); //var_dump($fenom->compile("bug158/main.tpl", [])->getTemplateCode());
var_dump($fenom->display("bug158/main.tpl", [])); //var_dump($fenom->display("bug158/main.tpl", []));
// $fenom->getTemplate("problem.tpl"); // $fenom->getTemplate("problem.tpl");

View File

@ -33,8 +33,9 @@ class Accessor {
return $tpl->parseVariable($tokens, $var); return $tpl->parseVariable($tokens, $var);
} }
public static function parserCall($accessor, Tokenizer $tokens, Template $tpl) {
// return $tpl->parseVariable($tokens, $var); public static function parserCall($call, Tokenizer $tokens, Template $tpl) {
return $call.$tpl->parseArgs($tokens);
} }
/** /**

View File

@ -1442,7 +1442,6 @@ class Template extends Render
* (1 + 2.3, 'string', $var, [2,4]) * (1 + 2.3, 'string', $var, [2,4])
* *
* @param Tokenizer $tokens * @param Tokenizer $tokens
* @param bool $as_string
* @return string * @return string
*/ */
public function parseArgs(Tokenizer $tokens) public function parseArgs(Tokenizer $tokens)