[limb-svn] r6774 - in 3.x/trunk/limb/macro/src: compiler tags/core
svn at limb-project.com
svn at limb-project.com
Thu Feb 7 14:15:59 MSK 2008
Author: korchasa
Date: 2008-02-07 14:15:59 +0300 (Thu, 07 Feb 2008)
New Revision: 6774
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6774
Modified:
3.x/trunk/limb/macro/src/compiler/lmbMacroParser.class.php
3.x/trunk/limb/macro/src/compiler/lmbMacroTagDictionary.class.php
3.x/trunk/limb/macro/src/compiler/lmbMacroTokenizerListener.interface.php
3.x/trunk/limb/macro/src/tags/core/include.tag.php
3.x/trunk/limb/macro/src/tags/core/wrap.tag.php
Log:
-- between compliter and parser clearly divided work with templates
-- parser works with the full path to the template
-- compiler works with the template name and generate full path by locator
Modified: 3.x/trunk/limb/macro/src/compiler/lmbMacroParser.class.php
===================================================================
--- 3.x/trunk/limb/macro/src/compiler/lmbMacroParser.class.php 2008-02-07 11:11:44 UTC (rev 6773)
+++ 3.x/trunk/limb/macro/src/compiler/lmbMacroParser.class.php 2008-02-07 11:15:59 UTC (rev 6774)
@@ -24,20 +24,14 @@
*/
protected $tree_builder;
- /**
- * @var lmbMacroTemplateLocator
- */
- protected $template_locator;
-
protected $tokenizer;
- function __construct($tree_builder, $template_locator, $tag_dictionary)
+ function __construct($tree_builder, $tag_dictionary)
{
$this->tokenizer = new lmbMacroTokenizer($this);
$this->preprocessor = new lmbMacroPreprocessor();
$this->tree_builder = $tree_builder;
- $this->template_locator = $template_locator;
$this->tag_parsing_state = $this->_createTagParsingState($tag_dictionary);
}
@@ -57,21 +51,14 @@
* Initially invoked by the CompileTemplate function,
* the first component argument being a root node.
*/
- function parse($file_name, $root_node)
+ function parse($source_file_path, $root_node)
{
- $source_file_path = $this->template_locator->locateSourceTemplate($file_name);
-
- if(empty($source_file_path))
- throw new lmbMacroException('Template source file not found', array('file_name' => $file_name));
-
$tags_before_parse = $this->tree_builder->getExpectedTagCount();
$this->tree_builder->setCursor($root_node);
- $this->changeToTagParsingState();
+ $this->changeToTagParsingState();
- $this->setTemplateLocator($this->template_locator);
-
$content = file_get_contents($source_file_path);
$this->preprocessor->process($content);
@@ -98,10 +85,6 @@
$this->active_parsing_state = $this->tag_parsing_state;
}
- function setTemplateLocator($template_locator)
- {
- $this->tag_parsing_state->setTemplateLocator($template_locator);
- }
function startElement($tag, $attrs)
{
Modified: 3.x/trunk/limb/macro/src/compiler/lmbMacroTagDictionary.class.php
===================================================================
--- 3.x/trunk/limb/macro/src/compiler/lmbMacroTagDictionary.class.php 2008-02-07 11:11:44 UTC (rev 6773)
+++ 3.x/trunk/limb/macro/src/compiler/lmbMacroTagDictionary.class.php 2008-02-07 11:15:59 UTC (rev 6774)
@@ -84,6 +84,7 @@
protected function _saveCache()
{
+ lmb_require('limb/fs/src/lmbFs.class.php');
$cache_file = $this->cache_dir . '/tags.cache';
lmbFs :: safeWrite($cache_file, serialize($this->info));
}
Modified: 3.x/trunk/limb/macro/src/compiler/lmbMacroTokenizerListener.interface.php
===================================================================
--- 3.x/trunk/limb/macro/src/compiler/lmbMacroTokenizerListener.interface.php 2008-02-07 11:11:44 UTC (rev 6773)
+++ 3.x/trunk/limb/macro/src/compiler/lmbMacroTokenizerListener.interface.php 2008-02-07 11:15:59 UTC (rev 6774)
@@ -23,6 +23,5 @@
function unexpectedEOF($data);
function invalidEntitySyntax($data);
function invalidAttributeSyntax($data);
- function setTemplateLocator($locator);
}
Modified: 3.x/trunk/limb/macro/src/tags/core/include.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/core/include.tag.php 2008-02-07 11:11:44 UTC (rev 6773)
+++ 3.x/trunk/limb/macro/src/tags/core/include.tag.php 2008-02-07 11:15:59 UTC (rev 6774)
@@ -22,17 +22,9 @@
{
parent :: preParse($compiler);
- $locator = $compiler->getTemplateLocator();
-
- $file = $this->get('file');
-
if(!$this->_isDynamic())
{
- $source_file = $locator->locateSourceTemplate($file);
- if(empty($source_file))
- $this->raise('Template source file not found', array('file_name' => $file));
-
- $compiler->parseTemplate($file, $this);
+ $compiler->parseTemplate($this->get('file'), $this);
}
}
Modified: 3.x/trunk/limb/macro/src/tags/core/wrap.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/core/wrap.tag.php 2008-02-07 11:11:44 UTC (rev 6773)
+++ 3.x/trunk/limb/macro/src/tags/core/wrap.tag.php 2008-02-07 11:15:59 UTC (rev 6774)
@@ -32,7 +32,7 @@
if(!$this->is_dynamic)
{
$file = $this->get('with');
- $this->_compileSourceFileName($file, $compiler);
+ $compiler->parseTemplate($file, $this);
//if there's no 'into' attribute we consider that {{into}} tags used instead
if($into = $this->get('into'))
@@ -43,16 +43,6 @@
}
}
- protected function _compileSourceFileName($file, $compiler)
- {
- $this->sourcefile = $compiler->getTemplateLocator()->locateSourceTemplate($file);
-
- if(empty($this->sourcefile))
- $this->raise('Template source file not found', array('file_name' => $file));
-
- $compiler->parseTemplate($file, $this);
- }
-
function _insert($wrapper, $tree_builder, $point)
{
$insertionPoint = $wrapper->findChild($point);
More information about the limb-svn
mailing list