*/
class Smarty_Internal_Templatelexer
{
    const TEXT = 1;
    const TAG = 2;
    const TAGBODY = 3;
    const LITERAL = 4;
    const DOUBLEQUOTEDSTRING = 5;
    /**
     * Source
     *
     * @var string
     */
    public $data;
    /**
     * Source length
     *
     * @var int
     */
    public $dataLength = null;
    /**
     * byte counter
     *
     * @var int
     */
    public $counter;
    /**
     * token number
     *
     * @var int
     */
    public $token;
    /**
     * token value
     *
     * @var string
     */
    public $value;
    /**
     * current line
     *
     * @var int
     */
    public $line;
    /**
     * tag start line
     *
     * @var
     */
    public $taglineno;
    /**
     * php code type
     *
     * @var string
     */
    public $phpType = '';
    /**
     * escaped left delimiter
     *
     * @var string
     */
    public $ldel = '';
    /**
     * escaped left delimiter length
     *
     * @var int
     */
    public $ldel_length = 0;
    /**
     * escaped right delimiter
     *
     * @var string
     */
    public $rdel = '';
    /**
     * PHP start tag string
     *
     * @var string
     */
    /**
     * escaped right delimiter length
     *
     * @var int
     */
    public $rdel_length = 0;
    /**
     * state number
     *
     * @var int
     */
    public $state = 1;
    /**
     * Smarty object
     *
     * @var Smarty
     */
    public $smarty = null;
    /**
     * compiler object
     *
     * @var Smarty_Internal_TemplateCompilerBase
     */
    public $compiler = null;
    /**
     * trace file
     *
     * @var resource
     */
    public $yyTraceFILE;
    /**
     * trace prompt
     *
     * @var string
     */
    public $yyTracePrompt;
    /**
     * XML flag true while processing xml
     *
     * @var bool
     */
    public $is_xml = false;
    /**
     * state names
     *
     * @var array
     */
    public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',);
    /**
     * token names
     *
     * @var array
     */
    public $smarty_token_names = array(        // Text for parser error messages
                                               'NOT' => '(!,not)', 'OPENP' => '(', 'CLOSEP' => ')', 'OPENB' => '[',
                                               'CLOSEB' => ']', 'PTR' => '->', 'APTR' => '=>', 'EQUAL' => '=',
                                               'NUMBER' => 'number', 'UNIMATH' => '+" , "-', 'MATH' => '*" , "/" , "%',
                                               'INCDEC' => '++" , "--', 'SPACE' => ' ', 'DOLLAR' => '$',
                                               'SEMICOLON' => ';', 'COLON' => ':', 'DOUBLECOLON' => '::', 'AT' => '@',
                                               'HATCH' => '#', 'QUOTE' => '"', 'BACKTICK' => '`',
                                               'VERT' => '"|" modifier', 'DOT' => '.', 'COMMA' => '","',
                                               'QMARK' => '"?"', 'ID' => 'id, name', 'TEXT' => 'text',
                                               'LDELSLASH' => '{/..} closing tag', 'LDEL' => '{...} Smarty tag',
                                               'COMMENT' => 'comment', 'AS' => 'as', 'TO' => 'to',
                                               'PHP' => '" '"<", "==" ... logical operator',
                                               'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition',
                                               'SCOND' => '"is even" ... if condition',);
    /**
     * literal tag nesting level
     *
     * @var int
     */
    private $literal_cnt = 0;
    /**
     * storage for assembled token patterns
     *
     * @var string
     */
    private $yy_global_pattern1 = null;
    private $yy_global_pattern2 = null;
    /*
      * Check if this tag is autoliteral
      */
    private $yy_global_pattern3 = null;
    private $yy_global_pattern4 = null;
    private $yy_global_pattern5 = null;
    private $_yy_state = 1;
    private $_yy_stack = array();
    /**
     * constructor
     *
     * @param   string $data template source
     * @param Smarty_Internal_TemplateCompilerBase $compiler
     */
    function __construct($data, Smarty_Internal_TemplateCompilerBase $compiler)
    {
        $this->data = $data;
        $this->dataLength = strlen($data);
        $this->counter = 0;
        if (preg_match('/^\xEF\xBB\xBF/i', $this->data, $match)) {
            $this->counter += strlen($match[0]);
        }
        $this->line = 1;
        $this->smarty = $compiler->smarty;
        $this->compiler = $compiler;
        $this->pldel = preg_quote($this->smarty->left_delimiter, '/');
        $this->ldel = $this->pldel . ($this->smarty->auto_literal ? '(?!\\s+)' : '\\s*');
        $this->ldel_length = strlen($this->smarty->left_delimiter);
        $this->rdel = preg_quote($this->smarty->right_delimiter, '/');
        $this->rdel_length = strlen($this->smarty->right_delimiter);
        $this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter;
        $this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter;
    }
    public function PrintTrace()
    {
        $this->yyTraceFILE = fopen('php://output', 'w');
        $this->yyTracePrompt = '
';
    }
    public function isAutoLiteral()
    {
        return $this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
            strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false;
    }
public function yylex1()
    {
        if (!isset($this->yy_global_pattern1)) {
            $this->yy_global_pattern1 =
                $this->replace("/\G([{][}])|\G(SMARTYldel[*])|\G((SMARTYldelphp([ ].*?)?SMARTYrdel)|(SMARTYldel[\/]phpSMARTYrdel))|\G(SMARTYrawldel{2,})|\G(SMARTYldelliteral\\s*SMARTYrdel)|\G(SMARTYldel[\/]literal\\s*SMARTYrdel)|\G(SMARTYldel)|\G((<[?]((php\\s+|=)|\\s+))|(<[%])|(<[?]xml\\s+)|(