Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

Rev Author Line No. Line
2809 rexy 1
<?php
2
/*
3
 * This file is part of Smarty.
4
 *
5
 * (c) 2015 Uwe Tews
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
 
11
/**
12
 * Smarty_Internal_Templatelexer
13
 * This is the template file lexer.
14
 * It is generated from the smarty_internal_templatelexer.plex file
15
 *
16
 *
17
 * @author Uwe Tews <uwe.tews@googlemail.com>
18
 */
19
class Smarty_Internal_Templatelexer
20
{
21
    const TEXT               = 1;
22
    const TAG                = 2;
23
    const TAGBODY            = 3;
24
    const LITERAL            = 4;
25
    const DOUBLEQUOTEDSTRING = 5;
26
 
27
    /**
28
     * Source
29
     *
30
     * @var string
31
     */
32
    public $data;
33
 
34
    /**
35
     * Source length
36
     *
37
     * @var int
38
     */
39
    public $dataLength = null;
40
 
41
    /**
42
     * byte counter
43
     *
44
     * @var int
45
     */
46
    public $counter;
47
 
48
    /**
49
     * token number
50
     *
51
     * @var int
52
     */
53
    public $token;
54
 
55
    /**
56
     * token value
57
     *
58
     * @var string
59
     */
60
    public $value;
61
 
62
    /**
63
     * current line
64
     *
65
     * @var int
66
     */
67
    public $line;
68
 
69
    /**
70
     * tag start line
71
     *
72
     * @var
73
     */
74
    public $taglineno;
75
 
76
    /**
77
     * php code type
78
     *
79
     * @var string
80
     */
81
    public $phpType = '';
82
 
83
    /**
84
     * state number
85
     *
86
     * @var int
87
     */
88
    public $state = 1;
89
 
90
    /**
91
     * Smarty object
92
     *
93
     * @var Smarty
94
     */
95
    public $smarty = null;
96
 
97
    /**
98
     * compiler object
99
     *
100
     * @var Smarty_Internal_TemplateCompilerBase
101
     */
102
    public $compiler = null;
103
 
104
    /**
105
     * trace file
106
     *
107
     * @var resource
108
     */
109
    public $yyTraceFILE;
110
 
111
    /**
112
     * trace prompt
113
     *
114
     * @var string
115
     */
116
    public $yyTracePrompt;
117
 
118
    /**
119
     * XML flag true while processing xml
120
     *
121
     * @var bool
122
     */
123
    public $is_xml = false;
124
 
125
    /**
126
     * state names
127
     *
128
     * @var array
129
     */
130
    public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',);
131
 
132
    /**
133
     * token names
134
     *
135
     * @var array
136
     */
137
    public $smarty_token_names = array(        // Text for parser error messages
138
                                               'NOT'         => '(!,not)',
139
                                               'OPENP'       => '(',
140
                                               'CLOSEP'      => ')',
141
                                               'OPENB'       => '[',
142
                                               'CLOSEB'      => ']',
143
                                               'PTR'         => '->',
144
                                               'APTR'        => '=>',
145
                                               'EQUAL'       => '=',
146
                                               'NUMBER'      => 'number',
147
                                               'UNIMATH'     => '+" , "-',
148
                                               'MATH'        => '*" , "/" , "%',
149
                                               'INCDEC'      => '++" , "--',
150
                                               'SPACE'       => ' ',
151
                                               'DOLLAR'      => '$',
152
                                               'SEMICOLON'   => ';',
153
                                               'COLON'       => ':',
154
                                               'DOUBLECOLON' => '::',
155
                                               'AT'          => '@',
156
                                               'HATCH'       => '#',
157
                                               'QUOTE'       => '"',
158
                                               'BACKTICK'    => '`',
159
                                               'VERT'        => '"|" modifier',
160
                                               'DOT'         => '.',
161
                                               'COMMA'       => '","',
162
                                               'QMARK'       => '"?"',
163
                                               'ID'          => 'id, name',
164
                                               'TEXT'        => 'text',
165
                                               'LDELSLASH'   => '{/..} closing tag',
166
                                               'LDEL'        => '{...} Smarty tag',
167
                                               'COMMENT'     => 'comment',
168
                                               'AS'          => 'as',
169
                                               'TO'          => 'to',
170
                                               'PHP'         => '"<?php", "<%", "{php}" tag',
171
                                               'LOGOP'       => '"<", "==" ... logical operator',
172
                                               'TLOGOP'      => '"lt", "eq" ... logical operator; "is div by" ... if condition',
173
                                               'SCOND'       => '"is even" ... if condition',
174
    );
175
 
176
    /**
177
     * literal tag nesting level
178
     *
179
     * @var int
180
     */
181
    private $literal_cnt = 0;
182
 
183
    /**
184
     * preg token pattern for state TEXT
185
     *
186
     * @var string
187
     */
188
    private $yy_global_pattern1 = null;
189
 
190
    /**
191
     * preg token pattern for state TAG
192
     *
193
     * @var string
194
     */
195
    private $yy_global_pattern2 = null;
196
 
197
    /**
198
     * preg token pattern for state TAGBODY
199
     *
200
     * @var string
201
     */
202
    private $yy_global_pattern3 = null;
203
 
204
    /**
205
     * preg token pattern for state LITERAL
206
     *
207
     * @var string
208
     */
209
    private $yy_global_pattern4 = null;
210
 
211
    /**
212
     * preg token pattern for state DOUBLEQUOTEDSTRING
213
     *
214
     * @var null
215
     */
216
    private $yy_global_pattern5 = null;
217
 
218
    /**
219
     * preg token pattern for text
220
     *
221
     * @var null
222
     */
223
    private $yy_global_text = null;
224
 
225
    /**
226
     * preg token pattern for literal
227
     *
228
     * @var null
229
     */
230
    private $yy_global_literal = null;
231
 
232
    private $_yy_state         = 1;
233
 
234
    private $_yy_stack         = array();
235
 
236
    /**
237
     * constructor
238
     *
239
     * @param   string                             $source template source
240
     * @param Smarty_Internal_TemplateCompilerBase $compiler
241
     */
242
    public function __construct($source, Smarty_Internal_TemplateCompilerBase $compiler)
243
    {
244
        $this->data = $source;
245
        $this->dataLength = strlen($this->data);
246
        $this->counter = 0;
247
        if (preg_match('/^\xEF\xBB\xBF/i', $this->data, $match)) {
248
            $this->counter += strlen($match[ 0 ]);
249
        }
250
        $this->line = 1;
251
        $this->smarty = $compiler->template->smarty;
252
        $this->compiler = $compiler;
253
        $this->compiler->initDelimiterPreg();
254
        $this->smarty_token_names[ 'LDEL' ] = $this->smarty->getLeftDelimiter();
255
        $this->smarty_token_names[ 'RDEL' ] = $this->smarty->getRightDelimiter();
256
    }
257
 
258
    /**
259
     * open lexer/parser trace file
260
     *
261
     */
262
    public function PrintTrace()
263
    {
264
        $this->yyTraceFILE = fopen('php://output', 'w');
265
        $this->yyTracePrompt = '<br>';
266
    }
267
 
268
    /**
269
     * replace placeholders with runtime preg  code
270
     *
271
     * @param string $preg
272
     *
273
     * @return string
274
     */
275
    public function replace($preg)
276
    {
277
        return $this->compiler->replaceDelimiter($preg);
278
    }
279
 
280
    /**
281
     * check if current value is an autoliteral left delimiter
282
     *
283
     * @return bool
284
     */
285
    public function isAutoLiteral()
286
    {
287
        return $this->smarty->getAutoLiteral() && isset($this->value[ $this->compiler->getLdelLength() ]) ?
288
            strpos(" \n\t\r", $this->value[ $this->compiler->getLdelLength() ]) !== false : false;
289
    } // end function
290
 
291
    public function yylex()
292
    {
293
        return $this->{'yylex' . $this->_yy_state}();
294
    }
295
 
296
    public function yypushstate($state)
297
    {
298
        if ($this->yyTraceFILE) {
299
            fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt,
300
                isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
301
        }
302
        array_push($this->_yy_stack, $this->_yy_state);
303
        $this->_yy_state = $state;
304
        if ($this->yyTraceFILE) {
305
            fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt,
306
                isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
307
        }
308
    }
309
 
310
    public function yypopstate()
311
    {
312
        if ($this->yyTraceFILE) {
313
            fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt,
314
                isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
315
        }
316
        $this->_yy_state = array_pop($this->_yy_stack);
317
        if ($this->yyTraceFILE) {
318
            fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt,
319
                isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
320
        }
321
    }
322
 
323
    public function yybegin($state)
324
    {
325
        $this->_yy_state = $state;
326
        if ($this->yyTraceFILE) {
327
            fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt,
328
                isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
329
        }
330
    }
331
 
332
    public function yylex1()
333
    {
334
        if (!isset($this->yy_global_pattern1)) {
335
            $this->yy_global_pattern1 =
336
                $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([\S\s])/isS");
337
        }
338
        if (!isset($this->dataLength)) {
339
            $this->dataLength = strlen($this->data);
340
        }
341
        if ($this->counter >= $this->dataLength) {
342
            return false; // end of input
343
        }
344
        do {
345
            if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, 0, $this->counter)) {
346
                if (!isset($yymatches[ 0 ][ 1 ])) {
347
                    $yymatches = preg_grep("/(.|\s)+/", $yymatches);
348
                } else {
349
                    $yymatches = array_filter($yymatches);
350
                }
351
                if (empty($yymatches)) {
352
                    throw new Exception('Error: lexing failed because a rule matched' .
353
                                        ' an empty string.  Input "' . substr($this->data,
354
                            $this->counter, 5) . '... state TEXT');
355
                }
356
                next($yymatches); // skip global match
357
                $this->token = key($yymatches); // token number
358
                $this->value = current($yymatches); // token value
359
                $r = $this->{'yy_r1_' . $this->token}();
360
                if ($r === null) {
361
                    $this->counter += strlen($this->value);
362
                    $this->line += substr_count($this->value, "\n");
363
                    // accept this token
364
                    return true;
365
                } elseif ($r === true) {
366
                    // we have changed state
367
                    // process this token in the new state
368
                    return $this->yylex();
369
                } elseif ($r === false) {
370
                    $this->counter += strlen($this->value);
371
                    $this->line += substr_count($this->value, "\n");
372
                    if ($this->counter >= $this->dataLength) {
373
                        return false; // end of input
374
                    }
375
                    // skip this token
376
                    continue;
377
                }
378
            } else {
379
                throw new Exception('Unexpected input at line ' . $this->line .
380
                                    ': ' . $this->data[ $this->counter ]);
381
            }
382
            break;
383
        } while (true);
