12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046 |
- <?php
- /*
- * This file is part of Smarty.
- *
- * (c) 2015 Uwe Tews
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
- /**
- * Smarty_Internal_Templatelexer
- * This is the template file lexer.
- * It is generated from the smarty_internal_templatelexer.plex file
- *
- *
- * @author Uwe Tews <uwe.tews@googlemail.com>
- */
- 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 = '';
- /**
- * 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' => '"<?php", "<%", "{php}" tag',
- 'LOGOP' => '"<", "==" ... 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;
- /**
- * preg token pattern for state TEXT
- *
- * @var string
- */
- private $yy_global_pattern1 = null;
- /**
- * preg token pattern for state TAG
- *
- * @var string
- */
- private $yy_global_pattern2 = null;
- /**
- * preg token pattern for state TAGBODY
- *
- * @var string
- */
- private $yy_global_pattern3 = null;
- /**
- * preg token pattern for state LITERAL
- *
- * @var string
- */
- private $yy_global_pattern4 = null;
- /**
- * preg token pattern for state DOUBLEQUOTEDSTRING
- *
- * @var null
- */
- private $yy_global_pattern5 = null;
- private $_yy_state = 1;
- private $_yy_stack = array();
-
- /**
- * constructor
- *
- * @param string $source template source
- * @param Smarty_Internal_TemplateCompilerBase $compiler
- */
- function __construct($source, Smarty_Internal_TemplateCompilerBase $compiler)
- {
- $this->data = $source;
- $this->dataLength = strlen($this->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->template->smarty;
- $this->compiler = $compiler;
- $this->compiler->initDelimiterPreg();
- $this->smarty_token_names[ 'LDEL' ] = $this->smarty->getLeftDelimiter();
- $this->smarty_token_names[ 'RDEL' ] = $this->smarty->getRightDelimiter();
- }
-
- /**
- * open lexer/parser trace file
- *
- */
- public function PrintTrace()
- {
- $this->yyTraceFILE = fopen('php://output', 'w');
- $this->yyTracePrompt = '<br>';
- }
-
- /**
- * replace placeholders with runtime preg code
- *
- * @param string $preg
- *
- * @return string
- */
- public function replace($preg)
- {
- return $this->compiler->replaceDelimiter($preg);
- }
-
- /**
- * check if current value is an autoliteral left delimiter
- *
- * @return bool
- */
- public function isAutoLiteral()
- {
- return $this->smarty->getAutoLiteral() && isset($this->value[ $this->compiler->getLdelLength() ]) ?
- strpos(" \n\t\r", $this->value[ $this->compiler->getLdelLength() ]) !== false : false;
- } // end function
-
- public function yylex()
- {
- return $this->{'yylex' . $this->_yy_state}();
- }
-
- public function yypushstate($state)
- {
- if ($this->yyTraceFILE) {
- fprintf($this->yyTraceFILE,
- "%sState push %s\n",
- $this->yyTracePrompt,
- isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
- $this->_yy_state);
- }
- array_push($this->_yy_stack, $this->_yy_state);
- $this->_yy_state = $state;
- if ($this->yyTraceFILE) {
- fprintf($this->yyTraceFILE,
- "%snew State %s\n",
- $this->yyTracePrompt,
- isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
- $this->_yy_state);
- }
- }
-
- public function yypopstate()
- {
- if ($this->yyTraceFILE) {
- fprintf($this->yyTraceFILE,
- "%sState pop %s\n",
- $this->yyTracePrompt,
- isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
- $this->_yy_state);
- }
- $this->_yy_state = array_pop($this->_yy_stack);
- if ($this->yyTraceFILE) {
- fprintf($this->yyTraceFILE,
- "%snew State %s\n",
- $this->yyTracePrompt,
- isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
- $this->_yy_state);
- }
- }
-
- public function yybegin($state)
- {
- $this->_yy_state = $state;
- if ($this->yyTraceFILE) {
- fprintf($this->yyTraceFILE,
- "%sState set %s\n",
- $this->yyTracePrompt,
- isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
- $this->_yy_state);
- }
- }
-
- public function yylex1()
- {
- if (!isset($this->yy_global_pattern1)) {
- $this->yy_global_pattern1 =
- $this->replace("/\G([{][}])|\G((SMARTYldel)SMARTYal[*])|\G((SMARTYldel)SMARTYalphp([ ].*?)?SMARTYrdel|(SMARTYldel)SMARTYal[\/]phpSMARTYrdel)|\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([<][?]((php\\s+|=)|\\s+)|[<][%]|[<][?]xml\\s+|[<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>]|[?][>]|[%][>])|\G((.*?)(?=((SMARTYldel)SMARTYal|[<][?]((php\\s+|=)|\\s+)|[<][%]|[<][?]xml\\s+|[<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>]|[?][>]|[%][>]SMARTYliteral))|[\s\S]+)/isS");
- }
- if (!isset($this->dataLength)) {
- $this->dataLength = strlen($this->data);
- }
- if ($this->counter >= $this->dataLength) {
- return false; // end of input
- }
- do {
- if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, 0, $this->counter)) {
- if (!isset($yymatches[ 0 ][ 1 ])) {
- $yymatches = preg_grep("/(.|\s)+/", $yymatches);
- } else {
- $yymatches = array_filter($yymatches);
- }
- if (empty($yymatches)) {
- throw new Exception('Error: lexing failed because a rule matched' .
- ' an empty string. Input "' . substr($this->data,
- $this->counter,
- 5) . '... state TEXT');
- }
- next($yymatches); // skip global match
- $this->token = key($yymatches); // token number
- $this->value = current($yymatches); // token value
- $r = $this->{'yy_r1_' . $this->token}();
- if ($r === null) {
- $this->counter += strlen($this->value);
- $this->line += substr_count($this->value, "\n");
- // accept this token
- return true;
- } else if ($r === true) {
- // we have changed state
- // process this token in the new state
- return $this->yylex();
- } else if ($r === false) {
- $this->counter += strlen($this->value);
- $this->line += substr_count($this->value, "\n");
- if ($this->counter >= $this->dataLength) {
- return false; // end of input
- }
- // skip this token
- continue;
- }
- } else {
- throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[ $this->counter ]);
- }
- break;
- } while (true);
- }
-
- function yy_r1_1()
- {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
-
- function yy_r1_2()
- {
- preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/",
- $this->data,
- $match,
- PREG_OFFSET_CAPTURE,
- $this->counter);
- if (isset($match[ 0 ][ 1 ])) {
- $to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]);
- } else {
- $this->compiler->trigger_template_error("missing or misspelled comment closing tag '{$this->smarty->getRightDelimiter()}'");
- }
- $this->value = substr($this->data, $this->counter, $to - $this->counter);
- return false;
- }
-
- function yy_r1_4()
- {
- $this->compiler->getTagCompiler('private_php')->parsePhp($this);
- }
-
- function yy_r1_8()
- {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
-
- function yy_r1_10()
- {
- $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
- $this->yypushstate(self::LITERAL);
- }
-
- function yy_r1_12()
- {
- $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
- $this->yypushstate(self::LITERAL);
- } // end function
-
- function yy_r1_14()
- {
- $this->yypushstate(self::TAG);
- return true;
- }
-
- function yy_r1_16()
- {
- $this->compiler->getTagCompiler('private_php')->parsePhp($this);
- }
-
- function yy_r1_19()
- {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
-
- public function yylex2()
- {
- if (!isset($this->yy_global_pattern2)) {
- $this->yy_global_pattern2 =
- $this->replace("/\G((SMARTYldel)SMARTYal(if|elseif|else if|while)\\s+)|\G((SMARTYldel)SMARTYalfor\\s+)|\G((SMARTYldel)SMARTYalforeach(?![^\s]))|\G((SMARTYldel)SMARTYalsetfilter\\s+)|\G((SMARTYldel)SMARTYalmake_nocache\\s+)|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[$]smarty\\.block\\.(child|parent)\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/][0-9]*[a-zA-Z_]\\w*\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal)/isS");
- }
- if (!isset($this->dataLength)) {
- $this->dataLength = strlen($this->data);
- }
- if ($this->counter >= $this->dataLength) {
- return false; // end of input
- }
- do {
- if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, 0, $this->counter)) {
- if (!isset($yymatches[ 0 ][ 1 ])) {
- $yymatches = preg_grep("/(.|\s)+/", $yymatches);
- } else {
- $yymatches = array_filter($yymatches);
- }
- if (empty($yymatches)) {
- throw new Exception('Error: lexing failed because a rule matched' .
- ' an empty string. Input "' . substr($this->data,
- $this->counter,
- 5) . '... state TAG');
- }
- next($yymatches); // skip global match
- $this->token = key($yymatches); // token number
- $this->value = current($yymatches); // token value
- $r = $this->{'yy_r2_' . $this->token}();
- if ($r === null) {
- $this->counter += strlen($this->value);
- $this->line += substr_count($this->value, "\n");
- // accept this token
- return true;
- } else if ($r === true) {
- // we have changed state
- // process this token in the new state
- return $this->yylex();
- } else if ($r === false) {
- $this->counter += strlen($this->value);
- $this->line += substr_count($this->value, "\n");
- if ($this->counter >= $this->dataLength) {
- return false; // end of input
- }
- // skip this token
- continue;
- }
- } else {
- throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[ $this->counter ]);
- }
- break;
- } while (true);
- }
-
- function yy_r2_1()
- {
- $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
- $this->yybegin(self::TAGBODY);
- $this->taglineno = $this->line;
- }
-
- function yy_r2_4()
- {
- $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
- $this->yybegin(self::TAGBODY);
- $this->taglineno = $this->line;
- }
-
- function yy_r2_6()
- {
- $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
- $this->yybegin(self::TAGBODY);
- $this->taglineno = $this->line;
- }
-
- function yy_r2_8()
- {
- $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
- $this->yybegin(self::TAGBODY);
- $this->taglineno = $this->line;
- }
-
- function yy_r2_10()
- {
- $this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE;
- $this->yybegin(self::TAGBODY);
- $this->taglineno = $this->line;
- }
-
- function yy_r2_12()
- {
- $this->yypopstate();
- $this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG;
- $this->taglineno = $this->line;
- }
-
- function yy_r2_15()
- {
- $this->yypopstate();
- $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
- $this->taglineno = $this->line;
- }
-
- function yy_r2_18()
- {
- $this->yypopstate();
- $this->token = Smarty_Internal_Templateparser::TP_CLOSETAG;
- $this->taglineno = $this->line;
- }
-
- function yy_r2_20()
- {
- if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] === self::TEXT) {
- $this->yypopstate();
- $this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT;
- $this->taglineno = $this->line;
- } else {
- $this->value = $this->smarty->getLeftDelimiter();
- $this->token = Smarty_Internal_Templateparser::TP_LDEL;
- $this->yybegin(self::TAGBODY);
- $this->taglineno = $this->line;
- }
- } // end function
-
- function yy_r2_23()
- {
- $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
- $this->yybegin(self::TAGBODY);
- $this->taglineno = $this->line;
- }
-
- function yy_r2_25()
- {
- $this->token = Smarty_Internal_Templateparser::TP_LDEL;
- $this->yybegin(self::TAGBODY);
- $this->taglineno = $this->line;
- }
-
- public function yylex3()
- {
- if (!isset($this->yy_global_pattern3)) {
- $this->yy_global_pattern3 =
- $this->replace("/\G(\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*([!=][=]{1,2}|[<][=>]?|[>][=]?|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even|div)\\s+by\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G([!]\\s*|not\\s+)|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|][@]?)|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G([\S\s])/isS");
- }
- if (!isset($this->dataLength)) {
- $this->dataLength = strlen($this->data);
- }
- if ($this->counter >= $this->dataLength) {
- return false; // end of input
- }
- do {
- if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, 0, $this->counter)) {
- if (!isset($yymatches[ 0 ][ 1 ])) {
- $yymatches = preg_grep("/(.|\s)+/", $yymatches);
- } else {
- $yymatches = array_filter($yymatches);
- }
- if (empty($yymatches)) {
- throw new Exception('Error: lexing failed because a rule matched' .
- ' an empty string. Input "' . substr($this->data,
- $this->counter,
- 5) . '... state TAGBODY');
- }
- next($yymatches); // skip global match
- $this->token = key($yymatches); // token number
- $this->value = current($yymatches); // token value
- $r = $this->{'yy_r3_' . $this->token}();
- if ($r === null) {
- $this->counter += strlen($this->value);
- $this->line += substr_count($this->value, "\n");
- // accept this token
- return true;
- } else if ($r === true) {
- // we have changed state
- // process this token in the new state
- return $this->yylex();
- } else if ($r === false) {
- $this->counter += strlen($this->value);
- $this->line += substr_count($this->value, "\n");
- if ($this->counter >= $this->dataLength) {
- return false; // end of input
- }
- // skip this token
- continue;
- }
- } else {
- throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[ $this->counter ]);
- }
- break;
- } while (true);
- }
-
- function yy_r3_1()
- {
- $this->token = Smarty_Internal_Templateparser::TP_RDEL;
- $this->yypopstate();
- }
-
- function yy_r3_2()
- {
- $this->yypushstate(self::TAG);
- return true;
- }
-
- function yy_r3_4()
- {
- $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
- $this->yypushstate(self::DOUBLEQUOTEDSTRING);
- $this->compiler->enterDoubleQuote();
- }
-
- function yy_r3_5()
- {
- $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
- }
-
- function yy_r3_6()
- {
- $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
- }
-
- function yy_r3_7()
- {
- $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
- }
-
- function yy_r3_8()
- {
- $this->token = Smarty_Internal_Templateparser::TP_ISIN;
- }
-
- function yy_r3_9()
- {
- $this->token = Smarty_Internal_Templateparser::TP_AS;
- }
-
- function yy_r3_10()
- {
- $this->token = Smarty_Internal_Templateparser::TP_TO;
- }
-
- function yy_r3_11()
- {
- $this->token = Smarty_Internal_Templateparser::TP_STEP;
- }
-
- function yy_r3_12()
- {
- $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
- }
-
- function yy_r3_13()
- {
- $this->token = Smarty_Internal_Templateparser::TP_LOGOP;
- }
-
- function yy_r3_15()
- {
- $this->token = Smarty_Internal_Templateparser::TP_SLOGOP;
- }
-
- function yy_r3_17()
- {
- $this->token = Smarty_Internal_Templateparser::TP_TLOGOP;
- }
-
- function yy_r3_20()
- {
- $this->token = Smarty_Internal_Templateparser::TP_SINGLECOND;
- }
-
- function yy_r3_23()
- {
- $this->token = Smarty_Internal_Templateparser::TP_NOT;
- }
-
- function yy_r3_24()
- {
- $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
- }
-
- function yy_r3_28()
- {
- $this->token = Smarty_Internal_Templateparser::TP_OPENP;
- }
-
- function yy_r3_29()
- {
- $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
- }
-
- function yy_r3_30()
- {
- $this->token = Smarty_Internal_Templateparser::TP_OPENB;
- }
-
- function yy_r3_31()
- {
- $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
- }
-
- function yy_r3_32()
- {
- $this->token = Smarty_Internal_Templateparser::TP_PTR;
- }
-
- function yy_r3_33()
- {
- $this->token = Smarty_Internal_Templateparser::TP_APTR;
- }
-
- function yy_r3_34()
- {
- $this->token = Smarty_Internal_Templateparser::TP_EQUAL;
- }
-
- function yy_r3_35()
- {
- $this->token = Smarty_Internal_Templateparser::TP_INCDEC;
- }
-
- function yy_r3_37()
- {
- $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
- }
-
- function yy_r3_39()
- {
- $this->token = Smarty_Internal_Templateparser::TP_MATH;
- }
-
- function yy_r3_41()
- {
- $this->token = Smarty_Internal_Templateparser::TP_AT;
- }
-
- function yy_r3_42()
- {
- $this->token = Smarty_Internal_Templateparser::TP_HATCH;
- }
-
- function yy_r3_43()
- {
- // resolve conflicts with shorttag and right_delimiter starting with '='
- if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) ===
- $this->smarty->getRightDelimiter()) {
- preg_match('/\s+/', $this->value, $match);
- $this->value = $match[ 0 ];
- $this->token = Smarty_Internal_Templateparser::TP_SPACE;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_ATTR;
- }
- }
-
- function yy_r3_44()
- {
- $this->token = Smarty_Internal_Templateparser::TP_NAMESPACE;
- }
-
- function yy_r3_47()
- {
- $this->token = Smarty_Internal_Templateparser::TP_ID;
- }
-
- function yy_r3_48()
- {
- $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
- }
-
- function yy_r3_49()
- {
- $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
- $this->yypopstate();
- }
-
- function yy_r3_50()
- {
- $this->token = Smarty_Internal_Templateparser::TP_VERT;
- }
-
- function yy_r3_51()
- {
- $this->token = Smarty_Internal_Templateparser::TP_DOT;
- }
-
- function yy_r3_52()
- {
- $this->token = Smarty_Internal_Templateparser::TP_COMMA;
- }
-
- function yy_r3_53()
- {
- $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
- }
-
- function yy_r3_54()
- {
- $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
- }
-
- function yy_r3_55()
- {
- $this->token = Smarty_Internal_Templateparser::TP_COLON;
- }
-
- function yy_r3_56()
- {
- $this->token = Smarty_Internal_Templateparser::TP_QMARK;
- }
-
- function yy_r3_57()
- {
- $this->token = Smarty_Internal_Templateparser::TP_HEX;
- }
-
- function yy_r3_58()
- {
- $this->token = Smarty_Internal_Templateparser::TP_SPACE;
- } // end function
-
- function yy_r3_59()
- {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
-
- public function yylex4()
- {
- if (!isset($this->yy_global_pattern4)) {
- $this->yy_global_pattern4 =
- $this->replace("/\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((.*?)(?=(SMARTYldel)SMARTYal[\/]?literalSMARTYrdel))/isS");
- }
- if (!isset($this->dataLength)) {
- $this->dataLength = strlen($this->data);
- }
- if ($this->counter >= $this->dataLength) {
- return false; // end of input
- }
- do {
- if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, 0, $this->counter)) {
- if (!isset($yymatches[ 0 ][ 1 ])) {
- $yymatches = preg_grep("/(.|\s)+/", $yymatches);
- } else {
- $yymatches = array_filter($yymatches);
- }
- if (empty($yymatches)) {
- throw new Exception('Error: lexing failed because a rule matched' .
- ' an empty string. Input "' . substr($this->data,
- $this->counter,
- 5) . '... state LITERAL');
- }
- next($yymatches); // skip global match
- $this->token = key($yymatches); // token number
- $this->value = current($yymatches); // token value
- $r = $this->{'yy_r4_' . $this->token}();
- if ($r === null) {
- $this->counter += strlen($this->value);
- $this->line += substr_count($this->value, "\n");
- // accept this token
- return true;
- } else if ($r === true) {
- // we have changed state
- // process this token in the new state
- return $this->yylex();
- } else if ($r === false) {
- $this->counter += strlen($this->value);
- $this->line += substr_count($this->value, "\n");
- if ($this->counter >= $this->dataLength) {
- return false; // end of input
- }
- // skip this token
- continue;
- }
- } else {
- throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[ $this->counter ]);
- }
- break;
- } while (true);
- }
-
- function yy_r4_1()
- {
- $this->literal_cnt++;
- $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
- }
-
- function yy_r4_3()
- {
- if ($this->literal_cnt) {
- $this->literal_cnt--;
- $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
- $this->yypopstate();
- }
- }
-
- function yy_r4_5()
- {
- $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
- } // end function
-
- public function yylex5()
- {
- if (!isset($this->yy_global_pattern5)) {
- $this->yy_global_pattern5 =
- $this->replace("/\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=((SMARTYldel)SMARTYal|\\$|`\\$|\"SMARTYliteral)))/isS");
- }
- if (!isset($this->dataLength)) {
- $this->dataLength = strlen($this->data);
- }
- if ($this->counter >= $this->dataLength) {
- return false; // end of input
- }
- do {
- if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, 0, $this->counter)) {
- if (!isset($yymatches[ 0 ][ 1 ])) {
- $yymatches = preg_grep("/(.|\s)+/", $yymatches);
- } else {
- $yymatches = array_filter($yymatches);
- }
- if (empty($yymatches)) {
- throw new Exception('Error: lexing failed because a rule matched' .
- ' an empty string. Input "' . substr($this->data,
- $this->counter,
- 5) . '... state DOUBLEQUOTEDSTRING');
- }
- next($yymatches); // skip global match
- $this->token = key($yymatches); // token number
- $this->value = current($yymatches); // token value
- $r = $this->{'yy_r5_' . $this->token}();
- if ($r === null) {
- $this->counter += strlen($this->value);
- $this->line += substr_count($this->value, "\n");
- // accept this token
- return true;
- } else if ($r === true) {
- // we have changed state
- // process this token in the new state
- return $this->yylex();
- } else if ($r === false) {
- $this->counter += strlen($this->value);
- $this->line += substr_count($this->value, "\n");
- if ($this->counter >= $this->dataLength) {
- return false; // end of input
- }
- // skip this token
- continue;
- }
- } else {
- throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[ $this->counter ]);
- }
- break;
- } while (true);
- }
-
- function yy_r5_1()
- {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
-
- function yy_r5_3()
- {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
-
- function yy_r5_5()
- {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
-
- function yy_r5_7()
- {
- $this->yypushstate(self::TAG);
- return true;
- }
-
- function yy_r5_9()
- {
- $this->yypushstate(self::TAG);
- return true;
- }
-
- function yy_r5_11()
- {
- $this->token = Smarty_Internal_Templateparser::TP_LDEL;
- $this->taglineno = $this->line;
- $this->yypushstate(self::TAGBODY);
- }
-
- function yy_r5_13()
- {
- $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
- $this->yypopstate();
- }
-
- function yy_r5_14()
- {
- $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
- $this->value = substr($this->value, 0, -1);
- $this->yypushstate(self::TAGBODY);
- $this->taglineno = $this->line;
- }
-
- function yy_r5_15()
- {
- $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
- }
-
- function yy_r5_16()
- {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
-
- function yy_r5_17()
- {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
- }
-
-
|