- Added tests, tags and filters
[haanga.git] / haanga / lexer.php
blob3e6c7f1159e7e93d3a003505ff1acc221639cf52
1 <?php
2 /*
3 +---------------------------------------------------------------------------------+
4 | Copyright (c) 2010 Haanga |
5 +---------------------------------------------------------------------------------+
6 | Redistribution and use in source and binary forms, with or without |
7 | modification, are permitted provided that the following conditions are met: |
8 | 1. Redistributions of source code must retain the above copyright |
9 | notice, this list of conditions and the following disclaimer. |
10 | |
11 | 2. Redistributions in binary form must reproduce the above copyright |
12 | notice, this list of conditions and the following disclaimer in the |
13 | documentation and/or other materials provided with the distribution. |
14 | |
15 | 3. All advertising materials mentioning features or use of this software |
16 | must display the following acknowledgement: |
17 | This product includes software developed by César D. Rodas. |
18 | |
19 | 4. Neither the name of the César D. Rodas nor the |
20 | names of its contributors may be used to endorse or promote products |
21 | derived from this software without specific prior written permission. |
22 | |
23 | THIS SOFTWARE IS PROVIDED BY CÉSAR D. RODAS ''AS IS'' AND ANY |
24 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
26 | DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY |
27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
30 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE |
33 +---------------------------------------------------------------------------------+
34 | Authors: César Rodas <crodas@php.net> |
35 +---------------------------------------------------------------------------------+
38 require dirname(__FILE__)."/parser.php";
40 function do_parsing($template, $ignore_whitespace=FALSE)
42 $lexer = new Haanga_Lexer($template, $ignore_whitespace);
43 $parser = new Parser;
44 try {
45 for($i=0; ; $i++) {
46 if (!$lexer->yylex()) {
47 break;
49 //var_dump(array($lexer->token, $lexer->value));
50 $parser->doParse($lexer->token, $lexer->value);
52 } catch (Exception $e) {
53 throw new CompilerException($e->getMessage(). ' on line '.$lexer->getLine());
55 $parser->doParse(0, 0);
56 return $parser->body;
59 class Haanga_Lexer
61 private $data;
62 private $N;
63 public $token;
64 public $value;
65 private $line;
66 private $state = 1;
67 private $ignore_whitespace;
69 function __construct($data, $whitespace=FALSE)
71 $this->data = $data;
72 $this->N = 0;
73 $this->ignore_whitespace = $whitespace;
74 $this->line = 1;
77 function getLine()
79 return $this->line;
82 public $custom_tags=array();
84 function is_custom_tag()
86 static $tag=NULL;
87 if (!$tag) {
88 $tag = Extensions::getInstance('Haanga_tag');
90 $value = $tag->isValid($this->value);
91 $this->token = $value ? $value : Parser::T_ALPHA;
95 private $_yy_state = 1;
96 private $_yy_stack = array();
98 function yylex()
100 return $this->{'yylex' . $this->_yy_state}();
103 function yypushstate($state)
105 array_push($this->_yy_stack, $this->_yy_state);
106 $this->_yy_state = $state;
109 function yypopstate()
111 $this->_yy_state = array_pop($this->_yy_stack);
114 function yybegin($state)
116 $this->_yy_state = $state;
121 function yylex1()
123 $tokenMap = array (
124 1 => 0,
125 2 => 0,
126 3 => 0,
127 4 => 2,
129 if ($this->N >= strlen($this->data)) {
130 return false; // end of input
132 $yy_global_pattern = "/^(\\{%)|^(\\{#)|^(\\{\\{)|^(([^{]+(.[^%{#])?)+)/";
134 do {
135 if (preg_match($yy_global_pattern, substr($this->data, $this->N), $yymatches)) {
136 $yysubmatches = $yymatches;
137 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
138 if (!count($yymatches)) {
139 throw new Exception('Error: lexing failed because a rule matched' .
140 'an empty string. Input "' . substr($this->data,
141 $this->N, 5) . '... state IN_HTML');
143 next($yymatches); // skip global match
144 $this->token = key($yymatches); // token number
145 if ($tokenMap[$this->token]) {
146 // extract sub-patterns for passing to lex function
147 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
148 $tokenMap[$this->token]);
149 } else {
150 $yysubmatches = array();
152 $this->value = current($yymatches); // token value
153 $r = $this->{'yy_r1_' . $this->token}($yysubmatches);
154 if ($r === null) {
155 $this->N += strlen($this->value);
156 $this->line += substr_count($this->value, "\n");
157 // accept this token
158 return true;
159 } elseif ($r === true) {
160 // we have changed state
161 // process this token in the new state
162 return $this->yylex();
163 } elseif ($r === false) {
164 $this->N += strlen($this->value);
165 $this->line += substr_count($this->value, "\n");
166 if ($this->N >= strlen($this->data)) {
167 return false; // end of input
169 // skip this token
170 continue;
171 } else { $yy_yymore_patterns = array(
172 1 => array(0, "^(\\{#)|^(\\{\\{)|^(([^{]+(.[^%{#])?)+)"),
173 2 => array(0, "^(\\{\\{)|^(([^{]+(.[^%{#])?)+)"),
174 3 => array(0, "^(([^{]+(.[^%{#])?)+)"),
175 4 => array(2, ""),
178 // yymore is needed
179 do {
180 if (!strlen($yy_yymore_patterns[$this->token][1])) {
181 throw new Exception('cannot do yymore for the last token');
183 $yysubmatches = array();
184 if (preg_match('/' . $yy_yymore_patterns[$this->token][1] . '/',
185 substr($this->data, $this->N), $yymatches)) {
186 $yysubmatches = $yymatches;
187 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
188 next($yymatches); // skip global match
189 $this->token += key($yymatches) + $yy_yymore_patterns[$this->token][0]; // token number
190 $this->value = current($yymatches); // token value
191 $this->line = substr_count($this->value, "\n");
192 if ($tokenMap[$this->token]) {
193 // extract sub-patterns for passing to lex function
194 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
195 $tokenMap[$this->token]);
196 } else {
197 $yysubmatches = array();
200 $r = $this->{'yy_r1_' . $this->token}($yysubmatches);
201 } while ($r !== null && !is_bool($r));
202 if ($r === true) {
203 // we have changed state
204 // process this token in the new state
205 return $this->yylex();
206 } elseif ($r === false) {
207 $this->N += strlen($this->value);
208 $this->line += substr_count($this->value, "\n");
209 if ($this->N >= strlen($this->data)) {
210 return false; // end of input
212 // skip this token
213 continue;
214 } else {
215 // accept
216 $this->N += strlen($this->value);
217 $this->line += substr_count($this->value, "\n");
218 return true;
221 } else {
222 throw new Exception('Unexpected input at line' . $this->line .
223 ': ' . $this->data[$this->N]);
225 break;
226 } while (true);
228 } // end function
231 const IN_HTML = 1;
232 function yy_r1_1($yy_subpatterns)
235 $this->token = Parser::T_OPEN_TAG;
236 $this->yypushstate(self::IN_CODE);
238 function yy_r1_2($yy_subpatterns)
241 $this->token = Parser::T_COMMENT_OPEN;
242 $this->yypushstate(self::IN_COMMENT);
244 function yy_r1_3($yy_subpatterns)
247 $this->token = Parser::T_PRINT_OPEN;
248 $this->yypushstate(self::IN_PRINT);
250 function yy_r1_4($yy_subpatterns)
253 $this->token = Parser::T_HTML;
257 function yylex2()
259 $tokenMap = array (
260 1 => 0,
261 2 => 0,
262 3 => 0,
263 4 => 0,
264 5 => 0,
265 6 => 0,
266 7 => 0,
267 8 => 0,
268 9 => 0,
269 10 => 0,
270 11 => 0,
271 12 => 0,
272 13 => 0,
273 14 => 0,
274 15 => 0,
275 16 => 0,
276 17 => 0,
277 18 => 0,
278 19 => 0,
279 20 => 0,
280 21 => 0,
281 22 => 0,
282 23 => 0,
283 24 => 0,
284 25 => 0,
285 26 => 0,
286 27 => 0,
287 28 => 0,
288 29 => 0,
289 30 => 0,
290 31 => 0,
291 32 => 0,
292 33 => 0,
293 34 => 0,
294 35 => 0,
295 36 => 0,
296 37 => 0,
297 38 => 0,
298 39 => 0,
299 40 => 0,
300 41 => 0,
301 42 => 0,
302 43 => 0,
303 44 => 0,
304 45 => 0,
305 46 => 0,
306 47 => 0,
307 48 => 0,
308 49 => 0,
309 50 => 1,
310 52 => 0,
311 53 => 0,
312 54 => 1,
313 56 => 2,
314 59 => 1,
315 61 => 0,
317 if ($this->N >= strlen($this->data)) {
318 return false; // end of input
320 $yy_global_pattern = "/^(%\\})|^(\\.)|^(for[^a-zA-Z0-9])|^(empty[^a-zA-Z0-9])|^(firstof[^a-zA-Z0-9])|^(block[^a-zA-Z0-9])|^(&&)|^(AND)|^(\\|\\|)|^(OR)|^(==)|^(!=)|^(>=)|^(\\[)|^(\\])|^(>)|^(<)|^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)/";
322 do {
323 if (preg_match($yy_global_pattern, substr($this->data, $this->N), $yymatches)) {
324 $yysubmatches = $yymatches;
325 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
326 if (!count($yymatches)) {
327 throw new Exception('Error: lexing failed because a rule matched' .
328 'an empty string. Input "' . substr($this->data,
329 $this->N, 5) . '... state IN_CODE');
331 next($yymatches); // skip global match
332 $this->token = key($yymatches); // token number
333 if ($tokenMap[$this->token]) {
334 // extract sub-patterns for passing to lex function
335 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
336 $tokenMap[$this->token]);
337 } else {
338 $yysubmatches = array();
340 $this->value = current($yymatches); // token value
341 $r = $this->{'yy_r2_' . $this->token}($yysubmatches);
342 if ($r === null) {
343 $this->N += strlen($this->value);
344 $this->line += substr_count($this->value, "\n");
345 // accept this token
346 return true;
347 } elseif ($r === true) {
348 // we have changed state
349 // process this token in the new state
350 return $this->yylex();
351 } elseif ($r === false) {
352 $this->N += strlen($this->value);
353 $this->line += substr_count($this->value, "\n");
354 if ($this->N >= strlen($this->data)) {
355 return false; // end of input
357 // skip this token
358 continue;
359 } else { $yy_yymore_patterns = array(
360 1 => array(0, "^(\\.)|^(for[^a-zA-Z0-9])|^(empty[^a-zA-Z0-9])|^(firstof[^a-zA-Z0-9])|^(block[^a-zA-Z0-9])|^(&&)|^(AND)|^(\\|\\|)|^(OR)|^(==)|^(!=)|^(>=)|^(\\[)|^(\\])|^(>)|^(<)|^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
361 2 => array(0, "^(for[^a-zA-Z0-9])|^(empty[^a-zA-Z0-9])|^(firstof[^a-zA-Z0-9])|^(block[^a-zA-Z0-9])|^(&&)|^(AND)|^(\\|\\|)|^(OR)|^(==)|^(!=)|^(>=)|^(\\[)|^(\\])|^(>)|^(<)|^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
362 3 => array(0, "^(empty[^a-zA-Z0-9])|^(firstof[^a-zA-Z0-9])|^(block[^a-zA-Z0-9])|^(&&)|^(AND)|^(\\|\\|)|^(OR)|^(==)|^(!=)|^(>=)|^(\\[)|^(\\])|^(>)|^(<)|^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
363 4 => array(0, "^(firstof[^a-zA-Z0-9])|^(block[^a-zA-Z0-9])|^(&&)|^(AND)|^(\\|\\|)|^(OR)|^(==)|^(!=)|^(>=)|^(\\[)|^(\\])|^(>)|^(<)|^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
364 5 => array(0, "^(block[^a-zA-Z0-9])|^(&&)|^(AND)|^(\\|\\|)|^(OR)|^(==)|^(!=)|^(>=)|^(\\[)|^(\\])|^(>)|^(<)|^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
365 6 => array(0, "^(&&)|^(AND)|^(\\|\\|)|^(OR)|^(==)|^(!=)|^(>=)|^(\\[)|^(\\])|^(>)|^(<)|^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
366 7 => array(0, "^(AND)|^(\\|\\|)|^(OR)|^(==)|^(!=)|^(>=)|^(\\[)|^(\\])|^(>)|^(<)|^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
367 8 => array(0, "^(\\|\\|)|^(OR)|^(==)|^(!=)|^(>=)|^(\\[)|^(\\])|^(>)|^(<)|^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
368 9 => array(0, "^(OR)|^(==)|^(!=)|^(>=)|^(\\[)|^(\\])|^(>)|^(<)|^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
369 10 => array(0, "^(==)|^(!=)|^(>=)|^(\\[)|^(\\])|^(>)|^(<)|^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
370 11 => array(0, "^(!=)|^(>=)|^(\\[)|^(\\])|^(>)|^(<)|^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
371 12 => array(0, "^(>=)|^(\\[)|^(\\])|^(>)|^(<)|^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
372 13 => array(0, "^(\\[)|^(\\])|^(>)|^(<)|^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
373 14 => array(0, "^(\\])|^(>)|^(<)|^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
374 15 => array(0, "^(>)|^(<)|^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
375 16 => array(0, "^(<)|^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
376 17 => array(0, "^(=<)|^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
377 18 => array(0, "^(\\|)|^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
378 19 => array(0, "^(:)|^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
379 20 => array(0, "^(filter[^a-zA-Z0-9])|^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
380 21 => array(0, "^(regroup[^a-zA-Z0-9])|^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
381 22 => array(0, "^(endfilter[^a-zA-Z0-9])|^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
382 23 => array(0, "^(autoescape[^a-zA-Z0-9])|^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
383 24 => array(0, "^(endautoescape[^a-zA-Z0-9])|^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
384 25 => array(0, "^(endblock[^a-zA-Z0-9])|^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
385 26 => array(0, "^(ifchanged[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
386 27 => array(0, "^(else[^a-zA-Z0-9])|^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
387 28 => array(0, "^(endifchanged[^a-zA-Z0-9])|^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
388 29 => array(0, "^(in[^a-zA-Z0-9])|^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
389 30 => array(0, "^(endfor[^a-zA-Z0-9])|^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
390 31 => array(0, "^(with[^a-zA-Z0-9])|^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
391 32 => array(0, "^(endwith[^a-zA-Z0-9])|^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
392 33 => array(0, "^(as)|^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
393 34 => array(0, "^(on)|^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
394 35 => array(0, "^(off)|^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
395 36 => array(0, "^(by)|^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
396 37 => array(0, "^(if[^a-zA-Z0-9])|^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
397 38 => array(0, "^(else[^a-zA-Z0-9])|^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
398 39 => array(0, "^(endif[^a-zA-Z0-9])|^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
399 40 => array(0, "^(\\()|^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
400 41 => array(0, "^(\\))|^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
401 42 => array(0, "^(%)|^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
402 43 => array(0, "^(,)|^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
403 44 => array(0, "^(\\+)|^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
404 45 => array(0, "^(\\*)|^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
405 46 => array(0, "^(\/)|^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
406 47 => array(0, "^(')|^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
407 48 => array(0, "^(\")|^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
408 49 => array(0, "^(end([a-zA-Z][a-zA-Z0-9]*))|^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
409 50 => array(1, "^(extends[^a-zA-Z0-9])|^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
410 52 => array(1, "^(include[^a-zA-Z0-9])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
411 53 => array(1, "^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
412 54 => array(2, "^(([0-9])+\\.([0-9])+)|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
413 56 => array(4, "^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
414 59 => array(5, "^([ \r\t\n]+)"),
415 61 => array(5, ""),
418 // yymore is needed
419 do {
420 if (!strlen($yy_yymore_patterns[$this->token][1])) {
421 throw new Exception('cannot do yymore for the last token');
423 $yysubmatches = array();
424 if (preg_match('/' . $yy_yymore_patterns[$this->token][1] . '/',
425 substr($this->data, $this->N), $yymatches)) {
426 $yysubmatches = $yymatches;
427 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
428 next($yymatches); // skip global match
429 $this->token += key($yymatches) + $yy_yymore_patterns[$this->token][0]; // token number
430 $this->value = current($yymatches); // token value
431 $this->line = substr_count($this->value, "\n");
432 if ($tokenMap[$this->token]) {
433 // extract sub-patterns for passing to lex function
434 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
435 $tokenMap[$this->token]);
436 } else {
437 $yysubmatches = array();
440 $r = $this->{'yy_r2_' . $this->token}($yysubmatches);
441 } while ($r !== null && !is_bool($r));
442 if ($r === true) {
443 // we have changed state
444 // process this token in the new state
445 return $this->yylex();
446 } elseif ($r === false) {
447 $this->N += strlen($this->value);
448 $this->line += substr_count($this->value, "\n");
449 if ($this->N >= strlen($this->data)) {
450 return false; // end of input
452 // skip this token
453 continue;
454 } else {
455 // accept
456 $this->N += strlen($this->value);
457 $this->line += substr_count($this->value, "\n");
458 return true;
461 } else {
462 throw new Exception('Unexpected input at line' . $this->line .
463 ': ' . $this->data[$this->N]);
465 break;
466 } while (true);
468 } // end function
471 const IN_CODE = 2;
472 function yy_r2_1($yy_subpatterns)
475 $this->token = Parser::T_CLOSE_TAG;
476 $this->yypopstate();
478 function yy_r2_2($yy_subpatterns)
481 $this->token = Parser::T_DOT;
483 function yy_r2_3($yy_subpatterns)
486 $this->token = Parser::T_FOR;
488 function yy_r2_4($yy_subpatterns)
491 $this->token = Parser::T_EMPTY;
493 function yy_r2_5($yy_subpatterns)
496 $this->token = Parser::T_FIRST_OF;
498 function yy_r2_6($yy_subpatterns)
501 $this->token = Parser::T_BLOCK;
503 function yy_r2_7($yy_subpatterns)
506 $this->token = Parser::T_AND;
508 function yy_r2_8($yy_subpatterns)
511 $this->token = Parser::T_AND;
513 function yy_r2_9($yy_subpatterns)
516 $this->token = Parser::T_OR;
518 function yy_r2_10($yy_subpatterns)
521 $this->token = Parser::T_OR;
523 function yy_r2_11($yy_subpatterns)
526 $this->token = Parser::T_EQ;
528 function yy_r2_12($yy_subpatterns)
531 $this->token = Parser::T_NE;
533 function yy_r2_13($yy_subpatterns)
536 $this->token = Parser::T_GE;
538 function yy_r2_14($yy_subpatterns)
541 $this->token = Parser::T_BRACKETS_OPEN;
543 function yy_r2_15($yy_subpatterns)
546 $this->token = Parser::T_BRACKETS_CLOSE;
548 function yy_r2_16($yy_subpatterns)
551 $this->token = Parser::T_GT;
553 function yy_r2_17($yy_subpatterns)
556 $this->token = Parser::T_LT;
558 function yy_r2_18($yy_subpatterns)
561 $this->token = Parser::T_LE;
563 function yy_r2_19($yy_subpatterns)
566 $this->token = Parser::T_PIPE;
568 function yy_r2_20($yy_subpatterns)
571 $this->token = Parser::T_COLON;
573 function yy_r2_21($yy_subpatterns)
576 $this->token = Parser::T_FILTER;
578 function yy_r2_22($yy_subpatterns)
581 $this->token = Parser::T_REGROUP;
583 function yy_r2_23($yy_subpatterns)
586 $this->token = Parser::T_END_FILTER;
588 function yy_r2_24($yy_subpatterns)
591 $this->token = Parser::T_AUTOESCAPE;
593 function yy_r2_25($yy_subpatterns)
596 $this->token = Parser::T_END_AUTOESCAPE;
598 function yy_r2_26($yy_subpatterns)
601 $this->token = Parser::T_END_BLOCK;
603 function yy_r2_27($yy_subpatterns)
606 $this->token = Parser::T_IFCHANGED;
608 function yy_r2_28($yy_subpatterns)
611 $this->token = Parser::T_ELSE;
613 function yy_r2_29($yy_subpatterns)
616 $this->token = Parser::T_ENDIFCHANGED;
618 function yy_r2_30($yy_subpatterns)
621 $this->token = Parser::T_IN;
623 function yy_r2_31($yy_subpatterns)
626 $this->token = Parser::T_CLOSEFOR;
628 function yy_r2_32($yy_subpatterns)
631 $this->token = Parser::T_WITH;
633 function yy_r2_33($yy_subpatterns)
636 $this->token = Parser::T_ENDWITH;
638 function yy_r2_34($yy_subpatterns)
641 $this->token = Parser::T_AS;
643 function yy_r2_35($yy_subpatterns)
646 $this->token = Parser::T_ON;
648 function yy_r2_36($yy_subpatterns)
651 $this->token = Parser::T_OFF;
653 function yy_r2_37($yy_subpatterns)
656 $this->token = Parser::T_BY;
658 function yy_r2_38($yy_subpatterns)
661 $this->token = Parser::T_IF;
663 function yy_r2_39($yy_subpatterns)
666 $this->token = Parser::T_ELSE;
668 function yy_r2_40($yy_subpatterns)
671 $this->token = Parser::T_ENDIF;
673 function yy_r2_41($yy_subpatterns)
676 $this->token = Parser::T_LPARENT;
678 function yy_r2_42($yy_subpatterns)
681 $this->token = Parser::T_RPARENT;
683 function yy_r2_43($yy_subpatterns)
686 $this->token = Parser::T_MOD;
688 function yy_r2_44($yy_subpatterns)
691 $this->token = Parser::T_COMMA;
693 function yy_r2_45($yy_subpatterns)
696 $this->token = Parser::T_PLUS;
698 function yy_r2_46($yy_subpatterns)
701 $this->token = Parser::T_TIMES;
703 function yy_r2_47($yy_subpatterns)
706 $this->token = Parser::T_DIV;
708 function yy_r2_48($yy_subpatterns)
711 $this->token = Parser::T_STRING_SINGLE_INIT;
712 $this->yypushstate(self::IN_STRING_SINGLE);
714 function yy_r2_49($yy_subpatterns)
717 $this->token = Parser::T_STRING_DOUBLE_INIT;
718 $this->yypushstate(self::IN_STRING_DOUBLE);
720 function yy_r2_50($yy_subpatterns)
723 $this->token = Parser::T_CUSTOM_END;
725 function yy_r2_52($yy_subpatterns)
728 $this->token = Parser::T_EXTENDS;
730 function yy_r2_53($yy_subpatterns)
733 $this->token = Parser::T_INCLUDE;
735 function yy_r2_54($yy_subpatterns)
738 $this->token = Parser::T_NUMERIC;
740 function yy_r2_56($yy_subpatterns)
743 $this->token = Parser::T_NUMERIC;
745 function yy_r2_59($yy_subpatterns)
748 $this->is_custom_tag();
750 function yy_r2_61($yy_subpatterns)
753 return FALSE;
757 function yylex3()
759 $tokenMap = array (
760 1 => 0,
761 2 => 0,
762 3 => 0,
763 4 => 0,
764 5 => 0,
765 6 => 0,
766 7 => 1,
767 9 => 2,
768 12 => 0,
769 13 => 0,
770 14 => 1,
771 16 => 0,
773 if ($this->N >= strlen($this->data)) {
774 return false; // end of input
776 $yy_global_pattern = "/^(\\}\\})|^(\\|)|^(:)|^(\\.)|^(\\[)|^(\\])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(')|^(\")|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)/";
778 do {
779 if (preg_match($yy_global_pattern, substr($this->data, $this->N), $yymatches)) {
780 $yysubmatches = $yymatches;
781 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
782 if (!count($yymatches)) {
783 throw new Exception('Error: lexing failed because a rule matched' .
784 'an empty string. Input "' . substr($this->data,
785 $this->N, 5) . '... state IN_PRINT');
787 next($yymatches); // skip global match
788 $this->token = key($yymatches); // token number
789 if ($tokenMap[$this->token]) {
790 // extract sub-patterns for passing to lex function
791 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
792 $tokenMap[$this->token]);
793 } else {
794 $yysubmatches = array();
796 $this->value = current($yymatches); // token value
797 $r = $this->{'yy_r3_' . $this->token}($yysubmatches);
798 if ($r === null) {
799 $this->N += strlen($this->value);
800 $this->line += substr_count($this->value, "\n");
801 // accept this token
802 return true;
803 } elseif ($r === true) {
804 // we have changed state
805 // process this token in the new state
806 return $this->yylex();
807 } elseif ($r === false) {
808 $this->N += strlen($this->value);
809 $this->line += substr_count($this->value, "\n");
810 if ($this->N >= strlen($this->data)) {
811 return false; // end of input
813 // skip this token
814 continue;
815 } else { $yy_yymore_patterns = array(
816 1 => array(0, "^(\\|)|^(:)|^(\\.)|^(\\[)|^(\\])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(')|^(\")|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
817 2 => array(0, "^(:)|^(\\.)|^(\\[)|^(\\])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(')|^(\")|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
818 3 => array(0, "^(\\.)|^(\\[)|^(\\])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(')|^(\")|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
819 4 => array(0, "^(\\[)|^(\\])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(')|^(\")|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
820 5 => array(0, "^(\\])|^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(')|^(\")|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
821 6 => array(0, "^(([0-9])+)|^(([0-9])+\\.([0-9])+)|^(')|^(\")|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
822 7 => array(1, "^(([0-9])+\\.([0-9])+)|^(')|^(\")|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
823 9 => array(3, "^(')|^(\")|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
824 12 => array(3, "^(\")|^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
825 13 => array(3, "^(([a-zA-Z_][a-zA-Z_0-9]*))|^([ \r\t\n]+)"),
826 14 => array(4, "^([ \r\t\n]+)"),
827 16 => array(4, ""),
830 // yymore is needed
831 do {
832 if (!strlen($yy_yymore_patterns[$this->token][1])) {
833 throw new Exception('cannot do yymore for the last token');
835 $yysubmatches = array();
836 if (preg_match('/' . $yy_yymore_patterns[$this->token][1] . '/',
837 substr($this->data, $this->N), $yymatches)) {
838 $yysubmatches = $yymatches;
839 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
840 next($yymatches); // skip global match
841 $this->token += key($yymatches) + $yy_yymore_patterns[$this->token][0]; // token number
842 $this->value = current($yymatches); // token value
843 $this->line = substr_count($this->value, "\n");
844 if ($tokenMap[$this->token]) {
845 // extract sub-patterns for passing to lex function
846 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
847 $tokenMap[$this->token]);
848 } else {
849 $yysubmatches = array();
852 $r = $this->{'yy_r3_' . $this->token}($yysubmatches);
853 } while ($r !== null && !is_bool($r));
854 if ($r === true) {
855 // we have changed state
856 // process this token in the new state
857 return $this->yylex();
858 } elseif ($r === false) {
859 $this->N += strlen($this->value);
860 $this->line += substr_count($this->value, "\n");
861 if ($this->N >= strlen($this->data)) {
862 return false; // end of input
864 // skip this token
865 continue;
866 } else {
867 // accept
868 $this->N += strlen($this->value);
869 $this->line += substr_count($this->value, "\n");
870 return true;
873 } else {
874 throw new Exception('Unexpected input at line' . $this->line .
875 ': ' . $this->data[$this->N]);
877 break;
878 } while (true);
880 } // end function
883 const IN_PRINT = 3;
884 function yy_r3_1($yy_subpatterns)
887 $this->token = Parser::T_PRINT_CLOSE;
888 $this->yypopstate();
890 function yy_r3_2($yy_subpatterns)
893 $this->token = Parser::T_PIPE;
895 function yy_r3_3($yy_subpatterns)
898 $this->token = Parser::T_COLON;
900 function yy_r3_4($yy_subpatterns)
903 $this->token = Parser::T_DOT;
905 function yy_r3_5($yy_subpatterns)
908 $this->token = Parser::T_BRACKETS_OPEN;
910 function yy_r3_6($yy_subpatterns)
913 $this->token = Parser::T_BRACKETS_CLOSE;
915 function yy_r3_7($yy_subpatterns)
918 $this->token = Parser::T_NUMERIC;
920 function yy_r3_9($yy_subpatterns)
923 $this->token = Parser::T_NUMERIC;
925 function yy_r3_12($yy_subpatterns)
928 $this->token = Parser::T_STRING_SINGLE_INIT;
929 $this->yypushstate(self::IN_STRING_SINGLE);
931 function yy_r3_13($yy_subpatterns)
934 $this->token = Parser::T_STRING_DOUBLE_INIT;
935 $this->yypushstate(self::IN_STRING_DOUBLE);
937 function yy_r3_14($yy_subpatterns)
940 $this->token = Parser::T_ALPHA;
942 function yy_r3_16($yy_subpatterns)
945 return FALSE;
950 function yylex4()
952 $tokenMap = array (
953 1 => 0,
954 2 => 0,
955 3 => 0,
956 4 => 0,
958 if ($this->N >= strlen($this->data)) {
959 return false; // end of input
961 $yy_global_pattern = "/^(\\\\\")|^(\\\\')|^(\")|^([^\"\\\\]+)/";
963 do {
964 if (preg_match($yy_global_pattern, substr($this->data, $this->N), $yymatches)) {
965 $yysubmatches = $yymatches;
966 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
967 if (!count($yymatches)) {
968 throw new Exception('Error: lexing failed because a rule matched' .
969 'an empty string. Input "' . substr($this->data,
970 $this->N, 5) . '... state IN_STRING_DOUBLE');
972 next($yymatches); // skip global match
973 $this->token = key($yymatches); // token number
974 if ($tokenMap[$this->token]) {
975 // extract sub-patterns for passing to lex function
976 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
977 $tokenMap[$this->token]);
978 } else {
979 $yysubmatches = array();
981 $this->value = current($yymatches); // token value
982 $r = $this->{'yy_r4_' . $this->token}($yysubmatches);
983 if ($r === null) {
984 $this->N += strlen($this->value);
985 $this->line += substr_count($this->value, "\n");
986 // accept this token
987 return true;
988 } elseif ($r === true) {
989 // we have changed state
990 // process this token in the new state
991 return $this->yylex();
992 } elseif ($r === false) {
993 $this->N += strlen($this->value);
994 $this->line += substr_count($this->value, "\n");
995 if ($this->N >= strlen($this->data)) {
996 return false; // end of input
998 // skip this token
999 continue;
1000 } else { $yy_yymore_patterns = array(
1001 1 => array(0, "^(\\\\')|^(\")|^([^\"\\\\]+)"),
1002 2 => array(0, "^(\")|^([^\"\\\\]+)"),
1003 3 => array(0, "^([^\"\\\\]+)"),
1004 4 => array(0, ""),
1007 // yymore is needed
1008 do {
1009 if (!strlen($yy_yymore_patterns[$this->token][1])) {
1010 throw new Exception('cannot do yymore for the last token');
1012 $yysubmatches = array();
1013 if (preg_match('/' . $yy_yymore_patterns[$this->token][1] . '/',
1014 substr($this->data, $this->N), $yymatches)) {
1015 $yysubmatches = $yymatches;
1016 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
1017 next($yymatches); // skip global match
1018 $this->token += key($yymatches) + $yy_yymore_patterns[$this->token][0]; // token number
1019 $this->value = current($yymatches); // token value
1020 $this->line = substr_count($this->value, "\n");
1021 if ($tokenMap[$this->token]) {
1022 // extract sub-patterns for passing to lex function
1023 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
1024 $tokenMap[$this->token]);
1025 } else {
1026 $yysubmatches = array();
1029 $r = $this->{'yy_r4_' . $this->token}($yysubmatches);
1030 } while ($r !== null && !is_bool($r));
1031 if ($r === true) {
1032 // we have changed state
1033 // process this token in the new state
1034 return $this->yylex();
1035 } elseif ($r === false) {
1036 $this->N += strlen($this->value);
1037 $this->line += substr_count($this->value, "\n");
1038 if ($this->N >= strlen($this->data)) {
1039 return false; // end of input
1041 // skip this token
1042 continue;
1043 } else {
1044 // accept
1045 $this->N += strlen($this->value);
1046 $this->line += substr_count($this->value, "\n");
1047 return true;
1050 } else {
1051 throw new Exception('Unexpected input at line' . $this->line .
1052 ': ' . $this->data[$this->N]);
1054 break;
1055 } while (true);
1057 } // end function
1060 const IN_STRING_DOUBLE = 4;
1061 function yy_r4_1($yy_subpatterns)
1064 $this->token = Parser::T_STRING_CONTENT;
1065 $this->value = "\"";
1066 $this->N += 1;
1068 function yy_r4_2($yy_subpatterns)
1071 $this->token = Parser::T_STRING_CONTENT;
1072 $this->value = "'";
1073 $this->N += 1;
1075 function yy_r4_3($yy_subpatterns)
1078 $this->token = Parser::T_STRING_DOUBLE_END;
1079 $this->yypopstate();
1081 function yy_r4_4($yy_subpatterns)
1084 $this->token = Parser::T_STRING_CONTENT;
1089 function yylex5()
1091 $tokenMap = array (
1092 1 => 0,
1093 2 => 0,
1094 3 => 0,
1095 4 => 0,
1097 if ($this->N >= strlen($this->data)) {
1098 return false; // end of input
1100 $yy_global_pattern = "/^(\\\\')|^(\\\\\")|^(')|^([^'\\\\]+)/";
1102 do {
1103 if (preg_match($yy_global_pattern, substr($this->data, $this->N), $yymatches)) {
1104 $yysubmatches = $yymatches;
1105 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
1106 if (!count($yymatches)) {
1107 throw new Exception('Error: lexing failed because a rule matched' .
1108 'an empty string. Input "' . substr($this->data,
1109 $this->N, 5) . '... state IN_STRING_SINGLE');
1111 next($yymatches); // skip global match
1112 $this->token = key($yymatches); // token number
1113 if ($tokenMap[$this->token]) {
1114 // extract sub-patterns for passing to lex function
1115 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
1116 $tokenMap[$this->token]);
1117 } else {
1118 $yysubmatches = array();
1120 $this->value = current($yymatches); // token value
1121 $r = $this->{'yy_r5_' . $this->token}($yysubmatches);
1122 if ($r === null) {
1123 $this->N += strlen($this->value);
1124 $this->line += substr_count($this->value, "\n");
1125 // accept this token
1126 return true;
1127 } elseif ($r === true) {
1128 // we have changed state
1129 // process this token in the new state
1130 return $this->yylex();
1131 } elseif ($r === false) {
1132 $this->N += strlen($this->value);
1133 $this->line += substr_count($this->value, "\n");
1134 if ($this->N >= strlen($this->data)) {
1135 return false; // end of input
1137 // skip this token
1138 continue;
1139 } else { $yy_yymore_patterns = array(
1140 1 => array(0, "^(\\\\\")|^(')|^([^'\\\\]+)"),
1141 2 => array(0, "^(')|^([^'\\\\]+)"),
1142 3 => array(0, "^([^'\\\\]+)"),
1143 4 => array(0, ""),
1146 // yymore is needed
1147 do {
1148 if (!strlen($yy_yymore_patterns[$this->token][1])) {
1149 throw new Exception('cannot do yymore for the last token');
1151 $yysubmatches = array();
1152 if (preg_match('/' . $yy_yymore_patterns[$this->token][1] . '/',
1153 substr($this->data, $this->N), $yymatches)) {
1154 $yysubmatches = $yymatches;
1155 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
1156 next($yymatches); // skip global match
1157 $this->token += key($yymatches) + $yy_yymore_patterns[$this->token][0]; // token number
1158 $this->value = current($yymatches); // token value
1159 $this->line = substr_count($this->value, "\n");
1160 if ($tokenMap[$this->token]) {
1161 // extract sub-patterns for passing to lex function
1162 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
1163 $tokenMap[$this->token]);
1164 } else {
1165 $yysubmatches = array();
1168 $r = $this->{'yy_r5_' . $this->token}($yysubmatches);
1169 } while ($r !== null && !is_bool($r));
1170 if ($r === true) {
1171 // we have changed state
1172 // process this token in the new state
1173 return $this->yylex();
1174 } elseif ($r === false) {
1175 $this->N += strlen($this->value);
1176 $this->line += substr_count($this->value, "\n");
1177 if ($this->N >= strlen($this->data)) {
1178 return false; // end of input
1180 // skip this token
1181 continue;
1182 } else {
1183 // accept
1184 $this->N += strlen($this->value);
1185 $this->line += substr_count($this->value, "\n");
1186 return true;
1189 } else {
1190 throw new Exception('Unexpected input at line' . $this->line .
1191 ': ' . $this->data[$this->N]);
1193 break;
1194 } while (true);
1196 } // end function
1199 const IN_STRING_SINGLE = 5;
1200 function yy_r5_1($yy_subpatterns)
1203 $this->token = Parser::T_STRING_CONTENT;
1204 $this->value = "'";
1205 $this->N += 1;
1207 function yy_r5_2($yy_subpatterns)
1210 $this->token = Parser::T_STRING_CONTENT;
1211 $this->value = "\"";
1212 $this->N += 1;
1214 function yy_r5_3($yy_subpatterns)
1217 $this->token = Parser::T_STRING_SINGLE_END;
1218 $this->yypopstate();
1220 function yy_r5_4($yy_subpatterns)
1223 $this->token = Parser::T_STRING_CONTENT;
1228 function yylex6()
1230 $tokenMap = array (
1231 1 => 1,
1233 if ($this->N >= strlen($this->data)) {
1234 return false; // end of input
1236 $yy_global_pattern = "/^(([^#]+#\\})+)/";
1238 do {
1239 if (preg_match($yy_global_pattern, substr($this->data, $this->N), $yymatches)) {
1240 $yysubmatches = $yymatches;
1241 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
1242 if (!count($yymatches)) {
1243 throw new Exception('Error: lexing failed because a rule matched' .
1244 'an empty string. Input "' . substr($this->data,
1245 $this->N, 5) . '... state IN_COMMENT');
1247 next($yymatches); // skip global match
1248 $this->token = key($yymatches); // token number
1249 if ($tokenMap[$this->token]) {
1250 // extract sub-patterns for passing to lex function
1251 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
1252 $tokenMap[$this->token]);
1253 } else {
1254 $yysubmatches = array();
1256 $this->value = current($yymatches); // token value
1257 $r = $this->{'yy_r6_' . $this->token}($yysubmatches);
1258 if ($r === null) {
1259 $this->N += strlen($this->value);
1260 $this->line += substr_count($this->value, "\n");
1261 // accept this token
1262 return true;
1263 } elseif ($r === true) {
1264 // we have changed state
1265 // process this token in the new state
1266 return $this->yylex();
1267 } elseif ($r === false) {
1268 $this->N += strlen($this->value);
1269 $this->line += substr_count($this->value, "\n");
1270 if ($this->N >= strlen($this->data)) {
1271 return false; // end of input
1273 // skip this token
1274 continue;
1275 } else { $yy_yymore_patterns = array(
1276 1 => array(0, ""),
1279 // yymore is needed
1280 do {
1281 if (!strlen($yy_yymore_patterns[$this->token][1])) {
1282 throw new Exception('cannot do yymore for the last token');
1284 $yysubmatches = array();
1285 if (preg_match('/' . $yy_yymore_patterns[$this->token][1] . '/',
1286 substr($this->data, $this->N), $yymatches)) {
1287 $yysubmatches = $yymatches;
1288 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
1289 next($yymatches); // skip global match
1290 $this->token += key($yymatches) + $yy_yymore_patterns[$this->token][0]; // token number
1291 $this->value = current($yymatches); // token value
1292 $this->line = substr_count($this->value, "\n");
1293 if ($tokenMap[$this->token]) {
1294 // extract sub-patterns for passing to lex function
1295 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
1296 $tokenMap[$this->token]);
1297 } else {
1298 $yysubmatches = array();
1301 $r = $this->{'yy_r6_' . $this->token}($yysubmatches);
1302 } while ($r !== null && !is_bool($r));
1303 if ($r === true) {
1304 // we have changed state
1305 // process this token in the new state
1306 return $this->yylex();
1307 } elseif ($r === false) {
1308 $this->N += strlen($this->value);
1309 $this->line += substr_count($this->value, "\n");
1310 if ($this->N >= strlen($this->data)) {
1311 return false; // end of input
1313 // skip this token
1314 continue;
1315 } else {
1316 // accept
1317 $this->N += strlen($this->value);
1318 $this->line += substr_count($this->value, "\n");
1319 return true;
1322 } else {
1323 throw new Exception('Unexpected input at line' . $this->line .
1324 ': ' . $this->data[$this->N]);
1326 break;
1327 } while (true);
1329 } // end function
1332 const IN_COMMENT = 6;
1333 function yy_r6_1($yy_subpatterns)
1336 $this->token = Parser::T_COMMENT;
1337 $this->yypopstate();