<?php
/**
* Harmony
* Copyright (c) 2008 Maxime Bouroumeau-Fuseau
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @category Harmony
* @package Harmony_Script
* @subpackage Harmony_Script_Context
* @author Maxime Bouroumeau-Fuseau
* @copyright 2008 (c) Maxime Bouroumeau-Fuseau
* @license http://www.opensource.org/licenses/mit-license.php
* @link http://www.harmony-framework.com
*/
/** Harmony_Script_Context */
require_once 'Harmony/Script/Context.php';
/**
* Script context
*
* @category Harmony
* @package Harmony_Script
* @subpackage Harmony_Script_Context
* @copyright 2008 (c) Maxime Bouroumeau-Fuseau
* @license http://www.opensource.org/licenses/mit-license.php
*/
class Harmony_Script_Context_Script extends Harmony_Script_Context
{
/**
* Removes <?php
*/
public function tokenOpenTag($text)
{
}
/**
* Class
*/
public function tokenClass($text)
{
$this->_enterContext('Class');
}
/**
* Interface
*/
public function tokenInterface($text)
{
$this->_enterContext('Class');
}
/**
* Function
*/
public function tokenFunction($text)
{
$this->_enterContext('Function');
}
/**
* Removes ?>
*/
public function tokenCloseTag($text)
{
}
/**
* Checks if the context should be ignored and
* enters it if not
*/
protected function _enterContext($context)
{
$params = array();
if (!empty($this->_previousDocBlock)) {
$params['docComment'] = $this->_previousDocBlock;
}
$js = $this->getParser()->enterContext($context, $params);
/* checks if the context should be ignored */
if (!empty($this->_previousDocBlock)) {
if (preg_match('/@harmony-ignore/', $this->_previousDocBlock)) {
$this->_previousDocBlock = null;
return;
}
$this->_previousDocBlock = null;
}
$this->_js .= $js;
}
}