diff --git a/library/smarty/libs/sysplugins/smarty_internal_templatelexer.php b/library/smarty/libs/sysplugins/smarty_internal_templatelexer.php
new file mode 100644
--- /dev/null
+++ b/library/smarty/libs/sysplugins/smarty_internal_templatelexer.php
@@ -0,0 +1,1266 @@
+ 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',
+ 6 => 'CHILDBODY', 7 => 'CHILDBLOCK', 8 => 'CHILDLITERAL');
+
+ /**
+ * storage for assembled token patterns
+ *
+ * @var string
+ */
+ private $yy_global_pattern1 = null;
+
+ private $yy_global_pattern2 = null;
+
+ private $yy_global_pattern3 = null;
+
+ private $yy_global_pattern4 = null;
+
+ private $yy_global_pattern5 = null;
+
+ private $yy_global_pattern6 = null;
+
+ private $yy_global_pattern7 = null;
+
+ private $yy_global_pattern8 = null;
+
+ /**
+ * 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',);
+
+ /**
+ * constructor
+ *
+ * @param string $data template source
+ * @param Smarty_Internal_TemplateCompilerBase $compiler
+ */
+ function __construct($data, Smarty_Internal_TemplateCompilerBase $compiler) {
+ $this->data = $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->ldel = preg_quote($this->smarty->left_delimiter, '~');
+ $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 = '
';
+ }
+
+ /*
+ * Check if this tag is autoliteral
+ */
+ 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;
+ }
+
+ private $_yy_state = 1;
+
+ private $_yy_stack = array();
+
+ 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 = "/\G([{][}])|\G(" . $this->ldel . "[*])|\G((<[?]((php\\s+|=)|\\s+))|(<[%])|(<[?]xml\\s+)|(