Commit | Line | Data |
---|---|---|
2aa91ff2 S |
1 | <?php |
2 | /** | |
cd8826ea S |
3 | * Smarty Internal Plugin Configfilelexer |
4 | * | |
5 | * This is the lexer to break the config file source into tokens | |
6 | * | |
7 | * @package Smarty | |
8 | * @subpackage Config | |
9 | * @author Uwe Tews | |
10 | */ | |
11 | ||
2aa91ff2 | 12 | /** |
cd8826ea S |
13 | * Smarty_Internal_Configfilelexer |
14 | * | |
15 | * This is the config file lexer. | |
16 | * It is generated from the smarty_internal_configfilelexer.plex file | |
17 | * | |
18 | * @package Smarty | |
19 | * @subpackage Compiler | |
20 | * @author Uwe Tews | |
21 | */ | |
2aa91ff2 S |
22 | class Smarty_Internal_Configfilelexer |
23 | { | |
cd8826ea | 24 | |
ccd27f54 S |
25 | /** |
26 | * Source | |
27 | * | |
28 | * @var string | |
29 | */ | |
2aa91ff2 | 30 | public $data; |
cd8826ea | 31 | |
ccd27f54 S |
32 | /** |
33 | * byte counter | |
34 | * | |
35 | * @var int | |
36 | */ | |
2aa91ff2 | 37 | public $counter; |
cd8826ea | 38 | |
ccd27f54 S |
39 | /** |
40 | * token number | |
41 | * | |
42 | * @var int | |
43 | */ | |
2aa91ff2 | 44 | public $token; |
cd8826ea | 45 | |
ccd27f54 S |
46 | /** |
47 | * token value | |
48 | * | |
49 | * @var string | |
50 | */ | |
2aa91ff2 | 51 | public $value; |
cd8826ea | 52 | |
ccd27f54 S |
53 | /** |
54 | * current line | |
55 | * | |
56 | * @var int | |
57 | */ | |
2aa91ff2 | 58 | public $line; |
cd8826ea | 59 | |
ccd27f54 S |
60 | /** |
61 | * state number | |
62 | * | |
63 | * @var int | |
64 | */ | |
65 | public $state = 1; | |
cd8826ea | 66 | |
ccd27f54 S |
67 | /** |
68 | * Smarty object | |
69 | * | |
70 | * @var Smarty | |
71 | */ | |
72 | public $smarty = null; | |
cd8826ea | 73 | |
ccd27f54 S |
74 | /** |
75 | * compiler object | |
76 | * | |
77 | * @var Smarty_Internal_Config_File_Compiler | |
78 | */ | |
79 | private $compiler = null; | |
cd8826ea | 80 | |
ccd27f54 S |
81 | /** |
82 | * copy of config_booleanize | |
83 | * | |
84 | * @var bool | |
85 | */ | |
86 | private $configBooleanize = false; | |
cd8826ea | 87 | |
ccd27f54 S |
88 | /** |
89 | * trace file | |
90 | * | |
91 | * @var resource | |
92 | */ | |
2aa91ff2 | 93 | public $yyTraceFILE; |
cd8826ea | 94 | |
ccd27f54 S |
95 | /** |
96 | * trace prompt | |
97 | * | |
98 | * @var string | |
99 | */ | |
2aa91ff2 | 100 | public $yyTracePrompt; |
cd8826ea | 101 | |
ccd27f54 S |
102 | /** |
103 | * state names | |
104 | * | |
105 | * @var array | |
106 | */ | |
2aa91ff2 | 107 | public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', 6 => 'TRIPPLE'); |
cd8826ea S |
108 | |
109 | /** | |
110 | * storage for assembled token patterns | |
111 | * | |
112 | * @var sring | |
113 | */ | |
114 | private $yy_global_pattern1 = null; | |
115 | ||
116 | private $yy_global_pattern2 = null; | |
117 | ||
118 | private $yy_global_pattern3 = null; | |
119 | ||
120 | private $yy_global_pattern4 = null; | |
121 | ||
122 | private $yy_global_pattern5 = null; | |
123 | ||
124 | private $yy_global_pattern6 = null; | |
125 | ||
ccd27f54 S |
126 | /** |
127 | * token names | |
128 | * | |
129 | * @var array | |
130 | */ | |
131 | public $smarty_token_names = array( // Text for parser error messages | |
2aa91ff2 S |
132 | ); |
133 | ||
ccd27f54 S |
134 | /** |
135 | * constructor | |
136 | * | |
137 | * @param string $data template source | |
138 | * @param Smarty_Internal_Config_File_Compiler $compiler | |
139 | */ | |
140 | function __construct($data, Smarty_Internal_Config_File_Compiler $compiler) | |
2aa91ff2 S |
141 | { |
142 | // set instance object | |
143 | self::instance($this); | |
144 | $this->data = $data . "\n"; //now all lines are \n-terminated | |
145 | $this->counter = 0; | |
146 | if (preg_match('/^\xEF\xBB\xBF/', $this->data, $match)) { | |
147 | $this->counter += strlen($match[0]); | |
148 | } | |
149 | $this->line = 1; | |
150 | $this->compiler = $compiler; | |
151 | $this->smarty = $compiler->smarty; | |
ccd27f54 | 152 | $this->configBooleanize = $this->smarty->config_booleanize; |
2aa91ff2 S |
153 | } |
154 | ||
155 | public static function &instance($new_instance = null) | |
156 | { | |
157 | static $instance = null; | |
158 | if (isset($new_instance) && is_object($new_instance)) { | |
159 | $instance = $new_instance; | |
160 | } | |
161 | return $instance; | |
162 | } | |
163 | ||
164 | public function PrintTrace() | |
165 | { | |
166 | $this->yyTraceFILE = fopen('php://output', 'w'); | |
167 | $this->yyTracePrompt = '<br>'; | |
168 | } | |
169 | ||
170 | private $_yy_state = 1; | |
cd8826ea | 171 | |
2aa91ff2 S |
172 | private $_yy_stack = array(); |
173 | ||
174 | public function yylex() | |
175 | { | |
176 | return $this->{'yylex' . $this->_yy_state}(); | |
177 | } | |
178 | ||
179 | public function yypushstate($state) | |
180 | { | |
181 | if ($this->yyTraceFILE) { | |
cd8826ea | 182 | fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); |
2aa91ff2 S |
183 | } |
184 | array_push($this->_yy_stack, $this->_yy_state); | |
185 | $this->_yy_state = $state; | |
186 | if ($this->yyTraceFILE) { | |
cd8826ea | 187 | fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); |
2aa91ff2 S |
188 | } |
189 | } | |
190 | ||
191 | public function yypopstate() | |
192 | { | |
cd8826ea S |
193 | if ($this->yyTraceFILE) { |
194 | fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); | |
2aa91ff2 | 195 | } |
cd8826ea | 196 | $this->_yy_state = array_pop($this->_yy_stack); |
2aa91ff2 | 197 | if ($this->yyTraceFILE) { |
cd8826ea | 198 | fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); |
2aa91ff2 S |
199 | } |
200 | } | |
201 | ||
202 | public function yybegin($state) | |
203 | { | |
cd8826ea | 204 | $this->_yy_state = $state; |
2aa91ff2 | 205 | if ($this->yyTraceFILE) { |
cd8826ea | 206 | fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); |
2aa91ff2 S |
207 | } |
208 | } | |
209 | ||
210 | public function yylex1() | |
211 | { | |
cd8826ea S |
212 | if (!isset($this->yy_global_pattern1)) { |
213 | $this->yy_global_pattern1 = "/\G(#|;)|\G(\\[)|\G(\\])|\G(=)|\G([ \t\r]+)|\G(\n)|\G([0-9]*[a-zA-Z_]\\w*)|\G([\S\s])/iS"; | |
214 | } | |
215 | if ($this->counter >= strlen($this->data)) { | |
2aa91ff2 S |
216 | return false; // end of input |
217 | } | |
2aa91ff2 S |
218 | |
219 | do { | |
cd8826ea | 220 | if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, null, $this->counter)) { |
2aa91ff2 | 221 | $yysubmatches = $yymatches; |
ccd27f54 | 222 | $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
cd8826ea S |
223 | if (empty($yymatches)) { |
224 | throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state START'); | |
2aa91ff2 S |
225 | } |
226 | next($yymatches); // skip global match | |
227 | $this->token = key($yymatches); // token number | |
2aa91ff2 | 228 | $this->value = current($yymatches); // token value |
cd8826ea | 229 | $r = $this->{'yy_r1_' . $this->token}(); |
2aa91ff2 S |
230 | if ($r === null) { |
231 | $this->counter += strlen($this->value); | |
232 | $this->line += substr_count($this->value, "\n"); | |
233 | // accept this token | |
234 | return true; | |
235 | } elseif ($r === true) { | |
236 | // we have changed state | |
237 | // process this token in the new state | |
238 | return $this->yylex(); | |
239 | } elseif ($r === false) { | |
240 | $this->counter += strlen($this->value); | |
241 | $this->line += substr_count($this->value, "\n"); | |
cd8826ea | 242 | if ($this->counter >= strlen($this->data)) { |
2aa91ff2 S |
243 | return false; // end of input |
244 | } | |
245 | // skip this token | |
246 | continue; | |
cd8826ea S |
247 | } |
248 | } else { | |
249 | throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]); | |
2aa91ff2 S |
250 | } |
251 | break; | |
252 | } while (true); | |
253 | } // end function | |
254 | ||
ccd27f54 | 255 | const START = 1; |
2aa91ff2 | 256 | |
cd8826ea | 257 | function yy_r1_1() |
2aa91ff2 S |
258 | { |
259 | ||
cd8826ea S |
260 | $this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART; |
261 | $this->yypushstate(self::COMMENT); | |
2aa91ff2 | 262 | } |
cd8826ea S |
263 | |
264 | function yy_r1_2() | |
2aa91ff2 S |
265 | { |
266 | ||
cd8826ea S |
267 | $this->token = Smarty_Internal_Configfileparser::TPC_OPENB; |
268 | $this->yypushstate(self::SECTION); | |
2aa91ff2 | 269 | } |
cd8826ea S |
270 | |
271 | function yy_r1_3() | |
2aa91ff2 S |
272 | { |
273 | ||
cd8826ea | 274 | $this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB; |
2aa91ff2 | 275 | } |
cd8826ea S |
276 | |
277 | function yy_r1_4() | |
2aa91ff2 S |
278 | { |
279 | ||
cd8826ea S |
280 | $this->token = Smarty_Internal_Configfileparser::TPC_EQUAL; |
281 | $this->yypushstate(self::VALUE); | |
2aa91ff2 | 282 | } |
cd8826ea S |
283 | |
284 | function yy_r1_5() | |
2aa91ff2 S |
285 | { |
286 | ||
cd8826ea | 287 | return false; |
2aa91ff2 | 288 | } |
cd8826ea S |
289 | |
290 | function yy_r1_6() | |
2aa91ff2 S |
291 | { |
292 | ||
cd8826ea | 293 | $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE; |
2aa91ff2 | 294 | } |
cd8826ea S |
295 | |
296 | function yy_r1_7() | |
2aa91ff2 S |
297 | { |
298 | ||
cd8826ea | 299 | $this->token = Smarty_Internal_Configfileparser::TPC_ID; |
2aa91ff2 S |
300 | } |
301 | ||
cd8826ea S |
302 | function yy_r1_8() |
303 | { | |
ccd27f54 | 304 | |
cd8826ea S |
305 | $this->token = Smarty_Internal_Configfileparser::TPC_OTHER; |
306 | } | |
ccd27f54 | 307 | |
2aa91ff2 S |
308 | public function yylex2() |
309 | { | |
cd8826ea S |
310 | if (!isset($this->yy_global_pattern2)) { |
311 | $this->yy_global_pattern2 = "/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/iS"; | |
312 | } | |
313 | if ($this->counter >= strlen($this->data)) { | |
2aa91ff2 S |
314 | return false; // end of input |
315 | } | |
2aa91ff2 S |
316 | |
317 | do { | |
cd8826ea | 318 | if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, null, $this->counter)) { |
2aa91ff2 | 319 | $yysubmatches = $yymatches; |
ccd27f54 | 320 | $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
cd8826ea S |
321 | if (empty($yymatches)) { |
322 | throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state VALUE'); | |
2aa91ff2 S |
323 | } |
324 | next($yymatches); // skip global match | |
325 | $this->token = key($yymatches); // token number | |
2aa91ff2 | 326 | $this->value = current($yymatches); // token value |
cd8826ea | 327 | $r = $this->{'yy_r2_' . $this->token}(); |
2aa91ff2 S |
328 | if ($r === null) { |
329 | $this->counter += strlen($this->value); | |
330 | $this->line += substr_count($this->value, "\n"); | |
331 | // accept this token | |
332 | return true; | |
333 | } elseif ($r === true) { | |
334 | // we have changed state | |
335 | // process this token in the new state | |
336 | return $this->yylex(); | |
337 | } elseif ($r === false) { | |
338 | $this->counter += strlen($this->value); | |
339 | $this->line += substr_count($this->value, "\n"); | |
cd8826ea | 340 | if ($this->counter >= strlen($this->data)) { |
2aa91ff2 S |
341 | return false; // end of input |
342 | } | |
343 | // skip this token | |
344 | continue; | |
cd8826ea S |
345 | } |
346 | } else { | |
347 | throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]); | |
2aa91ff2 S |
348 | } |
349 | break; | |
350 | } while (true); | |
351 | } // end function | |
352 | ||
ccd27f54 | 353 | const VALUE = 2; |
2aa91ff2 | 354 | |
cd8826ea | 355 | function yy_r2_1() |
2aa91ff2 S |
356 | { |
357 | ||
cd8826ea | 358 | return false; |
2aa91ff2 | 359 | } |
cd8826ea S |
360 | |
361 | function yy_r2_2() | |
2aa91ff2 S |
362 | { |
363 | ||
cd8826ea S |
364 | $this->token = Smarty_Internal_Configfileparser::TPC_FLOAT; |
365 | $this->yypopstate(); | |
2aa91ff2 | 366 | } |
cd8826ea S |
367 | |
368 | function yy_r2_3() | |
2aa91ff2 S |
369 | { |
370 | ||
cd8826ea S |
371 | $this->token = Smarty_Internal_Configfileparser::TPC_INT; |
372 | $this->yypopstate(); | |
2aa91ff2 | 373 | } |
cd8826ea S |
374 | |
375 | function yy_r2_4() | |
2aa91ff2 S |
376 | { |
377 | ||
cd8826ea S |
378 | $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES; |
379 | $this->yypushstate(self::TRIPPLE); | |
2aa91ff2 | 380 | } |
cd8826ea S |
381 | |
382 | function yy_r2_5() | |
2aa91ff2 S |
383 | { |
384 | ||
cd8826ea S |
385 | $this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING; |
386 | $this->yypopstate(); | |
2aa91ff2 | 387 | } |
cd8826ea S |
388 | |
389 | function yy_r2_6() | |
2aa91ff2 S |
390 | { |
391 | ||
cd8826ea | 392 | $this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING; |
ccd27f54 S |
393 | $this->yypopstate(); |
394 | } | |
cd8826ea S |
395 | |
396 | function yy_r2_7() | |
2aa91ff2 S |
397 | { |
398 | ||
cd8826ea S |
399 | if (!$this->configBooleanize || !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no"))) { |
400 | $this->yypopstate(); | |
401 | $this->yypushstate(self::NAKED_STRING_VALUE); | |
402 | return true; //reprocess in new state | |
403 | } else { | |
404 | $this->token = Smarty_Internal_Configfileparser::TPC_BOOL; | |
405 | $this->yypopstate(); | |
406 | } | |
2aa91ff2 | 407 | } |
cd8826ea S |
408 | |
409 | function yy_r2_8() | |
2aa91ff2 S |
410 | { |
411 | ||
cd8826ea S |
412 | $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; |
413 | $this->yypopstate(); | |
2aa91ff2 S |
414 | } |
415 | ||
cd8826ea S |
416 | function yy_r2_9() |
417 | { | |
ccd27f54 | 418 | |
cd8826ea S |
419 | $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; |
420 | $this->value = ""; | |
421 | $this->yypopstate(); | |
422 | } | |
ccd27f54 | 423 | |
2aa91ff2 S |
424 | public function yylex3() |
425 | { | |
cd8826ea S |
426 | if (!isset($this->yy_global_pattern3)) { |
427 | $this->yy_global_pattern3 = "/\G([^\n]+?(?=[ \t\r]*\n))/iS"; | |
428 | } | |
429 | if ($this->counter >= strlen($this->data)) { | |
2aa91ff2 S |
430 | return false; // end of input |
431 | } | |
2aa91ff2 S |
432 | |
433 | do { | |
cd8826ea | 434 | if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, null, $this->counter)) { |
2aa91ff2 | 435 | $yysubmatches = $yymatches; |
ccd27f54 | 436 | $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
cd8826ea S |
437 | if (empty($yymatches)) { |
438 | throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state NAKED_STRING_VALUE'); | |
2aa91ff2 S |
439 | } |
440 | next($yymatches); // skip global match | |
441 | $this->token = key($yymatches); // token number | |
2aa91ff2 | 442 | $this->value = current($yymatches); // token value |
cd8826ea | 443 | $r = $this->{'yy_r3_' . $this->token}(); |
2aa91ff2 S |
444 | if ($r === null) { |
445 | $this->counter += strlen($this->value); | |
446 | $this->line += substr_count($this->value, "\n"); | |
447 | // accept this token | |
448 | return true; | |
449 | } elseif ($r === true) { | |
450 | // we have changed state | |
451 | // process this token in the new state | |
452 | return $this->yylex(); | |
453 | } elseif ($r === false) { | |
454 | $this->counter += strlen($this->value); | |
455 | $this->line += substr_count($this->value, "\n"); | |
cd8826ea | 456 | if ($this->counter >= strlen($this->data)) { |
2aa91ff2 S |
457 | return false; // end of input |
458 | } | |
459 | // skip this token | |
460 | continue; | |
cd8826ea S |
461 | } |
462 | } else { | |
463 | throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]); | |
2aa91ff2 S |
464 | } |
465 | break; | |
466 | } while (true); | |
467 | } // end function | |
468 | ||
ccd27f54 | 469 | const NAKED_STRING_VALUE = 3; |
cd8826ea S |
470 | |
471 | function yy_r3_1() | |
2aa91ff2 S |
472 | { |
473 | ||
cd8826ea S |
474 | $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; |
475 | $this->yypopstate(); | |
2aa91ff2 S |
476 | } |
477 | ||
478 | public function yylex4() | |
479 | { | |
cd8826ea S |
480 | if (!isset($this->yy_global_pattern4)) { |
481 | $this->yy_global_pattern4 = "/\G([ \t\r]+)|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/iS"; | |
482 | } | |
483 | if ($this->counter >= strlen($this->data)) { | |
2aa91ff2 S |
484 | return false; // end of input |
485 | } | |
2aa91ff2 S |
486 | |
487 | do { | |
cd8826ea | 488 | if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, null, $this->counter)) { |
2aa91ff2 | 489 | $yysubmatches = $yymatches; |
ccd27f54 | 490 | $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
cd8826ea S |
491 | if (empty($yymatches)) { |
492 | throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state COMMENT'); | |
2aa91ff2 S |
493 | } |
494 | next($yymatches); // skip global match | |
495 | $this->token = key($yymatches); // token number | |
2aa91ff2 | 496 | $this->value = current($yymatches); // token value |
cd8826ea | 497 | $r = $this->{'yy_r4_' . $this->token}(); |
2aa91ff2 S |
498 | if ($r === null) { |
499 | $this->counter += strlen($this->value); | |
500 | $this->line += substr_count($this->value, "\n"); | |
501 | // accept this token | |
502 | return true; | |
503 | } elseif ($r === true) { | |
504 | // we have changed state | |
505 | // process this token in the new state | |
506 | return $this->yylex(); | |
507 | } elseif ($r === false) { | |
508 | $this->counter += strlen($this->value); | |
509 | $this->line += substr_count($this->value, "\n"); | |
cd8826ea | 510 | if ($this->counter >= strlen($this->data)) { |
2aa91ff2 S |
511 | return false; // end of input |
512 | } | |
513 | // skip this token | |
514 | continue; | |
cd8826ea S |
515 | } |
516 | } else { | |
517 | throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]); | |
2aa91ff2 S |
518 | } |
519 | break; | |
520 | } while (true); | |
521 | } // end function | |
522 | ||
ccd27f54 | 523 | const COMMENT = 4; |
2aa91ff2 | 524 | |
cd8826ea | 525 | function yy_r4_1() |
2aa91ff2 S |
526 | { |
527 | ||
cd8826ea | 528 | return false; |
2aa91ff2 | 529 | } |
cd8826ea S |
530 | |
531 | function yy_r4_2() | |
2aa91ff2 S |
532 | { |
533 | ||
cd8826ea | 534 | $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; |
2aa91ff2 S |
535 | } |
536 | ||
cd8826ea S |
537 | function yy_r4_3() |
538 | { | |
ccd27f54 | 539 | |
cd8826ea S |
540 | $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE; |
541 | $this->yypopstate(); | |
542 | } | |
ccd27f54 | 543 | |
2aa91ff2 S |
544 | public function yylex5() |
545 | { | |
cd8826ea S |
546 | if (!isset($this->yy_global_pattern5)) { |
547 | $this->yy_global_pattern5 = "/\G(\\.)|\G(.*?(?=[\.=[\]\r\n]))/iS"; | |
548 | } | |
549 | if ($this->counter >= strlen($this->data)) { | |
2aa91ff2 S |
550 | return false; // end of input |
551 | } | |
2aa91ff2 S |
552 | |
553 | do { | |
cd8826ea | 554 | if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, null, $this->counter)) { |
2aa91ff2 | 555 | $yysubmatches = $yymatches; |
ccd27f54 | 556 | $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
cd8826ea S |
557 | if (empty($yymatches)) { |
558 | throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state SECTION'); | |
2aa91ff2 S |
559 | } |
560 | next($yymatches); // skip global match | |
561 | $this->token = key($yymatches); // token number | |
2aa91ff2 | 562 | $this->value = current($yymatches); // token value |
cd8826ea | 563 | $r = $this->{'yy_r5_' . $this->token}(); |
2aa91ff2 S |
564 | if ($r === null) { |
565 | $this->counter += strlen($this->value); | |
566 | $this->line += substr_count($this->value, "\n"); | |
567 | // accept this token | |
568 | return true; | |
569 | } elseif ($r === true) { | |
570 | // we have changed state | |
571 | // process this token in the new state | |
572 | return $this->yylex(); | |
573 | } elseif ($r === false) { | |
574 | $this->counter += strlen($this->value); | |
575 | $this->line += substr_count($this->value, "\n"); | |
cd8826ea | 576 | if ($this->counter >= strlen($this->data)) { |
2aa91ff2 S |
577 | return false; // end of input |
578 | } | |
579 | // skip this token | |
580 | continue; | |
cd8826ea S |
581 | } |
582 | } else { | |
583 | throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]); | |
2aa91ff2 S |
584 | } |
585 | break; | |
586 | } while (true); | |
587 | } // end function | |
588 | ||
ccd27f54 | 589 | const SECTION = 5; |
cd8826ea S |
590 | |
591 | function yy_r5_1() | |
2aa91ff2 S |
592 | { |
593 | ||
cd8826ea | 594 | $this->token = Smarty_Internal_Configfileparser::TPC_DOT; |
2aa91ff2 | 595 | } |
cd8826ea S |
596 | |
597 | function yy_r5_2() | |
2aa91ff2 S |
598 | { |
599 | ||
cd8826ea S |
600 | $this->token = Smarty_Internal_Configfileparser::TPC_SECTION; |
601 | $this->yypopstate(); | |
2aa91ff2 S |
602 | } |
603 | ||
604 | public function yylex6() | |
605 | { | |
cd8826ea S |
606 | if (!isset($this->yy_global_pattern6)) { |
607 | $this->yy_global_pattern6 = "/\G(\"\"\"(?=[ \t\r]*[\n#;]))|\G([\S\s])/iS"; | |
608 | } | |
609 | if ($this->counter >= strlen($this->data)) { | |
2aa91ff2 S |
610 | return false; // end of input |
611 | } | |
2aa91ff2 S |
612 | |
613 | do { | |
cd8826ea | 614 | if (preg_match($this->yy_global_pattern6, $this->data, $yymatches, null, $this->counter)) { |
2aa91ff2 | 615 | $yysubmatches = $yymatches; |
ccd27f54 | 616 | $yymatches = preg_grep("/(.|\s)+/", $yysubmatches); |
cd8826ea S |
617 | if (empty($yymatches)) { |
618 | throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state TRIPPLE'); | |
2aa91ff2 S |
619 | } |
620 | next($yymatches); // skip global match | |
621 | $this->token = key($yymatches); // token number | |
2aa91ff2 | 622 | $this->value = current($yymatches); // token value |
cd8826ea | 623 | $r = $this->{'yy_r6_' . $this->token}(); |
2aa91ff2 S |
624 | if ($r === null) { |
625 | $this->counter += strlen($this->value); | |
626 | $this->line += substr_count($this->value, "\n"); | |
627 | // accept this token | |
628 | return true; | |
629 | } elseif ($r === true) { | |
630 | // we have changed state | |
631 | // process this token in the new state | |
632 | return $this->yylex(); | |
633 | } elseif ($r === false) { | |
634 | $this->counter += strlen($this->value); | |
635 | $this->line += substr_count($this->value, "\n"); | |
cd8826ea | 636 | if ($this->counter >= strlen($this->data)) { |
2aa91ff2 S |
637 | return false; // end of input |
638 | } | |
639 | // skip this token | |
640 | continue; | |
cd8826ea S |
641 | } |
642 | } else { | |
643 | throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]); | |
2aa91ff2 S |
644 | } |
645 | break; | |
646 | } while (true); | |
647 | } // end function | |
648 | ||
ccd27f54 | 649 | const TRIPPLE = 6; |
2aa91ff2 | 650 | |
cd8826ea | 651 | function yy_r6_1() |
2aa91ff2 S |
652 | { |
653 | ||
cd8826ea S |
654 | $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END; |
655 | $this->yypopstate(); | |
656 | $this->yypushstate(self::START); | |
2aa91ff2 | 657 | } |
2aa91ff2 | 658 | |
cd8826ea S |
659 | function yy_r6_2() |
660 | { | |
ccd27f54 | 661 | |
cd8826ea S |
662 | $to = strlen($this->data); |
663 | preg_match("/\"\"\"[ \t\r]*[\n#;]/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); | |
664 | if (isset($match[0][1])) { | |
665 | $to = $match[0][1]; | |
666 | } else { | |
667 | $this->compiler->trigger_template_error("missing or misspelled literal closing tag"); | |
668 | } | |
669 | $this->value = substr($this->data, $this->counter, $to - $this->counter); | |
670 | $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT; | |
671 | } | |
ccd27f54 | 672 | } |