|
1
|
|
|
<?php |
|
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
WARNING: This file has been machine generated. Do not edit it, or your changes will be overwritten next time it is compiled. |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
|
|
8
|
|
|
|
|
9
|
|
|
|
|
10
|
|
|
namespace SilverStripe\View; |
|
11
|
|
|
|
|
12
|
|
|
use SilverStripe\Core\Injector\Injector; |
|
13
|
|
|
use Parser; |
|
14
|
|
|
use InvalidArgumentException; |
|
15
|
|
|
|
|
16
|
|
|
// We want this to work when run by hand too |
|
17
|
|
|
if (defined('THIRDPARTY_PATH')) { |
|
18
|
|
|
require_once(THIRDPARTY_PATH . '/php-peg/Parser.php'); |
|
19
|
|
|
} else { |
|
20
|
|
|
$base = dirname(__FILE__); |
|
21
|
|
|
require_once($base.'/../thirdparty/php-peg/Parser.php'); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* This is the parser for the SilverStripe template language. It gets called on a string and uses a php-peg parser |
|
26
|
|
|
* to match that string against the language structure, building up the PHP code to execute that structure as it |
|
27
|
|
|
* parses |
|
28
|
|
|
* |
|
29
|
|
|
* The $result array that is built up as part of the parsing (see thirdparty/php-peg/README.md for more on how |
|
30
|
|
|
* parsers build results) has one special member, 'php', which contains the php equivalent of that part of the |
|
31
|
|
|
* template tree. |
|
32
|
|
|
* |
|
33
|
|
|
* Some match rules generate alternate php, or other variations, so check the per-match documentation too. |
|
34
|
|
|
* |
|
35
|
|
|
* Terms used: |
|
36
|
|
|
* |
|
37
|
|
|
* Marked: A string or lookup in the template that has been explictly marked as such - lookups by prepending with |
|
38
|
|
|
* "$" (like $Foo.Bar), strings by wrapping with single or double quotes ('Foo' or "Foo") |
|
39
|
|
|
* |
|
40
|
|
|
* Bare: The opposite of marked. An argument that has to has it's type inferred by usage and 2.4 defaults. |
|
41
|
|
|
* |
|
42
|
|
|
* Example of using a bare argument for a loop block: <% loop Foo %> |
|
43
|
|
|
* |
|
44
|
|
|
* Block: One of two SS template structures. The special characters "<%" and "%>" are used to wrap the opening and |
|
45
|
|
|
* (required or forbidden depending on which block exactly) closing block marks. |
|
46
|
|
|
* |
|
47
|
|
|
* Open Block: An SS template block that doesn't wrap any content or have a closing end tag (in fact, a closing end |
|
48
|
|
|
* tag is forbidden) |
|
49
|
|
|
* |
|
50
|
|
|
* Closed Block: An SS template block that wraps content, and requires a counterpart <% end_blockname %> tag |
|
51
|
|
|
* |
|
52
|
|
|
* Angle Bracket: angle brackets "<" and ">" are used to eat whitespace between template elements |
|
53
|
|
|
* N: eats white space including newlines (using in legacy _t support) |
|
54
|
|
|
*/ |
|
55
|
|
|
class SSTemplateParser extends Parser implements TemplateParser |
|
56
|
|
|
{ |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @var bool - Set true by SSTemplateParser::compileString if the template should include comments intended |
|
60
|
|
|
* for debugging (template source, included files, etc) |
|
61
|
|
|
*/ |
|
62
|
|
|
protected $includeDebuggingComments = false; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* Stores the user-supplied closed block extension rules in the form: |
|
66
|
|
|
* array( |
|
67
|
|
|
* 'name' => function (&$res) {} |
|
68
|
|
|
* ) |
|
69
|
|
|
* See SSTemplateParser::ClosedBlock_Handle_Loop for an example of what the callable should look like |
|
70
|
|
|
* @var array |
|
71
|
|
|
*/ |
|
72
|
|
|
protected $closedBlocks = array(); |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Stores the user-supplied open block extension rules in the form: |
|
76
|
|
|
* array( |
|
77
|
|
|
* 'name' => function (&$res) {} |
|
78
|
|
|
* ) |
|
79
|
|
|
* See SSTemplateParser::OpenBlock_Handle_Base_tag for an example of what the callable should look like |
|
80
|
|
|
* @var array |
|
81
|
|
|
*/ |
|
82
|
|
|
protected $openBlocks = array(); |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Allow the injection of new closed & open block callables |
|
86
|
|
|
* @param array $closedBlocks |
|
87
|
|
|
* @param array $openBlocks |
|
88
|
|
|
*/ |
|
89
|
|
|
public function __construct($closedBlocks = array(), $openBlocks = array()) |
|
90
|
|
|
{ |
|
91
|
|
|
parent::__construct(null); |
|
92
|
|
|
$this->setClosedBlocks($closedBlocks); |
|
93
|
|
|
$this->setOpenBlocks($openBlocks); |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* Override the function that constructs the result arrays to also prepare a 'php' item in the array |
|
98
|
|
|
*/ |
|
99
|
|
|
function construct($matchrule, $name, $arguments = null) |
|
100
|
|
|
{ |
|
101
|
|
|
$res = parent::construct($matchrule, $name, $arguments); |
|
102
|
|
|
if (!isset($res['php'])) { |
|
103
|
|
|
$res['php'] = ''; |
|
104
|
|
|
} |
|
105
|
|
|
return $res; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* Set the closed blocks that the template parser should use |
|
110
|
|
|
* |
|
111
|
|
|
* This method will delete any existing closed blocks, please use addClosedBlock if you don't |
|
112
|
|
|
* want to overwrite |
|
113
|
|
|
* @param array $closedBlocks |
|
114
|
|
|
* @throws InvalidArgumentException |
|
115
|
|
|
*/ |
|
116
|
|
|
public function setClosedBlocks($closedBlocks) |
|
117
|
|
|
{ |
|
118
|
|
|
$this->closedBlocks = array(); |
|
119
|
|
|
foreach ((array) $closedBlocks as $name => $callable) { |
|
120
|
|
|
$this->addClosedBlock($name, $callable); |
|
121
|
|
|
} |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* Set the open blocks that the template parser should use |
|
126
|
|
|
* |
|
127
|
|
|
* This method will delete any existing open blocks, please use addOpenBlock if you don't |
|
128
|
|
|
* want to overwrite |
|
129
|
|
|
* @param array $openBlocks |
|
130
|
|
|
* @throws InvalidArgumentException |
|
131
|
|
|
*/ |
|
132
|
|
|
public function setOpenBlocks($openBlocks) |
|
133
|
|
|
{ |
|
134
|
|
|
$this->openBlocks = array(); |
|
135
|
|
|
foreach ((array) $openBlocks as $name => $callable) { |
|
136
|
|
|
$this->addOpenBlock($name, $callable); |
|
137
|
|
|
} |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* Add a closed block callable to allow <% name %><% end_name %> syntax |
|
142
|
|
|
* @param string $name The name of the token to be used in the syntax <% name %><% end_name %> |
|
143
|
|
|
* @param callable $callable The function that modifies the generation of template code |
|
144
|
|
|
* @throws InvalidArgumentException |
|
145
|
|
|
*/ |
|
146
|
|
|
public function addClosedBlock($name, $callable) |
|
147
|
|
|
{ |
|
148
|
|
|
$this->validateExtensionBlock($name, $callable, 'Closed block'); |
|
149
|
|
|
$this->closedBlocks[$name] = $callable; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* Add a closed block callable to allow <% name %> syntax |
|
154
|
|
|
* @param string $name The name of the token to be used in the syntax <% name %> |
|
155
|
|
|
* @param callable $callable The function that modifies the generation of template code |
|
156
|
|
|
* @throws InvalidArgumentException |
|
157
|
|
|
*/ |
|
158
|
|
|
public function addOpenBlock($name, $callable) |
|
159
|
|
|
{ |
|
160
|
|
|
$this->validateExtensionBlock($name, $callable, 'Open block'); |
|
161
|
|
|
$this->openBlocks[$name] = $callable; |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
/** |
|
165
|
|
|
* Ensures that the arguments to addOpenBlock and addClosedBlock are valid |
|
166
|
|
|
* @param $name |
|
167
|
|
|
* @param $callable |
|
168
|
|
|
* @param $type |
|
169
|
|
|
* @throws InvalidArgumentException |
|
170
|
|
|
*/ |
|
171
|
|
|
protected function validateExtensionBlock($name, $callable, $type) |
|
172
|
|
|
{ |
|
173
|
|
|
if (!is_string($name)) { |
|
174
|
|
|
throw new InvalidArgumentException( |
|
175
|
|
|
sprintf( |
|
176
|
|
|
"Name argument for %s must be a string", |
|
177
|
|
|
$type |
|
178
|
|
|
) |
|
179
|
|
|
); |
|
180
|
|
|
} elseif (!is_callable($callable)) { |
|
181
|
|
|
throw new InvalidArgumentException( |
|
182
|
|
|
sprintf( |
|
183
|
|
|
"Callable %s argument named '%s' is not callable", |
|
184
|
|
|
$type, |
|
185
|
|
|
$name |
|
186
|
|
|
) |
|
187
|
|
|
); |
|
188
|
|
|
} |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
/* Template: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock | |
|
192
|
|
|
OpenBlock | MalformedBlock | Injection | Text)+ */ |
|
193
|
|
|
protected $match_Template_typestack = array('Template'); |
|
194
|
|
|
function match_Template ($stack = array()) { |
|
195
|
|
|
$matchrule = "Template"; $result = $this->construct($matchrule, $matchrule, null); |
|
196
|
|
|
$count = 0; |
|
197
|
|
|
while (true) { |
|
198
|
|
|
$res_50 = $result; |
|
199
|
|
|
$pos_50 = $this->pos; |
|
200
|
|
|
$_49 = NULL; |
|
201
|
|
|
do { |
|
|
|
|
|
|
202
|
|
|
$_47 = NULL; |
|
203
|
|
|
do { |
|
204
|
|
|
$res_0 = $result; |
|
205
|
|
|
$pos_0 = $this->pos; |
|
206
|
|
|
$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos; |
|
207
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
208
|
|
|
if ($subres !== FALSE) { |
|
209
|
|
|
$this->store( $result, $subres ); |
|
210
|
|
|
$_47 = TRUE; break; |
|
211
|
|
|
} |
|
212
|
|
|
$result = $res_0; |
|
213
|
|
|
$this->pos = $pos_0; |
|
214
|
|
|
$_45 = NULL; |
|
215
|
|
|
do { |
|
216
|
|
|
$res_2 = $result; |
|
217
|
|
|
$pos_2 = $this->pos; |
|
218
|
|
|
$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos; |
|
219
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
220
|
|
|
if ($subres !== FALSE) { |
|
221
|
|
|
$this->store( $result, $subres ); |
|
222
|
|
|
$_45 = TRUE; break; |
|
223
|
|
|
} |
|
224
|
|
|
$result = $res_2; |
|
225
|
|
|
$this->pos = $pos_2; |
|
226
|
|
|
$_43 = NULL; |
|
227
|
|
|
do { |
|
228
|
|
|
$res_4 = $result; |
|
229
|
|
|
$pos_4 = $this->pos; |
|
230
|
|
|
$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos; |
|
231
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
232
|
|
|
if ($subres !== FALSE) { |
|
233
|
|
|
$this->store( $result, $subres ); |
|
234
|
|
|
$_43 = TRUE; break; |
|
235
|
|
|
} |
|
236
|
|
|
$result = $res_4; |
|
237
|
|
|
$this->pos = $pos_4; |
|
238
|
|
|
$_41 = NULL; |
|
239
|
|
|
do { |
|
240
|
|
|
$res_6 = $result; |
|
241
|
|
|
$pos_6 = $this->pos; |
|
242
|
|
|
$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos; |
|
243
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
244
|
|
|
if ($subres !== FALSE) { |
|
245
|
|
|
$this->store( $result, $subres ); |
|
246
|
|
|
$_41 = TRUE; break; |
|
247
|
|
|
} |
|
248
|
|
|
$result = $res_6; |
|
249
|
|
|
$this->pos = $pos_6; |
|
250
|
|
|
$_39 = NULL; |
|
251
|
|
|
do { |
|
252
|
|
|
$res_8 = $result; |
|
253
|
|
|
$pos_8 = $this->pos; |
|
254
|
|
|
$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos; |
|
255
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
256
|
|
|
if ($subres !== FALSE) { |
|
257
|
|
|
$this->store( $result, $subres ); |
|
258
|
|
|
$_39 = TRUE; break; |
|
259
|
|
|
} |
|
260
|
|
|
$result = $res_8; |
|
261
|
|
|
$this->pos = $pos_8; |
|
262
|
|
|
$_37 = NULL; |
|
263
|
|
|
do { |
|
264
|
|
|
$res_10 = $result; |
|
265
|
|
|
$pos_10 = $this->pos; |
|
266
|
|
|
$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos; |
|
267
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
268
|
|
|
if ($subres !== FALSE) { |
|
269
|
|
|
$this->store( $result, $subres ); |
|
270
|
|
|
$_37 = TRUE; break; |
|
271
|
|
|
} |
|
272
|
|
|
$result = $res_10; |
|
273
|
|
|
$this->pos = $pos_10; |
|
274
|
|
|
$_35 = NULL; |
|
275
|
|
|
do { |
|
276
|
|
|
$res_12 = $result; |
|
277
|
|
|
$pos_12 = $this->pos; |
|
278
|
|
|
$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos; |
|
279
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
280
|
|
|
if ($subres !== FALSE) { |
|
281
|
|
|
$this->store( $result, $subres ); |
|
282
|
|
|
$_35 = TRUE; break; |
|
283
|
|
|
} |
|
284
|
|
|
$result = $res_12; |
|
285
|
|
|
$this->pos = $pos_12; |
|
286
|
|
|
$_33 = NULL; |
|
287
|
|
|
do { |
|
288
|
|
|
$res_14 = $result; |
|
289
|
|
|
$pos_14 = $this->pos; |
|
290
|
|
|
$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos; |
|
291
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
292
|
|
|
if ($subres !== FALSE) { |
|
293
|
|
|
$this->store( $result, $subres ); |
|
294
|
|
|
$_33 = TRUE; break; |
|
295
|
|
|
} |
|
296
|
|
|
$result = $res_14; |
|
297
|
|
|
$this->pos = $pos_14; |
|
298
|
|
|
$_31 = NULL; |
|
299
|
|
|
do { |
|
300
|
|
|
$res_16 = $result; |
|
301
|
|
|
$pos_16 = $this->pos; |
|
302
|
|
|
$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos; |
|
303
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
304
|
|
|
if ($subres !== FALSE) { |
|
305
|
|
|
$this->store( $result, $subres ); |
|
306
|
|
|
$_31 = TRUE; break; |
|
307
|
|
|
} |
|
308
|
|
|
$result = $res_16; |
|
309
|
|
|
$this->pos = $pos_16; |
|
310
|
|
|
$_29 = NULL; |
|
311
|
|
|
do { |
|
312
|
|
|
$res_18 = $result; |
|
313
|
|
|
$pos_18 = $this->pos; |
|
314
|
|
|
$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos; |
|
315
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
316
|
|
|
if ($subres !== FALSE) { |
|
317
|
|
|
$this->store( $result, $subres ); |
|
318
|
|
|
$_29 = TRUE; break; |
|
319
|
|
|
} |
|
320
|
|
|
$result = $res_18; |
|
321
|
|
|
$this->pos = $pos_18; |
|
322
|
|
|
$_27 = NULL; |
|
323
|
|
|
do { |
|
324
|
|
|
$res_20 = $result; |
|
325
|
|
|
$pos_20 = $this->pos; |
|
326
|
|
|
$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos; |
|
327
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
328
|
|
|
if ($subres !== FALSE) { |
|
329
|
|
|
$this->store( $result, $subres ); |
|
330
|
|
|
$_27 = TRUE; break; |
|
331
|
|
|
} |
|
332
|
|
|
$result = $res_20; |
|
333
|
|
|
$this->pos = $pos_20; |
|
334
|
|
|
$_25 = NULL; |
|
335
|
|
|
do { |
|
336
|
|
|
$res_22 = $result; |
|
337
|
|
|
$pos_22 = $this->pos; |
|
338
|
|
|
$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos; |
|
339
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
340
|
|
|
if ($subres !== FALSE) { |
|
341
|
|
|
$this->store( $result, $subres ); |
|
342
|
|
|
$_25 = TRUE; break; |
|
343
|
|
|
} |
|
344
|
|
|
$result = $res_22; |
|
345
|
|
|
$this->pos = $pos_22; |
|
346
|
|
|
$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos; |
|
347
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
348
|
|
|
if ($subres !== FALSE) { |
|
349
|
|
|
$this->store( $result, $subres ); |
|
350
|
|
|
$_25 = TRUE; break; |
|
351
|
|
|
} |
|
352
|
|
|
$result = $res_22; |
|
353
|
|
|
$this->pos = $pos_22; |
|
354
|
|
|
$_25 = FALSE; break; |
|
355
|
|
|
} |
|
356
|
|
|
while(0); |
|
357
|
|
|
if( $_25 === TRUE ) { $_27 = TRUE; break; } |
|
358
|
|
|
$result = $res_20; |
|
359
|
|
|
$this->pos = $pos_20; |
|
360
|
|
|
$_27 = FALSE; break; |
|
361
|
|
|
} |
|
362
|
|
|
while(0); |
|
363
|
|
|
if( $_27 === TRUE ) { $_29 = TRUE; break; } |
|
364
|
|
|
$result = $res_18; |
|
365
|
|
|
$this->pos = $pos_18; |
|
366
|
|
|
$_29 = FALSE; break; |
|
367
|
|
|
} |
|
368
|
|
|
while(0); |
|
369
|
|
|
if( $_29 === TRUE ) { $_31 = TRUE; break; } |
|
370
|
|
|
$result = $res_16; |
|
371
|
|
|
$this->pos = $pos_16; |
|
372
|
|
|
$_31 = FALSE; break; |
|
373
|
|
|
} |
|
374
|
|
|
while(0); |
|
375
|
|
|
if( $_31 === TRUE ) { $_33 = TRUE; break; } |
|
376
|
|
|
$result = $res_14; |
|
377
|
|
|
$this->pos = $pos_14; |
|
378
|
|
|
$_33 = FALSE; break; |
|
379
|
|
|
} |
|
380
|
|
|
while(0); |
|
381
|
|
|
if( $_33 === TRUE ) { $_35 = TRUE; break; } |
|
382
|
|
|
$result = $res_12; |
|
383
|
|
|
$this->pos = $pos_12; |
|
384
|
|
|
$_35 = FALSE; break; |
|
385
|
|
|
} |
|
386
|
|
|
while(0); |
|
387
|
|
|
if( $_35 === TRUE ) { $_37 = TRUE; break; } |
|
388
|
|
|
$result = $res_10; |
|
389
|
|
|
$this->pos = $pos_10; |
|
390
|
|
|
$_37 = FALSE; break; |
|
391
|
|
|
} |
|
392
|
|
|
while(0); |
|
393
|
|
|
if( $_37 === TRUE ) { $_39 = TRUE; break; } |
|
394
|
|
|
$result = $res_8; |
|
395
|
|
|
$this->pos = $pos_8; |
|
396
|
|
|
$_39 = FALSE; break; |
|
397
|
|
|
} |
|
398
|
|
|
while(0); |
|
399
|
|
|
if( $_39 === TRUE ) { $_41 = TRUE; break; } |
|
400
|
|
|
$result = $res_6; |
|
401
|
|
|
$this->pos = $pos_6; |
|
402
|
|
|
$_41 = FALSE; break; |
|
403
|
|
|
} |
|
404
|
|
|
while(0); |
|
405
|
|
|
if( $_41 === TRUE ) { $_43 = TRUE; break; } |
|
406
|
|
|
$result = $res_4; |
|
407
|
|
|
$this->pos = $pos_4; |
|
408
|
|
|
$_43 = FALSE; break; |
|
409
|
|
|
} |
|
410
|
|
|
while(0); |
|
411
|
|
|
if( $_43 === TRUE ) { $_45 = TRUE; break; } |
|
412
|
|
|
$result = $res_2; |
|
413
|
|
|
$this->pos = $pos_2; |
|
414
|
|
|
$_45 = FALSE; break; |
|
415
|
|
|
} |
|
416
|
|
|
while(0); |
|
417
|
|
|
if( $_45 === TRUE ) { $_47 = TRUE; break; } |
|
418
|
|
|
$result = $res_0; |
|
419
|
|
|
$this->pos = $pos_0; |
|
420
|
|
|
$_47 = FALSE; break; |
|
421
|
|
|
} |
|
422
|
|
|
while(0); |
|
423
|
|
|
if( $_47 === FALSE) { $_49 = FALSE; break; } |
|
424
|
|
|
$_49 = TRUE; break; |
|
425
|
|
|
} |
|
426
|
|
|
while(0); |
|
427
|
|
|
if( $_49 === FALSE) { |
|
428
|
|
|
$result = $res_50; |
|
429
|
|
|
$this->pos = $pos_50; |
|
430
|
|
|
unset( $res_50 ); |
|
431
|
|
|
unset( $pos_50 ); |
|
432
|
|
|
break; |
|
433
|
|
|
} |
|
434
|
|
|
$count += 1; |
|
435
|
|
|
} |
|
436
|
|
|
if ($count > 0) { return $this->finalise($result); } |
|
437
|
|
|
else { return FALSE; } |
|
438
|
|
|
} |
|
439
|
|
|
|
|
440
|
|
|
|
|
441
|
|
|
|
|
442
|
|
|
function Template_STR(&$res, $sub) |
|
443
|
|
|
{ |
|
444
|
|
|
$res['php'] .= $sub['php'] . PHP_EOL ; |
|
445
|
|
|
} |
|
446
|
|
|
|
|
447
|
|
|
/* Word: / [A-Za-z_] [A-Za-z0-9_]* / */ |
|
448
|
|
|
protected $match_Word_typestack = array('Word'); |
|
449
|
|
|
function match_Word ($stack = array()) { |
|
|
|
|
|
|
450
|
|
|
$matchrule = "Word"; $result = $this->construct($matchrule, $matchrule, null); |
|
451
|
|
|
if (( $subres = $this->rx( '/ [A-Za-z_] [A-Za-z0-9_]* /' ) ) !== FALSE) { |
|
452
|
|
|
$result["text"] .= $subres; |
|
453
|
|
|
return $this->finalise($result); |
|
454
|
|
|
} |
|
455
|
|
|
else { return FALSE; } |
|
456
|
|
|
} |
|
457
|
|
|
|
|
458
|
|
|
|
|
459
|
|
|
/* NamespacedWord: / [A-Za-z_\/\\] [A-Za-z0-9_\/\\]* / */ |
|
460
|
|
|
protected $match_NamespacedWord_typestack = array('NamespacedWord'); |
|
461
|
|
|
function match_NamespacedWord ($stack = array()) { |
|
|
|
|
|
|
462
|
|
|
$matchrule = "NamespacedWord"; $result = $this->construct($matchrule, $matchrule, null); |
|
463
|
|
|
if (( $subres = $this->rx( '/ [A-Za-z_\/\\\\] [A-Za-z0-9_\/\\\\]* /' ) ) !== FALSE) { |
|
464
|
|
|
$result["text"] .= $subres; |
|
465
|
|
|
return $this->finalise($result); |
|
466
|
|
|
} |
|
467
|
|
|
else { return FALSE; } |
|
468
|
|
|
} |
|
469
|
|
|
|
|
470
|
|
|
|
|
471
|
|
|
/* Number: / [0-9]+ / */ |
|
472
|
|
|
protected $match_Number_typestack = array('Number'); |
|
473
|
|
|
function match_Number ($stack = array()) { |
|
|
|
|
|
|
474
|
|
|
$matchrule = "Number"; $result = $this->construct($matchrule, $matchrule, null); |
|
475
|
|
|
if (( $subres = $this->rx( '/ [0-9]+ /' ) ) !== FALSE) { |
|
476
|
|
|
$result["text"] .= $subres; |
|
477
|
|
|
return $this->finalise($result); |
|
478
|
|
|
} |
|
479
|
|
|
else { return FALSE; } |
|
480
|
|
|
} |
|
481
|
|
|
|
|
482
|
|
|
|
|
483
|
|
|
/* Value: / [A-Za-z0-9_]+ / */ |
|
484
|
|
|
protected $match_Value_typestack = array('Value'); |
|
485
|
|
|
function match_Value ($stack = array()) { |
|
|
|
|
|
|
486
|
|
|
$matchrule = "Value"; $result = $this->construct($matchrule, $matchrule, null); |
|
487
|
|
|
if (( $subres = $this->rx( '/ [A-Za-z0-9_]+ /' ) ) !== FALSE) { |
|
488
|
|
|
$result["text"] .= $subres; |
|
489
|
|
|
return $this->finalise($result); |
|
490
|
|
|
} |
|
491
|
|
|
else { return FALSE; } |
|
492
|
|
|
} |
|
493
|
|
|
|
|
494
|
|
|
|
|
495
|
|
|
/* CallArguments: :Argument ( < "," < :Argument )* */ |
|
496
|
|
|
protected $match_CallArguments_typestack = array('CallArguments'); |
|
497
|
|
|
function match_CallArguments ($stack = array()) { |
|
498
|
|
|
$matchrule = "CallArguments"; $result = $this->construct($matchrule, $matchrule, null); |
|
499
|
|
|
$_62 = NULL; |
|
500
|
|
|
do { |
|
|
|
|
|
|
501
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos; |
|
502
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
503
|
|
|
if ($subres !== FALSE) { |
|
504
|
|
|
$this->store( $result, $subres, "Argument" ); |
|
505
|
|
|
} |
|
506
|
|
|
else { $_62 = FALSE; break; } |
|
507
|
|
|
while (true) { |
|
508
|
|
|
$res_61 = $result; |
|
509
|
|
|
$pos_61 = $this->pos; |
|
510
|
|
|
$_60 = NULL; |
|
511
|
|
|
do { |
|
512
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
513
|
|
|
if (substr($this->string,$this->pos,1) == ',') { |
|
514
|
|
|
$this->pos += 1; |
|
515
|
|
|
$result["text"] .= ','; |
|
516
|
|
|
} |
|
517
|
|
|
else { $_60 = FALSE; break; } |
|
518
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
519
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos; |
|
520
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
521
|
|
|
if ($subres !== FALSE) { |
|
522
|
|
|
$this->store( $result, $subres, "Argument" ); |
|
523
|
|
|
} |
|
524
|
|
|
else { $_60 = FALSE; break; } |
|
525
|
|
|
$_60 = TRUE; break; |
|
526
|
|
|
} |
|
527
|
|
|
while(0); |
|
528
|
|
|
if( $_60 === FALSE) { |
|
529
|
|
|
$result = $res_61; |
|
530
|
|
|
$this->pos = $pos_61; |
|
531
|
|
|
unset( $res_61 ); |
|
532
|
|
|
unset( $pos_61 ); |
|
533
|
|
|
break; |
|
534
|
|
|
} |
|
535
|
|
|
} |
|
536
|
|
|
$_62 = TRUE; break; |
|
537
|
|
|
} |
|
538
|
|
|
while(0); |
|
539
|
|
|
if( $_62 === TRUE ) { return $this->finalise($result); } |
|
540
|
|
|
if( $_62 === FALSE) { return FALSE; } |
|
541
|
|
|
} |
|
542
|
|
|
|
|
543
|
|
|
|
|
544
|
|
|
|
|
545
|
|
|
|
|
546
|
|
|
/** |
|
547
|
|
|
* Values are bare words in templates, but strings in PHP. We rely on PHP's type conversion to back-convert |
|
548
|
|
|
* strings to numbers when needed. |
|
549
|
|
|
*/ |
|
550
|
|
|
function CallArguments_Argument(&$res, $sub) |
|
551
|
|
|
{ |
|
552
|
|
|
if (!empty($res['php'])) { |
|
553
|
|
|
$res['php'] .= ', '; |
|
554
|
|
|
} |
|
555
|
|
|
|
|
556
|
|
|
$res['php'] .= ($sub['ArgumentMode'] == 'default') ? $sub['string_php'] : |
|
557
|
|
|
str_replace('$$FINAL', 'XML_val', $sub['php']); |
|
558
|
|
|
} |
|
559
|
|
|
|
|
560
|
|
|
/* Call: Method:Word ( "(" < :CallArguments? > ")" )? */ |
|
561
|
|
|
protected $match_Call_typestack = array('Call'); |
|
562
|
|
|
function match_Call ($stack = array()) { |
|
563
|
|
|
$matchrule = "Call"; $result = $this->construct($matchrule, $matchrule, null); |
|
564
|
|
|
$_72 = NULL; |
|
565
|
|
|
do { |
|
|
|
|
|
|
566
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; |
|
567
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
568
|
|
|
if ($subres !== FALSE) { |
|
569
|
|
|
$this->store( $result, $subres, "Method" ); |
|
570
|
|
|
} |
|
571
|
|
|
else { $_72 = FALSE; break; } |
|
572
|
|
|
$res_71 = $result; |
|
573
|
|
|
$pos_71 = $this->pos; |
|
574
|
|
|
$_70 = NULL; |
|
575
|
|
|
do { |
|
576
|
|
|
if (substr($this->string,$this->pos,1) == '(') { |
|
577
|
|
|
$this->pos += 1; |
|
578
|
|
|
$result["text"] .= '('; |
|
579
|
|
|
} |
|
580
|
|
|
else { $_70 = FALSE; break; } |
|
581
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
582
|
|
|
$res_67 = $result; |
|
583
|
|
|
$pos_67 = $this->pos; |
|
584
|
|
|
$matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos; |
|
585
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
586
|
|
|
if ($subres !== FALSE) { |
|
587
|
|
|
$this->store( $result, $subres, "CallArguments" ); |
|
588
|
|
|
} |
|
589
|
|
|
else { |
|
590
|
|
|
$result = $res_67; |
|
591
|
|
|
$this->pos = $pos_67; |
|
592
|
|
|
unset( $res_67 ); |
|
593
|
|
|
unset( $pos_67 ); |
|
594
|
|
|
} |
|
595
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
596
|
|
|
if (substr($this->string,$this->pos,1) == ')') { |
|
597
|
|
|
$this->pos += 1; |
|
598
|
|
|
$result["text"] .= ')'; |
|
599
|
|
|
} |
|
600
|
|
|
else { $_70 = FALSE; break; } |
|
601
|
|
|
$_70 = TRUE; break; |
|
602
|
|
|
} |
|
603
|
|
|
while(0); |
|
604
|
|
|
if( $_70 === FALSE) { |
|
605
|
|
|
$result = $res_71; |
|
606
|
|
|
$this->pos = $pos_71; |
|
607
|
|
|
unset( $res_71 ); |
|
608
|
|
|
unset( $pos_71 ); |
|
609
|
|
|
} |
|
610
|
|
|
$_72 = TRUE; break; |
|
611
|
|
|
} |
|
612
|
|
|
while(0); |
|
613
|
|
|
if( $_72 === TRUE ) { return $this->finalise($result); } |
|
614
|
|
|
if( $_72 === FALSE) { return FALSE; } |
|
615
|
|
|
} |
|
616
|
|
|
|
|
617
|
|
|
|
|
618
|
|
|
/* LookupStep: :Call &"." */ |
|
|
|
|
|
|
619
|
|
|
protected $match_LookupStep_typestack = array('LookupStep'); |
|
620
|
|
|
function match_LookupStep ($stack = array()) { |
|
621
|
|
|
$matchrule = "LookupStep"; $result = $this->construct($matchrule, $matchrule, null); |
|
622
|
|
|
$_76 = NULL; |
|
623
|
|
|
do { |
|
|
|
|
|
|
624
|
|
|
$matcher = 'match_'.'Call'; $key = $matcher; $pos = $this->pos; |
|
625
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
626
|
|
|
if ($subres !== FALSE) { |
|
627
|
|
|
$this->store( $result, $subres, "Call" ); |
|
628
|
|
|
} |
|
629
|
|
|
else { $_76 = FALSE; break; } |
|
630
|
|
|
$res_75 = $result; |
|
631
|
|
|
$pos_75 = $this->pos; |
|
632
|
|
|
if (substr($this->string,$this->pos,1) == '.') { |
|
633
|
|
|
$this->pos += 1; |
|
634
|
|
|
$result["text"] .= '.'; |
|
635
|
|
|
$result = $res_75; |
|
636
|
|
|
$this->pos = $pos_75; |
|
637
|
|
|
} |
|
638
|
|
|
else { |
|
639
|
|
|
$result = $res_75; |
|
640
|
|
|
$this->pos = $pos_75; |
|
641
|
|
|
$_76 = FALSE; break; |
|
642
|
|
|
} |
|
643
|
|
|
$_76 = TRUE; break; |
|
644
|
|
|
} |
|
645
|
|
|
while(0); |
|
646
|
|
|
if( $_76 === TRUE ) { return $this->finalise($result); } |
|
647
|
|
|
if( $_76 === FALSE) { return FALSE; } |
|
648
|
|
|
} |
|
649
|
|
|
|
|
650
|
|
|
|
|
651
|
|
|
/* LastLookupStep: :Call */ |
|
652
|
|
|
protected $match_LastLookupStep_typestack = array('LastLookupStep'); |
|
653
|
|
|
function match_LastLookupStep ($stack = array()) { |
|
654
|
|
|
$matchrule = "LastLookupStep"; $result = $this->construct($matchrule, $matchrule, null); |
|
655
|
|
|
$matcher = 'match_'.'Call'; $key = $matcher; $pos = $this->pos; |
|
656
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
657
|
|
|
if ($subres !== FALSE) { |
|
658
|
|
|
$this->store( $result, $subres, "Call" ); |
|
659
|
|
|
return $this->finalise($result); |
|
660
|
|
|
} |
|
661
|
|
|
else { return FALSE; } |
|
662
|
|
|
} |
|
663
|
|
|
|
|
664
|
|
|
|
|
665
|
|
|
/* Lookup: LookupStep ("." LookupStep)* "." LastLookupStep | LastLookupStep */ |
|
666
|
|
|
protected $match_Lookup_typestack = array('Lookup'); |
|
667
|
|
|
function match_Lookup ($stack = array()) { |
|
668
|
|
|
$matchrule = "Lookup"; $result = $this->construct($matchrule, $matchrule, null); |
|
669
|
|
|
$_90 = NULL; |
|
670
|
|
|
do { |
|
|
|
|
|
|
671
|
|
|
$res_79 = $result; |
|
672
|
|
|
$pos_79 = $this->pos; |
|
673
|
|
|
$_87 = NULL; |
|
674
|
|
|
do { |
|
675
|
|
|
$matcher = 'match_'.'LookupStep'; $key = $matcher; $pos = $this->pos; |
|
676
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
677
|
|
|
if ($subres !== FALSE) { |
|
678
|
|
|
$this->store( $result, $subres ); |
|
679
|
|
|
} |
|
680
|
|
|
else { $_87 = FALSE; break; } |
|
681
|
|
|
while (true) { |
|
682
|
|
|
$res_84 = $result; |
|
683
|
|
|
$pos_84 = $this->pos; |
|
684
|
|
|
$_83 = NULL; |
|
685
|
|
|
do { |
|
686
|
|
|
if (substr($this->string,$this->pos,1) == '.') { |
|
687
|
|
|
$this->pos += 1; |
|
688
|
|
|
$result["text"] .= '.'; |
|
689
|
|
|
} |
|
690
|
|
|
else { $_83 = FALSE; break; } |
|
691
|
|
|
$matcher = 'match_'.'LookupStep'; $key = $matcher; $pos = $this->pos; |
|
692
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
693
|
|
|
if ($subres !== FALSE) { |
|
694
|
|
|
$this->store( $result, $subres ); |
|
695
|
|
|
} |
|
696
|
|
|
else { $_83 = FALSE; break; } |
|
697
|
|
|
$_83 = TRUE; break; |
|
698
|
|
|
} |
|
699
|
|
|
while(0); |
|
700
|
|
|
if( $_83 === FALSE) { |
|
701
|
|
|
$result = $res_84; |
|
702
|
|
|
$this->pos = $pos_84; |
|
703
|
|
|
unset( $res_84 ); |
|
704
|
|
|
unset( $pos_84 ); |
|
705
|
|
|
break; |
|
706
|
|
|
} |
|
707
|
|
|
} |
|
708
|
|
|
if (substr($this->string,$this->pos,1) == '.') { |
|
709
|
|
|
$this->pos += 1; |
|
710
|
|
|
$result["text"] .= '.'; |
|
711
|
|
|
} |
|
712
|
|
|
else { $_87 = FALSE; break; } |
|
713
|
|
|
$matcher = 'match_'.'LastLookupStep'; $key = $matcher; $pos = $this->pos; |
|
714
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
715
|
|
|
if ($subres !== FALSE) { |
|
716
|
|
|
$this->store( $result, $subres ); |
|
717
|
|
|
} |
|
718
|
|
|
else { $_87 = FALSE; break; } |
|
719
|
|
|
$_87 = TRUE; break; |
|
720
|
|
|
} |
|
721
|
|
|
while(0); |
|
722
|
|
|
if( $_87 === TRUE ) { $_90 = TRUE; break; } |
|
723
|
|
|
$result = $res_79; |
|
724
|
|
|
$this->pos = $pos_79; |
|
725
|
|
|
$matcher = 'match_'.'LastLookupStep'; $key = $matcher; $pos = $this->pos; |
|
726
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
727
|
|
|
if ($subres !== FALSE) { |
|
728
|
|
|
$this->store( $result, $subres ); |
|
729
|
|
|
$_90 = TRUE; break; |
|
730
|
|
|
} |
|
731
|
|
|
$result = $res_79; |
|
732
|
|
|
$this->pos = $pos_79; |
|
733
|
|
|
$_90 = FALSE; break; |
|
734
|
|
|
} |
|
735
|
|
|
while(0); |
|
736
|
|
|
if( $_90 === TRUE ) { return $this->finalise($result); } |
|
737
|
|
|
if( $_90 === FALSE) { return FALSE; } |
|
738
|
|
|
} |
|
739
|
|
|
|
|
740
|
|
|
|
|
741
|
|
|
|
|
742
|
|
|
|
|
743
|
|
|
function Lookup__construct(&$res) |
|
744
|
|
|
{ |
|
745
|
|
|
$res['php'] = '$scope->locally()'; |
|
746
|
|
|
$res['LookupSteps'] = array(); |
|
747
|
|
|
} |
|
748
|
|
|
|
|
749
|
|
|
/** |
|
750
|
|
|
* The basic generated PHP of LookupStep and LastLookupStep is the same, except that LookupStep calls 'obj' to |
|
751
|
|
|
* get the next ViewableData in the sequence, and LastLookupStep calls different methods (XML_val, hasValue, obj) |
|
752
|
|
|
* depending on the context the lookup is used in. |
|
753
|
|
|
*/ |
|
754
|
|
|
function Lookup_AddLookupStep(&$res, $sub, $method) |
|
755
|
|
|
{ |
|
756
|
|
|
$res['LookupSteps'][] = $sub; |
|
757
|
|
|
|
|
758
|
|
|
$property = $sub['Call']['Method']['text']; |
|
759
|
|
|
|
|
760
|
|
|
if (isset($sub['Call']['CallArguments']) && $arguments = $sub['Call']['CallArguments']['php']) { |
|
761
|
|
|
$res['php'] .= "->$method('$property', array($arguments), true)"; |
|
762
|
|
|
} else { |
|
763
|
|
|
$res['php'] .= "->$method('$property', null, true)"; |
|
764
|
|
|
} |
|
765
|
|
|
} |
|
766
|
|
|
|
|
767
|
|
|
function Lookup_LookupStep(&$res, $sub) |
|
768
|
|
|
{ |
|
769
|
|
|
$this->Lookup_AddLookupStep($res, $sub, 'obj'); |
|
770
|
|
|
} |
|
771
|
|
|
|
|
772
|
|
|
function Lookup_LastLookupStep(&$res, $sub) |
|
773
|
|
|
{ |
|
774
|
|
|
$this->Lookup_AddLookupStep($res, $sub, '$$FINAL'); |
|
775
|
|
|
} |
|
776
|
|
|
|
|
777
|
|
|
|
|
778
|
|
|
/* Translate: "<%t" < Entity < (Default:QuotedString)? < (!("is" "=") < "is" < Context:QuotedString)? < |
|
|
|
|
|
|
779
|
|
|
(InjectionVariables)? > "%>" */ |
|
780
|
|
|
protected $match_Translate_typestack = array('Translate'); |
|
781
|
|
|
function match_Translate ($stack = array()) { |
|
782
|
|
|
$matchrule = "Translate"; $result = $this->construct($matchrule, $matchrule, null); |
|
783
|
|
|
$_116 = NULL; |
|
784
|
|
|
do { |
|
|
|
|
|
|
785
|
|
|
if (( $subres = $this->literal( '<%t' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
786
|
|
|
else { $_116 = FALSE; break; } |
|
787
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
788
|
|
|
$matcher = 'match_'.'Entity'; $key = $matcher; $pos = $this->pos; |
|
789
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
790
|
|
|
if ($subres !== FALSE) { |
|
791
|
|
|
$this->store( $result, $subres ); |
|
792
|
|
|
} |
|
793
|
|
|
else { $_116 = FALSE; break; } |
|
794
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
795
|
|
|
$res_98 = $result; |
|
796
|
|
|
$pos_98 = $this->pos; |
|
797
|
|
|
$_97 = NULL; |
|
798
|
|
|
do { |
|
799
|
|
|
$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos; |
|
800
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
801
|
|
|
if ($subres !== FALSE) { |
|
802
|
|
|
$this->store( $result, $subres, "Default" ); |
|
803
|
|
|
} |
|
804
|
|
|
else { $_97 = FALSE; break; } |
|
805
|
|
|
$_97 = TRUE; break; |
|
806
|
|
|
} |
|
807
|
|
|
while(0); |
|
808
|
|
|
if( $_97 === FALSE) { |
|
809
|
|
|
$result = $res_98; |
|
810
|
|
|
$this->pos = $pos_98; |
|
811
|
|
|
unset( $res_98 ); |
|
812
|
|
|
unset( $pos_98 ); |
|
813
|
|
|
} |
|
814
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
815
|
|
|
$res_109 = $result; |
|
816
|
|
|
$pos_109 = $this->pos; |
|
817
|
|
|
$_108 = NULL; |
|
818
|
|
|
do { |
|
819
|
|
|
$res_103 = $result; |
|
820
|
|
|
$pos_103 = $this->pos; |
|
821
|
|
|
$_102 = NULL; |
|
822
|
|
|
do { |
|
823
|
|
|
if (( $subres = $this->literal( 'is' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
824
|
|
|
else { $_102 = FALSE; break; } |
|
825
|
|
|
if (substr($this->string,$this->pos,1) == '=') { |
|
826
|
|
|
$this->pos += 1; |
|
827
|
|
|
$result["text"] .= '='; |
|
828
|
|
|
} |
|
829
|
|
|
else { $_102 = FALSE; break; } |
|
830
|
|
|
$_102 = TRUE; break; |
|
831
|
|
|
} |
|
832
|
|
|
while(0); |
|
833
|
|
|
if( $_102 === TRUE ) { |
|
834
|
|
|
$result = $res_103; |
|
835
|
|
|
$this->pos = $pos_103; |
|
836
|
|
|
$_108 = FALSE; break; |
|
837
|
|
|
} |
|
838
|
|
|
if( $_102 === FALSE) { |
|
839
|
|
|
$result = $res_103; |
|
840
|
|
|
$this->pos = $pos_103; |
|
841
|
|
|
} |
|
842
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
843
|
|
|
if (( $subres = $this->literal( 'is' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
844
|
|
|
else { $_108 = FALSE; break; } |
|
845
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
846
|
|
|
$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos; |
|
847
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
848
|
|
|
if ($subres !== FALSE) { |
|
849
|
|
|
$this->store( $result, $subres, "Context" ); |
|
850
|
|
|
} |
|
851
|
|
|
else { $_108 = FALSE; break; } |
|
852
|
|
|
$_108 = TRUE; break; |
|
853
|
|
|
} |
|
854
|
|
|
while(0); |
|
855
|
|
|
if( $_108 === FALSE) { |
|
856
|
|
|
$result = $res_109; |
|
857
|
|
|
$this->pos = $pos_109; |
|
858
|
|
|
unset( $res_109 ); |
|
859
|
|
|
unset( $pos_109 ); |
|
860
|
|
|
} |
|
861
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
862
|
|
|
$res_113 = $result; |
|
863
|
|
|
$pos_113 = $this->pos; |
|
864
|
|
|
$_112 = NULL; |
|
865
|
|
|
do { |
|
866
|
|
|
$matcher = 'match_'.'InjectionVariables'; $key = $matcher; $pos = $this->pos; |
|
867
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
868
|
|
|
if ($subres !== FALSE) { |
|
869
|
|
|
$this->store( $result, $subres ); |
|
870
|
|
|
} |
|
871
|
|
|
else { $_112 = FALSE; break; } |
|
872
|
|
|
$_112 = TRUE; break; |
|
873
|
|
|
} |
|
874
|
|
|
while(0); |
|
875
|
|
|
if( $_112 === FALSE) { |
|
876
|
|
|
$result = $res_113; |
|
877
|
|
|
$this->pos = $pos_113; |
|
878
|
|
|
unset( $res_113 ); |
|
879
|
|
|
unset( $pos_113 ); |
|
880
|
|
|
} |
|
881
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
882
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
883
|
|
|
else { $_116 = FALSE; break; } |
|
884
|
|
|
$_116 = TRUE; break; |
|
885
|
|
|
} |
|
886
|
|
|
while(0); |
|
887
|
|
|
if( $_116 === TRUE ) { return $this->finalise($result); } |
|
888
|
|
|
if( $_116 === FALSE) { return FALSE; } |
|
889
|
|
|
} |
|
890
|
|
|
|
|
891
|
|
|
|
|
892
|
|
|
/* InjectionVariables: (< InjectionName:Word "=" Argument)+ */ |
|
893
|
|
|
protected $match_InjectionVariables_typestack = array('InjectionVariables'); |
|
894
|
|
|
function match_InjectionVariables ($stack = array()) { |
|
895
|
|
|
$matchrule = "InjectionVariables"; $result = $this->construct($matchrule, $matchrule, null); |
|
896
|
|
|
$count = 0; |
|
897
|
|
|
while (true) { |
|
898
|
|
|
$res_123 = $result; |
|
899
|
|
|
$pos_123 = $this->pos; |
|
900
|
|
|
$_122 = NULL; |
|
901
|
|
|
do { |
|
|
|
|
|
|
902
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
903
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; |
|
904
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
905
|
|
|
if ($subres !== FALSE) { |
|
906
|
|
|
$this->store( $result, $subres, "InjectionName" ); |
|
907
|
|
|
} |
|
908
|
|
|
else { $_122 = FALSE; break; } |
|
909
|
|
|
if (substr($this->string,$this->pos,1) == '=') { |
|
910
|
|
|
$this->pos += 1; |
|
911
|
|
|
$result["text"] .= '='; |
|
912
|
|
|
} |
|
913
|
|
|
else { $_122 = FALSE; break; } |
|
914
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos; |
|
915
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
916
|
|
|
if ($subres !== FALSE) { |
|
917
|
|
|
$this->store( $result, $subres ); |
|
918
|
|
|
} |
|
919
|
|
|
else { $_122 = FALSE; break; } |
|
920
|
|
|
$_122 = TRUE; break; |
|
921
|
|
|
} |
|
922
|
|
|
while(0); |
|
923
|
|
|
if( $_122 === FALSE) { |
|
924
|
|
|
$result = $res_123; |
|
925
|
|
|
$this->pos = $pos_123; |
|
926
|
|
|
unset( $res_123 ); |
|
927
|
|
|
unset( $pos_123 ); |
|
928
|
|
|
break; |
|
929
|
|
|
} |
|
930
|
|
|
$count += 1; |
|
931
|
|
|
} |
|
932
|
|
|
if ($count > 0) { return $this->finalise($result); } |
|
933
|
|
|
else { return FALSE; } |
|
934
|
|
|
} |
|
935
|
|
|
|
|
936
|
|
|
|
|
937
|
|
|
/* Entity: / [A-Za-z_\\] [\w\.\\]* / */ |
|
938
|
|
|
protected $match_Entity_typestack = array('Entity'); |
|
939
|
|
|
function match_Entity ($stack = array()) { |
|
|
|
|
|
|
940
|
|
|
$matchrule = "Entity"; $result = $this->construct($matchrule, $matchrule, null); |
|
941
|
|
|
if (( $subres = $this->rx( '/ [A-Za-z_\\\\] [\w\.\\\\]* /' ) ) !== FALSE) { |
|
942
|
|
|
$result["text"] .= $subres; |
|
943
|
|
|
return $this->finalise($result); |
|
944
|
|
|
} |
|
945
|
|
|
else { return FALSE; } |
|
946
|
|
|
} |
|
947
|
|
|
|
|
948
|
|
|
|
|
949
|
|
|
|
|
950
|
|
|
|
|
951
|
|
|
function Translate__construct(&$res) |
|
952
|
|
|
{ |
|
953
|
|
|
$res['php'] = '$val .= _t('; |
|
954
|
|
|
} |
|
955
|
|
|
|
|
956
|
|
|
function Translate_Entity(&$res, $sub) |
|
957
|
|
|
{ |
|
958
|
|
|
$res['php'] .= "'$sub[text]'"; |
|
959
|
|
|
} |
|
960
|
|
|
|
|
961
|
|
|
function Translate_Default(&$res, $sub) |
|
962
|
|
|
{ |
|
963
|
|
|
$res['php'] .= ",$sub[text]"; |
|
964
|
|
|
} |
|
965
|
|
|
|
|
966
|
|
|
function Translate_Context(&$res, $sub) |
|
967
|
|
|
{ |
|
968
|
|
|
$res['php'] .= ",$sub[text]"; |
|
969
|
|
|
} |
|
970
|
|
|
|
|
971
|
|
|
function Translate_InjectionVariables(&$res, $sub) |
|
972
|
|
|
{ |
|
973
|
|
|
$res['php'] .= ",$sub[php]"; |
|
974
|
|
|
} |
|
975
|
|
|
|
|
976
|
|
|
function Translate__finalise(&$res) |
|
977
|
|
|
{ |
|
978
|
|
|
$res['php'] .= ');'; |
|
979
|
|
|
} |
|
980
|
|
|
|
|
981
|
|
|
function InjectionVariables__construct(&$res) |
|
982
|
|
|
{ |
|
983
|
|
|
$res['php'] = "array("; |
|
984
|
|
|
} |
|
985
|
|
|
|
|
986
|
|
|
function InjectionVariables_InjectionName(&$res, $sub) |
|
987
|
|
|
{ |
|
988
|
|
|
$res['php'] .= "'$sub[text]'=>"; |
|
989
|
|
|
} |
|
990
|
|
|
|
|
991
|
|
|
function InjectionVariables_Argument(&$res, $sub) |
|
992
|
|
|
{ |
|
993
|
|
|
$res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']) . ','; |
|
994
|
|
|
} |
|
995
|
|
|
|
|
996
|
|
|
function InjectionVariables__finalise(&$res) |
|
997
|
|
|
{ |
|
998
|
|
|
if (substr($res['php'], -1) == ',') { |
|
999
|
|
|
$res['php'] = substr($res['php'], 0, -1); //remove last comma in the array |
|
1000
|
|
|
} |
|
1001
|
|
|
$res['php'] .= ')'; |
|
1002
|
|
|
} |
|
1003
|
|
|
|
|
1004
|
|
|
|
|
1005
|
|
|
/* SimpleInjection: '$' :Lookup */ |
|
1006
|
|
|
protected $match_SimpleInjection_typestack = array('SimpleInjection'); |
|
1007
|
|
|
function match_SimpleInjection ($stack = array()) { |
|
1008
|
|
|
$matchrule = "SimpleInjection"; $result = $this->construct($matchrule, $matchrule, null); |
|
1009
|
|
|
$_127 = NULL; |
|
1010
|
|
|
do { |
|
|
|
|
|
|
1011
|
|
|
if (substr($this->string,$this->pos,1) == '$') { |
|
1012
|
|
|
$this->pos += 1; |
|
1013
|
|
|
$result["text"] .= '$'; |
|
1014
|
|
|
} |
|
1015
|
|
|
else { $_127 = FALSE; break; } |
|
1016
|
|
|
$matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos; |
|
1017
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1018
|
|
|
if ($subres !== FALSE) { |
|
1019
|
|
|
$this->store( $result, $subres, "Lookup" ); |
|
1020
|
|
|
} |
|
1021
|
|
|
else { $_127 = FALSE; break; } |
|
1022
|
|
|
$_127 = TRUE; break; |
|
1023
|
|
|
} |
|
1024
|
|
|
while(0); |
|
1025
|
|
|
if( $_127 === TRUE ) { return $this->finalise($result); } |
|
1026
|
|
|
if( $_127 === FALSE) { return FALSE; } |
|
1027
|
|
|
} |
|
1028
|
|
|
|
|
1029
|
|
|
|
|
1030
|
|
|
/* BracketInjection: '{$' :Lookup "}" */ |
|
1031
|
|
|
protected $match_BracketInjection_typestack = array('BracketInjection'); |
|
1032
|
|
|
function match_BracketInjection ($stack = array()) { |
|
1033
|
|
|
$matchrule = "BracketInjection"; $result = $this->construct($matchrule, $matchrule, null); |
|
1034
|
|
|
$_132 = NULL; |
|
1035
|
|
|
do { |
|
|
|
|
|
|
1036
|
|
|
if (( $subres = $this->literal( '{$' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1037
|
|
|
else { $_132 = FALSE; break; } |
|
1038
|
|
|
$matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos; |
|
1039
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1040
|
|
|
if ($subres !== FALSE) { |
|
1041
|
|
|
$this->store( $result, $subres, "Lookup" ); |
|
1042
|
|
|
} |
|
1043
|
|
|
else { $_132 = FALSE; break; } |
|
1044
|
|
|
if (substr($this->string,$this->pos,1) == '}') { |
|
1045
|
|
|
$this->pos += 1; |
|
1046
|
|
|
$result["text"] .= '}'; |
|
1047
|
|
|
} |
|
1048
|
|
|
else { $_132 = FALSE; break; } |
|
1049
|
|
|
$_132 = TRUE; break; |
|
1050
|
|
|
} |
|
1051
|
|
|
while(0); |
|
1052
|
|
|
if( $_132 === TRUE ) { return $this->finalise($result); } |
|
1053
|
|
|
if( $_132 === FALSE) { return FALSE; } |
|
1054
|
|
|
} |
|
1055
|
|
|
|
|
1056
|
|
|
|
|
1057
|
|
|
/* Injection: BracketInjection | SimpleInjection */ |
|
1058
|
|
|
protected $match_Injection_typestack = array('Injection'); |
|
1059
|
|
|
function match_Injection ($stack = array()) { |
|
1060
|
|
|
$matchrule = "Injection"; $result = $this->construct($matchrule, $matchrule, null); |
|
1061
|
|
|
$_137 = NULL; |
|
1062
|
|
|
do { |
|
|
|
|
|
|
1063
|
|
|
$res_134 = $result; |
|
1064
|
|
|
$pos_134 = $this->pos; |
|
1065
|
|
|
$matcher = 'match_'.'BracketInjection'; $key = $matcher; $pos = $this->pos; |
|
1066
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1067
|
|
|
if ($subres !== FALSE) { |
|
1068
|
|
|
$this->store( $result, $subres ); |
|
1069
|
|
|
$_137 = TRUE; break; |
|
1070
|
|
|
} |
|
1071
|
|
|
$result = $res_134; |
|
1072
|
|
|
$this->pos = $pos_134; |
|
1073
|
|
|
$matcher = 'match_'.'SimpleInjection'; $key = $matcher; $pos = $this->pos; |
|
1074
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1075
|
|
|
if ($subres !== FALSE) { |
|
1076
|
|
|
$this->store( $result, $subres ); |
|
1077
|
|
|
$_137 = TRUE; break; |
|
1078
|
|
|
} |
|
1079
|
|
|
$result = $res_134; |
|
1080
|
|
|
$this->pos = $pos_134; |
|
1081
|
|
|
$_137 = FALSE; break; |
|
1082
|
|
|
} |
|
1083
|
|
|
while(0); |
|
1084
|
|
|
if( $_137 === TRUE ) { return $this->finalise($result); } |
|
1085
|
|
|
if( $_137 === FALSE) { return FALSE; } |
|
1086
|
|
|
} |
|
1087
|
|
|
|
|
1088
|
|
|
|
|
1089
|
|
|
|
|
1090
|
|
|
function Injection_STR(&$res, $sub) |
|
1091
|
|
|
{ |
|
1092
|
|
|
$res['php'] = '$val .= '. str_replace('$$FINAL', 'XML_val', $sub['Lookup']['php']) . ';'; |
|
1093
|
|
|
} |
|
1094
|
|
|
|
|
1095
|
|
|
/* DollarMarkedLookup: SimpleInjection */ |
|
1096
|
|
|
protected $match_DollarMarkedLookup_typestack = array('DollarMarkedLookup'); |
|
1097
|
|
|
function match_DollarMarkedLookup ($stack = array()) { |
|
1098
|
|
|
$matchrule = "DollarMarkedLookup"; $result = $this->construct($matchrule, $matchrule, null); |
|
1099
|
|
|
$matcher = 'match_'.'SimpleInjection'; $key = $matcher; $pos = $this->pos; |
|
1100
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1101
|
|
|
if ($subres !== FALSE) { |
|
1102
|
|
|
$this->store( $result, $subres ); |
|
1103
|
|
|
return $this->finalise($result); |
|
1104
|
|
|
} |
|
1105
|
|
|
else { return FALSE; } |
|
1106
|
|
|
} |
|
1107
|
|
|
|
|
1108
|
|
|
|
|
1109
|
|
|
|
|
1110
|
|
|
function DollarMarkedLookup_STR(&$res, $sub) |
|
1111
|
|
|
{ |
|
1112
|
|
|
$res['Lookup'] = $sub['Lookup']; |
|
1113
|
|
|
} |
|
1114
|
|
|
|
|
1115
|
|
|
/* QuotedString: q:/['"]/ String:/ (\\\\ | \\. | [^$q\\])* / '$q' */ |
|
1116
|
|
|
protected $match_QuotedString_typestack = array('QuotedString'); |
|
1117
|
|
|
function match_QuotedString ($stack = array()) { |
|
1118
|
|
|
$matchrule = "QuotedString"; $result = $this->construct($matchrule, $matchrule, null); |
|
1119
|
|
|
$_143 = NULL; |
|
1120
|
|
|
do { |
|
|
|
|
|
|
1121
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "q" ); |
|
1122
|
|
|
if (( $subres = $this->rx( '/[\'"]/' ) ) !== FALSE) { |
|
1123
|
|
|
$result["text"] .= $subres; |
|
1124
|
|
|
$subres = $result; $result = array_pop($stack); |
|
1125
|
|
|
$this->store( $result, $subres, 'q' ); |
|
1126
|
|
|
} |
|
1127
|
|
|
else { |
|
1128
|
|
|
$result = array_pop($stack); |
|
1129
|
|
|
$_143 = FALSE; break; |
|
1130
|
|
|
} |
|
1131
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "String" ); |
|
1132
|
|
|
if (( $subres = $this->rx( '/ (\\\\\\\\ | \\\\. | [^'.$this->expression($result, $stack, 'q').'\\\\])* /' ) ) !== FALSE) { |
|
1133
|
|
|
$result["text"] .= $subres; |
|
1134
|
|
|
$subres = $result; $result = array_pop($stack); |
|
1135
|
|
|
$this->store( $result, $subres, 'String' ); |
|
1136
|
|
|
} |
|
1137
|
|
|
else { |
|
1138
|
|
|
$result = array_pop($stack); |
|
1139
|
|
|
$_143 = FALSE; break; |
|
1140
|
|
|
} |
|
1141
|
|
|
if (( $subres = $this->literal( ''.$this->expression($result, $stack, 'q').'' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1142
|
|
|
else { $_143 = FALSE; break; } |
|
1143
|
|
|
$_143 = TRUE; break; |
|
1144
|
|
|
} |
|
1145
|
|
|
while(0); |
|
1146
|
|
|
if( $_143 === TRUE ) { return $this->finalise($result); } |
|
1147
|
|
|
if( $_143 === FALSE) { return FALSE; } |
|
1148
|
|
|
} |
|
1149
|
|
|
|
|
1150
|
|
|
|
|
1151
|
|
|
/* FreeString: /[^,)%!=><|&]+/ */ |
|
|
|
|
|
|
1152
|
|
|
protected $match_FreeString_typestack = array('FreeString'); |
|
1153
|
|
|
function match_FreeString ($stack = array()) { |
|
|
|
|
|
|
1154
|
|
|
$matchrule = "FreeString"; $result = $this->construct($matchrule, $matchrule, null); |
|
1155
|
|
|
if (( $subres = $this->rx( '/[^,)%!=><|&]+/' ) ) !== FALSE) { |
|
1156
|
|
|
$result["text"] .= $subres; |
|
1157
|
|
|
return $this->finalise($result); |
|
1158
|
|
|
} |
|
1159
|
|
|
else { return FALSE; } |
|
1160
|
|
|
} |
|
1161
|
|
|
|
|
1162
|
|
|
|
|
1163
|
|
|
/* Argument: |
|
|
|
|
|
|
1164
|
|
|
:DollarMarkedLookup | |
|
1165
|
|
|
:QuotedString | |
|
1166
|
|
|
:Lookup !(< FreeString)| |
|
1167
|
|
|
:FreeString */ |
|
1168
|
|
|
protected $match_Argument_typestack = array('Argument'); |
|
1169
|
|
|
function match_Argument ($stack = array()) { |
|
1170
|
|
|
$matchrule = "Argument"; $result = $this->construct($matchrule, $matchrule, null); |
|
1171
|
|
|
$_163 = NULL; |
|
1172
|
|
|
do { |
|
|
|
|
|
|
1173
|
|
|
$res_146 = $result; |
|
1174
|
|
|
$pos_146 = $this->pos; |
|
1175
|
|
|
$matcher = 'match_'.'DollarMarkedLookup'; $key = $matcher; $pos = $this->pos; |
|
1176
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1177
|
|
|
if ($subres !== FALSE) { |
|
1178
|
|
|
$this->store( $result, $subres, "DollarMarkedLookup" ); |
|
1179
|
|
|
$_163 = TRUE; break; |
|
1180
|
|
|
} |
|
1181
|
|
|
$result = $res_146; |
|
1182
|
|
|
$this->pos = $pos_146; |
|
1183
|
|
|
$_161 = NULL; |
|
1184
|
|
|
do { |
|
1185
|
|
|
$res_148 = $result; |
|
1186
|
|
|
$pos_148 = $this->pos; |
|
1187
|
|
|
$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos; |
|
1188
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1189
|
|
|
if ($subres !== FALSE) { |
|
1190
|
|
|
$this->store( $result, $subres, "QuotedString" ); |
|
1191
|
|
|
$_161 = TRUE; break; |
|
1192
|
|
|
} |
|
1193
|
|
|
$result = $res_148; |
|
1194
|
|
|
$this->pos = $pos_148; |
|
1195
|
|
|
$_159 = NULL; |
|
1196
|
|
|
do { |
|
1197
|
|
|
$res_150 = $result; |
|
1198
|
|
|
$pos_150 = $this->pos; |
|
1199
|
|
|
$_156 = NULL; |
|
1200
|
|
|
do { |
|
1201
|
|
|
$matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos; |
|
1202
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1203
|
|
|
if ($subres !== FALSE) { |
|
1204
|
|
|
$this->store( $result, $subres, "Lookup" ); |
|
1205
|
|
|
} |
|
1206
|
|
|
else { $_156 = FALSE; break; } |
|
1207
|
|
|
$res_155 = $result; |
|
1208
|
|
|
$pos_155 = $this->pos; |
|
1209
|
|
|
$_154 = NULL; |
|
1210
|
|
|
do { |
|
1211
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1212
|
|
|
$matcher = 'match_'.'FreeString'; $key = $matcher; $pos = $this->pos; |
|
1213
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1214
|
|
|
if ($subres !== FALSE) { |
|
1215
|
|
|
$this->store( $result, $subres ); |
|
1216
|
|
|
} |
|
1217
|
|
|
else { $_154 = FALSE; break; } |
|
1218
|
|
|
$_154 = TRUE; break; |
|
1219
|
|
|
} |
|
1220
|
|
|
while(0); |
|
1221
|
|
|
if( $_154 === TRUE ) { |
|
1222
|
|
|
$result = $res_155; |
|
1223
|
|
|
$this->pos = $pos_155; |
|
1224
|
|
|
$_156 = FALSE; break; |
|
1225
|
|
|
} |
|
1226
|
|
|
if( $_154 === FALSE) { |
|
1227
|
|
|
$result = $res_155; |
|
1228
|
|
|
$this->pos = $pos_155; |
|
1229
|
|
|
} |
|
1230
|
|
|
$_156 = TRUE; break; |
|
1231
|
|
|
} |
|
1232
|
|
|
while(0); |
|
1233
|
|
|
if( $_156 === TRUE ) { $_159 = TRUE; break; } |
|
1234
|
|
|
$result = $res_150; |
|
1235
|
|
|
$this->pos = $pos_150; |
|
1236
|
|
|
$matcher = 'match_'.'FreeString'; $key = $matcher; $pos = $this->pos; |
|
1237
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1238
|
|
|
if ($subres !== FALSE) { |
|
1239
|
|
|
$this->store( $result, $subres, "FreeString" ); |
|
1240
|
|
|
$_159 = TRUE; break; |
|
1241
|
|
|
} |
|
1242
|
|
|
$result = $res_150; |
|
1243
|
|
|
$this->pos = $pos_150; |
|
1244
|
|
|
$_159 = FALSE; break; |
|
1245
|
|
|
} |
|
1246
|
|
|
while(0); |
|
1247
|
|
|
if( $_159 === TRUE ) { $_161 = TRUE; break; } |
|
1248
|
|
|
$result = $res_148; |
|
1249
|
|
|
$this->pos = $pos_148; |
|
1250
|
|
|
$_161 = FALSE; break; |
|
1251
|
|
|
} |
|
1252
|
|
|
while(0); |
|
1253
|
|
|
if( $_161 === TRUE ) { $_163 = TRUE; break; } |
|
1254
|
|
|
$result = $res_146; |
|
1255
|
|
|
$this->pos = $pos_146; |
|
1256
|
|
|
$_163 = FALSE; break; |
|
1257
|
|
|
} |
|
1258
|
|
|
while(0); |
|
1259
|
|
|
if( $_163 === TRUE ) { return $this->finalise($result); } |
|
1260
|
|
|
if( $_163 === FALSE) { return FALSE; } |
|
1261
|
|
|
} |
|
1262
|
|
|
|
|
1263
|
|
|
|
|
1264
|
|
|
|
|
1265
|
|
|
|
|
1266
|
|
|
/** |
|
1267
|
|
|
* If we get a bare value, we don't know enough to determine exactly what php would be the translation, because |
|
1268
|
|
|
* we don't know if the position of use indicates a lookup or a string argument. |
|
1269
|
|
|
* |
|
1270
|
|
|
* Instead, we record 'ArgumentMode' as a member of this matches results node, which can be: |
|
1271
|
|
|
* - lookup if this argument was unambiguously a lookup (marked as such) |
|
1272
|
|
|
* - string is this argument was unambiguously a string (marked as such, or impossible to parse as lookup) |
|
1273
|
|
|
* - default if this argument needs to be handled as per 2.4 |
|
1274
|
|
|
* |
|
1275
|
|
|
* In the case of 'default', there is no php member of the results node, but instead 'lookup_php', which |
|
1276
|
|
|
* should be used by the parent if the context indicates a lookup, and 'string_php' which should be used |
|
1277
|
|
|
* if the context indicates a string |
|
1278
|
|
|
*/ |
|
1279
|
|
|
|
|
1280
|
|
|
function Argument_DollarMarkedLookup(&$res, $sub) |
|
1281
|
|
|
{ |
|
1282
|
|
|
$res['ArgumentMode'] = 'lookup'; |
|
1283
|
|
|
$res['php'] = $sub['Lookup']['php']; |
|
1284
|
|
|
} |
|
1285
|
|
|
|
|
1286
|
|
|
function Argument_QuotedString(&$res, $sub) |
|
1287
|
|
|
{ |
|
1288
|
|
|
$res['ArgumentMode'] = 'string'; |
|
1289
|
|
|
$res['php'] = "'" . str_replace("'", "\\'", $sub['String']['text']) . "'"; |
|
1290
|
|
|
} |
|
1291
|
|
|
|
|
1292
|
|
|
function Argument_Lookup(&$res, $sub) |
|
1293
|
|
|
{ |
|
1294
|
|
|
if (count($sub['LookupSteps']) == 1 && !isset($sub['LookupSteps'][0]['Call']['Arguments'])) { |
|
1295
|
|
|
$res['ArgumentMode'] = 'default'; |
|
1296
|
|
|
$res['lookup_php'] = $sub['php']; |
|
1297
|
|
|
$res['string_php'] = "'".$sub['LookupSteps'][0]['Call']['Method']['text']."'"; |
|
1298
|
|
|
} else { |
|
1299
|
|
|
$res['ArgumentMode'] = 'lookup'; |
|
1300
|
|
|
$res['php'] = $sub['php']; |
|
1301
|
|
|
} |
|
1302
|
|
|
} |
|
1303
|
|
|
|
|
1304
|
|
|
function Argument_FreeString(&$res, $sub) |
|
1305
|
|
|
{ |
|
1306
|
|
|
$res['ArgumentMode'] = 'string'; |
|
1307
|
|
|
$res['php'] = "'" . str_replace("'", "\\'", trim($sub['text'])) . "'"; |
|
1308
|
|
|
} |
|
1309
|
|
|
|
|
1310
|
|
|
/* ComparisonOperator: "!=" | "==" | ">=" | ">" | "<=" | "<" | "=" */ |
|
|
|
|
|
|
1311
|
|
|
protected $match_ComparisonOperator_typestack = array('ComparisonOperator'); |
|
1312
|
|
|
function match_ComparisonOperator ($stack = array()) { |
|
|
|
|
|
|
1313
|
|
|
$matchrule = "ComparisonOperator"; $result = $this->construct($matchrule, $matchrule, null); |
|
1314
|
|
|
$_188 = NULL; |
|
1315
|
|
|
do { |
|
|
|
|
|
|
1316
|
|
|
$res_165 = $result; |
|
1317
|
|
|
$pos_165 = $this->pos; |
|
1318
|
|
|
if (( $subres = $this->literal( '!=' ) ) !== FALSE) { |
|
1319
|
|
|
$result["text"] .= $subres; |
|
1320
|
|
|
$_188 = TRUE; break; |
|
1321
|
|
|
} |
|
1322
|
|
|
$result = $res_165; |
|
1323
|
|
|
$this->pos = $pos_165; |
|
1324
|
|
|
$_186 = NULL; |
|
1325
|
|
|
do { |
|
1326
|
|
|
$res_167 = $result; |
|
1327
|
|
|
$pos_167 = $this->pos; |
|
1328
|
|
|
if (( $subres = $this->literal( '==' ) ) !== FALSE) { |
|
1329
|
|
|
$result["text"] .= $subres; |
|
1330
|
|
|
$_186 = TRUE; break; |
|
1331
|
|
|
} |
|
1332
|
|
|
$result = $res_167; |
|
1333
|
|
|
$this->pos = $pos_167; |
|
1334
|
|
|
$_184 = NULL; |
|
1335
|
|
|
do { |
|
1336
|
|
|
$res_169 = $result; |
|
1337
|
|
|
$pos_169 = $this->pos; |
|
1338
|
|
|
if (( $subres = $this->literal( '>=' ) ) !== FALSE) { |
|
1339
|
|
|
$result["text"] .= $subres; |
|
1340
|
|
|
$_184 = TRUE; break; |
|
1341
|
|
|
} |
|
1342
|
|
|
$result = $res_169; |
|
1343
|
|
|
$this->pos = $pos_169; |
|
1344
|
|
|
$_182 = NULL; |
|
1345
|
|
|
do { |
|
1346
|
|
|
$res_171 = $result; |
|
1347
|
|
|
$pos_171 = $this->pos; |
|
1348
|
|
|
if (substr($this->string,$this->pos,1) == '>') { |
|
1349
|
|
|
$this->pos += 1; |
|
1350
|
|
|
$result["text"] .= '>'; |
|
1351
|
|
|
$_182 = TRUE; break; |
|
1352
|
|
|
} |
|
1353
|
|
|
$result = $res_171; |
|
1354
|
|
|
$this->pos = $pos_171; |
|
1355
|
|
|
$_180 = NULL; |
|
1356
|
|
|
do { |
|
1357
|
|
|
$res_173 = $result; |
|
1358
|
|
|
$pos_173 = $this->pos; |
|
1359
|
|
|
if (( $subres = $this->literal( '<=' ) ) !== FALSE) { |
|
1360
|
|
|
$result["text"] .= $subres; |
|
1361
|
|
|
$_180 = TRUE; break; |
|
1362
|
|
|
} |
|
1363
|
|
|
$result = $res_173; |
|
1364
|
|
|
$this->pos = $pos_173; |
|
1365
|
|
|
$_178 = NULL; |
|
1366
|
|
|
do { |
|
1367
|
|
|
$res_175 = $result; |
|
1368
|
|
|
$pos_175 = $this->pos; |
|
1369
|
|
|
if (substr($this->string,$this->pos,1) == '<') { |
|
1370
|
|
|
$this->pos += 1; |
|
1371
|
|
|
$result["text"] .= '<'; |
|
1372
|
|
|
$_178 = TRUE; break; |
|
1373
|
|
|
} |
|
1374
|
|
|
$result = $res_175; |
|
1375
|
|
|
$this->pos = $pos_175; |
|
1376
|
|
|
if (substr($this->string,$this->pos,1) == '=') { |
|
1377
|
|
|
$this->pos += 1; |
|
1378
|
|
|
$result["text"] .= '='; |
|
1379
|
|
|
$_178 = TRUE; break; |
|
1380
|
|
|
} |
|
1381
|
|
|
$result = $res_175; |
|
1382
|
|
|
$this->pos = $pos_175; |
|
1383
|
|
|
$_178 = FALSE; break; |
|
1384
|
|
|
} |
|
1385
|
|
|
while(0); |
|
1386
|
|
|
if( $_178 === TRUE ) { $_180 = TRUE; break; } |
|
1387
|
|
|
$result = $res_173; |
|
1388
|
|
|
$this->pos = $pos_173; |
|
1389
|
|
|
$_180 = FALSE; break; |
|
1390
|
|
|
} |
|
1391
|
|
|
while(0); |
|
1392
|
|
|
if( $_180 === TRUE ) { $_182 = TRUE; break; } |
|
1393
|
|
|
$result = $res_171; |
|
1394
|
|
|
$this->pos = $pos_171; |
|
1395
|
|
|
$_182 = FALSE; break; |
|
1396
|
|
|
} |
|
1397
|
|
|
while(0); |
|
1398
|
|
|
if( $_182 === TRUE ) { $_184 = TRUE; break; } |
|
1399
|
|
|
$result = $res_169; |
|
1400
|
|
|
$this->pos = $pos_169; |
|
1401
|
|
|
$_184 = FALSE; break; |
|
1402
|
|
|
} |
|
1403
|
|
|
while(0); |
|
1404
|
|
|
if( $_184 === TRUE ) { $_186 = TRUE; break; } |
|
1405
|
|
|
$result = $res_167; |
|
1406
|
|
|
$this->pos = $pos_167; |
|
1407
|
|
|
$_186 = FALSE; break; |
|
1408
|
|
|
} |
|
1409
|
|
|
while(0); |
|
1410
|
|
|
if( $_186 === TRUE ) { $_188 = TRUE; break; } |
|
1411
|
|
|
$result = $res_165; |
|
1412
|
|
|
$this->pos = $pos_165; |
|
1413
|
|
|
$_188 = FALSE; break; |
|
1414
|
|
|
} |
|
1415
|
|
|
while(0); |
|
1416
|
|
|
if( $_188 === TRUE ) { return $this->finalise($result); } |
|
1417
|
|
|
if( $_188 === FALSE) { return FALSE; } |
|
1418
|
|
|
} |
|
1419
|
|
|
|
|
1420
|
|
|
|
|
1421
|
|
|
/* Comparison: Argument < ComparisonOperator > Argument */ |
|
1422
|
|
|
protected $match_Comparison_typestack = array('Comparison'); |
|
1423
|
|
|
function match_Comparison ($stack = array()) { |
|
1424
|
|
|
$matchrule = "Comparison"; $result = $this->construct($matchrule, $matchrule, null); |
|
1425
|
|
|
$_195 = NULL; |
|
1426
|
|
|
do { |
|
|
|
|
|
|
1427
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos; |
|
1428
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1429
|
|
|
if ($subres !== FALSE) { |
|
1430
|
|
|
$this->store( $result, $subres ); |
|
1431
|
|
|
} |
|
1432
|
|
|
else { $_195 = FALSE; break; } |
|
1433
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1434
|
|
|
$matcher = 'match_'.'ComparisonOperator'; $key = $matcher; $pos = $this->pos; |
|
1435
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1436
|
|
|
if ($subres !== FALSE) { |
|
1437
|
|
|
$this->store( $result, $subres ); |
|
1438
|
|
|
} |
|
1439
|
|
|
else { $_195 = FALSE; break; } |
|
1440
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1441
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos; |
|
1442
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1443
|
|
|
if ($subres !== FALSE) { |
|
1444
|
|
|
$this->store( $result, $subres ); |
|
1445
|
|
|
} |
|
1446
|
|
|
else { $_195 = FALSE; break; } |
|
1447
|
|
|
$_195 = TRUE; break; |
|
1448
|
|
|
} |
|
1449
|
|
|
while(0); |
|
1450
|
|
|
if( $_195 === TRUE ) { return $this->finalise($result); } |
|
1451
|
|
|
if( $_195 === FALSE) { return FALSE; } |
|
1452
|
|
|
} |
|
1453
|
|
|
|
|
1454
|
|
|
|
|
1455
|
|
|
|
|
1456
|
|
|
function Comparison_Argument(&$res, $sub) |
|
1457
|
|
|
{ |
|
1458
|
|
|
if ($sub['ArgumentMode'] == 'default') { |
|
1459
|
|
|
if (!empty($res['php'])) { |
|
1460
|
|
|
$res['php'] .= $sub['string_php']; |
|
1461
|
|
|
} else { |
|
1462
|
|
|
$res['php'] = str_replace('$$FINAL', 'XML_val', $sub['lookup_php']); |
|
1463
|
|
|
} |
|
1464
|
|
|
} else { |
|
1465
|
|
|
$res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']); |
|
1466
|
|
|
} |
|
1467
|
|
|
} |
|
1468
|
|
|
|
|
1469
|
|
|
function Comparison_ComparisonOperator(&$res, $sub) |
|
1470
|
|
|
{ |
|
1471
|
|
|
$res['php'] .= ($sub['text'] == '=' ? '==' : $sub['text']); |
|
1472
|
|
|
} |
|
1473
|
|
|
|
|
1474
|
|
|
/* PresenceCheck: (Not:'not' <)? Argument */ |
|
1475
|
|
|
protected $match_PresenceCheck_typestack = array('PresenceCheck'); |
|
1476
|
|
|
function match_PresenceCheck ($stack = array()) { |
|
1477
|
|
|
$matchrule = "PresenceCheck"; $result = $this->construct($matchrule, $matchrule, null); |
|
1478
|
|
|
$_202 = NULL; |
|
1479
|
|
|
do { |
|
|
|
|
|
|
1480
|
|
|
$res_200 = $result; |
|
1481
|
|
|
$pos_200 = $this->pos; |
|
1482
|
|
|
$_199 = NULL; |
|
1483
|
|
|
do { |
|
1484
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Not" ); |
|
1485
|
|
|
if (( $subres = $this->literal( 'not' ) ) !== FALSE) { |
|
1486
|
|
|
$result["text"] .= $subres; |
|
1487
|
|
|
$subres = $result; $result = array_pop($stack); |
|
1488
|
|
|
$this->store( $result, $subres, 'Not' ); |
|
1489
|
|
|
} |
|
1490
|
|
|
else { |
|
1491
|
|
|
$result = array_pop($stack); |
|
1492
|
|
|
$_199 = FALSE; break; |
|
1493
|
|
|
} |
|
1494
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1495
|
|
|
$_199 = TRUE; break; |
|
1496
|
|
|
} |
|
1497
|
|
|
while(0); |
|
1498
|
|
|
if( $_199 === FALSE) { |
|
1499
|
|
|
$result = $res_200; |
|
1500
|
|
|
$this->pos = $pos_200; |
|
1501
|
|
|
unset( $res_200 ); |
|
1502
|
|
|
unset( $pos_200 ); |
|
1503
|
|
|
} |
|
1504
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos; |
|
1505
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1506
|
|
|
if ($subres !== FALSE) { |
|
1507
|
|
|
$this->store( $result, $subres ); |
|
1508
|
|
|
} |
|
1509
|
|
|
else { $_202 = FALSE; break; } |
|
1510
|
|
|
$_202 = TRUE; break; |
|
1511
|
|
|
} |
|
1512
|
|
|
while(0); |
|
1513
|
|
|
if( $_202 === TRUE ) { return $this->finalise($result); } |
|
1514
|
|
|
if( $_202 === FALSE) { return FALSE; } |
|
1515
|
|
|
} |
|
1516
|
|
|
|
|
1517
|
|
|
|
|
1518
|
|
|
|
|
1519
|
|
|
function PresenceCheck_Not(&$res, $sub) |
|
|
|
|
|
|
1520
|
|
|
{ |
|
1521
|
|
|
$res['php'] = '!'; |
|
1522
|
|
|
} |
|
1523
|
|
|
|
|
1524
|
|
|
function PresenceCheck_Argument(&$res, $sub) |
|
1525
|
|
|
{ |
|
1526
|
|
|
if ($sub['ArgumentMode'] == 'string') { |
|
1527
|
|
|
$res['php'] .= '((bool)'.$sub['php'].')'; |
|
1528
|
|
|
} else { |
|
1529
|
|
|
$php = ($sub['ArgumentMode'] == 'default' ? $sub['lookup_php'] : $sub['php']); |
|
1530
|
|
|
// TODO: kinda hacky - maybe we need a way to pass state down the parse chain so |
|
1531
|
|
|
// Lookup_LastLookupStep and Argument_BareWord can produce hasValue instead of XML_val |
|
1532
|
|
|
$res['php'] .= str_replace('$$FINAL', 'hasValue', $php); |
|
1533
|
|
|
} |
|
1534
|
|
|
} |
|
1535
|
|
|
|
|
1536
|
|
|
/* IfArgumentPortion: Comparison | PresenceCheck */ |
|
1537
|
|
|
protected $match_IfArgumentPortion_typestack = array('IfArgumentPortion'); |
|
1538
|
|
|
function match_IfArgumentPortion ($stack = array()) { |
|
1539
|
|
|
$matchrule = "IfArgumentPortion"; $result = $this->construct($matchrule, $matchrule, null); |
|
1540
|
|
|
$_207 = NULL; |
|
1541
|
|
|
do { |
|
|
|
|
|
|
1542
|
|
|
$res_204 = $result; |
|
1543
|
|
|
$pos_204 = $this->pos; |
|
1544
|
|
|
$matcher = 'match_'.'Comparison'; $key = $matcher; $pos = $this->pos; |
|
1545
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1546
|
|
|
if ($subres !== FALSE) { |
|
1547
|
|
|
$this->store( $result, $subres ); |
|
1548
|
|
|
$_207 = TRUE; break; |
|
1549
|
|
|
} |
|
1550
|
|
|
$result = $res_204; |
|
1551
|
|
|
$this->pos = $pos_204; |
|
1552
|
|
|
$matcher = 'match_'.'PresenceCheck'; $key = $matcher; $pos = $this->pos; |
|
1553
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1554
|
|
|
if ($subres !== FALSE) { |
|
1555
|
|
|
$this->store( $result, $subres ); |
|
1556
|
|
|
$_207 = TRUE; break; |
|
1557
|
|
|
} |
|
1558
|
|
|
$result = $res_204; |
|
1559
|
|
|
$this->pos = $pos_204; |
|
1560
|
|
|
$_207 = FALSE; break; |
|
1561
|
|
|
} |
|
1562
|
|
|
while(0); |
|
1563
|
|
|
if( $_207 === TRUE ) { return $this->finalise($result); } |
|
1564
|
|
|
if( $_207 === FALSE) { return FALSE; } |
|
1565
|
|
|
} |
|
1566
|
|
|
|
|
1567
|
|
|
|
|
1568
|
|
|
|
|
1569
|
|
|
function IfArgumentPortion_STR(&$res, $sub) |
|
1570
|
|
|
{ |
|
1571
|
|
|
$res['php'] = $sub['php']; |
|
1572
|
|
|
} |
|
1573
|
|
|
|
|
1574
|
|
|
/* BooleanOperator: "||" | "&&" */ |
|
|
|
|
|
|
1575
|
|
|
protected $match_BooleanOperator_typestack = array('BooleanOperator'); |
|
1576
|
|
|
function match_BooleanOperator ($stack = array()) { |
|
|
|
|
|
|
1577
|
|
|
$matchrule = "BooleanOperator"; $result = $this->construct($matchrule, $matchrule, null); |
|
1578
|
|
|
$_212 = NULL; |
|
1579
|
|
|
do { |
|
|
|
|
|
|
1580
|
|
|
$res_209 = $result; |
|
1581
|
|
|
$pos_209 = $this->pos; |
|
1582
|
|
|
if (( $subres = $this->literal( '||' ) ) !== FALSE) { |
|
1583
|
|
|
$result["text"] .= $subres; |
|
1584
|
|
|
$_212 = TRUE; break; |
|
1585
|
|
|
} |
|
1586
|
|
|
$result = $res_209; |
|
1587
|
|
|
$this->pos = $pos_209; |
|
1588
|
|
|
if (( $subres = $this->literal( '&&' ) ) !== FALSE) { |
|
1589
|
|
|
$result["text"] .= $subres; |
|
1590
|
|
|
$_212 = TRUE; break; |
|
1591
|
|
|
} |
|
1592
|
|
|
$result = $res_209; |
|
1593
|
|
|
$this->pos = $pos_209; |
|
1594
|
|
|
$_212 = FALSE; break; |
|
1595
|
|
|
} |
|
1596
|
|
|
while(0); |
|
1597
|
|
|
if( $_212 === TRUE ) { return $this->finalise($result); } |
|
1598
|
|
|
if( $_212 === FALSE) { return FALSE; } |
|
1599
|
|
|
} |
|
1600
|
|
|
|
|
1601
|
|
|
|
|
1602
|
|
|
/* IfArgument: :IfArgumentPortion ( < :BooleanOperator < :IfArgumentPortion )* */ |
|
1603
|
|
|
protected $match_IfArgument_typestack = array('IfArgument'); |
|
1604
|
|
|
function match_IfArgument ($stack = array()) { |
|
1605
|
|
|
$matchrule = "IfArgument"; $result = $this->construct($matchrule, $matchrule, null); |
|
1606
|
|
|
$_221 = NULL; |
|
1607
|
|
|
do { |
|
|
|
|
|
|
1608
|
|
|
$matcher = 'match_'.'IfArgumentPortion'; $key = $matcher; $pos = $this->pos; |
|
1609
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1610
|
|
|
if ($subres !== FALSE) { |
|
1611
|
|
|
$this->store( $result, $subres, "IfArgumentPortion" ); |
|
1612
|
|
|
} |
|
1613
|
|
|
else { $_221 = FALSE; break; } |
|
1614
|
|
|
while (true) { |
|
1615
|
|
|
$res_220 = $result; |
|
1616
|
|
|
$pos_220 = $this->pos; |
|
1617
|
|
|
$_219 = NULL; |
|
1618
|
|
|
do { |
|
1619
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1620
|
|
|
$matcher = 'match_'.'BooleanOperator'; $key = $matcher; $pos = $this->pos; |
|
1621
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1622
|
|
|
if ($subres !== FALSE) { |
|
1623
|
|
|
$this->store( $result, $subres, "BooleanOperator" ); |
|
1624
|
|
|
} |
|
1625
|
|
|
else { $_219 = FALSE; break; } |
|
1626
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1627
|
|
|
$matcher = 'match_'.'IfArgumentPortion'; $key = $matcher; $pos = $this->pos; |
|
1628
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1629
|
|
|
if ($subres !== FALSE) { |
|
1630
|
|
|
$this->store( $result, $subres, "IfArgumentPortion" ); |
|
1631
|
|
|
} |
|
1632
|
|
|
else { $_219 = FALSE; break; } |
|
1633
|
|
|
$_219 = TRUE; break; |
|
1634
|
|
|
} |
|
1635
|
|
|
while(0); |
|
1636
|
|
|
if( $_219 === FALSE) { |
|
1637
|
|
|
$result = $res_220; |
|
1638
|
|
|
$this->pos = $pos_220; |
|
1639
|
|
|
unset( $res_220 ); |
|
1640
|
|
|
unset( $pos_220 ); |
|
1641
|
|
|
break; |
|
1642
|
|
|
} |
|
1643
|
|
|
} |
|
1644
|
|
|
$_221 = TRUE; break; |
|
1645
|
|
|
} |
|
1646
|
|
|
while(0); |
|
1647
|
|
|
if( $_221 === TRUE ) { return $this->finalise($result); } |
|
1648
|
|
|
if( $_221 === FALSE) { return FALSE; } |
|
1649
|
|
|
} |
|
1650
|
|
|
|
|
1651
|
|
|
|
|
1652
|
|
|
|
|
1653
|
|
|
function IfArgument_IfArgumentPortion(&$res, $sub) |
|
1654
|
|
|
{ |
|
1655
|
|
|
$res['php'] .= $sub['php']; |
|
1656
|
|
|
} |
|
1657
|
|
|
|
|
1658
|
|
|
function IfArgument_BooleanOperator(&$res, $sub) |
|
1659
|
|
|
{ |
|
1660
|
|
|
$res['php'] .= $sub['text']; |
|
1661
|
|
|
} |
|
1662
|
|
|
|
|
1663
|
|
|
/* IfPart: '<%' < 'if' [ :IfArgument > '%>' Template:$TemplateMatcher? */ |
|
1664
|
|
|
protected $match_IfPart_typestack = array('IfPart'); |
|
1665
|
|
|
function match_IfPart ($stack = array()) { |
|
1666
|
|
|
$matchrule = "IfPart"; $result = $this->construct($matchrule, $matchrule, null); |
|
1667
|
|
|
$_231 = NULL; |
|
1668
|
|
|
do { |
|
|
|
|
|
|
1669
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1670
|
|
|
else { $_231 = FALSE; break; } |
|
1671
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1672
|
|
|
if (( $subres = $this->literal( 'if' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1673
|
|
|
else { $_231 = FALSE; break; } |
|
1674
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1675
|
|
|
else { $_231 = FALSE; break; } |
|
1676
|
|
|
$matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos; |
|
1677
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1678
|
|
|
if ($subres !== FALSE) { |
|
1679
|
|
|
$this->store( $result, $subres, "IfArgument" ); |
|
1680
|
|
|
} |
|
1681
|
|
|
else { $_231 = FALSE; break; } |
|
1682
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1683
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1684
|
|
|
else { $_231 = FALSE; break; } |
|
1685
|
|
|
$res_230 = $result; |
|
1686
|
|
|
$pos_230 = $this->pos; |
|
1687
|
|
|
$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos; |
|
1688
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1689
|
|
|
if ($subres !== FALSE) { |
|
1690
|
|
|
$this->store( $result, $subres, "Template" ); |
|
1691
|
|
|
} |
|
1692
|
|
|
else { |
|
1693
|
|
|
$result = $res_230; |
|
1694
|
|
|
$this->pos = $pos_230; |
|
1695
|
|
|
unset( $res_230 ); |
|
1696
|
|
|
unset( $pos_230 ); |
|
1697
|
|
|
} |
|
1698
|
|
|
$_231 = TRUE; break; |
|
1699
|
|
|
} |
|
1700
|
|
|
while(0); |
|
1701
|
|
|
if( $_231 === TRUE ) { return $this->finalise($result); } |
|
1702
|
|
|
if( $_231 === FALSE) { return FALSE; } |
|
1703
|
|
|
} |
|
1704
|
|
|
|
|
1705
|
|
|
|
|
1706
|
|
|
/* ElseIfPart: '<%' < 'else_if' [ :IfArgument > '%>' Template:$TemplateMatcher? */ |
|
1707
|
|
|
protected $match_ElseIfPart_typestack = array('ElseIfPart'); |
|
1708
|
|
|
function match_ElseIfPart ($stack = array()) { |
|
1709
|
|
|
$matchrule = "ElseIfPart"; $result = $this->construct($matchrule, $matchrule, null); |
|
1710
|
|
|
$_241 = NULL; |
|
1711
|
|
|
do { |
|
|
|
|
|
|
1712
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1713
|
|
|
else { $_241 = FALSE; break; } |
|
1714
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1715
|
|
|
if (( $subres = $this->literal( 'else_if' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1716
|
|
|
else { $_241 = FALSE; break; } |
|
1717
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1718
|
|
|
else { $_241 = FALSE; break; } |
|
1719
|
|
|
$matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos; |
|
1720
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1721
|
|
|
if ($subres !== FALSE) { |
|
1722
|
|
|
$this->store( $result, $subres, "IfArgument" ); |
|
1723
|
|
|
} |
|
1724
|
|
|
else { $_241 = FALSE; break; } |
|
1725
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1726
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1727
|
|
|
else { $_241 = FALSE; break; } |
|
1728
|
|
|
$res_240 = $result; |
|
1729
|
|
|
$pos_240 = $this->pos; |
|
1730
|
|
|
$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos; |
|
1731
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1732
|
|
|
if ($subres !== FALSE) { |
|
1733
|
|
|
$this->store( $result, $subres, "Template" ); |
|
1734
|
|
|
} |
|
1735
|
|
|
else { |
|
1736
|
|
|
$result = $res_240; |
|
1737
|
|
|
$this->pos = $pos_240; |
|
1738
|
|
|
unset( $res_240 ); |
|
1739
|
|
|
unset( $pos_240 ); |
|
1740
|
|
|
} |
|
1741
|
|
|
$_241 = TRUE; break; |
|
1742
|
|
|
} |
|
1743
|
|
|
while(0); |
|
1744
|
|
|
if( $_241 === TRUE ) { return $this->finalise($result); } |
|
1745
|
|
|
if( $_241 === FALSE) { return FALSE; } |
|
1746
|
|
|
} |
|
1747
|
|
|
|
|
1748
|
|
|
|
|
1749
|
|
|
/* ElsePart: '<%' < 'else' > '%>' Template:$TemplateMatcher? */ |
|
1750
|
|
|
protected $match_ElsePart_typestack = array('ElsePart'); |
|
1751
|
|
|
function match_ElsePart ($stack = array()) { |
|
1752
|
|
|
$matchrule = "ElsePart"; $result = $this->construct($matchrule, $matchrule, null); |
|
1753
|
|
|
$_249 = NULL; |
|
1754
|
|
|
do { |
|
|
|
|
|
|
1755
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1756
|
|
|
else { $_249 = FALSE; break; } |
|
1757
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1758
|
|
|
if (( $subres = $this->literal( 'else' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1759
|
|
|
else { $_249 = FALSE; break; } |
|
1760
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1761
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1762
|
|
|
else { $_249 = FALSE; break; } |
|
1763
|
|
|
$res_248 = $result; |
|
1764
|
|
|
$pos_248 = $this->pos; |
|
1765
|
|
|
$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos; |
|
1766
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1767
|
|
|
if ($subres !== FALSE) { |
|
1768
|
|
|
$this->store( $result, $subres, "Template" ); |
|
1769
|
|
|
} |
|
1770
|
|
|
else { |
|
1771
|
|
|
$result = $res_248; |
|
1772
|
|
|
$this->pos = $pos_248; |
|
1773
|
|
|
unset( $res_248 ); |
|
1774
|
|
|
unset( $pos_248 ); |
|
1775
|
|
|
} |
|
1776
|
|
|
$_249 = TRUE; break; |
|
1777
|
|
|
} |
|
1778
|
|
|
while(0); |
|
1779
|
|
|
if( $_249 === TRUE ) { return $this->finalise($result); } |
|
1780
|
|
|
if( $_249 === FALSE) { return FALSE; } |
|
1781
|
|
|
} |
|
1782
|
|
|
|
|
1783
|
|
|
|
|
1784
|
|
|
/* If: IfPart ElseIfPart* ElsePart? '<%' < 'end_if' > '%>' */ |
|
1785
|
|
|
protected $match_If_typestack = array('If'); |
|
1786
|
|
|
function match_If ($stack = array()) { |
|
1787
|
|
|
$matchrule = "If"; $result = $this->construct($matchrule, $matchrule, null); |
|
1788
|
|
|
$_259 = NULL; |
|
1789
|
|
|
do { |
|
|
|
|
|
|
1790
|
|
|
$matcher = 'match_'.'IfPart'; $key = $matcher; $pos = $this->pos; |
|
1791
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1792
|
|
|
if ($subres !== FALSE) { |
|
1793
|
|
|
$this->store( $result, $subres ); |
|
1794
|
|
|
} |
|
1795
|
|
|
else { $_259 = FALSE; break; } |
|
1796
|
|
|
while (true) { |
|
1797
|
|
|
$res_252 = $result; |
|
1798
|
|
|
$pos_252 = $this->pos; |
|
1799
|
|
|
$matcher = 'match_'.'ElseIfPart'; $key = $matcher; $pos = $this->pos; |
|
1800
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1801
|
|
|
if ($subres !== FALSE) { |
|
1802
|
|
|
$this->store( $result, $subres ); |
|
1803
|
|
|
} |
|
1804
|
|
|
else { |
|
1805
|
|
|
$result = $res_252; |
|
1806
|
|
|
$this->pos = $pos_252; |
|
1807
|
|
|
unset( $res_252 ); |
|
1808
|
|
|
unset( $pos_252 ); |
|
1809
|
|
|
break; |
|
1810
|
|
|
} |
|
1811
|
|
|
} |
|
1812
|
|
|
$res_253 = $result; |
|
1813
|
|
|
$pos_253 = $this->pos; |
|
1814
|
|
|
$matcher = 'match_'.'ElsePart'; $key = $matcher; $pos = $this->pos; |
|
1815
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1816
|
|
|
if ($subres !== FALSE) { |
|
1817
|
|
|
$this->store( $result, $subres ); |
|
1818
|
|
|
} |
|
1819
|
|
|
else { |
|
1820
|
|
|
$result = $res_253; |
|
1821
|
|
|
$this->pos = $pos_253; |
|
1822
|
|
|
unset( $res_253 ); |
|
1823
|
|
|
unset( $pos_253 ); |
|
1824
|
|
|
} |
|
1825
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1826
|
|
|
else { $_259 = FALSE; break; } |
|
1827
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1828
|
|
|
if (( $subres = $this->literal( 'end_if' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1829
|
|
|
else { $_259 = FALSE; break; } |
|
1830
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1831
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1832
|
|
|
else { $_259 = FALSE; break; } |
|
1833
|
|
|
$_259 = TRUE; break; |
|
1834
|
|
|
} |
|
1835
|
|
|
while(0); |
|
1836
|
|
|
if( $_259 === TRUE ) { return $this->finalise($result); } |
|
1837
|
|
|
if( $_259 === FALSE) { return FALSE; } |
|
1838
|
|
|
} |
|
1839
|
|
|
|
|
1840
|
|
|
|
|
1841
|
|
|
|
|
1842
|
|
|
function If_IfPart(&$res, $sub) |
|
1843
|
|
|
{ |
|
1844
|
|
|
$res['php'] = |
|
1845
|
|
|
'if (' . $sub['IfArgument']['php'] . ') { ' . PHP_EOL . |
|
1846
|
|
|
(isset($sub['Template']) ? $sub['Template']['php'] : '') . PHP_EOL . |
|
1847
|
|
|
'}'; |
|
1848
|
|
|
} |
|
1849
|
|
|
|
|
1850
|
|
|
function If_ElseIfPart(&$res, $sub) |
|
1851
|
|
|
{ |
|
1852
|
|
|
$res['php'] .= |
|
1853
|
|
|
'else if (' . $sub['IfArgument']['php'] . ') { ' . PHP_EOL . |
|
1854
|
|
|
(isset($sub['Template']) ? $sub['Template']['php'] : '') . PHP_EOL . |
|
1855
|
|
|
'}'; |
|
1856
|
|
|
} |
|
1857
|
|
|
|
|
1858
|
|
|
function If_ElsePart(&$res, $sub) |
|
1859
|
|
|
{ |
|
1860
|
|
|
$res['php'] .= |
|
1861
|
|
|
'else { ' . PHP_EOL . |
|
1862
|
|
|
(isset($sub['Template']) ? $sub['Template']['php'] : '') . PHP_EOL . |
|
1863
|
|
|
'}'; |
|
1864
|
|
|
} |
|
1865
|
|
|
|
|
1866
|
|
|
/* Require: '<%' < 'require' [ Call:(Method:Word "(" < :CallArguments > ")") > '%>' */ |
|
1867
|
|
|
protected $match_Require_typestack = array('Require'); |
|
1868
|
|
|
function match_Require ($stack = array()) { |
|
1869
|
|
|
$matchrule = "Require"; $result = $this->construct($matchrule, $matchrule, null); |
|
1870
|
|
|
$_275 = NULL; |
|
1871
|
|
|
do { |
|
|
|
|
|
|
1872
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1873
|
|
|
else { $_275 = FALSE; break; } |
|
1874
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1875
|
|
|
if (( $subres = $this->literal( 'require' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1876
|
|
|
else { $_275 = FALSE; break; } |
|
1877
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1878
|
|
|
else { $_275 = FALSE; break; } |
|
1879
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Call" ); |
|
1880
|
|
|
$_271 = NULL; |
|
1881
|
|
|
do { |
|
1882
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; |
|
1883
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1884
|
|
|
if ($subres !== FALSE) { |
|
1885
|
|
|
$this->store( $result, $subres, "Method" ); |
|
1886
|
|
|
} |
|
1887
|
|
|
else { $_271 = FALSE; break; } |
|
1888
|
|
|
if (substr($this->string,$this->pos,1) == '(') { |
|
1889
|
|
|
$this->pos += 1; |
|
1890
|
|
|
$result["text"] .= '('; |
|
1891
|
|
|
} |
|
1892
|
|
|
else { $_271 = FALSE; break; } |
|
1893
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1894
|
|
|
$matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos; |
|
1895
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1896
|
|
|
if ($subres !== FALSE) { |
|
1897
|
|
|
$this->store( $result, $subres, "CallArguments" ); |
|
1898
|
|
|
} |
|
1899
|
|
|
else { $_271 = FALSE; break; } |
|
1900
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1901
|
|
|
if (substr($this->string,$this->pos,1) == ')') { |
|
1902
|
|
|
$this->pos += 1; |
|
1903
|
|
|
$result["text"] .= ')'; |
|
1904
|
|
|
} |
|
1905
|
|
|
else { $_271 = FALSE; break; } |
|
1906
|
|
|
$_271 = TRUE; break; |
|
1907
|
|
|
} |
|
1908
|
|
|
while(0); |
|
1909
|
|
|
if( $_271 === TRUE ) { |
|
1910
|
|
|
$subres = $result; $result = array_pop($stack); |
|
1911
|
|
|
$this->store( $result, $subres, 'Call' ); |
|
1912
|
|
|
} |
|
1913
|
|
|
if( $_271 === FALSE) { |
|
1914
|
|
|
$result = array_pop($stack); |
|
1915
|
|
|
$_275 = FALSE; break; |
|
1916
|
|
|
} |
|
1917
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1918
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
1919
|
|
|
else { $_275 = FALSE; break; } |
|
1920
|
|
|
$_275 = TRUE; break; |
|
1921
|
|
|
} |
|
1922
|
|
|
while(0); |
|
1923
|
|
|
if( $_275 === TRUE ) { return $this->finalise($result); } |
|
1924
|
|
|
if( $_275 === FALSE) { return FALSE; } |
|
1925
|
|
|
} |
|
1926
|
|
|
|
|
1927
|
|
|
|
|
1928
|
|
|
|
|
1929
|
|
|
function Require_Call(&$res, $sub) |
|
1930
|
|
|
{ |
|
1931
|
|
|
$requirements = '\\SilverStripe\\View\\Requirements'; |
|
1932
|
|
|
$res['php'] = "{$requirements}::".$sub['Method']['text'].'('.$sub['CallArguments']['php'].');'; |
|
1933
|
|
|
} |
|
1934
|
|
|
|
|
1935
|
|
|
|
|
1936
|
|
|
/* CacheBlockArgument: |
|
|
|
|
|
|
1937
|
|
|
!( "if " | "unless " ) |
|
1938
|
|
|
( |
|
1939
|
|
|
:DollarMarkedLookup | |
|
1940
|
|
|
:QuotedString | |
|
1941
|
|
|
:Lookup |
|
1942
|
|
|
) */ |
|
1943
|
|
|
protected $match_CacheBlockArgument_typestack = array('CacheBlockArgument'); |
|
1944
|
|
|
function match_CacheBlockArgument ($stack = array()) { |
|
1945
|
|
|
$matchrule = "CacheBlockArgument"; $result = $this->construct($matchrule, $matchrule, null); |
|
1946
|
|
|
$_295 = NULL; |
|
1947
|
|
|
do { |
|
|
|
|
|
|
1948
|
|
|
$res_283 = $result; |
|
1949
|
|
|
$pos_283 = $this->pos; |
|
1950
|
|
|
$_282 = NULL; |
|
1951
|
|
|
do { |
|
1952
|
|
|
$_280 = NULL; |
|
1953
|
|
|
do { |
|
1954
|
|
|
$res_277 = $result; |
|
1955
|
|
|
$pos_277 = $this->pos; |
|
1956
|
|
|
if (( $subres = $this->literal( 'if ' ) ) !== FALSE) { |
|
1957
|
|
|
$result["text"] .= $subres; |
|
1958
|
|
|
$_280 = TRUE; break; |
|
1959
|
|
|
} |
|
1960
|
|
|
$result = $res_277; |
|
1961
|
|
|
$this->pos = $pos_277; |
|
1962
|
|
|
if (( $subres = $this->literal( 'unless ' ) ) !== FALSE) { |
|
1963
|
|
|
$result["text"] .= $subres; |
|
1964
|
|
|
$_280 = TRUE; break; |
|
1965
|
|
|
} |
|
1966
|
|
|
$result = $res_277; |
|
1967
|
|
|
$this->pos = $pos_277; |
|
1968
|
|
|
$_280 = FALSE; break; |
|
1969
|
|
|
} |
|
1970
|
|
|
while(0); |
|
1971
|
|
|
if( $_280 === FALSE) { $_282 = FALSE; break; } |
|
1972
|
|
|
$_282 = TRUE; break; |
|
1973
|
|
|
} |
|
1974
|
|
|
while(0); |
|
1975
|
|
|
if( $_282 === TRUE ) { |
|
1976
|
|
|
$result = $res_283; |
|
1977
|
|
|
$this->pos = $pos_283; |
|
1978
|
|
|
$_295 = FALSE; break; |
|
1979
|
|
|
} |
|
1980
|
|
|
if( $_282 === FALSE) { |
|
1981
|
|
|
$result = $res_283; |
|
1982
|
|
|
$this->pos = $pos_283; |
|
1983
|
|
|
} |
|
1984
|
|
|
$_293 = NULL; |
|
1985
|
|
|
do { |
|
1986
|
|
|
$_291 = NULL; |
|
1987
|
|
|
do { |
|
1988
|
|
|
$res_284 = $result; |
|
1989
|
|
|
$pos_284 = $this->pos; |
|
1990
|
|
|
$matcher = 'match_'.'DollarMarkedLookup'; $key = $matcher; $pos = $this->pos; |
|
1991
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
1992
|
|
|
if ($subres !== FALSE) { |
|
1993
|
|
|
$this->store( $result, $subres, "DollarMarkedLookup" ); |
|
1994
|
|
|
$_291 = TRUE; break; |
|
1995
|
|
|
} |
|
1996
|
|
|
$result = $res_284; |
|
1997
|
|
|
$this->pos = $pos_284; |
|
1998
|
|
|
$_289 = NULL; |
|
1999
|
|
|
do { |
|
2000
|
|
|
$res_286 = $result; |
|
2001
|
|
|
$pos_286 = $this->pos; |
|
2002
|
|
|
$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos; |
|
2003
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2004
|
|
|
if ($subres !== FALSE) { |
|
2005
|
|
|
$this->store( $result, $subres, "QuotedString" ); |
|
2006
|
|
|
$_289 = TRUE; break; |
|
2007
|
|
|
} |
|
2008
|
|
|
$result = $res_286; |
|
2009
|
|
|
$this->pos = $pos_286; |
|
2010
|
|
|
$matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos; |
|
2011
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2012
|
|
|
if ($subres !== FALSE) { |
|
2013
|
|
|
$this->store( $result, $subres, "Lookup" ); |
|
2014
|
|
|
$_289 = TRUE; break; |
|
2015
|
|
|
} |
|
2016
|
|
|
$result = $res_286; |
|
2017
|
|
|
$this->pos = $pos_286; |
|
2018
|
|
|
$_289 = FALSE; break; |
|
2019
|
|
|
} |
|
2020
|
|
|
while(0); |
|
2021
|
|
|
if( $_289 === TRUE ) { $_291 = TRUE; break; } |
|
2022
|
|
|
$result = $res_284; |
|
2023
|
|
|
$this->pos = $pos_284; |
|
2024
|
|
|
$_291 = FALSE; break; |
|
2025
|
|
|
} |
|
2026
|
|
|
while(0); |
|
2027
|
|
|
if( $_291 === FALSE) { $_293 = FALSE; break; } |
|
2028
|
|
|
$_293 = TRUE; break; |
|
2029
|
|
|
} |
|
2030
|
|
|
while(0); |
|
2031
|
|
|
if( $_293 === FALSE) { $_295 = FALSE; break; } |
|
2032
|
|
|
$_295 = TRUE; break; |
|
2033
|
|
|
} |
|
2034
|
|
|
while(0); |
|
2035
|
|
|
if( $_295 === TRUE ) { return $this->finalise($result); } |
|
2036
|
|
|
if( $_295 === FALSE) { return FALSE; } |
|
2037
|
|
|
} |
|
2038
|
|
|
|
|
2039
|
|
|
|
|
2040
|
|
|
|
|
2041
|
|
|
function CacheBlockArgument_DollarMarkedLookup(&$res, $sub) |
|
2042
|
|
|
{ |
|
2043
|
|
|
$res['php'] = $sub['Lookup']['php']; |
|
2044
|
|
|
} |
|
2045
|
|
|
|
|
2046
|
|
|
function CacheBlockArgument_QuotedString(&$res, $sub) |
|
2047
|
|
|
{ |
|
2048
|
|
|
$res['php'] = "'" . str_replace("'", "\\'", $sub['String']['text']) . "'"; |
|
2049
|
|
|
} |
|
2050
|
|
|
|
|
2051
|
|
|
function CacheBlockArgument_Lookup(&$res, $sub) |
|
2052
|
|
|
{ |
|
2053
|
|
|
$res['php'] = $sub['php']; |
|
2054
|
|
|
} |
|
2055
|
|
|
|
|
2056
|
|
|
/* CacheBlockArguments: CacheBlockArgument ( < "," < CacheBlockArgument )* */ |
|
2057
|
|
|
protected $match_CacheBlockArguments_typestack = array('CacheBlockArguments'); |
|
2058
|
|
|
function match_CacheBlockArguments ($stack = array()) { |
|
2059
|
|
|
$matchrule = "CacheBlockArguments"; $result = $this->construct($matchrule, $matchrule, null); |
|
2060
|
|
|
$_304 = NULL; |
|
2061
|
|
|
do { |
|
|
|
|
|
|
2062
|
|
|
$matcher = 'match_'.'CacheBlockArgument'; $key = $matcher; $pos = $this->pos; |
|
2063
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2064
|
|
|
if ($subres !== FALSE) { |
|
2065
|
|
|
$this->store( $result, $subres ); |
|
2066
|
|
|
} |
|
2067
|
|
|
else { $_304 = FALSE; break; } |
|
2068
|
|
|
while (true) { |
|
2069
|
|
|
$res_303 = $result; |
|
2070
|
|
|
$pos_303 = $this->pos; |
|
2071
|
|
|
$_302 = NULL; |
|
2072
|
|
|
do { |
|
2073
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2074
|
|
|
if (substr($this->string,$this->pos,1) == ',') { |
|
2075
|
|
|
$this->pos += 1; |
|
2076
|
|
|
$result["text"] .= ','; |
|
2077
|
|
|
} |
|
2078
|
|
|
else { $_302 = FALSE; break; } |
|
2079
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2080
|
|
|
$matcher = 'match_'.'CacheBlockArgument'; $key = $matcher; $pos = $this->pos; |
|
2081
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2082
|
|
|
if ($subres !== FALSE) { |
|
2083
|
|
|
$this->store( $result, $subres ); |
|
2084
|
|
|
} |
|
2085
|
|
|
else { $_302 = FALSE; break; } |
|
2086
|
|
|
$_302 = TRUE; break; |
|
2087
|
|
|
} |
|
2088
|
|
|
while(0); |
|
2089
|
|
|
if( $_302 === FALSE) { |
|
2090
|
|
|
$result = $res_303; |
|
2091
|
|
|
$this->pos = $pos_303; |
|
2092
|
|
|
unset( $res_303 ); |
|
2093
|
|
|
unset( $pos_303 ); |
|
2094
|
|
|
break; |
|
2095
|
|
|
} |
|
2096
|
|
|
} |
|
2097
|
|
|
$_304 = TRUE; break; |
|
2098
|
|
|
} |
|
2099
|
|
|
while(0); |
|
2100
|
|
|
if( $_304 === TRUE ) { return $this->finalise($result); } |
|
2101
|
|
|
if( $_304 === FALSE) { return FALSE; } |
|
2102
|
|
|
} |
|
2103
|
|
|
|
|
2104
|
|
|
|
|
2105
|
|
|
|
|
2106
|
|
|
function CacheBlockArguments_CacheBlockArgument(&$res, $sub) |
|
2107
|
|
|
{ |
|
2108
|
|
|
if (!empty($res['php'])) { |
|
2109
|
|
|
$res['php'] .= ".'_'."; |
|
2110
|
|
|
} else { |
|
2111
|
|
|
$res['php'] = ''; |
|
2112
|
|
|
} |
|
2113
|
|
|
|
|
2114
|
|
|
$res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']); |
|
2115
|
|
|
} |
|
2116
|
|
|
|
|
2117
|
|
|
/* CacheBlockTemplate: (Comment | Translate | If | Require | OldI18NTag | Include | ClosedBlock | |
|
2118
|
|
|
OpenBlock | MalformedBlock | Injection | Text)+ */ |
|
2119
|
|
|
protected $match_CacheBlockTemplate_typestack = array('CacheBlockTemplate','Template'); |
|
2120
|
|
|
function match_CacheBlockTemplate ($stack = array()) { |
|
2121
|
|
|
$matchrule = "CacheBlockTemplate"; $result = $this->construct($matchrule, $matchrule, array('TemplateMatcher' => 'CacheRestrictedTemplate')); |
|
2122
|
|
|
$count = 0; |
|
2123
|
|
|
while (true) { |
|
2124
|
|
|
$res_348 = $result; |
|
2125
|
|
|
$pos_348 = $this->pos; |
|
2126
|
|
|
$_347 = NULL; |
|
2127
|
|
|
do { |
|
|
|
|
|
|
2128
|
|
|
$_345 = NULL; |
|
2129
|
|
|
do { |
|
2130
|
|
|
$res_306 = $result; |
|
2131
|
|
|
$pos_306 = $this->pos; |
|
2132
|
|
|
$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos; |
|
2133
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2134
|
|
|
if ($subres !== FALSE) { |
|
2135
|
|
|
$this->store( $result, $subres ); |
|
2136
|
|
|
$_345 = TRUE; break; |
|
2137
|
|
|
} |
|
2138
|
|
|
$result = $res_306; |
|
2139
|
|
|
$this->pos = $pos_306; |
|
2140
|
|
|
$_343 = NULL; |
|
2141
|
|
|
do { |
|
2142
|
|
|
$res_308 = $result; |
|
2143
|
|
|
$pos_308 = $this->pos; |
|
2144
|
|
|
$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos; |
|
2145
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2146
|
|
|
if ($subres !== FALSE) { |
|
2147
|
|
|
$this->store( $result, $subres ); |
|
2148
|
|
|
$_343 = TRUE; break; |
|
2149
|
|
|
} |
|
2150
|
|
|
$result = $res_308; |
|
2151
|
|
|
$this->pos = $pos_308; |
|
2152
|
|
|
$_341 = NULL; |
|
2153
|
|
|
do { |
|
2154
|
|
|
$res_310 = $result; |
|
2155
|
|
|
$pos_310 = $this->pos; |
|
2156
|
|
|
$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos; |
|
2157
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2158
|
|
|
if ($subres !== FALSE) { |
|
2159
|
|
|
$this->store( $result, $subres ); |
|
2160
|
|
|
$_341 = TRUE; break; |
|
2161
|
|
|
} |
|
2162
|
|
|
$result = $res_310; |
|
2163
|
|
|
$this->pos = $pos_310; |
|
2164
|
|
|
$_339 = NULL; |
|
2165
|
|
|
do { |
|
2166
|
|
|
$res_312 = $result; |
|
2167
|
|
|
$pos_312 = $this->pos; |
|
2168
|
|
|
$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos; |
|
2169
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2170
|
|
|
if ($subres !== FALSE) { |
|
2171
|
|
|
$this->store( $result, $subres ); |
|
2172
|
|
|
$_339 = TRUE; break; |
|
2173
|
|
|
} |
|
2174
|
|
|
$result = $res_312; |
|
2175
|
|
|
$this->pos = $pos_312; |
|
2176
|
|
|
$_337 = NULL; |
|
2177
|
|
|
do { |
|
2178
|
|
|
$res_314 = $result; |
|
2179
|
|
|
$pos_314 = $this->pos; |
|
2180
|
|
|
$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos; |
|
2181
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2182
|
|
|
if ($subres !== FALSE) { |
|
2183
|
|
|
$this->store( $result, $subres ); |
|
2184
|
|
|
$_337 = TRUE; break; |
|
2185
|
|
|
} |
|
2186
|
|
|
$result = $res_314; |
|
2187
|
|
|
$this->pos = $pos_314; |
|
2188
|
|
|
$_335 = NULL; |
|
2189
|
|
|
do { |
|
2190
|
|
|
$res_316 = $result; |
|
2191
|
|
|
$pos_316 = $this->pos; |
|
2192
|
|
|
$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos; |
|
2193
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2194
|
|
|
if ($subres !== FALSE) { |
|
2195
|
|
|
$this->store( $result, $subres ); |
|
2196
|
|
|
$_335 = TRUE; break; |
|
2197
|
|
|
} |
|
2198
|
|
|
$result = $res_316; |
|
2199
|
|
|
$this->pos = $pos_316; |
|
2200
|
|
|
$_333 = NULL; |
|
2201
|
|
|
do { |
|
2202
|
|
|
$res_318 = $result; |
|
2203
|
|
|
$pos_318 = $this->pos; |
|
2204
|
|
|
$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos; |
|
2205
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2206
|
|
|
if ($subres !== FALSE) { |
|
2207
|
|
|
$this->store( $result, $subres ); |
|
2208
|
|
|
$_333 = TRUE; break; |
|
2209
|
|
|
} |
|
2210
|
|
|
$result = $res_318; |
|
2211
|
|
|
$this->pos = $pos_318; |
|
2212
|
|
|
$_331 = NULL; |
|
2213
|
|
|
do { |
|
2214
|
|
|
$res_320 = $result; |
|
2215
|
|
|
$pos_320 = $this->pos; |
|
2216
|
|
|
$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos; |
|
2217
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2218
|
|
|
if ($subres !== FALSE) { |
|
2219
|
|
|
$this->store( $result, $subres ); |
|
2220
|
|
|
$_331 = TRUE; break; |
|
2221
|
|
|
} |
|
2222
|
|
|
$result = $res_320; |
|
2223
|
|
|
$this->pos = $pos_320; |
|
2224
|
|
|
$_329 = NULL; |
|
2225
|
|
|
do { |
|
2226
|
|
|
$res_322 = $result; |
|
2227
|
|
|
$pos_322 = $this->pos; |
|
2228
|
|
|
$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos; |
|
2229
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2230
|
|
|
if ($subres !== FALSE) { |
|
2231
|
|
|
$this->store( $result, $subres ); |
|
2232
|
|
|
$_329 = TRUE; break; |
|
2233
|
|
|
} |
|
2234
|
|
|
$result = $res_322; |
|
2235
|
|
|
$this->pos = $pos_322; |
|
2236
|
|
|
$_327 = NULL; |
|
2237
|
|
|
do { |
|
2238
|
|
|
$res_324 = $result; |
|
2239
|
|
|
$pos_324 = $this->pos; |
|
2240
|
|
|
$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos; |
|
2241
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2242
|
|
|
if ($subres !== FALSE) { |
|
2243
|
|
|
$this->store( $result, $subres ); |
|
2244
|
|
|
$_327 = TRUE; break; |
|
2245
|
|
|
} |
|
2246
|
|
|
$result = $res_324; |
|
2247
|
|
|
$this->pos = $pos_324; |
|
2248
|
|
|
$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos; |
|
2249
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2250
|
|
|
if ($subres !== FALSE) { |
|
2251
|
|
|
$this->store( $result, $subres ); |
|
2252
|
|
|
$_327 = TRUE; break; |
|
2253
|
|
|
} |
|
2254
|
|
|
$result = $res_324; |
|
2255
|
|
|
$this->pos = $pos_324; |
|
2256
|
|
|
$_327 = FALSE; break; |
|
2257
|
|
|
} |
|
2258
|
|
|
while(0); |
|
2259
|
|
|
if( $_327 === TRUE ) { $_329 = TRUE; break; } |
|
2260
|
|
|
$result = $res_322; |
|
2261
|
|
|
$this->pos = $pos_322; |
|
2262
|
|
|
$_329 = FALSE; break; |
|
2263
|
|
|
} |
|
2264
|
|
|
while(0); |
|
2265
|
|
|
if( $_329 === TRUE ) { $_331 = TRUE; break; } |
|
2266
|
|
|
$result = $res_320; |
|
2267
|
|
|
$this->pos = $pos_320; |
|
2268
|
|
|
$_331 = FALSE; break; |
|
2269
|
|
|
} |
|
2270
|
|
|
while(0); |
|
2271
|
|
|
if( $_331 === TRUE ) { $_333 = TRUE; break; } |
|
2272
|
|
|
$result = $res_318; |
|
2273
|
|
|
$this->pos = $pos_318; |
|
2274
|
|
|
$_333 = FALSE; break; |
|
2275
|
|
|
} |
|
2276
|
|
|
while(0); |
|
2277
|
|
|
if( $_333 === TRUE ) { $_335 = TRUE; break; } |
|
2278
|
|
|
$result = $res_316; |
|
2279
|
|
|
$this->pos = $pos_316; |
|
2280
|
|
|
$_335 = FALSE; break; |
|
2281
|
|
|
} |
|
2282
|
|
|
while(0); |
|
2283
|
|
|
if( $_335 === TRUE ) { $_337 = TRUE; break; } |
|
2284
|
|
|
$result = $res_314; |
|
2285
|
|
|
$this->pos = $pos_314; |
|
2286
|
|
|
$_337 = FALSE; break; |
|
2287
|
|
|
} |
|
2288
|
|
|
while(0); |
|
2289
|
|
|
if( $_337 === TRUE ) { $_339 = TRUE; break; } |
|
2290
|
|
|
$result = $res_312; |
|
2291
|
|
|
$this->pos = $pos_312; |
|
2292
|
|
|
$_339 = FALSE; break; |
|
2293
|
|
|
} |
|
2294
|
|
|
while(0); |
|
2295
|
|
|
if( $_339 === TRUE ) { $_341 = TRUE; break; } |
|
2296
|
|
|
$result = $res_310; |
|
2297
|
|
|
$this->pos = $pos_310; |
|
2298
|
|
|
$_341 = FALSE; break; |
|
2299
|
|
|
} |
|
2300
|
|
|
while(0); |
|
2301
|
|
|
if( $_341 === TRUE ) { $_343 = TRUE; break; } |
|
2302
|
|
|
$result = $res_308; |
|
2303
|
|
|
$this->pos = $pos_308; |
|
2304
|
|
|
$_343 = FALSE; break; |
|
2305
|
|
|
} |
|
2306
|
|
|
while(0); |
|
2307
|
|
|
if( $_343 === TRUE ) { $_345 = TRUE; break; } |
|
2308
|
|
|
$result = $res_306; |
|
2309
|
|
|
$this->pos = $pos_306; |
|
2310
|
|
|
$_345 = FALSE; break; |
|
2311
|
|
|
} |
|
2312
|
|
|
while(0); |
|
2313
|
|
|
if( $_345 === FALSE) { $_347 = FALSE; break; } |
|
2314
|
|
|
$_347 = TRUE; break; |
|
2315
|
|
|
} |
|
2316
|
|
|
while(0); |
|
2317
|
|
|
if( $_347 === FALSE) { |
|
2318
|
|
|
$result = $res_348; |
|
2319
|
|
|
$this->pos = $pos_348; |
|
2320
|
|
|
unset( $res_348 ); |
|
2321
|
|
|
unset( $pos_348 ); |
|
2322
|
|
|
break; |
|
2323
|
|
|
} |
|
2324
|
|
|
$count += 1; |
|
2325
|
|
|
} |
|
2326
|
|
|
if ($count > 0) { return $this->finalise($result); } |
|
2327
|
|
|
else { return FALSE; } |
|
2328
|
|
|
} |
|
2329
|
|
|
|
|
2330
|
|
|
|
|
2331
|
|
|
|
|
2332
|
|
|
|
|
2333
|
|
|
/* UncachedBlock: |
|
|
|
|
|
|
2334
|
|
|
'<%' < "uncached" < CacheBlockArguments? ( < Conditional:("if"|"unless") > Condition:IfArgument )? > '%>' |
|
2335
|
|
|
Template:$TemplateMatcher? |
|
2336
|
|
|
'<%' < 'end_' ("uncached"|"cached"|"cacheblock") > '%>' */ |
|
2337
|
|
|
protected $match_UncachedBlock_typestack = array('UncachedBlock'); |
|
2338
|
|
|
function match_UncachedBlock ($stack = array()) { |
|
2339
|
|
|
$matchrule = "UncachedBlock"; $result = $this->construct($matchrule, $matchrule, null); |
|
2340
|
|
|
$_385 = NULL; |
|
2341
|
|
|
do { |
|
|
|
|
|
|
2342
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2343
|
|
|
else { $_385 = FALSE; break; } |
|
2344
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2345
|
|
|
if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2346
|
|
|
else { $_385 = FALSE; break; } |
|
2347
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2348
|
|
|
$res_353 = $result; |
|
2349
|
|
|
$pos_353 = $this->pos; |
|
2350
|
|
|
$matcher = 'match_'.'CacheBlockArguments'; $key = $matcher; $pos = $this->pos; |
|
2351
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2352
|
|
|
if ($subres !== FALSE) { |
|
2353
|
|
|
$this->store( $result, $subres ); |
|
2354
|
|
|
} |
|
2355
|
|
|
else { |
|
2356
|
|
|
$result = $res_353; |
|
2357
|
|
|
$this->pos = $pos_353; |
|
2358
|
|
|
unset( $res_353 ); |
|
2359
|
|
|
unset( $pos_353 ); |
|
2360
|
|
|
} |
|
2361
|
|
|
$res_365 = $result; |
|
2362
|
|
|
$pos_365 = $this->pos; |
|
2363
|
|
|
$_364 = NULL; |
|
2364
|
|
|
do { |
|
2365
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2366
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); |
|
2367
|
|
|
$_360 = NULL; |
|
2368
|
|
|
do { |
|
2369
|
|
|
$_358 = NULL; |
|
2370
|
|
|
do { |
|
2371
|
|
|
$res_355 = $result; |
|
2372
|
|
|
$pos_355 = $this->pos; |
|
2373
|
|
|
if (( $subres = $this->literal( 'if' ) ) !== FALSE) { |
|
2374
|
|
|
$result["text"] .= $subres; |
|
2375
|
|
|
$_358 = TRUE; break; |
|
2376
|
|
|
} |
|
2377
|
|
|
$result = $res_355; |
|
2378
|
|
|
$this->pos = $pos_355; |
|
2379
|
|
|
if (( $subres = $this->literal( 'unless' ) ) !== FALSE) { |
|
2380
|
|
|
$result["text"] .= $subres; |
|
2381
|
|
|
$_358 = TRUE; break; |
|
2382
|
|
|
} |
|
2383
|
|
|
$result = $res_355; |
|
2384
|
|
|
$this->pos = $pos_355; |
|
2385
|
|
|
$_358 = FALSE; break; |
|
2386
|
|
|
} |
|
2387
|
|
|
while(0); |
|
2388
|
|
|
if( $_358 === FALSE) { $_360 = FALSE; break; } |
|
2389
|
|
|
$_360 = TRUE; break; |
|
2390
|
|
|
} |
|
2391
|
|
|
while(0); |
|
2392
|
|
|
if( $_360 === TRUE ) { |
|
2393
|
|
|
$subres = $result; $result = array_pop($stack); |
|
2394
|
|
|
$this->store( $result, $subres, 'Conditional' ); |
|
2395
|
|
|
} |
|
2396
|
|
|
if( $_360 === FALSE) { |
|
2397
|
|
|
$result = array_pop($stack); |
|
2398
|
|
|
$_364 = FALSE; break; |
|
2399
|
|
|
} |
|
2400
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2401
|
|
|
$matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos; |
|
2402
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2403
|
|
|
if ($subres !== FALSE) { |
|
2404
|
|
|
$this->store( $result, $subres, "Condition" ); |
|
2405
|
|
|
} |
|
2406
|
|
|
else { $_364 = FALSE; break; } |
|
2407
|
|
|
$_364 = TRUE; break; |
|
2408
|
|
|
} |
|
2409
|
|
|
while(0); |
|
2410
|
|
|
if( $_364 === FALSE) { |
|
2411
|
|
|
$result = $res_365; |
|
2412
|
|
|
$this->pos = $pos_365; |
|
2413
|
|
|
unset( $res_365 ); |
|
2414
|
|
|
unset( $pos_365 ); |
|
2415
|
|
|
} |
|
2416
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2417
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2418
|
|
|
else { $_385 = FALSE; break; } |
|
2419
|
|
|
$res_368 = $result; |
|
2420
|
|
|
$pos_368 = $this->pos; |
|
2421
|
|
|
$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos; |
|
2422
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2423
|
|
|
if ($subres !== FALSE) { |
|
2424
|
|
|
$this->store( $result, $subres, "Template" ); |
|
2425
|
|
|
} |
|
2426
|
|
|
else { |
|
2427
|
|
|
$result = $res_368; |
|
2428
|
|
|
$this->pos = $pos_368; |
|
2429
|
|
|
unset( $res_368 ); |
|
2430
|
|
|
unset( $pos_368 ); |
|
2431
|
|
|
} |
|
2432
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2433
|
|
|
else { $_385 = FALSE; break; } |
|
2434
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2435
|
|
|
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2436
|
|
|
else { $_385 = FALSE; break; } |
|
2437
|
|
|
$_381 = NULL; |
|
2438
|
|
|
do { |
|
2439
|
|
|
$_379 = NULL; |
|
2440
|
|
|
do { |
|
2441
|
|
|
$res_372 = $result; |
|
2442
|
|
|
$pos_372 = $this->pos; |
|
2443
|
|
|
if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) { |
|
2444
|
|
|
$result["text"] .= $subres; |
|
2445
|
|
|
$_379 = TRUE; break; |
|
2446
|
|
|
} |
|
2447
|
|
|
$result = $res_372; |
|
2448
|
|
|
$this->pos = $pos_372; |
|
2449
|
|
|
$_377 = NULL; |
|
2450
|
|
|
do { |
|
2451
|
|
|
$res_374 = $result; |
|
2452
|
|
|
$pos_374 = $this->pos; |
|
2453
|
|
|
if (( $subres = $this->literal( 'cached' ) ) !== FALSE) { |
|
2454
|
|
|
$result["text"] .= $subres; |
|
2455
|
|
|
$_377 = TRUE; break; |
|
2456
|
|
|
} |
|
2457
|
|
|
$result = $res_374; |
|
2458
|
|
|
$this->pos = $pos_374; |
|
2459
|
|
|
if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) { |
|
2460
|
|
|
$result["text"] .= $subres; |
|
2461
|
|
|
$_377 = TRUE; break; |
|
2462
|
|
|
} |
|
2463
|
|
|
$result = $res_374; |
|
2464
|
|
|
$this->pos = $pos_374; |
|
2465
|
|
|
$_377 = FALSE; break; |
|
2466
|
|
|
} |
|
2467
|
|
|
while(0); |
|
2468
|
|
|
if( $_377 === TRUE ) { $_379 = TRUE; break; } |
|
2469
|
|
|
$result = $res_372; |
|
2470
|
|
|
$this->pos = $pos_372; |
|
2471
|
|
|
$_379 = FALSE; break; |
|
2472
|
|
|
} |
|
2473
|
|
|
while(0); |
|
2474
|
|
|
if( $_379 === FALSE) { $_381 = FALSE; break; } |
|
2475
|
|
|
$_381 = TRUE; break; |
|
2476
|
|
|
} |
|
2477
|
|
|
while(0); |
|
2478
|
|
|
if( $_381 === FALSE) { $_385 = FALSE; break; } |
|
2479
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2480
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2481
|
|
|
else { $_385 = FALSE; break; } |
|
2482
|
|
|
$_385 = TRUE; break; |
|
2483
|
|
|
} |
|
2484
|
|
|
while(0); |
|
2485
|
|
|
if( $_385 === TRUE ) { return $this->finalise($result); } |
|
2486
|
|
|
if( $_385 === FALSE) { return FALSE; } |
|
2487
|
|
|
} |
|
2488
|
|
|
|
|
2489
|
|
|
|
|
2490
|
|
|
|
|
2491
|
|
|
function UncachedBlock_Template(&$res, $sub) |
|
2492
|
|
|
{ |
|
2493
|
|
|
$res['php'] = $sub['php']; |
|
2494
|
|
|
} |
|
2495
|
|
|
|
|
2496
|
|
|
/* CacheRestrictedTemplate: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock | |
|
2497
|
|
|
OpenBlock | MalformedBlock | Injection | Text)+ */ |
|
2498
|
|
|
protected $match_CacheRestrictedTemplate_typestack = array('CacheRestrictedTemplate','Template'); |
|
2499
|
|
|
function match_CacheRestrictedTemplate ($stack = array()) { |
|
2500
|
|
|
$matchrule = "CacheRestrictedTemplate"; $result = $this->construct($matchrule, $matchrule, null); |
|
2501
|
|
|
$count = 0; |
|
2502
|
|
|
while (true) { |
|
2503
|
|
|
$res_437 = $result; |
|
2504
|
|
|
$pos_437 = $this->pos; |
|
2505
|
|
|
$_436 = NULL; |
|
2506
|
|
|
do { |
|
|
|
|
|
|
2507
|
|
|
$_434 = NULL; |
|
2508
|
|
|
do { |
|
2509
|
|
|
$res_387 = $result; |
|
2510
|
|
|
$pos_387 = $this->pos; |
|
2511
|
|
|
$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos; |
|
2512
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2513
|
|
|
if ($subres !== FALSE) { |
|
2514
|
|
|
$this->store( $result, $subres ); |
|
2515
|
|
|
$_434 = TRUE; break; |
|
2516
|
|
|
} |
|
2517
|
|
|
$result = $res_387; |
|
2518
|
|
|
$this->pos = $pos_387; |
|
2519
|
|
|
$_432 = NULL; |
|
2520
|
|
|
do { |
|
2521
|
|
|
$res_389 = $result; |
|
2522
|
|
|
$pos_389 = $this->pos; |
|
2523
|
|
|
$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos; |
|
2524
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2525
|
|
|
if ($subres !== FALSE) { |
|
2526
|
|
|
$this->store( $result, $subres ); |
|
2527
|
|
|
$_432 = TRUE; break; |
|
2528
|
|
|
} |
|
2529
|
|
|
$result = $res_389; |
|
2530
|
|
|
$this->pos = $pos_389; |
|
2531
|
|
|
$_430 = NULL; |
|
2532
|
|
|
do { |
|
2533
|
|
|
$res_391 = $result; |
|
2534
|
|
|
$pos_391 = $this->pos; |
|
2535
|
|
|
$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos; |
|
2536
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2537
|
|
|
if ($subres !== FALSE) { |
|
2538
|
|
|
$this->store( $result, $subres ); |
|
2539
|
|
|
$_430 = TRUE; break; |
|
2540
|
|
|
} |
|
2541
|
|
|
$result = $res_391; |
|
2542
|
|
|
$this->pos = $pos_391; |
|
2543
|
|
|
$_428 = NULL; |
|
2544
|
|
|
do { |
|
2545
|
|
|
$res_393 = $result; |
|
2546
|
|
|
$pos_393 = $this->pos; |
|
2547
|
|
|
$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos; |
|
2548
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2549
|
|
|
if ($subres !== FALSE) { |
|
2550
|
|
|
$this->store( $result, $subres ); |
|
2551
|
|
|
$_428 = TRUE; break; |
|
2552
|
|
|
} |
|
2553
|
|
|
$result = $res_393; |
|
2554
|
|
|
$this->pos = $pos_393; |
|
2555
|
|
|
$_426 = NULL; |
|
2556
|
|
|
do { |
|
2557
|
|
|
$res_395 = $result; |
|
2558
|
|
|
$pos_395 = $this->pos; |
|
2559
|
|
|
$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos; |
|
2560
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2561
|
|
|
if ($subres !== FALSE) { |
|
2562
|
|
|
$this->store( $result, $subres ); |
|
2563
|
|
|
$_426 = TRUE; break; |
|
2564
|
|
|
} |
|
2565
|
|
|
$result = $res_395; |
|
2566
|
|
|
$this->pos = $pos_395; |
|
2567
|
|
|
$_424 = NULL; |
|
2568
|
|
|
do { |
|
2569
|
|
|
$res_397 = $result; |
|
2570
|
|
|
$pos_397 = $this->pos; |
|
2571
|
|
|
$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos; |
|
2572
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2573
|
|
|
if ($subres !== FALSE) { |
|
2574
|
|
|
$this->store( $result, $subres ); |
|
2575
|
|
|
$_424 = TRUE; break; |
|
2576
|
|
|
} |
|
2577
|
|
|
$result = $res_397; |
|
2578
|
|
|
$this->pos = $pos_397; |
|
2579
|
|
|
$_422 = NULL; |
|
2580
|
|
|
do { |
|
2581
|
|
|
$res_399 = $result; |
|
2582
|
|
|
$pos_399 = $this->pos; |
|
2583
|
|
|
$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos; |
|
2584
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2585
|
|
|
if ($subres !== FALSE) { |
|
2586
|
|
|
$this->store( $result, $subres ); |
|
2587
|
|
|
$_422 = TRUE; break; |
|
2588
|
|
|
} |
|
2589
|
|
|
$result = $res_399; |
|
2590
|
|
|
$this->pos = $pos_399; |
|
2591
|
|
|
$_420 = NULL; |
|
2592
|
|
|
do { |
|
2593
|
|
|
$res_401 = $result; |
|
2594
|
|
|
$pos_401 = $this->pos; |
|
2595
|
|
|
$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos; |
|
2596
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2597
|
|
|
if ($subres !== FALSE) { |
|
2598
|
|
|
$this->store( $result, $subres ); |
|
2599
|
|
|
$_420 = TRUE; break; |
|
2600
|
|
|
} |
|
2601
|
|
|
$result = $res_401; |
|
2602
|
|
|
$this->pos = $pos_401; |
|
2603
|
|
|
$_418 = NULL; |
|
2604
|
|
|
do { |
|
2605
|
|
|
$res_403 = $result; |
|
2606
|
|
|
$pos_403 = $this->pos; |
|
2607
|
|
|
$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos; |
|
2608
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2609
|
|
|
if ($subres !== FALSE) { |
|
2610
|
|
|
$this->store( $result, $subres ); |
|
2611
|
|
|
$_418 = TRUE; break; |
|
2612
|
|
|
} |
|
2613
|
|
|
$result = $res_403; |
|
2614
|
|
|
$this->pos = $pos_403; |
|
2615
|
|
|
$_416 = NULL; |
|
2616
|
|
|
do { |
|
2617
|
|
|
$res_405 = $result; |
|
2618
|
|
|
$pos_405 = $this->pos; |
|
2619
|
|
|
$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos; |
|
2620
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2621
|
|
|
if ($subres !== FALSE) { |
|
2622
|
|
|
$this->store( $result, $subres ); |
|
2623
|
|
|
$_416 = TRUE; break; |
|
2624
|
|
|
} |
|
2625
|
|
|
$result = $res_405; |
|
2626
|
|
|
$this->pos = $pos_405; |
|
2627
|
|
|
$_414 = NULL; |
|
2628
|
|
|
do { |
|
2629
|
|
|
$res_407 = $result; |
|
2630
|
|
|
$pos_407 = $this->pos; |
|
2631
|
|
|
$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos; |
|
2632
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2633
|
|
|
if ($subres !== FALSE) { |
|
2634
|
|
|
$this->store( $result, $subres ); |
|
2635
|
|
|
$_414 = TRUE; break; |
|
2636
|
|
|
} |
|
2637
|
|
|
$result = $res_407; |
|
2638
|
|
|
$this->pos = $pos_407; |
|
2639
|
|
|
$_412 = NULL; |
|
2640
|
|
|
do { |
|
2641
|
|
|
$res_409 = $result; |
|
2642
|
|
|
$pos_409 = $this->pos; |
|
2643
|
|
|
$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos; |
|
2644
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2645
|
|
|
if ($subres !== FALSE) { |
|
2646
|
|
|
$this->store( $result, $subres ); |
|
2647
|
|
|
$_412 = TRUE; break; |
|
2648
|
|
|
} |
|
2649
|
|
|
$result = $res_409; |
|
2650
|
|
|
$this->pos = $pos_409; |
|
2651
|
|
|
$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos; |
|
2652
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2653
|
|
|
if ($subres !== FALSE) { |
|
2654
|
|
|
$this->store( $result, $subres ); |
|
2655
|
|
|
$_412 = TRUE; break; |
|
2656
|
|
|
} |
|
2657
|
|
|
$result = $res_409; |
|
2658
|
|
|
$this->pos = $pos_409; |
|
2659
|
|
|
$_412 = FALSE; break; |
|
2660
|
|
|
} |
|
2661
|
|
|
while(0); |
|
2662
|
|
|
if( $_412 === TRUE ) { $_414 = TRUE; break; } |
|
2663
|
|
|
$result = $res_407; |
|
2664
|
|
|
$this->pos = $pos_407; |
|
2665
|
|
|
$_414 = FALSE; break; |
|
2666
|
|
|
} |
|
2667
|
|
|
while(0); |
|
2668
|
|
|
if( $_414 === TRUE ) { $_416 = TRUE; break; } |
|
2669
|
|
|
$result = $res_405; |
|
2670
|
|
|
$this->pos = $pos_405; |
|
2671
|
|
|
$_416 = FALSE; break; |
|
2672
|
|
|
} |
|
2673
|
|
|
while(0); |
|
2674
|
|
|
if( $_416 === TRUE ) { $_418 = TRUE; break; } |
|
2675
|
|
|
$result = $res_403; |
|
2676
|
|
|
$this->pos = $pos_403; |
|
2677
|
|
|
$_418 = FALSE; break; |
|
2678
|
|
|
} |
|
2679
|
|
|
while(0); |
|
2680
|
|
|
if( $_418 === TRUE ) { $_420 = TRUE; break; } |
|
2681
|
|
|
$result = $res_401; |
|
2682
|
|
|
$this->pos = $pos_401; |
|
2683
|
|
|
$_420 = FALSE; break; |
|
2684
|
|
|
} |
|
2685
|
|
|
while(0); |
|
2686
|
|
|
if( $_420 === TRUE ) { $_422 = TRUE; break; } |
|
2687
|
|
|
$result = $res_399; |
|
2688
|
|
|
$this->pos = $pos_399; |
|
2689
|
|
|
$_422 = FALSE; break; |
|
2690
|
|
|
} |
|
2691
|
|
|
while(0); |
|
2692
|
|
|
if( $_422 === TRUE ) { $_424 = TRUE; break; } |
|
2693
|
|
|
$result = $res_397; |
|
2694
|
|
|
$this->pos = $pos_397; |
|
2695
|
|
|
$_424 = FALSE; break; |
|
2696
|
|
|
} |
|
2697
|
|
|
while(0); |
|
2698
|
|
|
if( $_424 === TRUE ) { $_426 = TRUE; break; } |
|
2699
|
|
|
$result = $res_395; |
|
2700
|
|
|
$this->pos = $pos_395; |
|
2701
|
|
|
$_426 = FALSE; break; |
|
2702
|
|
|
} |
|
2703
|
|
|
while(0); |
|
2704
|
|
|
if( $_426 === TRUE ) { $_428 = TRUE; break; } |
|
2705
|
|
|
$result = $res_393; |
|
2706
|
|
|
$this->pos = $pos_393; |
|
2707
|
|
|
$_428 = FALSE; break; |
|
2708
|
|
|
} |
|
2709
|
|
|
while(0); |
|
2710
|
|
|
if( $_428 === TRUE ) { $_430 = TRUE; break; } |
|
2711
|
|
|
$result = $res_391; |
|
2712
|
|
|
$this->pos = $pos_391; |
|
2713
|
|
|
$_430 = FALSE; break; |
|
2714
|
|
|
} |
|
2715
|
|
|
while(0); |
|
2716
|
|
|
if( $_430 === TRUE ) { $_432 = TRUE; break; } |
|
2717
|
|
|
$result = $res_389; |
|
2718
|
|
|
$this->pos = $pos_389; |
|
2719
|
|
|
$_432 = FALSE; break; |
|
2720
|
|
|
} |
|
2721
|
|
|
while(0); |
|
2722
|
|
|
if( $_432 === TRUE ) { $_434 = TRUE; break; } |
|
2723
|
|
|
$result = $res_387; |
|
2724
|
|
|
$this->pos = $pos_387; |
|
2725
|
|
|
$_434 = FALSE; break; |
|
2726
|
|
|
} |
|
2727
|
|
|
while(0); |
|
2728
|
|
|
if( $_434 === FALSE) { $_436 = FALSE; break; } |
|
2729
|
|
|
$_436 = TRUE; break; |
|
2730
|
|
|
} |
|
2731
|
|
|
while(0); |
|
2732
|
|
|
if( $_436 === FALSE) { |
|
2733
|
|
|
$result = $res_437; |
|
2734
|
|
|
$this->pos = $pos_437; |
|
2735
|
|
|
unset( $res_437 ); |
|
2736
|
|
|
unset( $pos_437 ); |
|
2737
|
|
|
break; |
|
2738
|
|
|
} |
|
2739
|
|
|
$count += 1; |
|
2740
|
|
|
} |
|
2741
|
|
|
if ($count > 0) { return $this->finalise($result); } |
|
2742
|
|
|
else { return FALSE; } |
|
2743
|
|
|
} |
|
2744
|
|
|
|
|
2745
|
|
|
|
|
2746
|
|
|
|
|
2747
|
|
|
function CacheRestrictedTemplate_CacheBlock(&$res, $sub) |
|
|
|
|
|
|
2748
|
|
|
{ |
|
2749
|
|
|
throw new SSTemplateParseException('You cant have cache blocks nested within with, loop or control blocks ' . |
|
2750
|
|
|
'that are within cache blocks', $this); |
|
2751
|
|
|
} |
|
2752
|
|
|
|
|
2753
|
|
|
function CacheRestrictedTemplate_UncachedBlock(&$res, $sub) |
|
|
|
|
|
|
2754
|
|
|
{ |
|
2755
|
|
|
throw new SSTemplateParseException('You cant have uncache blocks nested within with, loop or control blocks ' . |
|
2756
|
|
|
'that are within cache blocks', $this); |
|
2757
|
|
|
} |
|
2758
|
|
|
|
|
2759
|
|
|
/* CacheBlock: |
|
|
|
|
|
|
2760
|
|
|
'<%' < CacheTag:("cached"|"cacheblock") < (CacheBlockArguments)? ( < Conditional:("if"|"unless") > |
|
2761
|
|
|
Condition:IfArgument )? > '%>' |
|
2762
|
|
|
(CacheBlock | UncachedBlock | CacheBlockTemplate)* |
|
2763
|
|
|
'<%' < 'end_' ("cached"|"uncached"|"cacheblock") > '%>' */ |
|
2764
|
|
|
protected $match_CacheBlock_typestack = array('CacheBlock'); |
|
2765
|
|
|
function match_CacheBlock ($stack = array()) { |
|
2766
|
|
|
$matchrule = "CacheBlock"; $result = $this->construct($matchrule, $matchrule, null); |
|
2767
|
|
|
$_492 = NULL; |
|
2768
|
|
|
do { |
|
|
|
|
|
|
2769
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2770
|
|
|
else { $_492 = FALSE; break; } |
|
2771
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2772
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "CacheTag" ); |
|
2773
|
|
|
$_445 = NULL; |
|
2774
|
|
|
do { |
|
2775
|
|
|
$_443 = NULL; |
|
2776
|
|
|
do { |
|
2777
|
|
|
$res_440 = $result; |
|
2778
|
|
|
$pos_440 = $this->pos; |
|
2779
|
|
|
if (( $subres = $this->literal( 'cached' ) ) !== FALSE) { |
|
2780
|
|
|
$result["text"] .= $subres; |
|
2781
|
|
|
$_443 = TRUE; break; |
|
2782
|
|
|
} |
|
2783
|
|
|
$result = $res_440; |
|
2784
|
|
|
$this->pos = $pos_440; |
|
2785
|
|
|
if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) { |
|
2786
|
|
|
$result["text"] .= $subres; |
|
2787
|
|
|
$_443 = TRUE; break; |
|
2788
|
|
|
} |
|
2789
|
|
|
$result = $res_440; |
|
2790
|
|
|
$this->pos = $pos_440; |
|
2791
|
|
|
$_443 = FALSE; break; |
|
2792
|
|
|
} |
|
2793
|
|
|
while(0); |
|
2794
|
|
|
if( $_443 === FALSE) { $_445 = FALSE; break; } |
|
2795
|
|
|
$_445 = TRUE; break; |
|
2796
|
|
|
} |
|
2797
|
|
|
while(0); |
|
2798
|
|
|
if( $_445 === TRUE ) { |
|
2799
|
|
|
$subres = $result; $result = array_pop($stack); |
|
2800
|
|
|
$this->store( $result, $subres, 'CacheTag' ); |
|
2801
|
|
|
} |
|
2802
|
|
|
if( $_445 === FALSE) { |
|
2803
|
|
|
$result = array_pop($stack); |
|
2804
|
|
|
$_492 = FALSE; break; |
|
2805
|
|
|
} |
|
2806
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2807
|
|
|
$res_450 = $result; |
|
2808
|
|
|
$pos_450 = $this->pos; |
|
2809
|
|
|
$_449 = NULL; |
|
2810
|
|
|
do { |
|
2811
|
|
|
$matcher = 'match_'.'CacheBlockArguments'; $key = $matcher; $pos = $this->pos; |
|
2812
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2813
|
|
|
if ($subres !== FALSE) { |
|
2814
|
|
|
$this->store( $result, $subres ); |
|
2815
|
|
|
} |
|
2816
|
|
|
else { $_449 = FALSE; break; } |
|
2817
|
|
|
$_449 = TRUE; break; |
|
2818
|
|
|
} |
|
2819
|
|
|
while(0); |
|
2820
|
|
|
if( $_449 === FALSE) { |
|
2821
|
|
|
$result = $res_450; |
|
2822
|
|
|
$this->pos = $pos_450; |
|
2823
|
|
|
unset( $res_450 ); |
|
2824
|
|
|
unset( $pos_450 ); |
|
2825
|
|
|
} |
|
2826
|
|
|
$res_462 = $result; |
|
2827
|
|
|
$pos_462 = $this->pos; |
|
2828
|
|
|
$_461 = NULL; |
|
2829
|
|
|
do { |
|
2830
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2831
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); |
|
2832
|
|
|
$_457 = NULL; |
|
2833
|
|
|
do { |
|
2834
|
|
|
$_455 = NULL; |
|
2835
|
|
|
do { |
|
2836
|
|
|
$res_452 = $result; |
|
2837
|
|
|
$pos_452 = $this->pos; |
|
2838
|
|
|
if (( $subres = $this->literal( 'if' ) ) !== FALSE) { |
|
2839
|
|
|
$result["text"] .= $subres; |
|
2840
|
|
|
$_455 = TRUE; break; |
|
2841
|
|
|
} |
|
2842
|
|
|
$result = $res_452; |
|
2843
|
|
|
$this->pos = $pos_452; |
|
2844
|
|
|
if (( $subres = $this->literal( 'unless' ) ) !== FALSE) { |
|
2845
|
|
|
$result["text"] .= $subres; |
|
2846
|
|
|
$_455 = TRUE; break; |
|
2847
|
|
|
} |
|
2848
|
|
|
$result = $res_452; |
|
2849
|
|
|
$this->pos = $pos_452; |
|
2850
|
|
|
$_455 = FALSE; break; |
|
2851
|
|
|
} |
|
2852
|
|
|
while(0); |
|
2853
|
|
|
if( $_455 === FALSE) { $_457 = FALSE; break; } |
|
2854
|
|
|
$_457 = TRUE; break; |
|
2855
|
|
|
} |
|
2856
|
|
|
while(0); |
|
2857
|
|
|
if( $_457 === TRUE ) { |
|
2858
|
|
|
$subres = $result; $result = array_pop($stack); |
|
2859
|
|
|
$this->store( $result, $subres, 'Conditional' ); |
|
2860
|
|
|
} |
|
2861
|
|
|
if( $_457 === FALSE) { |
|
2862
|
|
|
$result = array_pop($stack); |
|
2863
|
|
|
$_461 = FALSE; break; |
|
2864
|
|
|
} |
|
2865
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2866
|
|
|
$matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos; |
|
2867
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2868
|
|
|
if ($subres !== FALSE) { |
|
2869
|
|
|
$this->store( $result, $subres, "Condition" ); |
|
2870
|
|
|
} |
|
2871
|
|
|
else { $_461 = FALSE; break; } |
|
2872
|
|
|
$_461 = TRUE; break; |
|
2873
|
|
|
} |
|
2874
|
|
|
while(0); |
|
2875
|
|
|
if( $_461 === FALSE) { |
|
2876
|
|
|
$result = $res_462; |
|
2877
|
|
|
$this->pos = $pos_462; |
|
2878
|
|
|
unset( $res_462 ); |
|
2879
|
|
|
unset( $pos_462 ); |
|
2880
|
|
|
} |
|
2881
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2882
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2883
|
|
|
else { $_492 = FALSE; break; } |
|
2884
|
|
|
while (true) { |
|
2885
|
|
|
$res_475 = $result; |
|
2886
|
|
|
$pos_475 = $this->pos; |
|
2887
|
|
|
$_474 = NULL; |
|
2888
|
|
|
do { |
|
2889
|
|
|
$_472 = NULL; |
|
2890
|
|
|
do { |
|
2891
|
|
|
$res_465 = $result; |
|
2892
|
|
|
$pos_465 = $this->pos; |
|
2893
|
|
|
$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos; |
|
2894
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2895
|
|
|
if ($subres !== FALSE) { |
|
2896
|
|
|
$this->store( $result, $subres ); |
|
2897
|
|
|
$_472 = TRUE; break; |
|
2898
|
|
|
} |
|
2899
|
|
|
$result = $res_465; |
|
2900
|
|
|
$this->pos = $pos_465; |
|
2901
|
|
|
$_470 = NULL; |
|
2902
|
|
|
do { |
|
2903
|
|
|
$res_467 = $result; |
|
2904
|
|
|
$pos_467 = $this->pos; |
|
2905
|
|
|
$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos; |
|
2906
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2907
|
|
|
if ($subres !== FALSE) { |
|
2908
|
|
|
$this->store( $result, $subres ); |
|
2909
|
|
|
$_470 = TRUE; break; |
|
2910
|
|
|
} |
|
2911
|
|
|
$result = $res_467; |
|
2912
|
|
|
$this->pos = $pos_467; |
|
2913
|
|
|
$matcher = 'match_'.'CacheBlockTemplate'; $key = $matcher; $pos = $this->pos; |
|
2914
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
2915
|
|
|
if ($subres !== FALSE) { |
|
2916
|
|
|
$this->store( $result, $subres ); |
|
2917
|
|
|
$_470 = TRUE; break; |
|
2918
|
|
|
} |
|
2919
|
|
|
$result = $res_467; |
|
2920
|
|
|
$this->pos = $pos_467; |
|
2921
|
|
|
$_470 = FALSE; break; |
|
2922
|
|
|
} |
|
2923
|
|
|
while(0); |
|
2924
|
|
|
if( $_470 === TRUE ) { $_472 = TRUE; break; } |
|
2925
|
|
|
$result = $res_465; |
|
2926
|
|
|
$this->pos = $pos_465; |
|
2927
|
|
|
$_472 = FALSE; break; |
|
2928
|
|
|
} |
|
2929
|
|
|
while(0); |
|
2930
|
|
|
if( $_472 === FALSE) { $_474 = FALSE; break; } |
|
2931
|
|
|
$_474 = TRUE; break; |
|
2932
|
|
|
} |
|
2933
|
|
|
while(0); |
|
2934
|
|
|
if( $_474 === FALSE) { |
|
2935
|
|
|
$result = $res_475; |
|
2936
|
|
|
$this->pos = $pos_475; |
|
2937
|
|
|
unset( $res_475 ); |
|
2938
|
|
|
unset( $pos_475 ); |
|
2939
|
|
|
break; |
|
2940
|
|
|
} |
|
2941
|
|
|
} |
|
2942
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2943
|
|
|
else { $_492 = FALSE; break; } |
|
2944
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2945
|
|
|
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2946
|
|
|
else { $_492 = FALSE; break; } |
|
2947
|
|
|
$_488 = NULL; |
|
2948
|
|
|
do { |
|
2949
|
|
|
$_486 = NULL; |
|
2950
|
|
|
do { |
|
2951
|
|
|
$res_479 = $result; |
|
2952
|
|
|
$pos_479 = $this->pos; |
|
2953
|
|
|
if (( $subres = $this->literal( 'cached' ) ) !== FALSE) { |
|
2954
|
|
|
$result["text"] .= $subres; |
|
2955
|
|
|
$_486 = TRUE; break; |
|
2956
|
|
|
} |
|
2957
|
|
|
$result = $res_479; |
|
2958
|
|
|
$this->pos = $pos_479; |
|
2959
|
|
|
$_484 = NULL; |
|
2960
|
|
|
do { |
|
2961
|
|
|
$res_481 = $result; |
|
2962
|
|
|
$pos_481 = $this->pos; |
|
2963
|
|
|
if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) { |
|
2964
|
|
|
$result["text"] .= $subres; |
|
2965
|
|
|
$_484 = TRUE; break; |
|
2966
|
|
|
} |
|
2967
|
|
|
$result = $res_481; |
|
2968
|
|
|
$this->pos = $pos_481; |
|
2969
|
|
|
if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) { |
|
2970
|
|
|
$result["text"] .= $subres; |
|
2971
|
|
|
$_484 = TRUE; break; |
|
2972
|
|
|
} |
|
2973
|
|
|
$result = $res_481; |
|
2974
|
|
|
$this->pos = $pos_481; |
|
2975
|
|
|
$_484 = FALSE; break; |
|
2976
|
|
|
} |
|
2977
|
|
|
while(0); |
|
2978
|
|
|
if( $_484 === TRUE ) { $_486 = TRUE; break; } |
|
2979
|
|
|
$result = $res_479; |
|
2980
|
|
|
$this->pos = $pos_479; |
|
2981
|
|
|
$_486 = FALSE; break; |
|
2982
|
|
|
} |
|
2983
|
|
|
while(0); |
|
2984
|
|
|
if( $_486 === FALSE) { $_488 = FALSE; break; } |
|
2985
|
|
|
$_488 = TRUE; break; |
|
2986
|
|
|
} |
|
2987
|
|
|
while(0); |
|
2988
|
|
|
if( $_488 === FALSE) { $_492 = FALSE; break; } |
|
2989
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2990
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
2991
|
|
|
else { $_492 = FALSE; break; } |
|
2992
|
|
|
$_492 = TRUE; break; |
|
2993
|
|
|
} |
|
2994
|
|
|
while(0); |
|
2995
|
|
|
if( $_492 === TRUE ) { return $this->finalise($result); } |
|
2996
|
|
|
if( $_492 === FALSE) { return FALSE; } |
|
2997
|
|
|
} |
|
2998
|
|
|
|
|
2999
|
|
|
|
|
3000
|
|
|
|
|
3001
|
|
|
function CacheBlock__construct(&$res) |
|
3002
|
|
|
{ |
|
3003
|
|
|
$res['subblocks'] = 0; |
|
3004
|
|
|
} |
|
3005
|
|
|
|
|
3006
|
|
|
function CacheBlock_CacheBlockArguments(&$res, $sub) |
|
3007
|
|
|
{ |
|
3008
|
|
|
$res['key'] = !empty($sub['php']) ? $sub['php'] : ''; |
|
3009
|
|
|
} |
|
3010
|
|
|
|
|
3011
|
|
|
function CacheBlock_Condition(&$res, $sub) |
|
3012
|
|
|
{ |
|
3013
|
|
|
$res['condition'] = ($res['Conditional']['text'] == 'if' ? '(' : '!(') . $sub['php'] . ') && '; |
|
3014
|
|
|
} |
|
3015
|
|
|
|
|
3016
|
|
|
function CacheBlock_CacheBlock(&$res, $sub) |
|
3017
|
|
|
{ |
|
3018
|
|
|
$res['php'] .= $sub['php']; |
|
3019
|
|
|
} |
|
3020
|
|
|
|
|
3021
|
|
|
function CacheBlock_UncachedBlock(&$res, $sub) |
|
3022
|
|
|
{ |
|
3023
|
|
|
$res['php'] .= $sub['php']; |
|
3024
|
|
|
} |
|
3025
|
|
|
|
|
3026
|
|
|
function CacheBlock_CacheBlockTemplate(&$res, $sub) |
|
3027
|
|
|
{ |
|
3028
|
|
|
// Get the block counter |
|
3029
|
|
|
$block = ++$res['subblocks']; |
|
3030
|
|
|
// Build the key for this block from the global key (evaluated in a closure within the template), |
|
3031
|
|
|
// the passed cache key, the block index, and the sha hash of the template. |
|
3032
|
|
|
$res['php'] .= '$keyExpression = function() use ($scope, $cache) {' . PHP_EOL; |
|
3033
|
|
|
$res['php'] .= '$val = \'\';' . PHP_EOL; |
|
3034
|
|
|
if ($globalKey = SSViewer::config()->get('global_key')) { |
|
3035
|
|
|
// Embed the code necessary to evaluate the globalKey directly into the template, |
|
3036
|
|
|
// so that SSTemplateParser only needs to be called during template regeneration. |
|
3037
|
|
|
// Warning: If the global key is changed, it's necessary to flush the template cache. |
|
3038
|
|
|
$parser = Injector::inst()->get(__CLASS__, false); |
|
3039
|
|
|
$result = $parser->compileString($globalKey, '', false, false); |
|
3040
|
|
|
if (!$result) { |
|
3041
|
|
|
throw new SSTemplateParseException('Unexpected problem parsing template', $parser); |
|
3042
|
|
|
} |
|
3043
|
|
|
$res['php'] .= $result . PHP_EOL; |
|
3044
|
|
|
} |
|
3045
|
|
|
$res['php'] .= 'return $val;' . PHP_EOL; |
|
3046
|
|
|
$res['php'] .= '};' . PHP_EOL; |
|
3047
|
|
|
$key = 'sha1($keyExpression())' // Global key |
|
3048
|
|
|
. '.\'_' . sha1($sub['php']) // sha of template |
|
3049
|
|
|
. (isset($res['key']) && $res['key'] ? "_'.sha1(".$res['key'].")" : "'") // Passed key |
|
3050
|
|
|
. ".'_$block'"; // block index |
|
3051
|
|
|
// Get any condition |
|
3052
|
|
|
$condition = isset($res['condition']) ? $res['condition'] : ''; |
|
3053
|
|
|
|
|
3054
|
|
|
$res['php'] .= 'if ('.$condition.'($partial = $cache->get('.$key.'))) $val .= $partial;' . PHP_EOL; |
|
3055
|
|
|
$res['php'] .= 'else { $oldval = $val; $val = "";' . PHP_EOL; |
|
3056
|
|
|
$res['php'] .= $sub['php'] . PHP_EOL; |
|
3057
|
|
|
$res['php'] .= $condition . ' $cache->set('.$key.', $val); $val = $oldval . $val;' . PHP_EOL; |
|
3058
|
|
|
$res['php'] .= '}'; |
|
3059
|
|
|
} |
|
3060
|
|
|
|
|
3061
|
|
|
/* OldTPart: "_t" N "(" N QuotedString (N "," N CallArguments)? N ")" N (";")? */ |
|
3062
|
|
|
protected $match_OldTPart_typestack = array('OldTPart'); |
|
3063
|
|
|
function match_OldTPart ($stack = array()) { |
|
3064
|
|
|
$matchrule = "OldTPart"; $result = $this->construct($matchrule, $matchrule, null); |
|
3065
|
|
|
$_511 = NULL; |
|
3066
|
|
|
do { |
|
|
|
|
|
|
3067
|
|
|
if (( $subres = $this->literal( '_t' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3068
|
|
|
else { $_511 = FALSE; break; } |
|
3069
|
|
|
$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos; |
|
3070
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3071
|
|
|
if ($subres !== FALSE) { |
|
3072
|
|
|
$this->store( $result, $subres ); |
|
3073
|
|
|
} |
|
3074
|
|
|
else { $_511 = FALSE; break; } |
|
3075
|
|
|
if (substr($this->string,$this->pos,1) == '(') { |
|
3076
|
|
|
$this->pos += 1; |
|
3077
|
|
|
$result["text"] .= '('; |
|
3078
|
|
|
} |
|
3079
|
|
|
else { $_511 = FALSE; break; } |
|
3080
|
|
|
$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos; |
|
3081
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3082
|
|
|
if ($subres !== FALSE) { |
|
3083
|
|
|
$this->store( $result, $subres ); |
|
3084
|
|
|
} |
|
3085
|
|
|
else { $_511 = FALSE; break; } |
|
3086
|
|
|
$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos; |
|
3087
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3088
|
|
|
if ($subres !== FALSE) { |
|
3089
|
|
|
$this->store( $result, $subres ); |
|
3090
|
|
|
} |
|
3091
|
|
|
else { $_511 = FALSE; break; } |
|
3092
|
|
|
$res_504 = $result; |
|
3093
|
|
|
$pos_504 = $this->pos; |
|
3094
|
|
|
$_503 = NULL; |
|
3095
|
|
|
do { |
|
3096
|
|
|
$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos; |
|
3097
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3098
|
|
|
if ($subres !== FALSE) { |
|
3099
|
|
|
$this->store( $result, $subres ); |
|
3100
|
|
|
} |
|
3101
|
|
|
else { $_503 = FALSE; break; } |
|
3102
|
|
|
if (substr($this->string,$this->pos,1) == ',') { |
|
3103
|
|
|
$this->pos += 1; |
|
3104
|
|
|
$result["text"] .= ','; |
|
3105
|
|
|
} |
|
3106
|
|
|
else { $_503 = FALSE; break; } |
|
3107
|
|
|
$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos; |
|
3108
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3109
|
|
|
if ($subres !== FALSE) { |
|
3110
|
|
|
$this->store( $result, $subres ); |
|
3111
|
|
|
} |
|
3112
|
|
|
else { $_503 = FALSE; break; } |
|
3113
|
|
|
$matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos; |
|
3114
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3115
|
|
|
if ($subres !== FALSE) { |
|
3116
|
|
|
$this->store( $result, $subres ); |
|
3117
|
|
|
} |
|
3118
|
|
|
else { $_503 = FALSE; break; } |
|
3119
|
|
|
$_503 = TRUE; break; |
|
3120
|
|
|
} |
|
3121
|
|
|
while(0); |
|
3122
|
|
|
if( $_503 === FALSE) { |
|
3123
|
|
|
$result = $res_504; |
|
3124
|
|
|
$this->pos = $pos_504; |
|
3125
|
|
|
unset( $res_504 ); |
|
3126
|
|
|
unset( $pos_504 ); |
|
3127
|
|
|
} |
|
3128
|
|
|
$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos; |
|
3129
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3130
|
|
|
if ($subres !== FALSE) { |
|
3131
|
|
|
$this->store( $result, $subres ); |
|
3132
|
|
|
} |
|
3133
|
|
|
else { $_511 = FALSE; break; } |
|
3134
|
|
|
if (substr($this->string,$this->pos,1) == ')') { |
|
3135
|
|
|
$this->pos += 1; |
|
3136
|
|
|
$result["text"] .= ')'; |
|
3137
|
|
|
} |
|
3138
|
|
|
else { $_511 = FALSE; break; } |
|
3139
|
|
|
$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos; |
|
3140
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3141
|
|
|
if ($subres !== FALSE) { |
|
3142
|
|
|
$this->store( $result, $subres ); |
|
3143
|
|
|
} |
|
3144
|
|
|
else { $_511 = FALSE; break; } |
|
3145
|
|
|
$res_510 = $result; |
|
3146
|
|
|
$pos_510 = $this->pos; |
|
3147
|
|
|
$_509 = NULL; |
|
3148
|
|
|
do { |
|
3149
|
|
|
if (substr($this->string,$this->pos,1) == ';') { |
|
3150
|
|
|
$this->pos += 1; |
|
3151
|
|
|
$result["text"] .= ';'; |
|
3152
|
|
|
} |
|
3153
|
|
|
else { $_509 = FALSE; break; } |
|
3154
|
|
|
$_509 = TRUE; break; |
|
3155
|
|
|
} |
|
3156
|
|
|
while(0); |
|
3157
|
|
|
if( $_509 === FALSE) { |
|
3158
|
|
|
$result = $res_510; |
|
3159
|
|
|
$this->pos = $pos_510; |
|
3160
|
|
|
unset( $res_510 ); |
|
3161
|
|
|
unset( $pos_510 ); |
|
3162
|
|
|
} |
|
3163
|
|
|
$_511 = TRUE; break; |
|
3164
|
|
|
} |
|
3165
|
|
|
while(0); |
|
3166
|
|
|
if( $_511 === TRUE ) { return $this->finalise($result); } |
|
3167
|
|
|
if( $_511 === FALSE) { return FALSE; } |
|
3168
|
|
|
} |
|
3169
|
|
|
|
|
3170
|
|
|
|
|
3171
|
|
|
/* N: / [\s\n]* / */ |
|
3172
|
|
|
protected $match_N_typestack = array('N'); |
|
3173
|
|
|
function match_N ($stack = array()) { |
|
|
|
|
|
|
3174
|
|
|
$matchrule = "N"; $result = $this->construct($matchrule, $matchrule, null); |
|
3175
|
|
|
if (( $subres = $this->rx( '/ [\s\n]* /' ) ) !== FALSE) { |
|
3176
|
|
|
$result["text"] .= $subres; |
|
3177
|
|
|
return $this->finalise($result); |
|
3178
|
|
|
} |
|
3179
|
|
|
else { return FALSE; } |
|
3180
|
|
|
} |
|
3181
|
|
|
|
|
3182
|
|
|
|
|
3183
|
|
|
|
|
3184
|
|
|
function OldTPart__construct(&$res) |
|
3185
|
|
|
{ |
|
3186
|
|
|
$res['php'] = "_t("; |
|
3187
|
|
|
} |
|
3188
|
|
|
|
|
3189
|
|
|
function OldTPart_QuotedString(&$res, $sub) |
|
3190
|
|
|
{ |
|
3191
|
|
|
$entity = $sub['String']['text']; |
|
3192
|
|
|
if (strpos($entity, '.') === false) { |
|
3193
|
|
|
$res['php'] .= "\$scope->XML_val('I18NNamespace').'.$entity'"; |
|
3194
|
|
|
} else { |
|
3195
|
|
|
$res['php'] .= "'$entity'"; |
|
3196
|
|
|
} |
|
3197
|
|
|
} |
|
3198
|
|
|
|
|
3199
|
|
|
function OldTPart_CallArguments(&$res, $sub) |
|
3200
|
|
|
{ |
|
3201
|
|
|
$res['php'] .= ',' . $sub['php']; |
|
3202
|
|
|
} |
|
3203
|
|
|
|
|
3204
|
|
|
function OldTPart__finalise(&$res) |
|
3205
|
|
|
{ |
|
3206
|
|
|
$res['php'] .= ')'; |
|
3207
|
|
|
} |
|
3208
|
|
|
|
|
3209
|
|
|
/* OldTTag: "<%" < OldTPart > "%>" */ |
|
3210
|
|
|
protected $match_OldTTag_typestack = array('OldTTag'); |
|
3211
|
|
|
function match_OldTTag ($stack = array()) { |
|
3212
|
|
|
$matchrule = "OldTTag"; $result = $this->construct($matchrule, $matchrule, null); |
|
3213
|
|
|
$_519 = NULL; |
|
3214
|
|
|
do { |
|
|
|
|
|
|
3215
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3216
|
|
|
else { $_519 = FALSE; break; } |
|
3217
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3218
|
|
|
$matcher = 'match_'.'OldTPart'; $key = $matcher; $pos = $this->pos; |
|
3219
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3220
|
|
|
if ($subres !== FALSE) { |
|
3221
|
|
|
$this->store( $result, $subres ); |
|
3222
|
|
|
} |
|
3223
|
|
|
else { $_519 = FALSE; break; } |
|
3224
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3225
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3226
|
|
|
else { $_519 = FALSE; break; } |
|
3227
|
|
|
$_519 = TRUE; break; |
|
3228
|
|
|
} |
|
3229
|
|
|
while(0); |
|
3230
|
|
|
if( $_519 === TRUE ) { return $this->finalise($result); } |
|
3231
|
|
|
if( $_519 === FALSE) { return FALSE; } |
|
3232
|
|
|
} |
|
3233
|
|
|
|
|
3234
|
|
|
|
|
3235
|
|
|
|
|
3236
|
|
|
function OldTTag_OldTPart(&$res, $sub) |
|
3237
|
|
|
{ |
|
3238
|
|
|
$res['php'] = $sub['php']; |
|
3239
|
|
|
} |
|
3240
|
|
|
|
|
3241
|
|
|
/* OldSprintfTag: "<%" < "sprintf" < "(" < OldTPart < "," < CallArguments > ")" > "%>" */ |
|
3242
|
|
|
protected $match_OldSprintfTag_typestack = array('OldSprintfTag'); |
|
3243
|
|
|
function match_OldSprintfTag ($stack = array()) { |
|
3244
|
|
|
$matchrule = "OldSprintfTag"; $result = $this->construct($matchrule, $matchrule, null); |
|
3245
|
|
|
$_536 = NULL; |
|
3246
|
|
|
do { |
|
|
|
|
|
|
3247
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3248
|
|
|
else { $_536 = FALSE; break; } |
|
3249
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3250
|
|
|
if (( $subres = $this->literal( 'sprintf' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3251
|
|
|
else { $_536 = FALSE; break; } |
|
3252
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3253
|
|
|
if (substr($this->string,$this->pos,1) == '(') { |
|
3254
|
|
|
$this->pos += 1; |
|
3255
|
|
|
$result["text"] .= '('; |
|
3256
|
|
|
} |
|
3257
|
|
|
else { $_536 = FALSE; break; } |
|
3258
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3259
|
|
|
$matcher = 'match_'.'OldTPart'; $key = $matcher; $pos = $this->pos; |
|
3260
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3261
|
|
|
if ($subres !== FALSE) { |
|
3262
|
|
|
$this->store( $result, $subres ); |
|
3263
|
|
|
} |
|
3264
|
|
|
else { $_536 = FALSE; break; } |
|
3265
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3266
|
|
|
if (substr($this->string,$this->pos,1) == ',') { |
|
3267
|
|
|
$this->pos += 1; |
|
3268
|
|
|
$result["text"] .= ','; |
|
3269
|
|
|
} |
|
3270
|
|
|
else { $_536 = FALSE; break; } |
|
3271
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3272
|
|
|
$matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos; |
|
3273
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3274
|
|
|
if ($subres !== FALSE) { |
|
3275
|
|
|
$this->store( $result, $subres ); |
|
3276
|
|
|
} |
|
3277
|
|
|
else { $_536 = FALSE; break; } |
|
3278
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3279
|
|
|
if (substr($this->string,$this->pos,1) == ')') { |
|
3280
|
|
|
$this->pos += 1; |
|
3281
|
|
|
$result["text"] .= ')'; |
|
3282
|
|
|
} |
|
3283
|
|
|
else { $_536 = FALSE; break; } |
|
3284
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3285
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3286
|
|
|
else { $_536 = FALSE; break; } |
|
3287
|
|
|
$_536 = TRUE; break; |
|
3288
|
|
|
} |
|
3289
|
|
|
while(0); |
|
3290
|
|
|
if( $_536 === TRUE ) { return $this->finalise($result); } |
|
3291
|
|
|
if( $_536 === FALSE) { return FALSE; } |
|
3292
|
|
|
} |
|
3293
|
|
|
|
|
3294
|
|
|
|
|
3295
|
|
|
|
|
3296
|
|
|
function OldSprintfTag__construct(&$res) |
|
3297
|
|
|
{ |
|
3298
|
|
|
$res['php'] = "sprintf("; |
|
3299
|
|
|
} |
|
3300
|
|
|
|
|
3301
|
|
|
function OldSprintfTag_OldTPart(&$res, $sub) |
|
3302
|
|
|
{ |
|
3303
|
|
|
$res['php'] .= $sub['php']; |
|
3304
|
|
|
} |
|
3305
|
|
|
|
|
3306
|
|
|
function OldSprintfTag_CallArguments(&$res, $sub) |
|
3307
|
|
|
{ |
|
3308
|
|
|
$res['php'] .= ',' . $sub['php'] . ')'; |
|
3309
|
|
|
} |
|
3310
|
|
|
|
|
3311
|
|
|
/* OldI18NTag: OldSprintfTag | OldTTag */ |
|
3312
|
|
|
protected $match_OldI18NTag_typestack = array('OldI18NTag'); |
|
3313
|
|
|
function match_OldI18NTag ($stack = array()) { |
|
3314
|
|
|
$matchrule = "OldI18NTag"; $result = $this->construct($matchrule, $matchrule, null); |
|
3315
|
|
|
$_541 = NULL; |
|
3316
|
|
|
do { |
|
|
|
|
|
|
3317
|
|
|
$res_538 = $result; |
|
3318
|
|
|
$pos_538 = $this->pos; |
|
3319
|
|
|
$matcher = 'match_'.'OldSprintfTag'; $key = $matcher; $pos = $this->pos; |
|
3320
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3321
|
|
|
if ($subres !== FALSE) { |
|
3322
|
|
|
$this->store( $result, $subres ); |
|
3323
|
|
|
$_541 = TRUE; break; |
|
3324
|
|
|
} |
|
3325
|
|
|
$result = $res_538; |
|
3326
|
|
|
$this->pos = $pos_538; |
|
3327
|
|
|
$matcher = 'match_'.'OldTTag'; $key = $matcher; $pos = $this->pos; |
|
3328
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3329
|
|
|
if ($subres !== FALSE) { |
|
3330
|
|
|
$this->store( $result, $subres ); |
|
3331
|
|
|
$_541 = TRUE; break; |
|
3332
|
|
|
} |
|
3333
|
|
|
$result = $res_538; |
|
3334
|
|
|
$this->pos = $pos_538; |
|
3335
|
|
|
$_541 = FALSE; break; |
|
3336
|
|
|
} |
|
3337
|
|
|
while(0); |
|
3338
|
|
|
if( $_541 === TRUE ) { return $this->finalise($result); } |
|
3339
|
|
|
if( $_541 === FALSE) { return FALSE; } |
|
3340
|
|
|
} |
|
3341
|
|
|
|
|
3342
|
|
|
|
|
3343
|
|
|
|
|
3344
|
|
|
function OldI18NTag_STR(&$res, $sub) |
|
3345
|
|
|
{ |
|
3346
|
|
|
$res['php'] = '$val .= ' . $sub['php'] . ';'; |
|
3347
|
|
|
} |
|
3348
|
|
|
|
|
3349
|
|
|
/* NamedArgument: Name:Word "=" Value:Argument */ |
|
3350
|
|
|
protected $match_NamedArgument_typestack = array('NamedArgument'); |
|
3351
|
|
|
function match_NamedArgument ($stack = array()) { |
|
3352
|
|
|
$matchrule = "NamedArgument"; $result = $this->construct($matchrule, $matchrule, null); |
|
3353
|
|
|
$_546 = NULL; |
|
3354
|
|
|
do { |
|
|
|
|
|
|
3355
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; |
|
3356
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3357
|
|
|
if ($subres !== FALSE) { |
|
3358
|
|
|
$this->store( $result, $subres, "Name" ); |
|
3359
|
|
|
} |
|
3360
|
|
|
else { $_546 = FALSE; break; } |
|
3361
|
|
|
if (substr($this->string,$this->pos,1) == '=') { |
|
3362
|
|
|
$this->pos += 1; |
|
3363
|
|
|
$result["text"] .= '='; |
|
3364
|
|
|
} |
|
3365
|
|
|
else { $_546 = FALSE; break; } |
|
3366
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos; |
|
3367
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3368
|
|
|
if ($subres !== FALSE) { |
|
3369
|
|
|
$this->store( $result, $subres, "Value" ); |
|
3370
|
|
|
} |
|
3371
|
|
|
else { $_546 = FALSE; break; } |
|
3372
|
|
|
$_546 = TRUE; break; |
|
3373
|
|
|
} |
|
3374
|
|
|
while(0); |
|
3375
|
|
|
if( $_546 === TRUE ) { return $this->finalise($result); } |
|
3376
|
|
|
if( $_546 === FALSE) { return FALSE; } |
|
3377
|
|
|
} |
|
3378
|
|
|
|
|
3379
|
|
|
|
|
3380
|
|
|
|
|
3381
|
|
|
function NamedArgument_Name(&$res, $sub) |
|
3382
|
|
|
{ |
|
3383
|
|
|
$res['php'] = "'" . $sub['text'] . "' => "; |
|
3384
|
|
|
} |
|
3385
|
|
|
|
|
3386
|
|
|
function NamedArgument_Value(&$res, $sub) |
|
3387
|
|
|
{ |
|
3388
|
|
|
switch ($sub['ArgumentMode']) { |
|
3389
|
|
|
case 'string': |
|
3390
|
|
|
$res['php'] .= $sub['php']; |
|
3391
|
|
|
break; |
|
3392
|
|
|
|
|
3393
|
|
|
case 'default': |
|
3394
|
|
|
$res['php'] .= $sub['string_php']; |
|
3395
|
|
|
break; |
|
3396
|
|
|
|
|
3397
|
|
|
default: |
|
3398
|
|
|
$res['php'] .= str_replace('$$FINAL', 'obj', $sub['php']) . '->self()'; |
|
3399
|
|
|
break; |
|
3400
|
|
|
} |
|
3401
|
|
|
} |
|
3402
|
|
|
|
|
3403
|
|
|
/* Include: "<%" < "include" < Template:NamespacedWord < (NamedArgument ( < "," < NamedArgument )*)? > "%>" */ |
|
3404
|
|
|
protected $match_Include_typestack = array('Include'); |
|
3405
|
|
|
function match_Include ($stack = array()) { |
|
3406
|
|
|
$matchrule = "Include"; $result = $this->construct($matchrule, $matchrule, null); |
|
3407
|
|
|
$_565 = NULL; |
|
3408
|
|
|
do { |
|
|
|
|
|
|
3409
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3410
|
|
|
else { $_565 = FALSE; break; } |
|
3411
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3412
|
|
|
if (( $subres = $this->literal( 'include' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3413
|
|
|
else { $_565 = FALSE; break; } |
|
3414
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3415
|
|
|
$matcher = 'match_'.'NamespacedWord'; $key = $matcher; $pos = $this->pos; |
|
3416
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3417
|
|
|
if ($subres !== FALSE) { |
|
3418
|
|
|
$this->store( $result, $subres, "Template" ); |
|
3419
|
|
|
} |
|
3420
|
|
|
else { $_565 = FALSE; break; } |
|
3421
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3422
|
|
|
$res_562 = $result; |
|
3423
|
|
|
$pos_562 = $this->pos; |
|
3424
|
|
|
$_561 = NULL; |
|
3425
|
|
|
do { |
|
3426
|
|
|
$matcher = 'match_'.'NamedArgument'; $key = $matcher; $pos = $this->pos; |
|
3427
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3428
|
|
|
if ($subres !== FALSE) { |
|
3429
|
|
|
$this->store( $result, $subres ); |
|
3430
|
|
|
} |
|
3431
|
|
|
else { $_561 = FALSE; break; } |
|
3432
|
|
|
while (true) { |
|
3433
|
|
|
$res_560 = $result; |
|
3434
|
|
|
$pos_560 = $this->pos; |
|
3435
|
|
|
$_559 = NULL; |
|
3436
|
|
|
do { |
|
3437
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3438
|
|
|
if (substr($this->string,$this->pos,1) == ',') { |
|
3439
|
|
|
$this->pos += 1; |
|
3440
|
|
|
$result["text"] .= ','; |
|
3441
|
|
|
} |
|
3442
|
|
|
else { $_559 = FALSE; break; } |
|
3443
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3444
|
|
|
$matcher = 'match_'.'NamedArgument'; $key = $matcher; $pos = $this->pos; |
|
3445
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3446
|
|
|
if ($subres !== FALSE) { |
|
3447
|
|
|
$this->store( $result, $subres ); |
|
3448
|
|
|
} |
|
3449
|
|
|
else { $_559 = FALSE; break; } |
|
3450
|
|
|
$_559 = TRUE; break; |
|
3451
|
|
|
} |
|
3452
|
|
|
while(0); |
|
3453
|
|
|
if( $_559 === FALSE) { |
|
3454
|
|
|
$result = $res_560; |
|
3455
|
|
|
$this->pos = $pos_560; |
|
3456
|
|
|
unset( $res_560 ); |
|
3457
|
|
|
unset( $pos_560 ); |
|
3458
|
|
|
break; |
|
3459
|
|
|
} |
|
3460
|
|
|
} |
|
3461
|
|
|
$_561 = TRUE; break; |
|
3462
|
|
|
} |
|
3463
|
|
|
while(0); |
|
3464
|
|
|
if( $_561 === FALSE) { |
|
3465
|
|
|
$result = $res_562; |
|
3466
|
|
|
$this->pos = $pos_562; |
|
3467
|
|
|
unset( $res_562 ); |
|
3468
|
|
|
unset( $pos_562 ); |
|
3469
|
|
|
} |
|
3470
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3471
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3472
|
|
|
else { $_565 = FALSE; break; } |
|
3473
|
|
|
$_565 = TRUE; break; |
|
3474
|
|
|
} |
|
3475
|
|
|
while(0); |
|
3476
|
|
|
if( $_565 === TRUE ) { return $this->finalise($result); } |
|
3477
|
|
|
if( $_565 === FALSE) { return FALSE; } |
|
3478
|
|
|
} |
|
3479
|
|
|
|
|
3480
|
|
|
|
|
3481
|
|
|
|
|
3482
|
|
|
function Include__construct(&$res) |
|
3483
|
|
|
{ |
|
3484
|
|
|
$res['arguments'] = array(); |
|
3485
|
|
|
} |
|
3486
|
|
|
|
|
3487
|
|
|
function Include_Template(&$res, $sub) |
|
3488
|
|
|
{ |
|
3489
|
|
|
$res['template'] = "'" . $sub['text'] . "'"; |
|
3490
|
|
|
} |
|
3491
|
|
|
|
|
3492
|
|
|
function Include_NamedArgument(&$res, $sub) |
|
3493
|
|
|
{ |
|
3494
|
|
|
$res['arguments'][] = $sub['php']; |
|
3495
|
|
|
} |
|
3496
|
|
|
|
|
3497
|
|
|
function Include__finalise(&$res) |
|
3498
|
|
|
{ |
|
3499
|
|
|
$template = $res['template']; |
|
3500
|
|
|
$arguments = $res['arguments']; |
|
3501
|
|
|
|
|
3502
|
|
|
$res['php'] = '$val .= \\SilverStripe\\View\\SSViewer::execute_template(["type" => "Includes", '.$template.'], $scope->getItem(), array(' . |
|
3503
|
|
|
implode(',', $arguments)."), \$scope);\n"; |
|
3504
|
|
|
|
|
3505
|
|
|
if ($this->includeDebuggingComments) { // Add include filename comments on dev sites |
|
3506
|
|
|
$res['php'] = |
|
3507
|
|
|
'$val .= \'<!-- include '.addslashes($template).' -->\';'. "\n". |
|
3508
|
|
|
$res['php']. |
|
3509
|
|
|
'$val .= \'<!-- end include '.addslashes($template).' -->\';'. "\n"; |
|
3510
|
|
|
} |
|
3511
|
|
|
} |
|
3512
|
|
|
|
|
3513
|
|
|
/* BlockArguments: :Argument ( < "," < :Argument)* */ |
|
3514
|
|
|
protected $match_BlockArguments_typestack = array('BlockArguments'); |
|
3515
|
|
|
function match_BlockArguments ($stack = array()) { |
|
3516
|
|
|
$matchrule = "BlockArguments"; $result = $this->construct($matchrule, $matchrule, null); |
|
3517
|
|
|
$_574 = NULL; |
|
3518
|
|
|
do { |
|
|
|
|
|
|
3519
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos; |
|
3520
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3521
|
|
|
if ($subres !== FALSE) { |
|
3522
|
|
|
$this->store( $result, $subres, "Argument" ); |
|
3523
|
|
|
} |
|
3524
|
|
|
else { $_574 = FALSE; break; } |
|
3525
|
|
|
while (true) { |
|
3526
|
|
|
$res_573 = $result; |
|
3527
|
|
|
$pos_573 = $this->pos; |
|
3528
|
|
|
$_572 = NULL; |
|
3529
|
|
|
do { |
|
3530
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3531
|
|
|
if (substr($this->string,$this->pos,1) == ',') { |
|
3532
|
|
|
$this->pos += 1; |
|
3533
|
|
|
$result["text"] .= ','; |
|
3534
|
|
|
} |
|
3535
|
|
|
else { $_572 = FALSE; break; } |
|
3536
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3537
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos; |
|
3538
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3539
|
|
|
if ($subres !== FALSE) { |
|
3540
|
|
|
$this->store( $result, $subres, "Argument" ); |
|
3541
|
|
|
} |
|
3542
|
|
|
else { $_572 = FALSE; break; } |
|
3543
|
|
|
$_572 = TRUE; break; |
|
3544
|
|
|
} |
|
3545
|
|
|
while(0); |
|
3546
|
|
|
if( $_572 === FALSE) { |
|
3547
|
|
|
$result = $res_573; |
|
3548
|
|
|
$this->pos = $pos_573; |
|
3549
|
|
|
unset( $res_573 ); |
|
3550
|
|
|
unset( $pos_573 ); |
|
3551
|
|
|
break; |
|
3552
|
|
|
} |
|
3553
|
|
|
} |
|
3554
|
|
|
$_574 = TRUE; break; |
|
3555
|
|
|
} |
|
3556
|
|
|
while(0); |
|
3557
|
|
|
if( $_574 === TRUE ) { return $this->finalise($result); } |
|
3558
|
|
|
if( $_574 === FALSE) { return FALSE; } |
|
3559
|
|
|
} |
|
3560
|
|
|
|
|
3561
|
|
|
|
|
3562
|
|
|
/* NotBlockTag: "end_" | (("if" | "else_if" | "else" | "require" | "cached" | "uncached" | "cacheblock" | "include")]) */ |
|
|
|
|
|
|
3563
|
|
|
protected $match_NotBlockTag_typestack = array('NotBlockTag'); |
|
3564
|
|
|
function match_NotBlockTag ($stack = array()) { |
|
|
|
|
|
|
3565
|
|
|
$matchrule = "NotBlockTag"; $result = $this->construct($matchrule, $matchrule, null); |
|
3566
|
|
|
$_612 = NULL; |
|
3567
|
|
|
do { |
|
|
|
|
|
|
3568
|
|
|
$res_576 = $result; |
|
3569
|
|
|
$pos_576 = $this->pos; |
|
3570
|
|
|
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { |
|
3571
|
|
|
$result["text"] .= $subres; |
|
3572
|
|
|
$_612 = TRUE; break; |
|
3573
|
|
|
} |
|
3574
|
|
|
$result = $res_576; |
|
3575
|
|
|
$this->pos = $pos_576; |
|
3576
|
|
|
$_610 = NULL; |
|
3577
|
|
|
do { |
|
3578
|
|
|
$_607 = NULL; |
|
3579
|
|
|
do { |
|
3580
|
|
|
$_605 = NULL; |
|
3581
|
|
|
do { |
|
3582
|
|
|
$res_578 = $result; |
|
3583
|
|
|
$pos_578 = $this->pos; |
|
3584
|
|
|
if (( $subres = $this->literal( 'if' ) ) !== FALSE) { |
|
3585
|
|
|
$result["text"] .= $subres; |
|
3586
|
|
|
$_605 = TRUE; break; |
|
3587
|
|
|
} |
|
3588
|
|
|
$result = $res_578; |
|
3589
|
|
|
$this->pos = $pos_578; |
|
3590
|
|
|
$_603 = NULL; |
|
3591
|
|
|
do { |
|
3592
|
|
|
$res_580 = $result; |
|
3593
|
|
|
$pos_580 = $this->pos; |
|
3594
|
|
|
if (( $subres = $this->literal( 'else_if' ) ) !== FALSE) { |
|
3595
|
|
|
$result["text"] .= $subres; |
|
3596
|
|
|
$_603 = TRUE; break; |
|
3597
|
|
|
} |
|
3598
|
|
|
$result = $res_580; |
|
3599
|
|
|
$this->pos = $pos_580; |
|
3600
|
|
|
$_601 = NULL; |
|
3601
|
|
|
do { |
|
3602
|
|
|
$res_582 = $result; |
|
3603
|
|
|
$pos_582 = $this->pos; |
|
3604
|
|
|
if (( $subres = $this->literal( 'else' ) ) !== FALSE) { |
|
3605
|
|
|
$result["text"] .= $subres; |
|
3606
|
|
|
$_601 = TRUE; break; |
|
3607
|
|
|
} |
|
3608
|
|
|
$result = $res_582; |
|
3609
|
|
|
$this->pos = $pos_582; |
|
3610
|
|
|
$_599 = NULL; |
|
3611
|
|
|
do { |
|
3612
|
|
|
$res_584 = $result; |
|
3613
|
|
|
$pos_584 = $this->pos; |
|
3614
|
|
|
if (( $subres = $this->literal( 'require' ) ) !== FALSE) { |
|
3615
|
|
|
$result["text"] .= $subres; |
|
3616
|
|
|
$_599 = TRUE; break; |
|
3617
|
|
|
} |
|
3618
|
|
|
$result = $res_584; |
|
3619
|
|
|
$this->pos = $pos_584; |
|
3620
|
|
|
$_597 = NULL; |
|
3621
|
|
|
do { |
|
3622
|
|
|
$res_586 = $result; |
|
3623
|
|
|
$pos_586 = $this->pos; |
|
3624
|
|
|
if (( $subres = $this->literal( 'cached' ) ) !== FALSE) { |
|
3625
|
|
|
$result["text"] .= $subres; |
|
3626
|
|
|
$_597 = TRUE; break; |
|
3627
|
|
|
} |
|
3628
|
|
|
$result = $res_586; |
|
3629
|
|
|
$this->pos = $pos_586; |
|
3630
|
|
|
$_595 = NULL; |
|
3631
|
|
|
do { |
|
3632
|
|
|
$res_588 = $result; |
|
3633
|
|
|
$pos_588 = $this->pos; |
|
3634
|
|
|
if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) { |
|
3635
|
|
|
$result["text"] .= $subres; |
|
3636
|
|
|
$_595 = TRUE; break; |
|
3637
|
|
|
} |
|
3638
|
|
|
$result = $res_588; |
|
3639
|
|
|
$this->pos = $pos_588; |
|
3640
|
|
|
$_593 = NULL; |
|
3641
|
|
|
do { |
|
3642
|
|
|
$res_590 = $result; |
|
3643
|
|
|
$pos_590 = $this->pos; |
|
3644
|
|
|
if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) { |
|
3645
|
|
|
$result["text"] .= $subres; |
|
3646
|
|
|
$_593 = TRUE; break; |
|
3647
|
|
|
} |
|
3648
|
|
|
$result = $res_590; |
|
3649
|
|
|
$this->pos = $pos_590; |
|
3650
|
|
|
if (( $subres = $this->literal( 'include' ) ) !== FALSE) { |
|
3651
|
|
|
$result["text"] .= $subres; |
|
3652
|
|
|
$_593 = TRUE; break; |
|
3653
|
|
|
} |
|
3654
|
|
|
$result = $res_590; |
|
3655
|
|
|
$this->pos = $pos_590; |
|
3656
|
|
|
$_593 = FALSE; break; |
|
3657
|
|
|
} |
|
3658
|
|
|
while(0); |
|
3659
|
|
|
if( $_593 === TRUE ) { $_595 = TRUE; break; } |
|
3660
|
|
|
$result = $res_588; |
|
3661
|
|
|
$this->pos = $pos_588; |
|
3662
|
|
|
$_595 = FALSE; break; |
|
3663
|
|
|
} |
|
3664
|
|
|
while(0); |
|
3665
|
|
|
if( $_595 === TRUE ) { $_597 = TRUE; break; } |
|
3666
|
|
|
$result = $res_586; |
|
3667
|
|
|
$this->pos = $pos_586; |
|
3668
|
|
|
$_597 = FALSE; break; |
|
3669
|
|
|
} |
|
3670
|
|
|
while(0); |
|
3671
|
|
|
if( $_597 === TRUE ) { $_599 = TRUE; break; } |
|
3672
|
|
|
$result = $res_584; |
|
3673
|
|
|
$this->pos = $pos_584; |
|
3674
|
|
|
$_599 = FALSE; break; |
|
3675
|
|
|
} |
|
3676
|
|
|
while(0); |
|
3677
|
|
|
if( $_599 === TRUE ) { $_601 = TRUE; break; } |
|
3678
|
|
|
$result = $res_582; |
|
3679
|
|
|
$this->pos = $pos_582; |
|
3680
|
|
|
$_601 = FALSE; break; |
|
3681
|
|
|
} |
|
3682
|
|
|
while(0); |
|
3683
|
|
|
if( $_601 === TRUE ) { $_603 = TRUE; break; } |
|
3684
|
|
|
$result = $res_580; |
|
3685
|
|
|
$this->pos = $pos_580; |
|
3686
|
|
|
$_603 = FALSE; break; |
|
3687
|
|
|
} |
|
3688
|
|
|
while(0); |
|
3689
|
|
|
if( $_603 === TRUE ) { $_605 = TRUE; break; } |
|
3690
|
|
|
$result = $res_578; |
|
3691
|
|
|
$this->pos = $pos_578; |
|
3692
|
|
|
$_605 = FALSE; break; |
|
3693
|
|
|
} |
|
3694
|
|
|
while(0); |
|
3695
|
|
|
if( $_605 === FALSE) { $_607 = FALSE; break; } |
|
3696
|
|
|
$_607 = TRUE; break; |
|
3697
|
|
|
} |
|
3698
|
|
|
while(0); |
|
3699
|
|
|
if( $_607 === FALSE) { $_610 = FALSE; break; } |
|
3700
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3701
|
|
|
else { $_610 = FALSE; break; } |
|
3702
|
|
|
$_610 = TRUE; break; |
|
3703
|
|
|
} |
|
3704
|
|
|
while(0); |
|
3705
|
|
|
if( $_610 === TRUE ) { $_612 = TRUE; break; } |
|
3706
|
|
|
$result = $res_576; |
|
3707
|
|
|
$this->pos = $pos_576; |
|
3708
|
|
|
$_612 = FALSE; break; |
|
3709
|
|
|
} |
|
3710
|
|
|
while(0); |
|
3711
|
|
|
if( $_612 === TRUE ) { return $this->finalise($result); } |
|
3712
|
|
|
if( $_612 === FALSE) { return FALSE; } |
|
3713
|
|
|
} |
|
3714
|
|
|
|
|
3715
|
|
|
|
|
3716
|
|
|
/* ClosedBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > Zap:'%>' Template:$TemplateMatcher? |
|
|
|
|
|
|
3717
|
|
|
'<%' < 'end_' '$BlockName' > '%>' */ |
|
3718
|
|
|
protected $match_ClosedBlock_typestack = array('ClosedBlock'); |
|
3719
|
|
|
function match_ClosedBlock ($stack = array()) { |
|
3720
|
|
|
$matchrule = "ClosedBlock"; $result = $this->construct($matchrule, $matchrule, null); |
|
3721
|
|
|
$_632 = NULL; |
|
3722
|
|
|
do { |
|
|
|
|
|
|
3723
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3724
|
|
|
else { $_632 = FALSE; break; } |
|
3725
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3726
|
|
|
$res_616 = $result; |
|
3727
|
|
|
$pos_616 = $this->pos; |
|
3728
|
|
|
$matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos; |
|
3729
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3730
|
|
|
if ($subres !== FALSE) { |
|
3731
|
|
|
$this->store( $result, $subres ); |
|
3732
|
|
|
$result = $res_616; |
|
3733
|
|
|
$this->pos = $pos_616; |
|
3734
|
|
|
$_632 = FALSE; break; |
|
3735
|
|
|
} |
|
3736
|
|
|
else { |
|
3737
|
|
|
$result = $res_616; |
|
3738
|
|
|
$this->pos = $pos_616; |
|
3739
|
|
|
} |
|
3740
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; |
|
3741
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3742
|
|
|
if ($subres !== FALSE) { |
|
3743
|
|
|
$this->store( $result, $subres, "BlockName" ); |
|
3744
|
|
|
} |
|
3745
|
|
|
else { $_632 = FALSE; break; } |
|
3746
|
|
|
$res_622 = $result; |
|
3747
|
|
|
$pos_622 = $this->pos; |
|
3748
|
|
|
$_621 = NULL; |
|
3749
|
|
|
do { |
|
3750
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3751
|
|
|
else { $_621 = FALSE; break; } |
|
3752
|
|
|
$matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos; |
|
3753
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3754
|
|
|
if ($subres !== FALSE) { |
|
3755
|
|
|
$this->store( $result, $subres, "BlockArguments" ); |
|
3756
|
|
|
} |
|
3757
|
|
|
else { $_621 = FALSE; break; } |
|
3758
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3759
|
|
|
else { $_621 = FALSE; break; } |
|
3760
|
|
|
$_621 = TRUE; break; |
|
3761
|
|
|
} |
|
3762
|
|
|
while(0); |
|
3763
|
|
|
if( $_621 === FALSE) { |
|
3764
|
|
|
$result = $res_622; |
|
3765
|
|
|
$this->pos = $pos_622; |
|
3766
|
|
|
unset( $res_622 ); |
|
3767
|
|
|
unset( $pos_622 ); |
|
3768
|
|
|
} |
|
3769
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3770
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Zap" ); |
|
3771
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { |
|
3772
|
|
|
$result["text"] .= $subres; |
|
3773
|
|
|
$subres = $result; $result = array_pop($stack); |
|
3774
|
|
|
$this->store( $result, $subres, 'Zap' ); |
|
3775
|
|
|
} |
|
3776
|
|
|
else { |
|
3777
|
|
|
$result = array_pop($stack); |
|
3778
|
|
|
$_632 = FALSE; break; |
|
3779
|
|
|
} |
|
3780
|
|
|
$res_625 = $result; |
|
3781
|
|
|
$pos_625 = $this->pos; |
|
3782
|
|
|
$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos; |
|
3783
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3784
|
|
|
if ($subres !== FALSE) { |
|
3785
|
|
|
$this->store( $result, $subres, "Template" ); |
|
3786
|
|
|
} |
|
3787
|
|
|
else { |
|
3788
|
|
|
$result = $res_625; |
|
3789
|
|
|
$this->pos = $pos_625; |
|
3790
|
|
|
unset( $res_625 ); |
|
3791
|
|
|
unset( $pos_625 ); |
|
3792
|
|
|
} |
|
3793
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3794
|
|
|
else { $_632 = FALSE; break; } |
|
3795
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3796
|
|
|
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3797
|
|
|
else { $_632 = FALSE; break; } |
|
3798
|
|
|
if (( $subres = $this->literal( ''.$this->expression($result, $stack, 'BlockName').'' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3799
|
|
|
else { $_632 = FALSE; break; } |
|
3800
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3801
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3802
|
|
|
else { $_632 = FALSE; break; } |
|
3803
|
|
|
$_632 = TRUE; break; |
|
3804
|
|
|
} |
|
3805
|
|
|
while(0); |
|
3806
|
|
|
if( $_632 === TRUE ) { return $this->finalise($result); } |
|
3807
|
|
|
if( $_632 === FALSE) { return FALSE; } |
|
3808
|
|
|
} |
|
3809
|
|
|
|
|
3810
|
|
|
|
|
3811
|
|
|
|
|
3812
|
|
|
|
|
3813
|
|
|
/** |
|
3814
|
|
|
* As mentioned in the parser comment, block handling is kept fairly generic for extensibility. The match rule |
|
3815
|
|
|
* builds up two important elements in the match result array: |
|
3816
|
|
|
* 'ArgumentCount' - how many arguments were passed in the opening tag |
|
3817
|
|
|
* 'Arguments' an array of the Argument match rule result arrays |
|
3818
|
|
|
* |
|
3819
|
|
|
* Once a block has successfully been matched against, it will then look for the actual handler, which should |
|
3820
|
|
|
* be on this class (either defined or extended on) as ClosedBlock_Handler_Name(&$res), where Name is the |
|
3821
|
|
|
* tag name, first letter captialized (i.e Control, Loop, With, etc). |
|
3822
|
|
|
* |
|
3823
|
|
|
* This function will be called with the match rule result array as it's first argument. It should return |
|
3824
|
|
|
* the php result of this block as it's return value, or throw an error if incorrect arguments were passed. |
|
3825
|
|
|
*/ |
|
3826
|
|
|
|
|
3827
|
|
|
function ClosedBlock__construct(&$res) |
|
3828
|
|
|
{ |
|
3829
|
|
|
$res['ArgumentCount'] = 0; |
|
3830
|
|
|
} |
|
3831
|
|
|
|
|
3832
|
|
|
function ClosedBlock_BlockArguments(&$res, $sub) |
|
3833
|
|
|
{ |
|
3834
|
|
|
if (isset($sub['Argument']['ArgumentMode'])) { |
|
3835
|
|
|
$res['Arguments'] = array($sub['Argument']); |
|
3836
|
|
|
$res['ArgumentCount'] = 1; |
|
3837
|
|
|
} else { |
|
3838
|
|
|
$res['Arguments'] = $sub['Argument']; |
|
3839
|
|
|
$res['ArgumentCount'] = count($res['Arguments']); |
|
3840
|
|
|
} |
|
3841
|
|
|
} |
|
3842
|
|
|
|
|
3843
|
|
|
function ClosedBlock__finalise(&$res) |
|
3844
|
|
|
{ |
|
3845
|
|
|
$blockname = $res['BlockName']['text']; |
|
3846
|
|
|
|
|
3847
|
|
|
$method = 'ClosedBlock_Handle_'.$blockname; |
|
3848
|
|
|
if (method_exists($this, $method)) { |
|
3849
|
|
|
$res['php'] = $this->$method($res); |
|
3850
|
|
|
} elseif (isset($this->closedBlocks[$blockname])) { |
|
3851
|
|
|
$res['php'] = call_user_func($this->closedBlocks[$blockname], $res); |
|
3852
|
|
|
} else { |
|
3853
|
|
|
throw new SSTemplateParseException('Unknown closed block "'.$blockname.'" encountered. Perhaps you are ' . |
|
3854
|
|
|
'not supposed to close this block, or have mis-spelled it?', $this); |
|
3855
|
|
|
} |
|
3856
|
|
|
} |
|
3857
|
|
|
|
|
3858
|
|
|
/** |
|
3859
|
|
|
* This is an example of a block handler function. This one handles the loop tag. |
|
3860
|
|
|
*/ |
|
3861
|
|
|
function ClosedBlock_Handle_Loop(&$res) |
|
3862
|
|
|
{ |
|
3863
|
|
|
if ($res['ArgumentCount'] > 1) { |
|
3864
|
|
|
throw new SSTemplateParseException('Either no or too many arguments in control block. Must be one ' . |
|
3865
|
|
|
'argument only.', $this); |
|
3866
|
|
|
} |
|
3867
|
|
|
|
|
3868
|
|
|
//loop without arguments loops on the current scope |
|
3869
|
|
|
if ($res['ArgumentCount'] == 0) { |
|
3870
|
|
|
$on = '$scope->obj(\'Up\', null)->obj(\'Foo\', null)'; |
|
3871
|
|
|
} else { //loop in the normal way |
|
3872
|
|
|
$arg = $res['Arguments'][0]; |
|
3873
|
|
|
if ($arg['ArgumentMode'] == 'string') { |
|
3874
|
|
|
throw new SSTemplateParseException('Control block cant take string as argument.', $this); |
|
3875
|
|
|
} |
|
3876
|
|
|
$on = str_replace( |
|
3877
|
|
|
'$$FINAL', |
|
3878
|
|
|
'obj', |
|
3879
|
|
|
($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php'] |
|
3880
|
|
|
); |
|
3881
|
|
|
} |
|
3882
|
|
|
|
|
3883
|
|
|
return |
|
3884
|
|
|
$on . '; $scope->pushScope(); while (($key = $scope->next()) !== false) {' . PHP_EOL . |
|
3885
|
|
|
$res['Template']['php'] . PHP_EOL . |
|
3886
|
|
|
'}; $scope->popScope(); '; |
|
3887
|
|
|
} |
|
3888
|
|
|
|
|
3889
|
|
|
/** |
|
3890
|
|
|
* The closed block handler for with blocks |
|
3891
|
|
|
*/ |
|
3892
|
|
|
function ClosedBlock_Handle_With(&$res) |
|
3893
|
|
|
{ |
|
3894
|
|
|
if ($res['ArgumentCount'] != 1) { |
|
3895
|
|
|
throw new SSTemplateParseException('Either no or too many arguments in with block. Must be one ' . |
|
3896
|
|
|
'argument only.', $this); |
|
3897
|
|
|
} |
|
3898
|
|
|
|
|
3899
|
|
|
$arg = $res['Arguments'][0]; |
|
3900
|
|
|
if ($arg['ArgumentMode'] == 'string') { |
|
3901
|
|
|
throw new SSTemplateParseException('Control block cant take string as argument.', $this); |
|
3902
|
|
|
} |
|
3903
|
|
|
|
|
3904
|
|
|
$on = str_replace('$$FINAL', 'obj', ($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php']); |
|
3905
|
|
|
return |
|
3906
|
|
|
$on . '; $scope->pushScope();' . PHP_EOL . |
|
3907
|
|
|
$res['Template']['php'] . PHP_EOL . |
|
3908
|
|
|
'; $scope->popScope(); '; |
|
3909
|
|
|
} |
|
3910
|
|
|
|
|
3911
|
|
|
/* OpenBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > '%>' */ |
|
3912
|
|
|
protected $match_OpenBlock_typestack = array('OpenBlock'); |
|
3913
|
|
|
function match_OpenBlock ($stack = array()) { |
|
3914
|
|
|
$matchrule = "OpenBlock"; $result = $this->construct($matchrule, $matchrule, null); |
|
3915
|
|
|
$_645 = NULL; |
|
3916
|
|
|
do { |
|
|
|
|
|
|
3917
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3918
|
|
|
else { $_645 = FALSE; break; } |
|
3919
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3920
|
|
|
$res_636 = $result; |
|
3921
|
|
|
$pos_636 = $this->pos; |
|
3922
|
|
|
$matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos; |
|
3923
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3924
|
|
|
if ($subres !== FALSE) { |
|
3925
|
|
|
$this->store( $result, $subres ); |
|
3926
|
|
|
$result = $res_636; |
|
3927
|
|
|
$this->pos = $pos_636; |
|
3928
|
|
|
$_645 = FALSE; break; |
|
3929
|
|
|
} |
|
3930
|
|
|
else { |
|
3931
|
|
|
$result = $res_636; |
|
3932
|
|
|
$this->pos = $pos_636; |
|
3933
|
|
|
} |
|
3934
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; |
|
3935
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3936
|
|
|
if ($subres !== FALSE) { |
|
3937
|
|
|
$this->store( $result, $subres, "BlockName" ); |
|
3938
|
|
|
} |
|
3939
|
|
|
else { $_645 = FALSE; break; } |
|
3940
|
|
|
$res_642 = $result; |
|
3941
|
|
|
$pos_642 = $this->pos; |
|
3942
|
|
|
$_641 = NULL; |
|
3943
|
|
|
do { |
|
3944
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3945
|
|
|
else { $_641 = FALSE; break; } |
|
3946
|
|
|
$matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos; |
|
3947
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
3948
|
|
|
if ($subres !== FALSE) { |
|
3949
|
|
|
$this->store( $result, $subres, "BlockArguments" ); |
|
3950
|
|
|
} |
|
3951
|
|
|
else { $_641 = FALSE; break; } |
|
3952
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3953
|
|
|
else { $_641 = FALSE; break; } |
|
3954
|
|
|
$_641 = TRUE; break; |
|
3955
|
|
|
} |
|
3956
|
|
|
while(0); |
|
3957
|
|
|
if( $_641 === FALSE) { |
|
3958
|
|
|
$result = $res_642; |
|
3959
|
|
|
$this->pos = $pos_642; |
|
3960
|
|
|
unset( $res_642 ); |
|
3961
|
|
|
unset( $pos_642 ); |
|
3962
|
|
|
} |
|
3963
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3964
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
3965
|
|
|
else { $_645 = FALSE; break; } |
|
3966
|
|
|
$_645 = TRUE; break; |
|
3967
|
|
|
} |
|
3968
|
|
|
while(0); |
|
3969
|
|
|
if( $_645 === TRUE ) { return $this->finalise($result); } |
|
3970
|
|
|
if( $_645 === FALSE) { return FALSE; } |
|
3971
|
|
|
} |
|
3972
|
|
|
|
|
3973
|
|
|
|
|
3974
|
|
|
|
|
3975
|
|
|
function OpenBlock__construct(&$res) |
|
3976
|
|
|
{ |
|
3977
|
|
|
$res['ArgumentCount'] = 0; |
|
3978
|
|
|
} |
|
3979
|
|
|
|
|
3980
|
|
|
function OpenBlock_BlockArguments(&$res, $sub) |
|
3981
|
|
|
{ |
|
3982
|
|
|
if (isset($sub['Argument']['ArgumentMode'])) { |
|
3983
|
|
|
$res['Arguments'] = array($sub['Argument']); |
|
3984
|
|
|
$res['ArgumentCount'] = 1; |
|
3985
|
|
|
} else { |
|
3986
|
|
|
$res['Arguments'] = $sub['Argument']; |
|
3987
|
|
|
$res['ArgumentCount'] = count($res['Arguments']); |
|
3988
|
|
|
} |
|
3989
|
|
|
} |
|
3990
|
|
|
|
|
3991
|
|
|
function OpenBlock__finalise(&$res) |
|
3992
|
|
|
{ |
|
3993
|
|
|
$blockname = $res['BlockName']['text']; |
|
3994
|
|
|
|
|
3995
|
|
|
$method = 'OpenBlock_Handle_'.$blockname; |
|
3996
|
|
|
if (method_exists($this, $method)) { |
|
3997
|
|
|
$res['php'] = $this->$method($res); |
|
3998
|
|
|
} elseif (isset($this->openBlocks[$blockname])) { |
|
3999
|
|
|
$res['php'] = call_user_func($this->openBlocks[$blockname], $res); |
|
4000
|
|
|
} else { |
|
4001
|
|
|
throw new SSTemplateParseException('Unknown open block "'.$blockname.'" encountered. Perhaps you missed ' . |
|
4002
|
|
|
' the closing tag or have mis-spelled it?', $this); |
|
4003
|
|
|
} |
|
4004
|
|
|
} |
|
4005
|
|
|
|
|
4006
|
|
|
/** |
|
4007
|
|
|
* This is an open block handler, for the <% debug %> utility tag |
|
4008
|
|
|
*/ |
|
4009
|
|
|
function OpenBlock_Handle_Debug(&$res) |
|
4010
|
|
|
{ |
|
4011
|
|
|
if ($res['ArgumentCount'] == 0) { |
|
4012
|
|
|
return '$scope->debug();'; |
|
4013
|
|
|
} elseif ($res['ArgumentCount'] == 1) { |
|
4014
|
|
|
$arg = $res['Arguments'][0]; |
|
4015
|
|
|
|
|
4016
|
|
|
if ($arg['ArgumentMode'] == 'string') { |
|
4017
|
|
|
return 'Debug::show('.$arg['php'].');'; |
|
4018
|
|
|
} |
|
4019
|
|
|
|
|
4020
|
|
|
$php = ($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php']; |
|
4021
|
|
|
return '$val .= Debug::show('.str_replace('FINALGET!', 'cachedCall', $php).');'; |
|
4022
|
|
|
} else { |
|
4023
|
|
|
throw new SSTemplateParseException('Debug takes 0 or 1 argument only.', $this); |
|
4024
|
|
|
} |
|
4025
|
|
|
} |
|
4026
|
|
|
|
|
4027
|
|
|
/** |
|
4028
|
|
|
* This is an open block handler, for the <% base_tag %> tag |
|
4029
|
|
|
*/ |
|
4030
|
|
|
function OpenBlock_Handle_Base_tag(&$res) |
|
4031
|
|
|
{ |
|
4032
|
|
|
if ($res['ArgumentCount'] != 0) { |
|
4033
|
|
|
throw new SSTemplateParseException('Base_tag takes no arguments', $this); |
|
4034
|
|
|
} |
|
4035
|
|
|
return '$val .= \\SilverStripe\\View\\SSViewer::get_base_tag($val);'; |
|
4036
|
|
|
} |
|
4037
|
|
|
|
|
4038
|
|
|
/** |
|
4039
|
|
|
* This is an open block handler, for the <% current_page %> tag |
|
4040
|
|
|
*/ |
|
4041
|
|
|
function OpenBlock_Handle_Current_page(&$res) |
|
4042
|
|
|
{ |
|
4043
|
|
|
if ($res['ArgumentCount'] != 0) { |
|
4044
|
|
|
throw new SSTemplateParseException('Current_page takes no arguments', $this); |
|
4045
|
|
|
} |
|
4046
|
|
|
return '$val .= $_SERVER[SCRIPT_URL];'; |
|
4047
|
|
|
} |
|
4048
|
|
|
|
|
4049
|
|
|
/* MismatchedEndBlock: '<%' < 'end_' :Word > '%>' */ |
|
4050
|
|
|
protected $match_MismatchedEndBlock_typestack = array('MismatchedEndBlock'); |
|
4051
|
|
|
function match_MismatchedEndBlock ($stack = array()) { |
|
4052
|
|
|
$matchrule = "MismatchedEndBlock"; $result = $this->construct($matchrule, $matchrule, null); |
|
4053
|
|
|
$_653 = NULL; |
|
4054
|
|
|
do { |
|
|
|
|
|
|
4055
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4056
|
|
|
else { $_653 = FALSE; break; } |
|
4057
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4058
|
|
|
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4059
|
|
|
else { $_653 = FALSE; break; } |
|
4060
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; |
|
4061
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4062
|
|
|
if ($subres !== FALSE) { |
|
4063
|
|
|
$this->store( $result, $subres, "Word" ); |
|
4064
|
|
|
} |
|
4065
|
|
|
else { $_653 = FALSE; break; } |
|
4066
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4067
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4068
|
|
|
else { $_653 = FALSE; break; } |
|
4069
|
|
|
$_653 = TRUE; break; |
|
4070
|
|
|
} |
|
4071
|
|
|
while(0); |
|
4072
|
|
|
if( $_653 === TRUE ) { return $this->finalise($result); } |
|
4073
|
|
|
if( $_653 === FALSE) { return FALSE; } |
|
4074
|
|
|
} |
|
4075
|
|
|
|
|
4076
|
|
|
|
|
4077
|
|
|
|
|
4078
|
|
|
function MismatchedEndBlock__finalise(&$res) |
|
4079
|
|
|
{ |
|
4080
|
|
|
$blockname = $res['Word']['text']; |
|
4081
|
|
|
throw new SSTemplateParseException('Unexpected close tag end_' . $blockname . |
|
4082
|
|
|
' encountered. Perhaps you have mis-nested blocks, or have mis-spelled a tag?', $this); |
|
4083
|
|
|
} |
|
4084
|
|
|
|
|
4085
|
|
|
/* MalformedOpenTag: '<%' < !NotBlockTag Tag:Word !( ( [ :BlockArguments ] )? > '%>' ) */ |
|
|
|
|
|
|
4086
|
|
|
protected $match_MalformedOpenTag_typestack = array('MalformedOpenTag'); |
|
4087
|
|
|
function match_MalformedOpenTag ($stack = array()) { |
|
4088
|
|
|
$matchrule = "MalformedOpenTag"; $result = $this->construct($matchrule, $matchrule, null); |
|
4089
|
|
|
$_668 = NULL; |
|
4090
|
|
|
do { |
|
|
|
|
|
|
4091
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4092
|
|
|
else { $_668 = FALSE; break; } |
|
4093
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4094
|
|
|
$res_657 = $result; |
|
4095
|
|
|
$pos_657 = $this->pos; |
|
4096
|
|
|
$matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos; |
|
4097
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4098
|
|
|
if ($subres !== FALSE) { |
|
4099
|
|
|
$this->store( $result, $subres ); |
|
4100
|
|
|
$result = $res_657; |
|
4101
|
|
|
$this->pos = $pos_657; |
|
4102
|
|
|
$_668 = FALSE; break; |
|
4103
|
|
|
} |
|
4104
|
|
|
else { |
|
4105
|
|
|
$result = $res_657; |
|
4106
|
|
|
$this->pos = $pos_657; |
|
4107
|
|
|
} |
|
4108
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; |
|
4109
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4110
|
|
|
if ($subres !== FALSE) { |
|
4111
|
|
|
$this->store( $result, $subres, "Tag" ); |
|
4112
|
|
|
} |
|
4113
|
|
|
else { $_668 = FALSE; break; } |
|
4114
|
|
|
$res_667 = $result; |
|
4115
|
|
|
$pos_667 = $this->pos; |
|
4116
|
|
|
$_666 = NULL; |
|
4117
|
|
|
do { |
|
4118
|
|
|
$res_663 = $result; |
|
4119
|
|
|
$pos_663 = $this->pos; |
|
4120
|
|
|
$_662 = NULL; |
|
4121
|
|
|
do { |
|
4122
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4123
|
|
|
else { $_662 = FALSE; break; } |
|
4124
|
|
|
$matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos; |
|
4125
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4126
|
|
|
if ($subres !== FALSE) { |
|
4127
|
|
|
$this->store( $result, $subres, "BlockArguments" ); |
|
4128
|
|
|
} |
|
4129
|
|
|
else { $_662 = FALSE; break; } |
|
4130
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4131
|
|
|
else { $_662 = FALSE; break; } |
|
4132
|
|
|
$_662 = TRUE; break; |
|
4133
|
|
|
} |
|
4134
|
|
|
while(0); |
|
4135
|
|
|
if( $_662 === FALSE) { |
|
4136
|
|
|
$result = $res_663; |
|
4137
|
|
|
$this->pos = $pos_663; |
|
4138
|
|
|
unset( $res_663 ); |
|
4139
|
|
|
unset( $pos_663 ); |
|
4140
|
|
|
} |
|
4141
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4142
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4143
|
|
|
else { $_666 = FALSE; break; } |
|
4144
|
|
|
$_666 = TRUE; break; |
|
4145
|
|
|
} |
|
4146
|
|
|
while(0); |
|
4147
|
|
|
if( $_666 === TRUE ) { |
|
4148
|
|
|
$result = $res_667; |
|
4149
|
|
|
$this->pos = $pos_667; |
|
4150
|
|
|
$_668 = FALSE; break; |
|
4151
|
|
|
} |
|
4152
|
|
|
if( $_666 === FALSE) { |
|
4153
|
|
|
$result = $res_667; |
|
4154
|
|
|
$this->pos = $pos_667; |
|
4155
|
|
|
} |
|
4156
|
|
|
$_668 = TRUE; break; |
|
4157
|
|
|
} |
|
4158
|
|
|
while(0); |
|
4159
|
|
|
if( $_668 === TRUE ) { return $this->finalise($result); } |
|
4160
|
|
|
if( $_668 === FALSE) { return FALSE; } |
|
4161
|
|
|
} |
|
4162
|
|
|
|
|
4163
|
|
|
|
|
4164
|
|
|
|
|
4165
|
|
|
function MalformedOpenTag__finalise(&$res) |
|
4166
|
|
|
{ |
|
4167
|
|
|
$tag = $res['Tag']['text']; |
|
4168
|
|
|
throw new SSTemplateParseException("Malformed opening block tag $tag. Perhaps you have tried to use operators?", $this); |
|
4169
|
|
|
} |
|
4170
|
|
|
|
|
4171
|
|
|
/* MalformedCloseTag: '<%' < Tag:('end_' :Word ) !( > '%>' ) */ |
|
|
|
|
|
|
4172
|
|
|
protected $match_MalformedCloseTag_typestack = array('MalformedCloseTag'); |
|
4173
|
|
|
function match_MalformedCloseTag ($stack = array()) { |
|
4174
|
|
|
$matchrule = "MalformedCloseTag"; $result = $this->construct($matchrule, $matchrule, null); |
|
4175
|
|
|
$_680 = NULL; |
|
4176
|
|
|
do { |
|
|
|
|
|
|
4177
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4178
|
|
|
else { $_680 = FALSE; break; } |
|
4179
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4180
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Tag" ); |
|
4181
|
|
|
$_674 = NULL; |
|
4182
|
|
|
do { |
|
4183
|
|
|
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4184
|
|
|
else { $_674 = FALSE; break; } |
|
4185
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; |
|
4186
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4187
|
|
|
if ($subres !== FALSE) { |
|
4188
|
|
|
$this->store( $result, $subres, "Word" ); |
|
4189
|
|
|
} |
|
4190
|
|
|
else { $_674 = FALSE; break; } |
|
4191
|
|
|
$_674 = TRUE; break; |
|
4192
|
|
|
} |
|
4193
|
|
|
while(0); |
|
4194
|
|
|
if( $_674 === TRUE ) { |
|
4195
|
|
|
$subres = $result; $result = array_pop($stack); |
|
4196
|
|
|
$this->store( $result, $subres, 'Tag' ); |
|
4197
|
|
|
} |
|
4198
|
|
|
if( $_674 === FALSE) { |
|
4199
|
|
|
$result = array_pop($stack); |
|
4200
|
|
|
$_680 = FALSE; break; |
|
4201
|
|
|
} |
|
4202
|
|
|
$res_679 = $result; |
|
4203
|
|
|
$pos_679 = $this->pos; |
|
4204
|
|
|
$_678 = NULL; |
|
4205
|
|
|
do { |
|
4206
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4207
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4208
|
|
|
else { $_678 = FALSE; break; } |
|
4209
|
|
|
$_678 = TRUE; break; |
|
4210
|
|
|
} |
|
4211
|
|
|
while(0); |
|
4212
|
|
|
if( $_678 === TRUE ) { |
|
4213
|
|
|
$result = $res_679; |
|
4214
|
|
|
$this->pos = $pos_679; |
|
4215
|
|
|
$_680 = FALSE; break; |
|
4216
|
|
|
} |
|
4217
|
|
|
if( $_678 === FALSE) { |
|
4218
|
|
|
$result = $res_679; |
|
4219
|
|
|
$this->pos = $pos_679; |
|
4220
|
|
|
} |
|
4221
|
|
|
$_680 = TRUE; break; |
|
4222
|
|
|
} |
|
4223
|
|
|
while(0); |
|
4224
|
|
|
if( $_680 === TRUE ) { return $this->finalise($result); } |
|
4225
|
|
|
if( $_680 === FALSE) { return FALSE; } |
|
4226
|
|
|
} |
|
4227
|
|
|
|
|
4228
|
|
|
|
|
4229
|
|
|
|
|
4230
|
|
|
function MalformedCloseTag__finalise(&$res) |
|
4231
|
|
|
{ |
|
4232
|
|
|
$tag = $res['Tag']['text']; |
|
4233
|
|
|
throw new SSTemplateParseException("Malformed closing block tag $tag. Perhaps you have tried to pass an " . |
|
4234
|
|
|
"argument to one?", $this); |
|
4235
|
|
|
} |
|
4236
|
|
|
|
|
4237
|
|
|
/* MalformedBlock: MalformedOpenTag | MalformedCloseTag */ |
|
4238
|
|
|
protected $match_MalformedBlock_typestack = array('MalformedBlock'); |
|
4239
|
|
|
function match_MalformedBlock ($stack = array()) { |
|
4240
|
|
|
$matchrule = "MalformedBlock"; $result = $this->construct($matchrule, $matchrule, null); |
|
4241
|
|
|
$_685 = NULL; |
|
4242
|
|
|
do { |
|
|
|
|
|
|
4243
|
|
|
$res_682 = $result; |
|
4244
|
|
|
$pos_682 = $this->pos; |
|
4245
|
|
|
$matcher = 'match_'.'MalformedOpenTag'; $key = $matcher; $pos = $this->pos; |
|
4246
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4247
|
|
|
if ($subres !== FALSE) { |
|
4248
|
|
|
$this->store( $result, $subres ); |
|
4249
|
|
|
$_685 = TRUE; break; |
|
4250
|
|
|
} |
|
4251
|
|
|
$result = $res_682; |
|
4252
|
|
|
$this->pos = $pos_682; |
|
4253
|
|
|
$matcher = 'match_'.'MalformedCloseTag'; $key = $matcher; $pos = $this->pos; |
|
4254
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4255
|
|
|
if ($subres !== FALSE) { |
|
4256
|
|
|
$this->store( $result, $subres ); |
|
4257
|
|
|
$_685 = TRUE; break; |
|
4258
|
|
|
} |
|
4259
|
|
|
$result = $res_682; |
|
4260
|
|
|
$this->pos = $pos_682; |
|
4261
|
|
|
$_685 = FALSE; break; |
|
4262
|
|
|
} |
|
4263
|
|
|
while(0); |
|
4264
|
|
|
if( $_685 === TRUE ) { return $this->finalise($result); } |
|
4265
|
|
|
if( $_685 === FALSE) { return FALSE; } |
|
4266
|
|
|
} |
|
4267
|
|
|
|
|
4268
|
|
|
|
|
4269
|
|
|
|
|
4270
|
|
|
|
|
4271
|
|
|
/* Comment: "<%--" (!"--%>" /(?s)./)+ "--%>" */ |
|
|
|
|
|
|
4272
|
|
|
protected $match_Comment_typestack = array('Comment'); |
|
4273
|
|
|
function match_Comment ($stack = array()) { |
|
|
|
|
|
|
4274
|
|
|
$matchrule = "Comment"; $result = $this->construct($matchrule, $matchrule, null); |
|
4275
|
|
|
$_693 = NULL; |
|
4276
|
|
|
do { |
|
|
|
|
|
|
4277
|
|
|
if (( $subres = $this->literal( '<%--' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4278
|
|
|
else { $_693 = FALSE; break; } |
|
4279
|
|
|
$count = 0; |
|
4280
|
|
|
while (true) { |
|
4281
|
|
|
$res_691 = $result; |
|
4282
|
|
|
$pos_691 = $this->pos; |
|
4283
|
|
|
$_690 = NULL; |
|
4284
|
|
|
do { |
|
4285
|
|
|
$res_688 = $result; |
|
4286
|
|
|
$pos_688 = $this->pos; |
|
4287
|
|
|
if (( $subres = $this->literal( '--%>' ) ) !== FALSE) { |
|
4288
|
|
|
$result["text"] .= $subres; |
|
4289
|
|
|
$result = $res_688; |
|
4290
|
|
|
$this->pos = $pos_688; |
|
4291
|
|
|
$_690 = FALSE; break; |
|
4292
|
|
|
} |
|
4293
|
|
|
else { |
|
4294
|
|
|
$result = $res_688; |
|
4295
|
|
|
$this->pos = $pos_688; |
|
4296
|
|
|
} |
|
4297
|
|
|
if (( $subres = $this->rx( '/(?s)./' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4298
|
|
|
else { $_690 = FALSE; break; } |
|
4299
|
|
|
$_690 = TRUE; break; |
|
4300
|
|
|
} |
|
4301
|
|
|
while(0); |
|
4302
|
|
|
if( $_690 === FALSE) { |
|
4303
|
|
|
$result = $res_691; |
|
4304
|
|
|
$this->pos = $pos_691; |
|
4305
|
|
|
unset( $res_691 ); |
|
4306
|
|
|
unset( $pos_691 ); |
|
4307
|
|
|
break; |
|
4308
|
|
|
} |
|
4309
|
|
|
$count += 1; |
|
4310
|
|
|
} |
|
4311
|
|
|
if ($count > 0) { } |
|
|
|
|
|
|
4312
|
|
|
else { $_693 = FALSE; break; } |
|
4313
|
|
|
if (( $subres = $this->literal( '--%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
|
4314
|
|
|
else { $_693 = FALSE; break; } |
|
4315
|
|
|
$_693 = TRUE; break; |
|
4316
|
|
|
} |
|
4317
|
|
|
while(0); |
|
4318
|
|
|
if( $_693 === TRUE ) { return $this->finalise($result); } |
|
4319
|
|
|
if( $_693 === FALSE) { return FALSE; } |
|
4320
|
|
|
} |
|
4321
|
|
|
|
|
4322
|
|
|
|
|
4323
|
|
|
|
|
4324
|
|
|
function Comment__construct(&$res) |
|
4325
|
|
|
{ |
|
4326
|
|
|
$res['php'] = ''; |
|
4327
|
|
|
} |
|
4328
|
|
|
|
|
4329
|
|
|
/* TopTemplate: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock | |
|
4330
|
|
|
OpenBlock | MalformedBlock | MismatchedEndBlock | Injection | Text)+ */ |
|
4331
|
|
|
protected $match_TopTemplate_typestack = array('TopTemplate','Template'); |
|
4332
|
|
|
function match_TopTemplate ($stack = array()) { |
|
4333
|
|
|
$matchrule = "TopTemplate"; $result = $this->construct($matchrule, $matchrule, array('TemplateMatcher' => 'Template')); |
|
4334
|
|
|
$count = 0; |
|
4335
|
|
|
while (true) { |
|
4336
|
|
|
$res_749 = $result; |
|
4337
|
|
|
$pos_749 = $this->pos; |
|
4338
|
|
|
$_748 = NULL; |
|
4339
|
|
|
do { |
|
|
|
|
|
|
4340
|
|
|
$_746 = NULL; |
|
4341
|
|
|
do { |
|
4342
|
|
|
$res_695 = $result; |
|
4343
|
|
|
$pos_695 = $this->pos; |
|
4344
|
|
|
$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos; |
|
4345
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4346
|
|
|
if ($subres !== FALSE) { |
|
4347
|
|
|
$this->store( $result, $subres ); |
|
4348
|
|
|
$_746 = TRUE; break; |
|
4349
|
|
|
} |
|
4350
|
|
|
$result = $res_695; |
|
4351
|
|
|
$this->pos = $pos_695; |
|
4352
|
|
|
$_744 = NULL; |
|
4353
|
|
|
do { |
|
4354
|
|
|
$res_697 = $result; |
|
4355
|
|
|
$pos_697 = $this->pos; |
|
4356
|
|
|
$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos; |
|
4357
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4358
|
|
|
if ($subres !== FALSE) { |
|
4359
|
|
|
$this->store( $result, $subres ); |
|
4360
|
|
|
$_744 = TRUE; break; |
|
4361
|
|
|
} |
|
4362
|
|
|
$result = $res_697; |
|
4363
|
|
|
$this->pos = $pos_697; |
|
4364
|
|
|
$_742 = NULL; |
|
4365
|
|
|
do { |
|
4366
|
|
|
$res_699 = $result; |
|
4367
|
|
|
$pos_699 = $this->pos; |
|
4368
|
|
|
$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos; |
|
4369
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4370
|
|
|
if ($subres !== FALSE) { |
|
4371
|
|
|
$this->store( $result, $subres ); |
|
4372
|
|
|
$_742 = TRUE; break; |
|
4373
|
|
|
} |
|
4374
|
|
|
$result = $res_699; |
|
4375
|
|
|
$this->pos = $pos_699; |
|
4376
|
|
|
$_740 = NULL; |
|
4377
|
|
|
do { |
|
4378
|
|
|
$res_701 = $result; |
|
4379
|
|
|
$pos_701 = $this->pos; |
|
4380
|
|
|
$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos; |
|
4381
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4382
|
|
|
if ($subres !== FALSE) { |
|
4383
|
|
|
$this->store( $result, $subres ); |
|
4384
|
|
|
$_740 = TRUE; break; |
|
4385
|
|
|
} |
|
4386
|
|
|
$result = $res_701; |
|
4387
|
|
|
$this->pos = $pos_701; |
|
4388
|
|
|
$_738 = NULL; |
|
4389
|
|
|
do { |
|
4390
|
|
|
$res_703 = $result; |
|
4391
|
|
|
$pos_703 = $this->pos; |
|
4392
|
|
|
$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos; |
|
4393
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4394
|
|
|
if ($subres !== FALSE) { |
|
4395
|
|
|
$this->store( $result, $subres ); |
|
4396
|
|
|
$_738 = TRUE; break; |
|
4397
|
|
|
} |
|
4398
|
|
|
$result = $res_703; |
|
4399
|
|
|
$this->pos = $pos_703; |
|
4400
|
|
|
$_736 = NULL; |
|
4401
|
|
|
do { |
|
4402
|
|
|
$res_705 = $result; |
|
4403
|
|
|
$pos_705 = $this->pos; |
|
4404
|
|
|
$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos; |
|
4405
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4406
|
|
|
if ($subres !== FALSE) { |
|
4407
|
|
|
$this->store( $result, $subres ); |
|
4408
|
|
|
$_736 = TRUE; break; |
|
4409
|
|
|
} |
|
4410
|
|
|
$result = $res_705; |
|
4411
|
|
|
$this->pos = $pos_705; |
|
4412
|
|
|
$_734 = NULL; |
|
4413
|
|
|
do { |
|
4414
|
|
|
$res_707 = $result; |
|
4415
|
|
|
$pos_707 = $this->pos; |
|
4416
|
|
|
$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos; |
|
4417
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4418
|
|
|
if ($subres !== FALSE) { |
|
4419
|
|
|
$this->store( $result, $subres ); |
|
4420
|
|
|
$_734 = TRUE; break; |
|
4421
|
|
|
} |
|
4422
|
|
|
$result = $res_707; |
|
4423
|
|
|
$this->pos = $pos_707; |
|
4424
|
|
|
$_732 = NULL; |
|
4425
|
|
|
do { |
|
4426
|
|
|
$res_709 = $result; |
|
4427
|
|
|
$pos_709 = $this->pos; |
|
4428
|
|
|
$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos; |
|
4429
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4430
|
|
|
if ($subres !== FALSE) { |
|
4431
|
|
|
$this->store( $result, $subres ); |
|
4432
|
|
|
$_732 = TRUE; break; |
|
4433
|
|
|
} |
|
4434
|
|
|
$result = $res_709; |
|
4435
|
|
|
$this->pos = $pos_709; |
|
4436
|
|
|
$_730 = NULL; |
|
4437
|
|
|
do { |
|
4438
|
|
|
$res_711 = $result; |
|
4439
|
|
|
$pos_711 = $this->pos; |
|
4440
|
|
|
$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos; |
|
4441
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4442
|
|
|
if ($subres !== FALSE) { |
|
4443
|
|
|
$this->store( $result, $subres ); |
|
4444
|
|
|
$_730 = TRUE; break; |
|
4445
|
|
|
} |
|
4446
|
|
|
$result = $res_711; |
|
4447
|
|
|
$this->pos = $pos_711; |
|
4448
|
|
|
$_728 = NULL; |
|
4449
|
|
|
do { |
|
4450
|
|
|
$res_713 = $result; |
|
4451
|
|
|
$pos_713 = $this->pos; |
|
4452
|
|
|
$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos; |
|
4453
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4454
|
|
|
if ($subres !== FALSE) { |
|
4455
|
|
|
$this->store( $result, $subres ); |
|
4456
|
|
|
$_728 = TRUE; break; |
|
4457
|
|
|
} |
|
4458
|
|
|
$result = $res_713; |
|
4459
|
|
|
$this->pos = $pos_713; |
|
4460
|
|
|
$_726 = NULL; |
|
4461
|
|
|
do { |
|
4462
|
|
|
$res_715 = $result; |
|
4463
|
|
|
$pos_715 = $this->pos; |
|
4464
|
|
|
$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos; |
|
4465
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4466
|
|
|
if ($subres !== FALSE) { |
|
4467
|
|
|
$this->store( $result, $subres ); |
|
4468
|
|
|
$_726 = TRUE; break; |
|
4469
|
|
|
} |
|
4470
|
|
|
$result = $res_715; |
|
4471
|
|
|
$this->pos = $pos_715; |
|
4472
|
|
|
$_724 = NULL; |
|
4473
|
|
|
do { |
|
4474
|
|
|
$res_717 = $result; |
|
4475
|
|
|
$pos_717 = $this->pos; |
|
4476
|
|
|
$matcher = 'match_'.'MismatchedEndBlock'; $key = $matcher; $pos = $this->pos; |
|
4477
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4478
|
|
|
if ($subres !== FALSE) { |
|
4479
|
|
|
$this->store( $result, $subres ); |
|
4480
|
|
|
$_724 = TRUE; break; |
|
4481
|
|
|
} |
|
4482
|
|
|
$result = $res_717; |
|
4483
|
|
|
$this->pos = $pos_717; |
|
4484
|
|
|
$_722 = NULL; |
|
4485
|
|
|
do { |
|
4486
|
|
|
$res_719 = $result; |
|
4487
|
|
|
$pos_719 = $this->pos; |
|
4488
|
|
|
$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos; |
|
4489
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4490
|
|
|
if ($subres !== FALSE) { |
|
4491
|
|
|
$this->store( $result, $subres ); |
|
4492
|
|
|
$_722 = TRUE; break; |
|
4493
|
|
|
} |
|
4494
|
|
|
$result = $res_719; |
|
4495
|
|
|
$this->pos = $pos_719; |
|
4496
|
|
|
$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos; |
|
4497
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
|
4498
|
|
|
if ($subres !== FALSE) { |
|
4499
|
|
|
$this->store( $result, $subres ); |
|
4500
|
|
|
$_722 = TRUE; break; |
|
4501
|
|
|
} |
|
4502
|
|
|
$result = $res_719; |
|
4503
|
|
|
$this->pos = $pos_719; |
|
4504
|
|
|
$_722 = FALSE; break; |
|
4505
|
|
|
} |
|
4506
|
|
|
while(0); |
|
4507
|
|
|
if( $_722 === TRUE ) { |
|
4508
|
|
|
$_724 = TRUE; break; |
|
4509
|
|
|
} |
|
4510
|
|
|
$result = $res_717; |
|
4511
|
|
|
$this->pos = $pos_717; |
|
4512
|
|
|
$_724 = FALSE; break; |
|
4513
|
|
|
} |
|
4514
|
|
|
while(0); |
|
4515
|
|
|
if( $_724 === TRUE ) { $_726 = TRUE; break; } |
|
4516
|
|
|
$result = $res_715; |
|
4517
|
|
|
$this->pos = $pos_715; |
|
4518
|
|
|
$_726 = FALSE; break; |
|
4519
|
|
|
} |
|
4520
|
|
|
while(0); |
|
4521
|
|
|
if( $_726 === TRUE ) { $_728 = TRUE; break; } |
|
4522
|
|
|
$result = $res_713; |
|
4523
|
|
|
$this->pos = $pos_713; |
|
4524
|
|
|
$_728 = FALSE; break; |
|
4525
|
|
|
} |
|
4526
|
|
|
while(0); |
|
4527
|
|
|
if( $_728 === TRUE ) { $_730 = TRUE; break; } |
|
4528
|
|
|
$result = $res_711; |
|
4529
|
|
|
$this->pos = $pos_711; |
|
4530
|
|
|
$_730 = FALSE; break; |
|
4531
|
|
|
} |
|
4532
|
|
|
while(0); |
|
4533
|
|
|
if( $_730 === TRUE ) { $_732 = TRUE; break; } |
|
4534
|
|
|
$result = $res_709; |
|
4535
|
|
|
$this->pos = $pos_709; |
|
4536
|
|
|
$_732 = FALSE; break; |
|
4537
|
|
|
} |
|
4538
|
|
|
while(0); |
|
4539
|
|
|
if( $_732 === TRUE ) { $_734 = TRUE; break; } |
|
4540
|
|
|
$result = $res_707; |
|
4541
|
|
|
$this->pos = $pos_707; |
|
4542
|
|
|
$_734 = FALSE; break; |
|
4543
|
|
|
} |
|
4544
|
|
|
while(0); |
|
4545
|
|
|
if( $_734 === TRUE ) { $_736 = TRUE; break; } |
|
4546
|
|
|
$result = $res_705; |
|
4547
|
|
|
$this->pos = $pos_705; |
|
4548
|
|
|
$_736 = FALSE; break; |
|
4549
|
|
|
} |
|
4550
|
|
|
while(0); |
|
4551
|
|
|
if( $_736 === TRUE ) { $_738 = TRUE; break; } |
|
4552
|
|
|
$result = $res_703; |
|
4553
|
|
|
$this->pos = $pos_703; |
|
4554
|
|
|
$_738 = FALSE; break; |
|
4555
|
|
|
} |
|
4556
|
|
|
while(0); |
|
4557
|
|
|
if( $_738 === TRUE ) { $_740 = TRUE; break; } |
|
4558
|
|
|
$result = $res_701; |
|
4559
|
|
|
$this->pos = $pos_701; |
|
4560
|
|
|
$_740 = FALSE; break; |
|
4561
|
|
|
} |
|
4562
|
|
|
while(0); |
|
4563
|
|
|
if( $_740 === TRUE ) { $_742 = TRUE; break; } |
|
4564
|
|
|
$result = $res_699; |
|
4565
|
|
|
$this->pos = $pos_699; |
|
4566
|
|
|
$_742 = FALSE; break; |
|
4567
|
|
|
} |
|
4568
|
|
|
while(0); |
|
4569
|
|
|
if( $_742 === TRUE ) { $_744 = TRUE; break; } |
|
4570
|
|
|
$result = $res_697; |
|
4571
|
|
|
$this->pos = $pos_697; |
|
4572
|
|
|
$_744 = FALSE; break; |
|
4573
|
|
|
} |
|
4574
|
|
|
while(0); |
|
4575
|
|
|
if( $_744 === TRUE ) { $_746 = TRUE; break; } |
|
4576
|
|
|
$result = $res_695; |
|
4577
|
|
|
$this->pos = $pos_695; |
|
4578
|
|
|
$_746 = FALSE; break; |
|
4579
|
|
|
} |
|
4580
|
|
|
while(0); |
|
4581
|
|
|
if( $_746 === FALSE) { $_748 = FALSE; break; } |
|
4582
|
|
|
$_748 = TRUE; break; |
|
4583
|
|
|
} |
|
4584
|
|
|
while(0); |
|
4585
|
|
|
if( $_748 === FALSE) { |
|
4586
|
|
|
$result = $res_749; |
|
4587
|
|
|
$this->pos = $pos_749; |
|
4588
|
|
|
unset( $res_749 ); |
|
4589
|
|
|
unset( $pos_749 ); |
|
4590
|
|
|
break; |
|
4591
|
|
|
} |
|
4592
|
|
|
$count += 1; |
|
4593
|
|
|
} |
|
4594
|
|
|
if ($count > 0) { return $this->finalise($result); } |
|
4595
|
|
|
else { return FALSE; } |
|
4596
|
|
|
} |
|
4597
|
|
|
|
|
4598
|
|
|
|
|
4599
|
|
|
|
|
4600
|
|
|
|
|
4601
|
|
|
/** |
|
4602
|
|
|
* The TopTemplate also includes the opening stanza to start off the template |
|
4603
|
|
|
*/ |
|
4604
|
|
|
function TopTemplate__construct(&$res) |
|
4605
|
|
|
{ |
|
4606
|
|
|
$res['php'] = "<?php" . PHP_EOL; |
|
4607
|
|
|
} |
|
4608
|
|
|
|
|
4609
|
|
|
/* Text: ( |
|
|
|
|
|
|
4610
|
|
|
/ [^<${\\]+ / | |
|
4611
|
|
|
/ (\\.) / | |
|
4612
|
|
|
'<' !'%' | |
|
4613
|
|
|
'$' !(/[A-Za-z_]/) | |
|
4614
|
|
|
'{' !'$' | |
|
4615
|
|
|
'{$' !(/[A-Za-z_]/) |
|
4616
|
|
|
)+ */ |
|
4617
|
|
|
protected $match_Text_typestack = array('Text'); |
|
4618
|
|
|
function match_Text ($stack = array()) { |
|
|
|
|
|
|
4619
|
|
|
$matchrule = "Text"; $result = $this->construct($matchrule, $matchrule, null); |
|
4620
|
|
|
$count = 0; |
|
4621
|
|
|
while (true) { |
|
4622
|
|
|
$res_788 = $result; |
|
4623
|
|
|
$pos_788 = $this->pos; |
|
4624
|
|
|
$_787 = NULL; |
|
4625
|
|
|
do { |
|
|
|
|
|
|
4626
|
|
|
$_785 = NULL; |
|
4627
|
|
|
do { |
|
4628
|
|
|
$res_750 = $result; |
|
4629
|
|
|
$pos_750 = $this->pos; |
|
4630
|
|
|
if (( $subres = $this->rx( '/ [^<${\\\\]+ /' ) ) !== FALSE) { |
|
4631
|
|
|
$result["text"] .= $subres; |
|
4632
|
|
|
$_785 = TRUE; break; |
|
4633
|
|
|
} |
|
4634
|
|
|
$result = $res_750; |
|
4635
|
|
|
$this->pos = $pos_750; |
|
4636
|
|
|
$_783 = NULL; |
|
4637
|
|
|
do { |
|
4638
|
|
|
$res_752 = $result; |
|
4639
|
|
|
$pos_752 = $this->pos; |
|
4640
|
|
|
if (( $subres = $this->rx( '/ (\\\\.) /' ) ) !== FALSE) { |
|
4641
|
|
|
$result["text"] .= $subres; |
|
4642
|
|
|
$_783 = TRUE; break; |
|
4643
|
|
|
} |
|
4644
|
|
|
$result = $res_752; |
|
4645
|
|
|
$this->pos = $pos_752; |
|
4646
|
|
|
$_781 = NULL; |
|
4647
|
|
|
do { |
|
4648
|
|
|
$res_754 = $result; |
|
4649
|
|
|
$pos_754 = $this->pos; |
|
4650
|
|
|
$_757 = NULL; |
|
4651
|
|
|
do { |
|
4652
|
|
|
if (substr($this->string,$this->pos,1) == '<') { |
|
4653
|
|
|
$this->pos += 1; |
|
4654
|
|
|
$result["text"] .= '<'; |
|
4655
|
|
|
} |
|
4656
|
|
|
else { $_757 = FALSE; break; } |
|
4657
|
|
|
$res_756 = $result; |
|
4658
|
|
|
$pos_756 = $this->pos; |
|
4659
|
|
|
if (substr($this->string,$this->pos,1) == '%') { |
|
4660
|
|
|
$this->pos += 1; |
|
4661
|
|
|
$result["text"] .= '%'; |
|
4662
|
|
|
$result = $res_756; |
|
4663
|
|
|
$this->pos = $pos_756; |
|
4664
|
|
|
$_757 = FALSE; break; |
|
4665
|
|
|
} |
|
4666
|
|
|
else { |
|
4667
|
|
|
$result = $res_756; |
|
4668
|
|
|
$this->pos = $pos_756; |
|
4669
|
|
|
} |
|
4670
|
|
|
$_757 = TRUE; break; |
|
4671
|
|
|
} |
|
4672
|
|
|
while(0); |
|
4673
|
|
|
if( $_757 === TRUE ) { $_781 = TRUE; break; } |
|
4674
|
|
|
$result = $res_754; |
|
4675
|
|
|
$this->pos = $pos_754; |
|
4676
|
|
|
$_779 = NULL; |
|
4677
|
|
|
do { |
|
4678
|
|
|
$res_759 = $result; |
|
4679
|
|
|
$pos_759 = $this->pos; |
|
4680
|
|
|
$_764 = NULL; |
|
4681
|
|
|
do { |
|
4682
|
|
|
if (substr($this->string,$this->pos,1) == '$') { |
|
4683
|
|
|
$this->pos += 1; |
|
4684
|
|
|
$result["text"] .= '$'; |
|
4685
|
|
|
} |
|
4686
|
|
|
else { $_764 = FALSE; break; } |
|
4687
|
|
|
$res_763 = $result; |
|
4688
|
|
|
$pos_763 = $this->pos; |
|
4689
|
|
|
$_762 = NULL; |
|
4690
|
|
|
do { |
|
4691
|
|
|
if (( $subres = $this->rx( '/[A-Za-z_]/' ) ) !== FALSE) { |
|
4692
|
|
|
$result["text"] .= $subres; |
|
4693
|
|
|
} |
|
4694
|
|
|
else { $_762 = FALSE; break; } |
|
4695
|
|
|
$_762 = TRUE; break; |
|
4696
|
|
|
} |
|
4697
|
|
|
while(0); |
|
4698
|
|
|
if( $_762 === TRUE ) { |
|
4699
|
|
|
$result = $res_763; |
|
4700
|
|
|
$this->pos = $pos_763; |
|
4701
|
|
|
$_764 = FALSE; break; |
|
4702
|
|
|
} |
|
4703
|
|
|
if( $_762 === FALSE) { |
|
4704
|
|
|
$result = $res_763; |
|
4705
|
|
|
$this->pos = $pos_763; |
|
4706
|
|
|
} |
|
4707
|
|
|
$_764 = TRUE; break; |
|
4708
|
|
|
} |
|
4709
|
|
|
while(0); |
|
4710
|
|
|
if( $_764 === TRUE ) { $_779 = TRUE; break; } |
|
4711
|
|
|
$result = $res_759; |
|
4712
|
|
|
$this->pos = $pos_759; |
|
4713
|
|
|
$_777 = NULL; |
|
4714
|
|
|
do { |
|
4715
|
|
|
$res_766 = $result; |
|
4716
|
|
|
$pos_766 = $this->pos; |
|
4717
|
|
|
$_769 = NULL; |
|
4718
|
|
|
do { |
|
4719
|
|
|
if (substr($this->string,$this->pos,1) == '{') { |
|
4720
|
|
|
$this->pos += 1; |
|
4721
|
|
|
$result["text"] .= '{'; |
|
4722
|
|
|
} |
|
4723
|
|
|
else { $_769 = FALSE; break; } |
|
4724
|
|
|
$res_768 = $result; |
|
4725
|
|
|
$pos_768 = $this->pos; |
|
4726
|
|
|
if (substr($this->string,$this->pos,1) == '$') { |
|
4727
|
|
|
$this->pos += 1; |
|
4728
|
|
|
$result["text"] .= '$'; |
|
4729
|
|
|
$result = $res_768; |
|
4730
|
|
|
$this->pos = $pos_768; |
|
4731
|
|
|
$_769 = FALSE; break; |
|
4732
|
|
|
} |
|
4733
|
|
|
else { |
|
4734
|
|
|
$result = $res_768; |
|
4735
|
|
|
$this->pos = $pos_768; |
|
4736
|
|
|
} |
|
4737
|
|
|
$_769 = TRUE; break; |
|
4738
|
|
|
} |
|
4739
|
|
|
while(0); |
|
4740
|
|
|
if( $_769 === TRUE ) { $_777 = TRUE; break; } |
|
4741
|
|
|
$result = $res_766; |
|
4742
|
|
|
$this->pos = $pos_766; |
|
4743
|
|
|
$_775 = NULL; |
|
4744
|
|
|
do { |
|
4745
|
|
|
if (( $subres = $this->literal( '{$' ) ) !== FALSE) { |
|
4746
|
|
|
$result["text"] .= $subres; |
|
4747
|
|
|
} |
|
4748
|
|
|
else { $_775 = FALSE; break; } |
|
4749
|
|
|
$res_774 = $result; |
|
4750
|
|
|
$pos_774 = $this->pos; |
|
4751
|
|
|
$_773 = NULL; |
|
4752
|
|
|
do { |
|
4753
|
|
|
if (( $subres = $this->rx( '/[A-Za-z_]/' ) ) !== FALSE) { |
|
4754
|
|
|
$result["text"] .= $subres; |
|
4755
|
|
|
} |
|
4756
|
|
|
else { $_773 = FALSE; break; } |
|
4757
|
|
|
$_773 = TRUE; break; |
|
4758
|
|
|
} |
|
4759
|
|
|
while(0); |
|
4760
|
|
|
if( $_773 === TRUE ) { |
|
4761
|
|
|
$result = $res_774; |
|
4762
|
|
|
$this->pos = $pos_774; |
|
4763
|
|
|
$_775 = FALSE; break; |
|
4764
|
|
|
} |
|
4765
|
|
|
if( $_773 === FALSE) { |
|
4766
|
|
|
$result = $res_774; |
|
4767
|
|
|
$this->pos = $pos_774; |
|
4768
|
|
|
} |
|
4769
|
|
|
$_775 = TRUE; break; |
|
4770
|
|
|
} |
|
4771
|
|
|
while(0); |
|
4772
|
|
|
if( $_775 === TRUE ) { $_777 = TRUE; break; } |
|
4773
|
|
|
$result = $res_766; |
|
4774
|
|
|
$this->pos = $pos_766; |
|
4775
|
|
|
$_777 = FALSE; break; |
|
4776
|
|
|
} |
|
4777
|
|
|
while(0); |
|
4778
|
|
|
if( $_777 === TRUE ) { $_779 = TRUE; break; } |
|
4779
|
|
|
$result = $res_759; |
|
4780
|
|
|
$this->pos = $pos_759; |
|
4781
|
|
|
$_779 = FALSE; break; |
|
4782
|
|
|
} |
|
4783
|
|
|
while(0); |
|
4784
|
|
|
if( $_779 === TRUE ) { $_781 = TRUE; break; } |
|
4785
|
|
|
$result = $res_754; |
|
4786
|
|
|
$this->pos = $pos_754; |
|
4787
|
|
|
$_781 = FALSE; break; |
|
4788
|
|
|
} |
|
4789
|
|
|
while(0); |
|
4790
|
|
|
if( $_781 === TRUE ) { $_783 = TRUE; break; } |
|
4791
|
|
|
$result = $res_752; |
|
4792
|
|
|
$this->pos = $pos_752; |
|
4793
|
|
|
$_783 = FALSE; break; |
|
4794
|
|
|
} |
|
4795
|
|
|
while(0); |
|
4796
|
|
|
if( $_783 === TRUE ) { $_785 = TRUE; break; } |
|
4797
|
|
|
$result = $res_750; |
|
4798
|
|
|
$this->pos = $pos_750; |
|
4799
|
|
|
$_785 = FALSE; break; |
|
4800
|
|
|
} |
|
4801
|
|
|
while(0); |
|
4802
|
|
|
if( $_785 === FALSE) { $_787 = FALSE; break; } |
|
4803
|
|
|
$_787 = TRUE; break; |
|
4804
|
|
|
} |
|
4805
|
|
|
while(0); |
|
4806
|
|
|
if( $_787 === FALSE) { |
|
4807
|
|
|
$result = $res_788; |
|
4808
|
|
|
$this->pos = $pos_788; |
|
4809
|
|
|
unset( $res_788 ); |
|
4810
|
|
|
unset( $pos_788 ); |
|
4811
|
|
|
break; |
|
4812
|
|
|
} |
|
4813
|
|
|
$count += 1; |
|
4814
|
|
|
} |
|
4815
|
|
|
if ($count > 0) { return $this->finalise($result); } |
|
4816
|
|
|
else { return FALSE; } |
|
4817
|
|
|
} |
|
4818
|
|
|
|
|
4819
|
|
|
|
|
4820
|
|
|
|
|
4821
|
|
|
|
|
4822
|
|
|
/** |
|
4823
|
|
|
* We convert text |
|
4824
|
|
|
*/ |
|
4825
|
|
|
function Text__finalise(&$res) |
|
4826
|
|
|
{ |
|
4827
|
|
|
$text = $res['text']; |
|
4828
|
|
|
|
|
4829
|
|
|
// Unescape any escaped characters in the text, then put back escapes for any single quotes and backslashes |
|
4830
|
|
|
$text = stripslashes($text); |
|
4831
|
|
|
$text = addcslashes($text, '\'\\'); |
|
4832
|
|
|
|
|
4833
|
|
|
// TODO: This is pretty ugly & gets applied on all files not just html. I wonder if we can make this |
|
4834
|
|
|
// non-dynamically calculated |
|
4835
|
|
|
$code = <<<'EOC' |
|
4836
|
|
|
(\SilverStripe\View\SSViewer::config()->get('rewrite_hash_links') |
|
4837
|
|
|
? \SilverStripe\Core\Convert::raw2att( preg_replace("/^(\\/)+/", "/", $_SERVER['REQUEST_URI'] ) ) |
|
4838
|
|
|
: "") |
|
4839
|
|
|
EOC; |
|
4840
|
|
|
// Because preg_replace replacement requires escaped slashes, addcslashes here |
|
4841
|
|
|
$text = preg_replace( |
|
4842
|
|
|
'/(<a[^>]+href *= *)"#/i', |
|
4843
|
|
|
'\\1"\' . ' . addcslashes($code, '\\') . ' . \'#', |
|
4844
|
|
|
$text |
|
4845
|
|
|
); |
|
4846
|
|
|
|
|
4847
|
|
|
$res['php'] .= '$val .= \'' . $text . '\';' . PHP_EOL; |
|
4848
|
|
|
} |
|
4849
|
|
|
|
|
4850
|
|
|
/****************** |
|
4851
|
|
|
* Here ends the parser itself. Below are utility methods to use the parser |
|
4852
|
|
|
*/ |
|
4853
|
|
|
|
|
4854
|
|
|
/** |
|
4855
|
|
|
* Compiles some passed template source code into the php code that will execute as per the template source. |
|
4856
|
|
|
* |
|
4857
|
|
|
* @throws SSTemplateParseException |
|
4858
|
|
|
* @param string $string The source of the template |
|
4859
|
|
|
* @param string $templateName The name of the template, normally the filename the template source was loaded from |
|
4860
|
|
|
* @param bool $includeDebuggingComments True is debugging comments should be included in the output |
|
4861
|
|
|
* @param bool $topTemplate True if this is a top template, false if it's just a template |
|
4862
|
|
|
* @return mixed|string The php that, when executed (via include or exec) will behave as per the template source |
|
4863
|
|
|
*/ |
|
4864
|
|
|
public function compileString($string, $templateName = "", $includeDebuggingComments = false, $topTemplate = true) |
|
4865
|
|
|
{ |
|
4866
|
|
|
if (!trim($string)) { |
|
4867
|
|
|
$code = ''; |
|
4868
|
|
|
} else { |
|
4869
|
|
|
parent::__construct($string); |
|
|
|
|
|
|
4870
|
|
|
|
|
4871
|
|
|
$this->includeDebuggingComments = $includeDebuggingComments; |
|
4872
|
|
|
|
|
4873
|
|
|
// Ignore UTF8 BOM at begining of string. TODO: Confirm this is needed, make sure SSViewer handles UTF |
|
4874
|
|
|
// (and other encodings) properly |
|
4875
|
|
|
if (substr($string, 0, 3) == pack("CCC", 0xef, 0xbb, 0xbf)) { |
|
4876
|
|
|
$this->pos = 3; |
|
4877
|
|
|
} |
|
4878
|
|
|
|
|
4879
|
|
|
// Match the source against the parser |
|
4880
|
|
|
if ($topTemplate) { |
|
4881
|
|
|
$result = $this->match_TopTemplate(); |
|
4882
|
|
|
} else { |
|
4883
|
|
|
$result = $this->match_Template(); |
|
4884
|
|
|
} |
|
4885
|
|
|
if (!$result) { |
|
4886
|
|
|
throw new SSTemplateParseException('Unexpected problem parsing template', $this); |
|
4887
|
|
|
} |
|
4888
|
|
|
|
|
4889
|
|
|
// Get the result |
|
4890
|
|
|
$code = $result['php']; |
|
4891
|
|
|
} |
|
4892
|
|
|
|
|
4893
|
|
|
// Include top level debugging comments if desired |
|
4894
|
|
|
if ($includeDebuggingComments && $templateName && stripos($code, "<?xml") === false) { |
|
4895
|
|
|
$code = $this->includeDebuggingComments($code, $templateName); |
|
4896
|
|
|
} |
|
4897
|
|
|
|
|
4898
|
|
|
return $code; |
|
4899
|
|
|
} |
|
4900
|
|
|
|
|
4901
|
|
|
/** |
|
4902
|
|
|
* @param string $code |
|
4903
|
|
|
* @return string $code |
|
4904
|
|
|
*/ |
|
4905
|
|
|
protected function includeDebuggingComments($code, $templateName) |
|
4906
|
|
|
{ |
|
4907
|
|
|
// If this template contains a doctype, put it right after it, |
|
4908
|
|
|
// if not, put it after the <html> tag to avoid IE glitches |
|
4909
|
|
|
if (stripos($code, "<!doctype") !== false) { |
|
4910
|
|
|
$code = preg_replace('/(<!doctype[^>]*("[^"]")*[^>]*>)/im', "$1\r\n<!-- template $templateName -->", $code); |
|
4911
|
|
|
$code .= "\r\n" . '$val .= \'<!-- end template ' . $templateName . ' -->\';'; |
|
4912
|
|
|
} elseif (stripos($code, "<html") !== false) { |
|
4913
|
|
|
$code = preg_replace_callback('/(.*)(<html[^>]*>)(.*)/i', function ($matches) use ($templateName) { |
|
4914
|
|
|
if (stripos($matches[3], '<!--') === false && stripos($matches[3], '-->') !== false) { |
|
4915
|
|
|
// after this <html> tag there is a comment close but no comment has been opened |
|
4916
|
|
|
// this most likely means that this <html> tag is inside a comment |
|
4917
|
|
|
// we should not add a comment inside a comment (invalid html) |
|
4918
|
|
|
// lets append it at the end of the comment |
|
4919
|
|
|
// an example case for this is the html5boilerplate: <!--[if IE]><html class="ie"><![endif]--> |
|
4920
|
|
|
return $matches[0]; |
|
4921
|
|
|
} else { |
|
4922
|
|
|
// all other cases, add the comment and return it |
|
4923
|
|
|
return "{$matches[1]}{$matches[2]}<!-- template $templateName -->{$matches[3]}"; |
|
4924
|
|
|
} |
|
4925
|
|
|
}, $code); |
|
4926
|
|
|
$code = preg_replace('/(<\/html[^>]*>)/i', "<!-- end template $templateName -->$1", $code); |
|
4927
|
|
|
} else { |
|
4928
|
|
|
$code = str_replace('<?php' . PHP_EOL, '<?php' . PHP_EOL . '$val .= \'<!-- template ' . $templateName . |
|
4929
|
|
|
' -->\';' . "\r\n", $code); |
|
4930
|
|
|
$code .= "\r\n" . '$val .= \'<!-- end template ' . $templateName . ' -->\';'; |
|
4931
|
|
|
} |
|
4932
|
|
|
return $code; |
|
4933
|
|
|
} |
|
4934
|
|
|
|
|
4935
|
|
|
/** |
|
4936
|
|
|
* Compiles some file that contains template source code, and returns the php code that will execute as per that |
|
4937
|
|
|
* source |
|
4938
|
|
|
* |
|
4939
|
|
|
* @static |
|
4940
|
|
|
* @param $template - A file path that contains template source code |
|
4941
|
|
|
* @return mixed|string - The php that, when executed (via include or exec) will behave as per the template source |
|
4942
|
|
|
*/ |
|
4943
|
|
|
public function compileFile($template) |
|
4944
|
|
|
{ |
|
4945
|
|
|
return $this->compileString(file_get_contents($template), $template); |
|
4946
|
|
|
} |
|
4947
|
|
|
} |
|
4948
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.