384
    }
385
 
386
    public function yy_r1_1()
387
    {
388
        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
389
    }
390
 
391
    public function yy_r1_2()
392
    {
393
        $to = $this->dataLength;
394
        preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/", $this->data, $match, PREG_OFFSET_CAPTURE,
395
            $this->counter);
396
        if (isset($match[ 0 ][ 1 ])) {
397
            $to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]);
398
        } else {
399
            $this->compiler->trigger_template_error("missing or misspelled comment closing tag '{$this->smarty->getRightDelimiter()}'");
400
        }
401
        $this->value = substr($this->data, $this->counter, $to - $this->counter);
402
        return false;
403
    }
404
 
405
    public function yy_r1_4()
406
    {
407
        $this->compiler->getTagCompiler('private_php')->parsePhp($this);
408
    }
409
 
410
    public function yy_r1_8()
411
    {
412
        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
413
    }
414
 
415
    public function yy_r1_10()
416
    {
417
        $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
418
        $this->yypushstate(self::LITERAL);
419
    }
420
 
421
    public function yy_r1_12()
422
    {
423
        $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
424
        $this->yypushstate(self::LITERAL);
425
    } // end function
426
 
427
    public function yy_r1_14()
428
    {
429
        $this->yypushstate(self::TAG);
430
        return true;
431
    }
