eZPublish  3.8
eZTemplateMultiPassParser Class Reference

The class eZTemplateMultiPassParser does. More...

+ Inheritance diagram for eZTemplateMultiPassParser:
+ Collaboration diagram for eZTemplateMultiPassParser:

Public Member Functions

 appendChild (&$root, &$node)
 
 eZTemplateMultiPassParser ()
 
 gotoEndPosition ($text, $line, $column, &$endLine, &$endColumn)
 
instance ()
 
 parse (&$tpl, &$sourceText, &$rootElement, $rootNamespace, &$resourceData)
 
 parseBlockFunction ($funcName, &$args, &$tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, &$rootNamespace)
 
 parseDefFunction ($funcName, &$args, &$tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, &$rootNamespace)
 
 parseForeachFunction (&$args, &$tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, &$rootNamespace)
 
 parseForFunction (&$args, &$tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, &$rootNamespace)
 
 parseIntoTextElements (&$tpl, $sourceText, $sourcePosition, $leftDelimiter, $rightDelimiter, $sourceLength, $relatedTemplateName)
 
 parseIntoTree (&$tpl, &$textElements, &$treeRoot, $rootNamespace, $relatedResource, $relatedTemplateName)
 
 parseSectionFunction ($funcName, &$args, &$tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, &$rootNamespace)
 
 parseSequenceParameter ($parseSequenceKeyword, $funcName, &$args, &$tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, &$rootNamespace)
 
 parseSetFunction ($funcName, &$args, &$tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, &$rootNamespace)
 
 parseUnnamedCondition ($funcName, &$args, &$tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, &$rootNamespace)
 
 parseWhileFunction (&$args, &$tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, &$rootNamespace)
 
 parseWhitespaceRemoval (&$tpl, &$textElements)
 
 showParseErrorMessage (&$tpl, &$text, $text_len, &$cur_pos, $tplName, $startLine, $startColumn, $funcName, $message)
 
- Public Member Functions inherited from eZTemplateParser
 eZTemplateParser ()
 
 parse (&$tpl, &$sourceText, &$rootElement, $rootNamespace, $relation)
 

Private Attributes

 $ElementParser
 

Detailed Description

The class eZTemplateMultiPassParser does.

Member Function Documentation

eZTemplateMultiPassParser::appendChild ( $root,
$node 
)

Referenced by parseIntoTree().

eZTemplateMultiPassParser::eZTemplateMultiPassParser ( )

Constructor

Referenced by instance().

eZTemplateMultiPassParser::gotoEndPosition (   $text,
  $line,
  $column,
$endLine,
$endColumn 
)
& eZTemplateMultiPassParser::instance ( )

Referenced by eZTemplate\parse().

eZTemplateMultiPassParser::parse ( $tpl,
$sourceText,
$rootElement,
  $rootNamespace,
$resourceData 
)

Parses the template file $sourceText. See the description of this class for more information on the parsing process.

eZTemplateMultiPassParser::parseBlockFunction (   $funcName,
$args,
$tpl,
$text,
$text_len,
$cur_pos,
  $relatedTemplateName,
  $startLine,
  $startColumn,
$rootNamespace 
)

Parse arguments for {set-block}/{append-block}. This method has been created to correctly handle the case when ($) is used in variable name, e.g. {set-block variable=$var} Here we strip the dollar sign and pass the variable name as string.

Referenced by parseIntoTree().

eZTemplateMultiPassParser::parseDefFunction (   $funcName,
$args,
$tpl,
$text,
$text_len,
$cur_pos,
  $relatedTemplateName,
  $startLine,
  $startColumn,
$rootNamespace 
)

Parse do..while function Syntax:

