blob: 66d80082039cdc67cbe1d119449cfb80b372e851 [file] [log] [blame]
<?php
/**
* File containing the ezcTemplateTranslationContextSourceToTstParser class
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
* @package Template
* @version //autogen//
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @access private
*/
/**
* Parser for {tr_context} loop.
*
* @package Template
* @version //autogen//
* @access private
*/
class ezcTemplateTranslationContextSourceToTstParser extends ezcTemplateSourceToTstParser
{
/**
* Passes control to parent.
*
* @param ezcTemplateParser $parser
* @param ezcTemplateSourceToTstParser $parentParser
* @param ezcTemplateCursor $startCursor
*/
function __construct( ezcTemplateParser $parser, /*ezcTemplateSourceToTstParser*/ $parentParser, /*ezcTemplateCursor*/ $startCursor )
{
parent::__construct( $parser, $parentParser, $startCursor );
$this->block = null;
}
/**
* Parses the expression by using the ezcTemplateExpressionSourceToTstParser class.
*
* @param ezcTemplateCursor $cursor
* @return bool
*/
protected function parseCurrent( ezcTemplateCursor $cursor )
{
$el = new ezcTemplateTranslationContextTstNode( $this->parser->source, $this->startCursor, $cursor );
$this->findNextElement();
if ( !$this->parseRequiredType( 'String', null, false ) )
{
throw new ezcTemplateParserException( $this->parser->source, $this->startCursor, $this->currentCursor, ezcTemplateSourceToTstErrorMessages::MSG_EXPECT_STRING );
}
$el->context = $this->lastParser->element;
if ( !$this->parentParser->atEnd( $cursor, null, false ) )
{
throw new ezcTemplateParserException( $this->parser->source, $this->startCursor, $this->currentCursor, ezcTemplateSourceToTstErrorMessages::MSG_EXPECT_CURLY_BRACKET_CLOSE );
}
$cursor->advance();
$this->appendElement( $el );
return true;
}
}
?>