432
 
433
    public function yy_r1_16()
434
    {
435
        $this->compiler->getTagCompiler('private_php')->parsePhp($this);
436
    }
437
 
438
    public function yy_r1_19()
439
    {
440
        if (!isset($this->yy_global_text)) {
441
            $this->yy_global_text =
442
                $this->replace('/(SMARTYldel)SMARTYal|[<][?]((php\s+|=)|\s+)|[<][%]|[<][?]xml\s+|[<]script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*[>]|[?][>]|[%][>]SMARTYliteral/isS');
443
        }
444
        $to = $this->dataLength;
445
        preg_match($this->yy_global_text, $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
446
        if (isset($match[ 0 ][ 1 ])) {
447
            $to = $match[ 0 ][ 1 ];
448
        }
449
        $this->value = substr($this->data, $this->counter, $to - $this->counter);
450
        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
451
    }
452
 
453
    public function yylex2()
454
    {
455
        if (!isset($this->yy_global_pattern2)) {
456
            $this->yy_global_pattern2 =
457
                $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");
458
        }
459
        if (!isset($this->dataLength)) {
460
            $this->dataLength = strlen($this->data);
461
        }
462
        if ($this->counter >= $this->dataLength) {
463
            return false; // end of input
464
        }
465
        do {
466
            if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, 0, $this->counter)) {
467
                if (!isset($yymatches[ 0 ][ 1 ])) {
468
                    $yymatches = preg_grep("/(.|\s)+/", $yymatches);
469
                } else {
470
                    $yymatches = array_filter($yymatches);
471
                }
472
                if (empty($yymatches)) {
473
                    throw new Exception('Error: lexing failed because a rule matched' .
474
                                        ' an empty string.  Input "' . substr($this->data,
475
                            $this->counter, 5) . '... state TAG');
476
                }
477
                next($yymatches); // skip global match
478
                $this->token = key($yymatches); // token number
479
                $this->value = current($yymatches); // token value
480
                $r = $this->{'yy_r2_' . $this->token}();
481
                if ($r === null) {
482
                    $this->counter += strlen($this->value);
483
                    $this->line += substr_count($this->value, "\n");
484
                    // accept this token
485
                    return true;
486
                } elseif ($r === true) {
487
                    // we have changed state
488
                    // process this token in the new state
489
                    return $this->yylex();
490
                } elseif ($r === false) {
491
                    $this->counter += strlen($this->value);
492
                    $this->line += substr_count($this->value, "\n");
493
                    if ($this->counter >= $this->dataLength) {
494
                        return false; // end of input
495
                    }
496
                    // skip this token
497
                    continue;
498
                }
499
            } else {
500
                throw new Exception('Unexpected input at line ' . $this->line .
501
                                    ': ' . $this->data[ $this->counter ]);
502
            }
503
            break;
504
        } while (true);