{do}
[{delimiter}...{/delimiter}]
[{break}]
[{continue}]
[{skip}]
{/do while <condition> [sequence <array> as $seqVar]}
*/
function parseDoFunction( &$args, &$tpl, &$text, &$text_len, &$cur_pos,
$relatedTemplateName, $startLine, $startColumn, &$rootNamespace )
{
// skip whitespaces
$cur_pos = $this->ElementParser->whitespaceEndPos( $tpl, $text, $cur_pos, $text_len );
// parse while keyword
$wordEndPos = $this->ElementParser->identifierEndPosition( $tpl, $text, $cur_pos, $text_len );
$word = substr( $text, $cur_pos, $wordEndPos-$cur_pos );
if ( $word != 'while' )
{
$this->showParseErrorMessage( $tpl, $text, $text_len, $cur_pos, $relatedTemplateName, $startLine, $startColumn,
'do', "Expected keyword 'while' not found in parameters" );
return;
}
$cur_pos = $wordEndPos;
// skip whitespaces
$cur_pos = $this->ElementParser->whitespaceEndPos( $tpl, $text, $cur_pos, $text_len );
$args['condition'] = $this->ElementParser->parseVariableTag( $tpl, $relatedTemplateName, $text, $cur_pos, $cur_pos, $text_len, $rootNamespace );
// skip whitespaces
$cur_pos = $this->ElementParser->whitespaceEndPos( $tpl, $text, $cur_pos, $text_len );
if ( $cur_pos == $text_len ) // no more arguments
return;
$this->parseSequenceParameter( true, 'do',
$args, $tpl, $text, $text_len, $cur_pos,
$relatedTemplateName, $startLine, $startColumn, $rootNamespace );
}
/*!
Parse def/undef functions
Syntax:
\code
{def $var1=<value1> [$var2=<value2> ...]}
{undef [$var1 [$var2] ...]}

Referenced by parseIntoTree().

eZTemplateMultiPassParser::parseForeachFunction ( $args,
$tpl,
$text,
$text_len,
$cur_pos,
  $relatedTemplateName,
  $startLine,
  $startColumn,
$rootNamespace 
)

Parse {foreach} function. Syntax:

{foreach <array> as [$keyVar =>] $itemVar
[sequence <array> as $sequenceVar]
[offset <offset>]
[max <max>]
[reverse]
}

Referenced by parseIntoTree().

eZTemplateMultiPassParser::parseForFunction ( $args,
$tpl,
$text,
$text_len,
$cur_pos,
  $relatedTemplateName,
  $startLine,
  $startColumn,
$rootNamespace 
)

Parse {for} function. Syntax:

// for <firstValue> to <lastValue> as <$loopVar> [sequence <array> as <$var>]

Referenced by parseIntoTree().

eZTemplateMultiPassParser::parseIntoTextElements ( $tpl,
  $sourceText,
  $sourcePosition,
  $leftDelimiter,
  $rightDelimiter,
  $sourceLength,
  $relatedTemplateName 
)

Referenced by parse().

eZTemplateMultiPassParser::parseIntoTree ( $tpl,
$textElements,
$treeRoot,
  $rootNamespace,
  $relatedResource,
  $relatedTemplateName 
)

Referenced by parse().

eZTemplateMultiPassParser::parseSectionFunction (   $funcName,
$args,
$tpl,
$text,
$text_len,
$cur_pos,
  $relatedTemplateName,
  $startLine,
  $startColumn,
$rootNamespace 
)

Parse arguments for {section}. This method has been created to correctly handle the case when ($) is used in variable name, e.g. {section var=$item} Here we strip the dollar sign and pass the variable name as string.

Referenced by parseIntoTree().

eZTemplateMultiPassParser::parseSequenceParameter (   $parseSequenceKeyword,
  $funcName,
$args,
$tpl,
$text,
$text_len,
$cur_pos,
  $relatedTemplateName,
  $startLine,
  $startColumn,
$rootNamespace 
)

parse 'sequence' loop parameter: "sequence <array> as <$seqVar>"

Referenced by parseForeachFunction(), parseForFunction(), and parseWhileFunction().

eZTemplateMultiPassParser::parseSetFunction (   $funcName,
$args,
$tpl,
$text,
$text_len,
$cur_pos,
  $relatedTemplateName,
  $startLine,
  $startColumn,
$rootNamespace 
)

Parse arguments for {set}/{let}/{default}

Referenced by parseIntoTree().

eZTemplateMultiPassParser::parseUnnamedCondition (   $funcName,
$args,
$tpl,
$text,
$text_len,
$cur_pos,
  $relatedTemplateName,
  $startLine,
  $startColumn,
$rootNamespace 
)

Parse arguments for {if}/{elseif}

Referenced by parseIntoTree().

eZTemplateMultiPassParser::parseWhileFunction ( $args,
$tpl,
$text,
$text_len,
$cur_pos,
  $relatedTemplateName,
  $startLine,
  $startColumn,
$rootNamespace 
)

Parse arguments for {while}

Referenced by parseIntoTree().

eZTemplateMultiPassParser::parseWhitespaceRemoval ( $tpl,
$textElements 
)

Referenced by parse().

eZTemplateMultiPassParser::showParseErrorMessage ( $tpl,
$text,
  $text_len,
$cur_pos,
  $tplName,
  $startLine,
  $startColumn,
  $funcName,
  $message 
)

Member Data Documentation

eZTemplateMultiPassParser::$ElementParser
private

The documentation for this class was generated from the following file: