smarty_internal_templatelexer.php 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190
  1. <?php
  2. /**
  3. * Smarty Internal Plugin Templatelexer
  4. *
  5. * This is the lexer to break the template source into tokens
  6. * @package Smarty
  7. * @subpackage Compiler
  8. * @author Uwe Tews
  9. */
  10. /**
  11. * Smarty Internal Plugin Templatelexer
  12. */
  13. class Smarty_Internal_Templatelexer
  14. {
  15. public $data;
  16. public $counter;
  17. public $token;
  18. public $value;
  19. public $node;
  20. public $line;
  21. public $taglineno;
  22. public $state = 1;
  23. private $heredoc_id_stack = Array();
  24. public $smarty_token_names = array ( // Text for parser error messages
  25. 'IDENTITY' => '===',
  26. 'NONEIDENTITY' => '!==',
  27. 'EQUALS' => '==',
  28. 'NOTEQUALS' => '!=',
  29. 'GREATEREQUAL' => '(>=,ge)',
  30. 'LESSEQUAL' => '(<=,le)',
  31. 'GREATERTHAN' => '(>,gt)',
  32. 'LESSTHAN' => '(<,lt)',
  33. 'MOD' => '(%,mod)',
  34. 'NOT' => '(!,not)',
  35. 'LAND' => '(&&,and)',
  36. 'LOR' => '(||,or)',
  37. 'LXOR' => 'xor',
  38. 'OPENP' => '(',
  39. 'CLOSEP' => ')',
  40. 'OPENB' => '[',
  41. 'CLOSEB' => ']',
  42. 'PTR' => '->',
  43. 'APTR' => '=>',
  44. 'EQUAL' => '=',
  45. 'NUMBER' => 'number',
  46. 'UNIMATH' => '+" , "-',
  47. 'MATH' => '*" , "/" , "%',
  48. 'INCDEC' => '++" , "--',
  49. 'SPACE' => ' ',
  50. 'DOLLAR' => '$',
  51. 'SEMICOLON' => ';',
  52. 'COLON' => ':',
  53. 'DOUBLECOLON' => '::',
  54. 'AT' => '@',
  55. 'HATCH' => '#',
  56. 'QUOTE' => '"',
  57. 'BACKTICK' => '`',
  58. 'VERT' => '|',
  59. 'DOT' => '.',
  60. 'COMMA' => '","',
  61. 'ANDSYM' => '"&"',
  62. 'QMARK' => '"?"',
  63. 'ID' => 'identifier',
  64. 'TEXT' => 'text',
  65. 'FAKEPHPSTARTTAG' => 'Fake PHP start tag',
  66. 'PHPSTARTTAG' => 'PHP start tag',
  67. 'PHPENDTAG' => 'PHP end tag',
  68. 'LITERALSTART' => 'Literal start',
  69. 'LITERALEND' => 'Literal end',
  70. 'LDELSLASH' => 'closing tag',
  71. 'COMMENT' => 'comment',
  72. 'AS' => 'as',
  73. 'TO' => 'to',
  74. );
  75. function __construct($data,$compiler)
  76. {
  77. // $this->data = preg_replace("/(\r\n|\r|\n)/", "\n", $data);
  78. $this->data = $data;
  79. $this->counter = 0;
  80. $this->line = 1;
  81. $this->smarty = $compiler->smarty;
  82. $this->compiler = $compiler;
  83. $this->ldel = preg_quote($this->smarty->left_delimiter,'/');
  84. $this->ldel_length = strlen($this->smarty->left_delimiter);
  85. $this->rdel = preg_quote($this->smarty->right_delimiter,'/');
  86. $this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter;
  87. $this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter;
  88. $this->mbstring_overload = ini_get('mbstring.func_overload') & 2;
  89. }
  90. private $_yy_state = 1;
  91. private $_yy_stack = array();
  92. function yylex()
  93. {
  94. return $this->{'yylex' . $this->_yy_state}();
  95. }
  96. function yypushstate($state)
  97. {
  98. array_push($this->_yy_stack, $this->_yy_state);
  99. $this->_yy_state = $state;
  100. }
  101. function yypopstate()
  102. {
  103. $this->_yy_state = array_pop($this->_yy_stack);
  104. }
  105. function yybegin($state)
  106. {
  107. $this->_yy_state = $state;
  108. }
  109. function yylex1()
  110. {
  111. $tokenMap = array (
  112. 1 => 0,
  113. 2 => 0,
  114. 3 => 1,
  115. 5 => 0,
  116. 6 => 0,
  117. 7 => 0,
  118. 8 => 0,
  119. 9 => 0,
  120. 10 => 0,
  121. 11 => 1,
  122. 13 => 0,
  123. 14 => 0,
  124. 15 => 0,
  125. 16 => 0,
  126. 17 => 0,
  127. 18 => 0,
  128. 19 => 0,
  129. 20 => 0,
  130. 21 => 0,
  131. 22 => 0,
  132. 23 => 0,
  133. );
  134. if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
  135. return false; // end of input
  136. }
  137. $yy_global_pattern = "/\G(".$this->ldel."[$]smarty\\.block\\.child".$this->rdel.")|\G(\\{\\})|\G(".$this->ldel."\\*([\S\s]*?)\\*".$this->rdel.")|\G(".$this->ldel."strip".$this->rdel.")|\G(".$this->ldel."\\s{1,}strip\\s{1,}".$this->rdel.")|\G(".$this->ldel."\/strip".$this->rdel.")|\G(".$this->ldel."\\s{1,}\/strip\\s{1,}".$this->rdel.")|\G(".$this->ldel."\\s*literal\\s*".$this->rdel.")|\G(".$this->ldel."\\s{1,}\/)|\G(".$this->ldel."\\s*(if|elseif|else if|while)\\s+)|\G(".$this->ldel."\\s*for\\s+)|\G(".$this->ldel."\\s*foreach(?![^\s]))|\G(".$this->ldel."\\s*setfilter\\s+)|\G(".$this->ldel."\\s{1,})|\G(".$this->ldel."\/)|\G(".$this->ldel.")|\G(<\\?(?:php\\w+|=|[a-zA-Z]+)?)|\G(\\?>)|\G(<%)|\G(%>)|\G([\S\s])/iS";
  138. do {
  139. if ($this->mbstring_overload ? preg_match($yy_global_pattern, mb_substr($this->data, $this->counter,2000000000,'latin1'), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {
  140. $yysubmatches = $yymatches;
  141. $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
  142. if (!count($yymatches)) {
  143. throw new Exception('Error: lexing failed because a rule matched' .
  144. ' an empty string. Input "' . substr($this->data,
  145. $this->counter, 5) . '... state TEXT');
  146. }
  147. next($yymatches); // skip global match
  148. $this->token = key($yymatches); // token number
  149. if ($tokenMap[$this->token]) {
  150. // extract sub-patterns for passing to lex function
  151. $yysubmatches = array_slice($yysubmatches, $this->token + 1,
  152. $tokenMap[$this->token]);
  153. } else {
  154. $yysubmatches = array();
  155. }
  156. $this->value = current($yymatches); // token value
  157. $r = $this->{'yy_r1_' . $this->token}($yysubmatches);
  158. if ($r === null) {
  159. $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
  160. $this->line += substr_count($this->value, "\n");
  161. // accept this token
  162. return true;
  163. } elseif ($r === true) {
  164. // we have changed state
  165. // process this token in the new state
  166. return $this->yylex();
  167. } elseif ($r === false) {
  168. $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
  169. $this->line += substr_count($this->value, "\n");
  170. if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
  171. return false; // end of input
  172. }
  173. // skip this token
  174. continue;
  175. } } else {
  176. throw new Exception('Unexpected input at line' . $this->line .
  177. ': ' . $this->data[$this->counter]);
  178. }
  179. break;
  180. } while (true);
  181. } // end function
  182. const TEXT = 1;
  183. function yy_r1_1($yy_subpatterns)
  184. {
  185. $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILD;
  186. }
  187. function yy_r1_2($yy_subpatterns)
  188. {
  189. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  190. }
  191. function yy_r1_3($yy_subpatterns)
  192. {
  193. $this->token = Smarty_Internal_Templateparser::TP_COMMENT;
  194. }
  195. function yy_r1_5($yy_subpatterns)
  196. {
  197. $this->token = Smarty_Internal_Templateparser::TP_STRIPON;
  198. }
  199. function yy_r1_6($yy_subpatterns)
  200. {
  201. if ($this->smarty->auto_literal) {
  202. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  203. } else {
  204. $this->token = Smarty_Internal_Templateparser::TP_STRIPON;
  205. }
  206. }
  207. function yy_r1_7($yy_subpatterns)
  208. {
  209. $this->token = Smarty_Internal_Templateparser::TP_STRIPOFF;
  210. }
  211. function yy_r1_8($yy_subpatterns)
  212. {
  213. if ($this->smarty->auto_literal) {
  214. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  215. } else {
  216. $this->token = Smarty_Internal_Templateparser::TP_STRIPOFF;
  217. }
  218. }
  219. function yy_r1_9($yy_subpatterns)
  220. {
  221. $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
  222. $this->yypushstate(self::LITERAL);
  223. }
  224. function yy_r1_10($yy_subpatterns)
  225. {
  226. if ($this->smarty->auto_literal) {
  227. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  228. } else {
  229. $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
  230. $this->yypushstate(self::SMARTY);
  231. $this->taglineno = $this->line;
  232. }
  233. }
  234. function yy_r1_11($yy_subpatterns)
  235. {
  236. if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
  237. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  238. } else {
  239. $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
  240. $this->yypushstate(self::SMARTY);
  241. $this->taglineno = $this->line;
  242. }
  243. }
  244. function yy_r1_13($yy_subpatterns)
  245. {
  246. if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
  247. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  248. } else {
  249. $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
  250. $this->yypushstate(self::SMARTY);
  251. $this->taglineno = $this->line;
  252. }
  253. }
  254. function yy_r1_14($yy_subpatterns)
  255. {
  256. if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
  257. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  258. } else {
  259. $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
  260. $this->yypushstate(self::SMARTY);
  261. $this->taglineno = $this->line;
  262. }
  263. }
  264. function yy_r1_15($yy_subpatterns)
  265. {
  266. if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
  267. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  268. } else {
  269. $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
  270. $this->yypushstate(self::SMARTY);
  271. $this->taglineno = $this->line;
  272. }
  273. }
  274. function yy_r1_16($yy_subpatterns)
  275. {
  276. if ($this->smarty->auto_literal) {
  277. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  278. } else {
  279. $this->token = Smarty_Internal_Templateparser::TP_LDEL;
  280. $this->yypushstate(self::SMARTY);
  281. $this->taglineno = $this->line;
  282. }
  283. }
  284. function yy_r1_17($yy_subpatterns)
  285. {
  286. $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
  287. $this->yypushstate(self::SMARTY);
  288. $this->taglineno = $this->line;
  289. }
  290. function yy_r1_18($yy_subpatterns)
  291. {
  292. $this->token = Smarty_Internal_Templateparser::TP_LDEL;
  293. $this->yypushstate(self::SMARTY);
  294. $this->taglineno = $this->line;
  295. }
  296. function yy_r1_19($yy_subpatterns)
  297. {
  298. if (in_array($this->value, Array('<?', '<?=', '<?php'))) {
  299. $this->token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG;
  300. } elseif ($this->value == '<?xml') {
  301. $this->token = Smarty_Internal_Templateparser::TP_XMLTAG;
  302. } else {
  303. $this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG;
  304. $this->value = substr($this->value, 0, 2);
  305. }
  306. }
  307. function yy_r1_20($yy_subpatterns)
  308. {
  309. $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG;
  310. }
  311. function yy_r1_21($yy_subpatterns)
  312. {
  313. $this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG;
  314. }
  315. function yy_r1_22($yy_subpatterns)
  316. {
  317. $this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG;
  318. }
  319. function yy_r1_23($yy_subpatterns)
  320. {
  321. if ($this->mbstring_overload) {
  322. $to = mb_strlen($this->data,'latin1');
  323. } else {
  324. $to = strlen($this->data);
  325. }
  326. preg_match("/{$this->ldel}|<\?|\?>|<%|%>/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
  327. if (isset($match[0][1])) {
  328. $to = $match[0][1];
  329. }
  330. if ($this->mbstring_overload) {
  331. $this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1');
  332. } else {
  333. $this->value = substr($this->data,$this->counter,$to-$this->counter);
  334. }
  335. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  336. }
  337. function yylex2()
  338. {
  339. $tokenMap = array (
  340. 1 => 0,
  341. 2 => 0,
  342. 3 => 1,
  343. 5 => 0,
  344. 6 => 0,
  345. 7 => 0,
  346. 8 => 0,
  347. 9 => 0,
  348. 10 => 0,
  349. 11 => 0,
  350. 12 => 0,
  351. 13 => 0,
  352. 14 => 0,
  353. 15 => 0,
  354. 16 => 0,
  355. 17 => 0,
  356. 18 => 0,
  357. 19 => 0,
  358. 20 => 1,
  359. 22 => 1,
  360. 24 => 1,
  361. 26 => 0,
  362. 27 => 0,
  363. 28 => 0,
  364. 29 => 0,
  365. 30 => 0,
  366. 31 => 0,
  367. 32 => 0,
  368. 33 => 0,
  369. 34 => 0,
  370. 35 => 0,
  371. 36 => 0,
  372. 37 => 0,
  373. 38 => 0,
  374. 39 => 0,
  375. 40 => 0,
  376. 41 => 0,
  377. 42 => 0,
  378. 43 => 3,
  379. 47 => 0,
  380. 48 => 0,
  381. 49 => 0,
  382. 50 => 0,
  383. 51 => 0,
  384. 52 => 0,
  385. 53 => 0,
  386. 54 => 0,
  387. 55 => 1,
  388. 57 => 1,
  389. 59 => 0,
  390. 60 => 0,
  391. 61 => 0,
  392. 62 => 0,
  393. 63 => 0,
  394. 64 => 0,
  395. 65 => 0,
  396. 66 => 0,
  397. 67 => 0,
  398. 68 => 0,
  399. 69 => 0,
  400. 70 => 0,
  401. 71 => 0,
  402. 72 => 0,
  403. 73 => 0,
  404. 74 => 0,
  405. 75 => 0,
  406. 76 => 0,
  407. 77 => 0,
  408. );
  409. if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
  410. return false; // end of input
  411. }
  412. $yy_global_pattern = "/\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G(".$this->ldel."\\s{1,}\/)|\G(".$this->ldel."\\s*(if|elseif|else if|while)\\s+)|\G(".$this->ldel."\\s*for\\s+)|\G(".$this->ldel."\\s*foreach(?![^\s]))|\G(".$this->ldel."\\s{1,})|\G(\\s{1,}".$this->rdel.")|\G(".$this->ldel."\/)|\G(".$this->ldel.")|\G(".$this->rdel.")|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*===\\s*)|\G(\\s*!==\\s*)|\G(\\s*==\\s*|\\s+eq\\s+)|\G(\\s*!=\\s*|\\s*<>\\s*|\\s+(ne|neq)\\s+)|\G(\\s*>=\\s*|\\s+(ge|gte)\\s+)|\G(\\s*<=\\s*|\\s+(le|lte)\\s+)|\G(\\s*>\\s*|\\s+gt\\s+)|\G(\\s*<\\s*|\\s+lt\\s+)|\G(\\s+mod\\s+)|\G(!\\s*|not\\s+)|\G(\\s*&&\\s*|\\s*and\\s+)|\G(\\s*\\|\\|\\s*|\\s*or\\s+)|\G(\\s*xor\\s+)|\G(\\s+is\\s+odd\\s+by\\s+)|\G(\\s+is\\s+not\\s+odd\\s+by\\s+)|\G(\\s+is\\s+odd)|\G(\\s+is\\s+not\\s+odd)|\G(\\s+is\\s+even\\s+by\\s+)|\G(\\s+is\\s+not\\s+even\\s+by\\s+)|\G(\\s+is\\s+even)|\G(\\s+is\\s+not\\s+even)|\G(\\s+is\\s+div\\s+by\\s+)|\G(\\s+is\\s+not\\s+div\\s+by\\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(\\+\\+|--)|\G(\\s*(\\+|-)\\s*)|\G(\\s*(\\*|\/|%)\\s*)|\G(\\$)|\G(\\s*;)|\G(::)|\G(\\s*:\\s*)|\G(@)|\G(#)|\G(\")|\G(`)|\G(\\|)|\G(\\.)|\G(\\s*,\\s*)|\G(\\s*&\\s*)|\G(\\s*\\?\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s?=\\s?)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G(\\s+)|\G([\S\s])/iS";
  413. do {
  414. if ($this->mbstring_overload ? preg_match($yy_global_pattern, mb_substr($this->data, $this->counter,2000000000,'latin1'), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {
  415. $yysubmatches = $yymatches;
  416. $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
  417. if (!count($yymatches)) {
  418. throw new Exception('Error: lexing failed because a rule matched' .
  419. ' an empty string. Input "' . substr($this->data,
  420. $this->counter, 5) . '... state SMARTY');
  421. }
  422. next($yymatches); // skip global match
  423. $this->token = key($yymatches); // token number
  424. if ($tokenMap[$this->token]) {
  425. // extract sub-patterns for passing to lex function
  426. $yysubmatches = array_slice($yysubmatches, $this->token + 1,
  427. $tokenMap[$this->token]);
  428. } else {
  429. $yysubmatches = array();
  430. }
  431. $this->value = current($yymatches); // token value
  432. $r = $this->{'yy_r2_' . $this->token}($yysubmatches);
  433. if ($r === null) {
  434. $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
  435. $this->line += substr_count($this->value, "\n");
  436. // accept this token
  437. return true;
  438. } elseif ($r === true) {
  439. // we have changed state
  440. // process this token in the new state
  441. return $this->yylex();
  442. } elseif ($r === false) {
  443. $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
  444. $this->line += substr_count($this->value, "\n");
  445. if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
  446. return false; // end of input
  447. }
  448. // skip this token
  449. continue;
  450. } } else {
  451. throw new Exception('Unexpected input at line' . $this->line .
  452. ': ' . $this->data[$this->counter]);
  453. }
  454. break;
  455. } while (true);
  456. } // end function
  457. const SMARTY = 2;
  458. function yy_r2_1($yy_subpatterns)
  459. {
  460. $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
  461. }
  462. function yy_r2_2($yy_subpatterns)
  463. {
  464. if ($this->smarty->auto_literal) {
  465. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  466. } else {
  467. $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
  468. $this->yypushstate(self::SMARTY);
  469. $this->taglineno = $this->line;
  470. }
  471. }
  472. function yy_r2_3($yy_subpatterns)
  473. {
  474. if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
  475. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  476. } else {
  477. $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
  478. $this->yypushstate(self::SMARTY);
  479. $this->taglineno = $this->line;
  480. }
  481. }
  482. function yy_r2_5($yy_subpatterns)
  483. {
  484. if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
  485. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  486. } else {
  487. $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
  488. $this->yypushstate(self::SMARTY);
  489. $this->taglineno = $this->line;
  490. }
  491. }
  492. function yy_r2_6($yy_subpatterns)
  493. {
  494. if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
  495. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  496. } else {
  497. $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
  498. $this->yypushstate(self::SMARTY);
  499. $this->taglineno = $this->line;
  500. }
  501. }
  502. function yy_r2_7($yy_subpatterns)
  503. {
  504. if ($this->smarty->auto_literal) {
  505. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  506. } else {
  507. $this->token = Smarty_Internal_Templateparser::TP_LDEL;
  508. $this->yypushstate(self::SMARTY);
  509. $this->taglineno = $this->line;
  510. }
  511. }
  512. function yy_r2_8($yy_subpatterns)
  513. {
  514. $this->token = Smarty_Internal_Templateparser::TP_RDEL;
  515. $this->yypopstate();
  516. }
  517. function yy_r2_9($yy_subpatterns)
  518. {
  519. $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
  520. $this->yypushstate(self::SMARTY);
  521. $this->taglineno = $this->line;
  522. }
  523. function yy_r2_10($yy_subpatterns)
  524. {
  525. $this->token = Smarty_Internal_Templateparser::TP_LDEL;
  526. $this->yypushstate(self::SMARTY);
  527. $this->taglineno = $this->line;
  528. }
  529. function yy_r2_11($yy_subpatterns)
  530. {
  531. $this->token = Smarty_Internal_Templateparser::TP_RDEL;
  532. $this->yypopstate();
  533. }
  534. function yy_r2_12($yy_subpatterns)
  535. {
  536. $this->token = Smarty_Internal_Templateparser::TP_ISIN;
  537. }
  538. function yy_r2_13($yy_subpatterns)
  539. {
  540. $this->token = Smarty_Internal_Templateparser::TP_AS;
  541. }
  542. function yy_r2_14($yy_subpatterns)
  543. {
  544. $this->token = Smarty_Internal_Templateparser::TP_TO;
  545. }
  546. function yy_r2_15($yy_subpatterns)
  547. {
  548. $this->token = Smarty_Internal_Templateparser::TP_STEP;
  549. }
  550. function yy_r2_16($yy_subpatterns)
  551. {
  552. $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
  553. }
  554. function yy_r2_17($yy_subpatterns)
  555. {
  556. $this->token = Smarty_Internal_Templateparser::TP_IDENTITY;
  557. }
  558. function yy_r2_18($yy_subpatterns)
  559. {
  560. $this->token = Smarty_Internal_Templateparser::TP_NONEIDENTITY;
  561. }
  562. function yy_r2_19($yy_subpatterns)
  563. {
  564. $this->token = Smarty_Internal_Templateparser::TP_EQUALS;
  565. }
  566. function yy_r2_20($yy_subpatterns)
  567. {
  568. $this->token = Smarty_Internal_Templateparser::TP_NOTEQUALS;
  569. }
  570. function yy_r2_22($yy_subpatterns)
  571. {
  572. $this->token = Smarty_Internal_Templateparser::TP_GREATEREQUAL;
  573. }
  574. function yy_r2_24($yy_subpatterns)
  575. {
  576. $this->token = Smarty_Internal_Templateparser::TP_LESSEQUAL;
  577. }
  578. function yy_r2_26($yy_subpatterns)
  579. {
  580. $this->token = Smarty_Internal_Templateparser::TP_GREATERTHAN;
  581. }
  582. function yy_r2_27($yy_subpatterns)
  583. {
  584. $this->token = Smarty_Internal_Templateparser::TP_LESSTHAN;
  585. }
  586. function yy_r2_28($yy_subpatterns)
  587. {
  588. $this->token = Smarty_Internal_Templateparser::TP_MOD;
  589. }
  590. function yy_r2_29($yy_subpatterns)
  591. {
  592. $this->token = Smarty_Internal_Templateparser::TP_NOT;
  593. }
  594. function yy_r2_30($yy_subpatterns)
  595. {
  596. $this->token = Smarty_Internal_Templateparser::TP_LAND;
  597. }
  598. function yy_r2_31($yy_subpatterns)
  599. {
  600. $this->token = Smarty_Internal_Templateparser::TP_LOR;
  601. }
  602. function yy_r2_32($yy_subpatterns)
  603. {
  604. $this->token = Smarty_Internal_Templateparser::TP_LXOR;
  605. }
  606. function yy_r2_33($yy_subpatterns)
  607. {
  608. $this->token = Smarty_Internal_Templateparser::TP_ISODDBY;
  609. }
  610. function yy_r2_34($yy_subpatterns)
  611. {
  612. $this->token = Smarty_Internal_Templateparser::TP_ISNOTODDBY;
  613. }
  614. function yy_r2_35($yy_subpatterns)
  615. {
  616. $this->token = Smarty_Internal_Templateparser::TP_ISODD;
  617. }
  618. function yy_r2_36($yy_subpatterns)
  619. {
  620. $this->token = Smarty_Internal_Templateparser::TP_ISNOTODD;
  621. }
  622. function yy_r2_37($yy_subpatterns)
  623. {
  624. $this->token = Smarty_Internal_Templateparser::TP_ISEVENBY;
  625. }
  626. function yy_r2_38($yy_subpatterns)
  627. {
  628. $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVENBY;
  629. }
  630. function yy_r2_39($yy_subpatterns)
  631. {
  632. $this->token = Smarty_Internal_Templateparser::TP_ISEVEN;
  633. }
  634. function yy_r2_40($yy_subpatterns)
  635. {
  636. $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVEN;
  637. }
  638. function yy_r2_41($yy_subpatterns)
  639. {
  640. $this->token = Smarty_Internal_Templateparser::TP_ISDIVBY;
  641. }
  642. function yy_r2_42($yy_subpatterns)
  643. {
  644. $this->token = Smarty_Internal_Templateparser::TP_ISNOTDIVBY;
  645. }
  646. function yy_r2_43($yy_subpatterns)
  647. {
  648. $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
  649. }
  650. function yy_r2_47($yy_subpatterns)
  651. {
  652. $this->token = Smarty_Internal_Templateparser::TP_OPENP;
  653. }
  654. function yy_r2_48($yy_subpatterns)
  655. {
  656. $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
  657. }
  658. function yy_r2_49($yy_subpatterns)
  659. {
  660. $this->token = Smarty_Internal_Templateparser::TP_OPENB;
  661. }
  662. function yy_r2_50($yy_subpatterns)
  663. {
  664. $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
  665. }
  666. function yy_r2_51($yy_subpatterns)
  667. {
  668. $this->token = Smarty_Internal_Templateparser::TP_PTR;
  669. }
  670. function yy_r2_52($yy_subpatterns)
  671. {
  672. $this->token = Smarty_Internal_Templateparser::TP_APTR;
  673. }
  674. function yy_r2_53($yy_subpatterns)
  675. {
  676. $this->token = Smarty_Internal_Templateparser::TP_EQUAL;
  677. }
  678. function yy_r2_54($yy_subpatterns)
  679. {
  680. $this->token = Smarty_Internal_Templateparser::TP_INCDEC;
  681. }
  682. function yy_r2_55($yy_subpatterns)
  683. {
  684. $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
  685. }
  686. function yy_r2_57($yy_subpatterns)
  687. {
  688. $this->token = Smarty_Internal_Templateparser::TP_MATH;
  689. }
  690. function yy_r2_59($yy_subpatterns)
  691. {
  692. $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
  693. }
  694. function yy_r2_60($yy_subpatterns)
  695. {
  696. $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
  697. }
  698. function yy_r2_61($yy_subpatterns)
  699. {
  700. $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
  701. }
  702. function yy_r2_62($yy_subpatterns)
  703. {
  704. $this->token = Smarty_Internal_Templateparser::TP_COLON;
  705. }
  706. function yy_r2_63($yy_subpatterns)
  707. {
  708. $this->token = Smarty_Internal_Templateparser::TP_AT;
  709. }
  710. function yy_r2_64($yy_subpatterns)
  711. {
  712. $this->token = Smarty_Internal_Templateparser::TP_HATCH;
  713. }
  714. function yy_r2_65($yy_subpatterns)
  715. {
  716. $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
  717. $this->yypushstate(self::DOUBLEQUOTEDSTRING);
  718. }
  719. function yy_r2_66($yy_subpatterns)
  720. {
  721. $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
  722. $this->yypopstate();
  723. }
  724. function yy_r2_67($yy_subpatterns)
  725. {
  726. $this->token = Smarty_Internal_Templateparser::TP_VERT;
  727. }
  728. function yy_r2_68($yy_subpatterns)
  729. {
  730. $this->token = Smarty_Internal_Templateparser::TP_DOT;
  731. }
  732. function yy_r2_69($yy_subpatterns)
  733. {
  734. $this->token = Smarty_Internal_Templateparser::TP_COMMA;
  735. }
  736. function yy_r2_70($yy_subpatterns)
  737. {
  738. $this->token = Smarty_Internal_Templateparser::TP_ANDSYM;
  739. }
  740. function yy_r2_71($yy_subpatterns)
  741. {
  742. $this->token = Smarty_Internal_Templateparser::TP_QMARK;
  743. }
  744. function yy_r2_72($yy_subpatterns)
  745. {
  746. $this->token = Smarty_Internal_Templateparser::TP_HEX;
  747. }
  748. function yy_r2_73($yy_subpatterns)
  749. {
  750. $this->token = Smarty_Internal_Templateparser::TP_ATTR;
  751. }
  752. function yy_r2_74($yy_subpatterns)
  753. {
  754. $this->token = Smarty_Internal_Templateparser::TP_ID;
  755. }
  756. function yy_r2_75($yy_subpatterns)
  757. {
  758. $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
  759. }
  760. function yy_r2_76($yy_subpatterns)
  761. {
  762. $this->token = Smarty_Internal_Templateparser::TP_SPACE;
  763. }
  764. function yy_r2_77($yy_subpatterns)
  765. {
  766. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  767. }
  768. function yylex3()
  769. {
  770. $tokenMap = array (
  771. 1 => 0,
  772. 2 => 0,
  773. 3 => 0,
  774. 4 => 0,
  775. 5 => 0,
  776. 6 => 0,
  777. 7 => 0,
  778. );
  779. if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
  780. return false; // end of input
  781. }
  782. $yy_global_pattern = "/\G(".$this->ldel."\\s*literal\\s*".$this->rdel.")|\G(".$this->ldel."\\s*\/literal\\s*".$this->rdel.")|\G(<\\?(?:php\\w+|=|[a-zA-Z]+)?)|\G(\\?>)|\G(<%)|\G(%>)|\G([\S\s])/iS";
  783. do {
  784. if ($this->mbstring_overload ? preg_match($yy_global_pattern, mb_substr($this->data, $this->counter,2000000000,'latin1'), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {
  785. $yysubmatches = $yymatches;
  786. $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
  787. if (!count($yymatches)) {
  788. throw new Exception('Error: lexing failed because a rule matched' .
  789. ' an empty string. Input "' . substr($this->data,
  790. $this->counter, 5) . '... state LITERAL');
  791. }
  792. next($yymatches); // skip global match
  793. $this->token = key($yymatches); // token number
  794. if ($tokenMap[$this->token]) {
  795. // extract sub-patterns for passing to lex function
  796. $yysubmatches = array_slice($yysubmatches, $this->token + 1,
  797. $tokenMap[$this->token]);
  798. } else {
  799. $yysubmatches = array();
  800. }
  801. $this->value = current($yymatches); // token value
  802. $r = $this->{'yy_r3_' . $this->token}($yysubmatches);
  803. if ($r === null) {
  804. $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
  805. $this->line += substr_count($this->value, "\n");
  806. // accept this token
  807. return true;
  808. } elseif ($r === true) {
  809. // we have changed state
  810. // process this token in the new state
  811. return $this->yylex();
  812. } elseif ($r === false) {
  813. $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
  814. $this->line += substr_count($this->value, "\n");
  815. if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
  816. return false; // end of input
  817. }
  818. // skip this token
  819. continue;
  820. } } else {
  821. throw new Exception('Unexpected input at line' . $this->line .
  822. ': ' . $this->data[$this->counter]);
  823. }
  824. break;
  825. } while (true);
  826. } // end function
  827. const LITERAL = 3;
  828. function yy_r3_1($yy_subpatterns)
  829. {
  830. $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
  831. $this->yypushstate(self::LITERAL);
  832. }
  833. function yy_r3_2($yy_subpatterns)
  834. {
  835. $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
  836. $this->yypopstate();
  837. }
  838. function yy_r3_3($yy_subpatterns)
  839. {
  840. if (in_array($this->value, Array('<?', '<?=', '<?php'))) {
  841. $this->token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG;
  842. } else {
  843. $this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG;
  844. $this->value = substr($this->value, 0, 2);
  845. }
  846. }
  847. function yy_r3_4($yy_subpatterns)
  848. {
  849. $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG;
  850. }
  851. function yy_r3_5($yy_subpatterns)
  852. {
  853. $this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG;
  854. }
  855. function yy_r3_6($yy_subpatterns)
  856. {
  857. $this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG;
  858. }
  859. function yy_r3_7($yy_subpatterns)
  860. {
  861. if ($this->mbstring_overload) {
  862. $to = mb_strlen($this->data,'latin1');
  863. } else {
  864. $to = strlen($this->data);
  865. }
  866. preg_match("/{$this->ldel}\/?literal{$this->rdel}|<\?|<%|\?>|%>/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
  867. if (isset($match[0][1])) {
  868. $to = $match[0][1];
  869. } else {
  870. $this->compiler->trigger_template_error ("missing or misspelled literal closing tag");
  871. }
  872. if ($this->mbstring_overload) {
  873. $this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1');
  874. } else {
  875. $this->value = substr($this->data,$this->counter,$to-$this->counter);
  876. }
  877. $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
  878. }
  879. function yylex4()
  880. {
  881. $tokenMap = array (
  882. 1 => 0,
  883. 2 => 1,
  884. 4 => 0,
  885. 5 => 0,
  886. 6 => 0,
  887. 7 => 0,
  888. 8 => 0,
  889. 9 => 0,
  890. 10 => 0,
  891. 11 => 0,
  892. 12 => 0,
  893. 13 => 3,
  894. 17 => 0,
  895. );
  896. if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
  897. return false; // end of input
  898. }
  899. $yy_global_pattern = "/\G(".$this->ldel."\\s{1,}\/)|\G(".$this->ldel."\\s*(if|elseif|else if|while)\\s+)|\G(".$this->ldel."\\s*for\\s+)|\G(".$this->ldel."\\s*foreach(?![^\s]))|\G(".$this->ldel."\\s{1,})|\G(".$this->ldel."\/)|\G(".$this->ldel.")|\G(\")|\G(`\\$)|\G(\\$[0-9]*[a-zA-Z_]\\w*)|\G(\\$)|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=(".$this->ldel."|\\$|`\\$|\")))|\G([\S\s])/iS";
  900. do {
  901. if ($this->mbstring_overload ? preg_match($yy_global_pattern, mb_substr($this->data, $this->counter,2000000000,'latin1'), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {
  902. $yysubmatches = $yymatches;
  903. $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
  904. if (!count($yymatches)) {
  905. throw new Exception('Error: lexing failed because a rule matched' .
  906. ' an empty string. Input "' . substr($this->data,
  907. $this->counter, 5) . '... state DOUBLEQUOTEDSTRING');
  908. }
  909. next($yymatches); // skip global match
  910. $this->token = key($yymatches); // token number
  911. if ($tokenMap[$this->token]) {
  912. // extract sub-patterns for passing to lex function
  913. $yysubmatches = array_slice($yysubmatches, $this->token + 1,
  914. $tokenMap[$this->token]);
  915. } else {
  916. $yysubmatches = array();
  917. }
  918. $this->value = current($yymatches); // token value
  919. $r = $this->{'yy_r4_' . $this->token}($yysubmatches);
  920. if ($r === null) {
  921. $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
  922. $this->line += substr_count($this->value, "\n");
  923. // accept this token
  924. return true;
  925. } elseif ($r === true) {
  926. // we have changed state
  927. // process this token in the new state
  928. return $this->yylex();
  929. } elseif ($r === false) {
  930. $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
  931. $this->line += substr_count($this->value, "\n");
  932. if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
  933. return false; // end of input
  934. }
  935. // skip this token
  936. continue;
  937. } } else {
  938. throw new Exception('Unexpected input at line' . $this->line .
  939. ': ' . $this->data[$this->counter]);
  940. }
  941. break;
  942. } while (true);
  943. } // end function
  944. const DOUBLEQUOTEDSTRING = 4;
  945. function yy_r4_1($yy_subpatterns)
  946. {
  947. if ($this->smarty->auto_literal) {
  948. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  949. } else {
  950. $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
  951. $this->yypushstate(self::SMARTY);
  952. $this->taglineno = $this->line;
  953. }
  954. }
  955. function yy_r4_2($yy_subpatterns)
  956. {
  957. if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
  958. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  959. } else {
  960. $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
  961. $this->yypushstate(self::SMARTY);
  962. $this->taglineno = $this->line;
  963. }
  964. }
  965. function yy_r4_4($yy_subpatterns)
  966. {
  967. if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
  968. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  969. } else {
  970. $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
  971. $this->yypushstate(self::SMARTY);
  972. $this->taglineno = $this->line;
  973. }
  974. }
  975. function yy_r4_5($yy_subpatterns)
  976. {
  977. if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
  978. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  979. } else {
  980. $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
  981. $this->yypushstate(self::SMARTY);
  982. $this->taglineno = $this->line;
  983. }
  984. }
  985. function yy_r4_6($yy_subpatterns)
  986. {
  987. if ($this->smarty->auto_literal) {
  988. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  989. } else {
  990. $this->token = Smarty_Internal_Templateparser::TP_LDEL;
  991. $this->yypushstate(self::SMARTY);
  992. $this->taglineno = $this->line;
  993. }
  994. }
  995. function yy_r4_7($yy_subpatterns)
  996. {
  997. $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
  998. $this->yypushstate(self::SMARTY);
  999. $this->taglineno = $this->line;
  1000. }
  1001. function yy_r4_8($yy_subpatterns)
  1002. {
  1003. $this->token = Smarty_Internal_Templateparser::TP_LDEL;
  1004. $this->yypushstate(self::SMARTY);
  1005. $this->taglineno = $this->line;
  1006. }
  1007. function yy_r4_9($yy_subpatterns)
  1008. {
  1009. $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
  1010. $this->yypopstate();
  1011. }
  1012. function yy_r4_10($yy_subpatterns)
  1013. {
  1014. $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
  1015. $this->value = substr($this->value,0,-1);
  1016. $this->yypushstate(self::SMARTY);
  1017. $this->taglineno = $this->line;
  1018. }
  1019. function yy_r4_11($yy_subpatterns)
  1020. {
  1021. $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
  1022. }
  1023. function yy_r4_12($yy_subpatterns)
  1024. {
  1025. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  1026. }
  1027. function yy_r4_13($yy_subpatterns)
  1028. {
  1029. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  1030. }
  1031. function yy_r4_17($yy_subpatterns)
  1032. {
  1033. if ($this->mbstring_overload) {
  1034. $to = mb_strlen($this->data,'latin1');
  1035. } else {
  1036. $to = strlen($this->data);
  1037. }
  1038. if ($this->mbstring_overload) {
  1039. $this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1');
  1040. } else {
  1041. $this->value = substr($this->data,$this->counter,$to-$this->counter);
  1042. }
  1043. $this->token = Smarty_Internal_Templateparser::TP_TEXT;
  1044. }
  1045. }
  1046. ?>