505
    }
506
 
507
    public function yy_r2_1()
508
    {
509
        $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
510
        $this->yybegin(self::TAGBODY);
511
        $this->taglineno = $this->line;
512
    }
513
 
514
    public function yy_r2_4()
515
    {
516
        $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
517
        $this->yybegin(self::TAGBODY);
518
        $this->taglineno = $this->line;
519
    }
520
 
521
    public function yy_r2_6()
522
    {
523
        $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
524
        $this->yybegin(self::TAGBODY);
525
        $this->taglineno = $this->line;
526
    }
527
 
528
    public function yy_r2_8()
529
    {
530
        $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
531
        $this->yybegin(self::TAGBODY);
532
        $this->taglineno = $this->line;
533
    }
534
 
535
    public function yy_r2_10()
536
    {
537
        $this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE;
538
        $this->yybegin(self::TAGBODY);
539
        $this->taglineno = $this->line;
540
    }
541
 
542
    public function yy_r2_12()
543
    {
544
        $this->yypopstate();
545
        $this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG;
546
        $this->taglineno = $this->line;
547
    }
548
 
549
    public function yy_r2_15()
550
    {
551
        $this->yypopstate();
552
        $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
553
        $this->taglineno = $this->line;
554
    }
555
 
556
    public function yy_r2_18()
557
    {
558
        $this->yypopstate();
559
        $this->token = Smarty_Internal_Templateparser::TP_CLOSETAG;
560
        $this->taglineno = $this->line;
561
    }
562
 
563
    public function yy_r2_20()
564
    {
565
        if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] === self::TEXT) {
566
            $this->yypopstate();
567
            $this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT;
568
            $this->taglineno = $this->line;
569
        } else {
570
            $this->value = $this->smarty->getLeftDelimiter();
571
            $this->token = Smarty_Internal_Templateparser::TP_LDEL;
572
            $this->yybegin(self::TAGBODY);
573
            $this->taglineno = $this->line;
574
        }
575
    } // end function
576
 
577
    public function yy_r2_23()
578
    {
579
        $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
580
        $this->yybegin(self::TAGBODY);
581
        $this->taglineno = $this->line;
582
    }
583
 
584
    public function yy_r2_25()
585
    {
586
        $this->token = Smarty_Internal_Templateparser::TP_LDEL;
587
        $this->yybegin(self::TAGBODY);
588
        $this->taglineno = $this->line;
589
    }
590
 
591
    public function yylex3()
592
    {
593
        if (!isset($this->yy_global_pattern3)) {
594
            $this->yy_global_pattern3 =
595
                $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(array\\s*[(]\\s*)|\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");
596
        }
597
        if (!isset($this->dataLength)) {
598
            $this->dataLength = strlen($this->data);
599
        }
600
        if ($this->counter >= $this->dataLength) {
601
            return false; // end of input
602
        }
603
        do {
604
            if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, 0, $this->counter)) {
605
                if (!isset($yymatches[ 0 ][ 1 ])) {
606
                    $yymatches = preg_grep("/(.|\s)+/", $yymatches);
607
                } else {
608
                    $yymatches = array_filter($yymatches);
609
                }
610
                if (empty($yymatches)) {
611
                    throw new Exception('Error: lexing failed because a rule matched' .
612
                                        ' an empty string.  Input "' . substr($this->data,
613
                            $this->counter, 5) . '... state TAGBODY');
614
                }
615
                next($yymatches); // skip global match
616
                $this->token = key($yymatches); // token number
617
                $this->value = current($yymatches); // token value
618
                $r = $this->{'yy_r3_' . $this->token}();
619
                if ($r === null) {
620
                    $this->counter += strlen($this->value);
621
                    $this->line += substr_count($this->value, "\n");
622
                    // accept this token
623
                    return true;
624
                } elseif ($r === true) {
625
                    // we have changed state
626
                    // process this token in the new state
627
                    return $this->yylex();
628
                } elseif ($r === false) {
629
                    $this->counter += strlen($this->value);
630
                    $this->line += substr_count($this->value, "\n");
631
                    if ($this->counter >= $this->dataLength) {
632
                        return false; // end of input
633
                    }
634
                    // skip this token
635
                    continue;
636
                }
637
            } else {
638
                throw new Exception('Unexpected input at line ' . $this->line .
639
                                    ': ' . $this->data[ $this->counter ]);
640
            }
641
            break;
642
        } while (true);
643
    }
644
 
645
    public function yy_r3_1()
646
    {
647
        $this->token = Smarty_Internal_Templateparser::TP_RDEL;
648
        $this->yypopstate();
649
    }
650
 
651
    public function yy_r3_2()
652
    {
653
        $this->yypushstate(self::TAG);
654
        return true;
655
    }
656
 
657
    public function yy_r3_4()
658
    {
659
        $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
660
        $this->yypushstate(self::DOUBLEQUOTEDSTRING);
661
        $this->compiler->enterDoubleQuote();
662
    }
663
 
664
    public function yy_r3_5()
665
    {
666
        $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
667
    }
668
 
669
    public function yy_r3_6()
670
    {
671
        $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
672
    }
673
 
674
    public function yy_r3_7()
675
    {
676
        $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
677
    }
678
 
679
    public function yy_r3_8()
680
    {
681
        $this->token = Smarty_Internal_Templateparser::TP_ISIN;
682
    }
683
 
684
    public function yy_r3_9()
685
    {
686
        $this->token = Smarty_Internal_Templateparser::TP_AS;
687
    }
688
 
689
    public function yy_r3_10()
690
    {
691
        $this->token = Smarty_Internal_Templateparser::TP_TO;
692
    }
693
 
694
    public function yy_r3_11()
695
    {
696
        $this->token = Smarty_Internal_Templateparser::TP_STEP;
697
    }
698
 
699
    public function yy_r3_12()
700
    {
701
        $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
702
    }
703
 
704
    public function yy_r3_13()
705
    {
706
        $this->token = Smarty_Internal_Templateparser::TP_LOGOP;
707
    }
708
 
709
    public function yy_r3_15()
710
    {
711
        $this->token = Smarty_Internal_Templateparser::TP_SLOGOP;
712
    }
713
 
714
    public function yy_r3_17()
715
    {
716
        $this->token = Smarty_Internal_Templateparser::TP_TLOGOP;
717
    }
718
 
719
    public function yy_r3_20()
720
    {
721
        $this->token = Smarty_Internal_Templateparser::TP_SINGLECOND;
722
    }
723
 
724
    public function yy_r3_23()
725
    {
726
        $this->token = Smarty_Internal_Templateparser::TP_NOT;
727
    }
728
 
729
    public function yy_r3_24()
730
    {
731
        $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
732
    }
733
 
734
    public function yy_r3_28()
735
    {
736
        $this->token = Smarty_Internal_Templateparser::TP_OPENP;
737
    }
738
 
739
    public function yy_r3_29()
740
    {
741
        $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
742
    }
743
 
744
    public function yy_r3_30()
745
    {
746
        $this->token = Smarty_Internal_Templateparser::TP_OPENB;
747
    }
748
 
749
    public function yy_r3_31()
750
    {
751
        $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
752
    }
753
 
754
    public function yy_r3_32()
755
    {
756
        $this->token = Smarty_Internal_Templateparser::TP_PTR;
757
    }
758
 
759
    public function yy_r3_33()
760
    {
761
        $this->token = Smarty_Internal_Templateparser::TP_APTR;
762
    }
763
 
764
    public function yy_r3_34()
765
    {
766
        $this->token = Smarty_Internal_Templateparser::TP_EQUAL;
767
    }
768
 
769
    public function yy_r3_35()
770
    {
771
        $this->token = Smarty_Internal_Templateparser::TP_INCDEC;
772
    }
773
 
774
    public function yy_r3_37()
775
    {
776
        $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
777
    }
778
 
779
    public function yy_r3_39()
780
    {
781
        $this->token = Smarty_Internal_Templateparser::TP_MATH;
782
    }
783
 
784
    public function yy_r3_41()
785
    {
786
        $this->token = Smarty_Internal_Templateparser::TP_AT;
787
    }
788
 
789
    public function yy_r3_42()
790
    {
791
        $this->token = Smarty_Internal_Templateparser::TP_ARRAYOPEN;
792
    }
793
 
794
    public function yy_r3_43()
795
    {
796
        $this->token = Smarty_Internal_Templateparser::TP_HATCH;
797
    }
798
 
799
    public function yy_r3_44()
800
    {
801
        // resolve conflicts with shorttag and right_delimiter starting with '='
802
        if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) ===
803
            $this->smarty->getRightDelimiter()) {
804
            preg_match('/\s+/', $this->value, $match);
805
            $this->value = $match[ 0 ];
806
            $this->token = Smarty_Internal_Templateparser::TP_SPACE;
807
        } else {
808
            $this->token = Smarty_Internal_Templateparser::TP_ATTR;
809
        }
810
    }
811
 
812
    public function yy_r3_45()
813
    {
814
        $this->token = Smarty_Internal_Templateparser::TP_NAMESPACE;
815
    }
816
 
817
    public function yy_r3_48()
818
    {
819
        $this->token = Smarty_Internal_Templateparser::TP_ID;
820
    }
821
 
822
    public function yy_r3_49()
823
    {
824
        $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
825
    }
826
 
827
    public function yy_r3_50()
828
    {
829
        $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
830
        $this->yypopstate();
831
    }
832
 
833
    public function yy_r3_51()
834
    {
835
        $this->token = Smarty_Internal_Templateparser::TP_VERT;
836
    }
837
 
838
    public function yy_r3_52()
839
    {
840
        $this->token = Smarty_Internal_Templateparser::TP_DOT;
841
    }
842
 
843
    public function yy_r3_53()
844
    {
845
        $this->token = Smarty_Internal_Templateparser::TP_COMMA;
846
    }
847
 
848
    public function yy_r3_54()
849
    {
850
        $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
851
    }
852
 
853
    public function yy_r3_55()
854
    {
855
        $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
856
    }
857
 
858
    public function yy_r3_56()
859
    {
860
        $this->token = Smarty_Internal_Templateparser::TP_COLON;
861
    }
862
 
863
    public function yy_r3_57()
864
    {
865
        $this->token = Smarty_Internal_Templateparser::TP_QMARK;
866
    }
867
 
868
    public function yy_r3_58()
869
    {
870
        $this->token = Smarty_Internal_Templateparser::TP_HEX;
871
    }
872
 
873
    public function yy_r3_59()
874
    {
875
        $this->token = Smarty_Internal_Templateparser::TP_SPACE;
876
    } // end function
877
 
878
    public function yy_r3_60()
879
    {
880
        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
881
    }
882
 
883
    public function yylex4()
884
    {
885
        if (!isset($this->yy_global_pattern4)) {
886
            $this->yy_global_pattern4 =
887
                $this->replace("/\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G([\S\s])/isS");
888
        }
889
        if (!isset($this->dataLength)) {
890
            $this->dataLength = strlen($this->data);
891
        }
892
        if ($this->counter >= $this->dataLength) {
893
            return false; // end of input
894
        }
895
        do {
896
            if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, 0, $this->counter)) {
897
                if (!isset($yymatches[ 0 ][ 1 ])) {
898
                    $yymatches = preg_grep("/(.|\s)+/", $yymatches);
899
                } else {
900
                    $yymatches = array_filter($yymatches);
901
                }
902
                if (empty($yymatches)) {
903
                    throw new Exception('Error: lexing failed because a rule matched' .
904
                                        ' an empty string.  Input "' . substr($this->data,
905
                            $this->counter, 5) . '... state LITERAL');
906
                }
907
                next($yymatches); // skip global match
908
                $this->token = key($yymatches); // token number
909
                $this->value = current($yymatches); // token value
910
                $r = $this->{'yy_r4_' . $this->token}();
911
                if ($r === null) {
912
                    $this->counter += strlen($this->value);
913
                    $this->line += substr_count($this->value, "\n");
914
                    // accept this token
915
                    return true;
916
                } elseif ($r === true) {
917
                    // we have changed state
918
                    // process this token in the new state
919
                    return $this->yylex();
920
                } elseif ($r === false) {
921
                    $this->counter += strlen($this->value);
922
                    $this->line += substr_count($this->value, "\n");
923
                    if ($this->counter >= $this->dataLength) {
924
                        return false; // end of input
925
                    }
926
                    // skip this token
927
                    continue;
928
                }
929
            } else {
930
                throw new Exception('Unexpected input at line ' . $this->line .
931
                                    ': ' . $this->data[ $this->counter ]);
932
            }
933
            break;
934
        } while (true);
935
    }
936
 
937
    public function yy_r4_1()
938
    {
939
        $this->literal_cnt++;
940
        $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
941
    }
942
 
943
    public function yy_r4_3()
944
    {
945
        if ($this->literal_cnt) {
946
            $this->literal_cnt--;
947
            $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
948
        } else {
949
            $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
950
            $this->yypopstate();
951
        }
952
    }
953
 
954
    public function yy_r4_5()
955
    {
956
        if (!isset($this->yy_global_literal)) {
957
            $this->yy_global_literal = $this->replace('/(SMARTYldel)SMARTYal[\/]?literalSMARTYrdel/isS');
958
        }
959
        $to = $this->dataLength;
960
        preg_match($this->yy_global_literal, $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
961
        if (isset($match[ 0 ][ 1 ])) {
962
            $to = $match[ 0 ][ 1 ];
963
        } else {
964
            $this->compiler->trigger_template_error("missing or misspelled literal closing tag");
965
        }
966
        $this->value = substr($this->data, $this->counter, $to - $this->counter);
967
        $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
968
    } // end function
969
 
970
    public function yylex5()
971
    {
972
        if (!isset($this->yy_global_pattern5)) {
973
            $this->yy_global_pattern5 =
974
                $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)))|\G([\S\s])/isS");
975
        }
976
        if (!isset($this->dataLength)) {
977
            $this->dataLength = strlen($this->data);
978
        }
979
        if ($this->counter >= $this->dataLength) {
980
            return false; // end of input
981
        }
982
        do {
983
            if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, 0, $this->counter)) {
984
                if (!isset($yymatches[ 0 ][ 1 ])) {
985
                    $yymatches = preg_grep("/(.|\s)+/", $yymatches);
986
                } else {
987
                    $yymatches = array_filter($yymatches);
988
                }
989
                if (empty($yymatches)) {
990
                    throw new Exception('Error: lexing failed because a rule matched' .
991
                                        ' an empty string.  Input "' . substr($this->data,
992
                            $this->counter, 5) . '... state DOUBLEQUOTEDSTRING');
993
                }
994
                next($yymatches); // skip global match
995
                $this->token = key($yymatches); // token number
996
                $this->value = current($yymatches); // token value
997
                $r = $this->{'yy_r5_' . $this->token}();
998
                if ($r === null) {
999
                    $this->counter += strlen($this->value);
1000
                    $this->line += substr_count($this->value, "\n");
1001
                    // accept this token
1002
                    return true;
1003
                } elseif ($r === true) {
1004
                    // we have changed state
1005
                    // process this token in the new state
1006
                    return $this->yylex();
1007
                } elseif ($r === false) {
1008
                    $this->counter += strlen($this->value);
1009
                    $this->line += substr_count($this->value, "\n");
1010
                    if ($this->counter >= $this->dataLength) {
1011
                        return false; // end of input
1012
                    }
1013
                    // skip this token
1014
                    continue;
1015
                }
1016
            } else {
1017
                throw new Exception('Unexpected input at line ' . $this->line .
1018
                                    ': ' . $this->data[ $this->counter ]);
1019
            }
1020
            break;
1021
        } while (true);
1022
    }
1023
 
1024
    public function yy_r5_1()
1025
    {
1026
        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1027
    }
1028
 
1029
    public function yy_r5_3()
1030
    {
1031
        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1032
    }
1033
 
1034
    public function yy_r5_5()
1035
    {
1036
        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1037
    }
1038
 
1039
    public function yy_r5_7()
1040
    {
1041
        $this->yypushstate(self::TAG);
1042
        return true;
1043
    }
1044
 
1045
    public function yy_r5_9()
1046
    {
1047
        $this->yypushstate(self::TAG);
1048
        return true;
1049
    }
1050
 
1051
    public function yy_r5_11()
1052
    {
1053
        $this->token = Smarty_Internal_Templateparser::TP_LDEL;
1054
        $this->taglineno = $this->line;
1055
        $this->yypushstate(self::TAGBODY);
1056
    }
1057
 
1058
    public function yy_r5_13()
1059
    {
1060
        $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
1061
        $this->yypopstate();
1062
    }
1063
 
1064
    public function yy_r5_14()
1065
    {
1066
        $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
1067
        $this->value = substr($this->value, 0, -1);
1068
        $this->yypushstate(self::TAGBODY);
1069
        $this->taglineno = $this->line;
1070
    }
1071
 
1072
    public function yy_r5_15()
1073
    {
1074
        $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
1075
    }
1076
 
1077
    public function yy_r5_16()
1078
    {
1079
        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1080
    }
1081
 
1082
    public function yy_r5_17()
1083
    {
1084
        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1085
    }
1086
 
1087
    public function yy_r5_22()
1088
    {
1089
        $to = $this->dataLength;
1090
        $this->value = substr($this->data, $this->counter, $to - $this->counter);
1091
        $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1092
    }
1093
}
1094
 
1095