2011-02-09 05:31:16 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
WARNING: This file has been machine generated. Do not edit it, or your changes will be overwritten next time it is compiled.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// We want this to work when run by hand too
|
|
|
|
if (defined(THIRDPARTY_PATH)) {
|
2011-12-04 12:54:07 +01:00
|
|
|
require_once(THIRDPARTY_PATH . '/php-peg/Parser.php');
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$base = dirname(__FILE__);
|
2011-12-04 12:54:07 +01:00
|
|
|
require_once($base.'/../thirdparty/php-peg/Parser.php');
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-09-26 23:34:00 +02:00
|
|
|
* This is the exception raised when failing to parse a template. Note that we don't currently do any static analysis,
|
|
|
|
* so we can't know if the template will run, just if it's malformed. It also won't catch mistakes that still look
|
|
|
|
* valid.
|
|
|
|
*/
|
2011-02-09 05:31:16 +01:00
|
|
|
class SSTemplateParseException extends Exception {
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function __construct($message, $parser) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$prior = substr($parser->string, 0, $parser->pos);
|
|
|
|
|
|
|
|
preg_match_all('/\r\n|\r|\n/', $prior, $matches);
|
|
|
|
$line = count($matches[0])+1;
|
|
|
|
|
|
|
|
parent::__construct("Parse error in template on line $line. Error was: $message");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-09-26 23:34:00 +02:00
|
|
|
* This is the parser for the SilverStripe template language. It gets called on a string and uses a php-peg parser
|
|
|
|
* to match that string against the language structure, building up the PHP code to execute that structure as it
|
|
|
|
* parses
|
|
|
|
*
|
|
|
|
* The $result array that is built up as part of the parsing (see thirdparty/php-peg/README.md for more on how
|
|
|
|
* parsers build results) has one special member, 'php', which contains the php equivalent of that part of the
|
|
|
|
* template tree.
|
|
|
|
*
|
|
|
|
* Some match rules generate alternate php, or other variations, so check the per-match documentation too.
|
|
|
|
*
|
|
|
|
* Terms used:
|
|
|
|
*
|
|
|
|
* Marked: A string or lookup in the template that has been explictly marked as such - lookups by prepending with
|
|
|
|
* "$" (like $Foo.Bar), strings by wrapping with single or double quotes ('Foo' or "Foo")
|
|
|
|
*
|
|
|
|
* Bare: The opposite of marked. An argument that has to has it's type inferred by usage and 2.4 defaults.
|
|
|
|
*
|
|
|
|
* Example of using a bare argument for a loop block: <% loop Foo %>
|
|
|
|
*
|
|
|
|
* Block: One of two SS template structures. The special characters "<%" and "%>" are used to wrap the opening and
|
|
|
|
* (required or forbidden depending on which block exactly) closing block marks.
|
|
|
|
*
|
|
|
|
* Open Block: An SS template block that doesn't wrap any content or have a closing end tag (in fact, a closing end
|
|
|
|
* tag is forbidden)
|
|
|
|
*
|
|
|
|
* Closed Block: An SS template block that wraps content, and requires a counterpart <% end_blockname %> tag
|
|
|
|
*
|
|
|
|
* Angle Bracket: angle brackets "<" and ">" are used to eat whitespace between template elements
|
|
|
|
* N: eats white space including newlines (using in legacy _t support)
|
|
|
|
*/
|
2011-02-09 05:31:16 +01:00
|
|
|
class SSTemplateParser extends Parser {
|
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
/**
|
|
|
|
* @var bool - Set true by SSTemplateParser::compileString if the template should include comments intended
|
|
|
|
* for debugging (template source, included files, etc)
|
|
|
|
*/
|
2011-02-09 05:31:16 +01:00
|
|
|
protected $includeDebuggingComments = false;
|
|
|
|
|
2011-02-28 04:12:41 +01:00
|
|
|
/**
|
|
|
|
* Override the function that constructs the result arrays to also prepare a 'php' item in the array
|
|
|
|
*/
|
2012-09-26 23:34:00 +02:00
|
|
|
function construct($matchrule, $name, $arguments = null) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$res = parent::construct($matchrule, $name, $arguments);
|
|
|
|
if (!isset($res['php'])) $res['php'] = '';
|
|
|
|
return $res;
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
/* Template: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock |
|
|
|
|
OpenBlock | MalformedBlock | Injection | Text)+ */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_Template_typestack = array('Template');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_Template ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "Template"; $result = $this->construct($matchrule, $matchrule, null);
|
|
|
|
$count = 0;
|
|
|
|
while (true) {
|
2012-04-16 07:37:57 +02:00
|
|
|
$res_50 = $result;
|
|
|
|
$pos_50 = $this->pos;
|
|
|
|
$_49 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2012-04-16 07:37:57 +02:00
|
|
|
$_47 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
$res_0 = $result;
|
|
|
|
$pos_0 = $this->pos;
|
|
|
|
$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2012-04-16 07:37:57 +02:00
|
|
|
$_47 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
$result = $res_0;
|
|
|
|
$this->pos = $pos_0;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_45 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
$res_2 = $result;
|
|
|
|
$pos_2 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2012-04-16 07:37:57 +02:00
|
|
|
$_45 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
$result = $res_2;
|
|
|
|
$this->pos = $pos_2;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_43 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
$res_4 = $result;
|
|
|
|
$pos_4 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2012-04-16 07:37:57 +02:00
|
|
|
$_43 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
$result = $res_4;
|
|
|
|
$this->pos = $pos_4;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_41 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
$res_6 = $result;
|
|
|
|
$pos_6 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2012-04-16 07:37:57 +02:00
|
|
|
$_41 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
$result = $res_6;
|
|
|
|
$this->pos = $pos_6;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_39 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
$res_8 = $result;
|
|
|
|
$pos_8 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2012-04-16 07:37:57 +02:00
|
|
|
$_39 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
$result = $res_8;
|
|
|
|
$this->pos = $pos_8;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_37 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
$res_10 = $result;
|
|
|
|
$pos_10 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2012-04-16 07:37:57 +02:00
|
|
|
$_37 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
$result = $res_10;
|
|
|
|
$this->pos = $pos_10;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_35 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
$res_12 = $result;
|
|
|
|
$pos_12 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2012-04-16 07:37:57 +02:00
|
|
|
$_35 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
$result = $res_12;
|
|
|
|
$this->pos = $pos_12;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_33 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
$res_14 = $result;
|
|
|
|
$pos_14 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2012-04-16 07:37:57 +02:00
|
|
|
$_33 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
$result = $res_14;
|
|
|
|
$this->pos = $pos_14;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_31 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
$res_16 = $result;
|
|
|
|
$pos_16 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2012-04-16 07:37:57 +02:00
|
|
|
$_31 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
$result = $res_16;
|
|
|
|
$this->pos = $pos_16;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_29 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
$res_18 = $result;
|
|
|
|
$pos_18 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2012-04-16 07:37:57 +02:00
|
|
|
$_29 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
$result = $res_18;
|
|
|
|
$this->pos = $pos_18;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_27 = NULL;
|
2012-04-11 11:34:27 +02:00
|
|
|
do {
|
|
|
|
$res_20 = $result;
|
|
|
|
$pos_20 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos;
|
2012-04-11 11:34:27 +02:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2012-04-16 07:37:57 +02:00
|
|
|
$_27 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
|
|
|
$result = $res_20;
|
|
|
|
$this->pos = $pos_20;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_25 = NULL;
|
|
|
|
do {
|
|
|
|
$res_22 = $result;
|
|
|
|
$pos_22 = $this->pos;
|
|
|
|
$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
|
|
|
$_25 = TRUE; break;
|
|
|
|
}
|
|
|
|
$result = $res_22;
|
|
|
|
$this->pos = $pos_22;
|
|
|
|
$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
|
|
|
$_25 = TRUE; break;
|
|
|
|
}
|
|
|
|
$result = $res_22;
|
|
|
|
$this->pos = $pos_22;
|
|
|
|
$_25 = FALSE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
while(0);
|
|
|
|
if( $_25 === TRUE ) { $_27 = TRUE; break; }
|
2012-04-11 11:34:27 +02:00
|
|
|
$result = $res_20;
|
|
|
|
$this->pos = $pos_20;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_27 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2012-04-11 11:34:27 +02:00
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_27 === TRUE ) { $_29 = TRUE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = $res_18;
|
|
|
|
$this->pos = $pos_18;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_29 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_29 === TRUE ) { $_31 = TRUE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = $res_16;
|
|
|
|
$this->pos = $pos_16;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_31 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_31 === TRUE ) { $_33 = TRUE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = $res_14;
|
|
|
|
$this->pos = $pos_14;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_33 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_33 === TRUE ) { $_35 = TRUE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = $res_12;
|
|
|
|
$this->pos = $pos_12;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_35 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_35 === TRUE ) { $_37 = TRUE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = $res_10;
|
|
|
|
$this->pos = $pos_10;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_37 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_37 === TRUE ) { $_39 = TRUE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = $res_8;
|
|
|
|
$this->pos = $pos_8;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_39 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_39 === TRUE ) { $_41 = TRUE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = $res_6;
|
|
|
|
$this->pos = $pos_6;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_41 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_41 === TRUE ) { $_43 = TRUE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = $res_4;
|
|
|
|
$this->pos = $pos_4;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_43 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_43 === TRUE ) { $_45 = TRUE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = $res_2;
|
|
|
|
$this->pos = $pos_2;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_45 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_45 === TRUE ) { $_47 = TRUE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = $res_0;
|
|
|
|
$this->pos = $pos_0;
|
2012-04-16 07:37:57 +02:00
|
|
|
$_47 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_47 === FALSE) { $_49 = FALSE; break; }
|
|
|
|
$_49 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_49 === FALSE) {
|
|
|
|
$result = $res_50;
|
|
|
|
$this->pos = $pos_50;
|
|
|
|
unset( $res_50 );
|
|
|
|
unset( $pos_50 );
|
2011-02-28 04:12:41 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
$count += 1;
|
|
|
|
}
|
|
|
|
if ($count > 0) { return $this->finalise($result); }
|
|
|
|
else { return FALSE; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Template_STR(&$res, $sub) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$res['php'] .= $sub['php'] . PHP_EOL ;
|
|
|
|
}
|
|
|
|
|
2011-02-09 05:31:16 +01:00
|
|
|
/* Word: / [A-Za-z_] [A-Za-z0-9_]* / */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_Word_typestack = array('Word');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_Word ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "Word"; $result = $this->construct($matchrule, $matchrule, null);
|
|
|
|
if (( $subres = $this->rx( '/ [A-Za-z_] [A-Za-z0-9_]* /' ) ) !== FALSE) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$result["text"] .= $subres;
|
2011-02-28 04:12:41 +01:00
|
|
|
return $this->finalise($result);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else { return FALSE; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Number: / [0-9]+ / */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_Number_typestack = array('Number');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_Number ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "Number"; $result = $this->construct($matchrule, $matchrule, null);
|
|
|
|
if (( $subres = $this->rx( '/ [0-9]+ /' ) ) !== FALSE) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$result["text"] .= $subres;
|
2011-02-28 04:12:41 +01:00
|
|
|
return $this->finalise($result);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else { return FALSE; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Value: / [A-Za-z0-9_]+ / */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_Value_typestack = array('Value');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_Value ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "Value"; $result = $this->construct($matchrule, $matchrule, null);
|
|
|
|
if (( $subres = $this->rx( '/ [A-Za-z0-9_]+ /' ) ) !== FALSE) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$result["text"] .= $subres;
|
2011-02-28 04:12:41 +01:00
|
|
|
return $this->finalise($result);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else { return FALSE; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
/* CallArguments: :Argument ( < "," < :Argument )* */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_CallArguments_typestack = array('CallArguments');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_CallArguments ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "CallArguments"; $result = $this->construct($matchrule, $matchrule, null);
|
2012-04-16 07:37:57 +02:00
|
|
|
$_61 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Argument" );
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_61 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
while (true) {
|
2012-04-16 07:37:57 +02:00
|
|
|
$res_60 = $result;
|
|
|
|
$pos_60 = $this->pos;
|
|
|
|
$_59 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == ',') {
|
2011-02-09 05:31:16 +01:00
|
|
|
$this->pos += 1;
|
2011-02-28 04:12:41 +01:00
|
|
|
$result["text"] .= ',';
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_59 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Argument" );
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_59 = FALSE; break; }
|
|
|
|
$_59 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_59 === FALSE) {
|
|
|
|
$result = $res_60;
|
|
|
|
$this->pos = $pos_60;
|
|
|
|
unset( $res_60 );
|
|
|
|
unset( $pos_60 );
|
2011-02-09 05:31:16 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
$_61 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_61 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_61 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
/**
|
2012-09-26 23:34:00 +02:00
|
|
|
* Values are bare words in templates, but strings in PHP. We rely on PHP's type conversion to back-convert
|
|
|
|
* strings to numbers when needed.
|
2011-02-14 22:03:42 +01:00
|
|
|
*/
|
2012-09-26 23:34:00 +02:00
|
|
|
function CallArguments_Argument(&$res, $sub) {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (!empty($res['php'])) $res['php'] .= ', ';
|
2011-02-09 05:31:16 +01:00
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
$res['php'] .= ($sub['ArgumentMode'] == 'default') ? $sub['string_php'] :
|
|
|
|
str_replace('$$FINAL', 'XML_val', $sub['php']);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
/* Call: Method:Word ( "(" < :CallArguments? > ")" )? */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_Call_typestack = array('Call');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_Call ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "Call"; $result = $this->construct($matchrule, $matchrule, null);
|
2012-04-16 07:37:57 +02:00
|
|
|
$_71 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Method" );
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_71 = FALSE; break; }
|
|
|
|
$res_70 = $result;
|
|
|
|
$pos_70 = $this->pos;
|
|
|
|
$_69 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == '(') {
|
2011-02-09 05:31:16 +01:00
|
|
|
$this->pos += 1;
|
2011-02-28 04:12:41 +01:00
|
|
|
$result["text"] .= '(';
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_69 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2012-04-16 07:37:57 +02:00
|
|
|
$res_66 = $result;
|
|
|
|
$pos_66 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
2011-02-14 22:03:42 +01:00
|
|
|
$this->store( $result, $subres, "CallArguments" );
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else {
|
2012-04-16 07:37:57 +02:00
|
|
|
$result = $res_66;
|
|
|
|
$this->pos = $pos_66;
|
|
|
|
unset( $res_66 );
|
|
|
|
unset( $pos_66 );
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == ')') {
|
2011-02-09 05:31:16 +01:00
|
|
|
$this->pos += 1;
|
2011-02-28 04:12:41 +01:00
|
|
|
$result["text"] .= ')';
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_69 = FALSE; break; }
|
|
|
|
$_69 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_69 === FALSE) {
|
|
|
|
$result = $res_70;
|
|
|
|
$this->pos = $pos_70;
|
|
|
|
unset( $res_70 );
|
|
|
|
unset( $pos_70 );
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
$_71 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_71 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_71 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* LookupStep: :Call &"." */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_LookupStep_typestack = array('LookupStep');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_LookupStep ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "LookupStep"; $result = $this->construct($matchrule, $matchrule, null);
|
2012-04-16 07:37:57 +02:00
|
|
|
$_75 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Call'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Call" );
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_75 = FALSE; break; }
|
|
|
|
$res_74 = $result;
|
|
|
|
$pos_74 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == '.') {
|
2011-02-09 05:31:16 +01:00
|
|
|
$this->pos += 1;
|
2011-02-28 04:12:41 +01:00
|
|
|
$result["text"] .= '.';
|
2012-04-16 07:37:57 +02:00
|
|
|
$result = $res_74;
|
|
|
|
$this->pos = $pos_74;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else {
|
2012-04-16 07:37:57 +02:00
|
|
|
$result = $res_74;
|
|
|
|
$this->pos = $pos_74;
|
|
|
|
$_75 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
$_75 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_75 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_75 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* LastLookupStep: :Call */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_LastLookupStep_typestack = array('LastLookupStep');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_LastLookupStep ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "LastLookupStep"; $result = $this->construct($matchrule, $matchrule, null);
|
|
|
|
$matcher = 'match_'.'Call'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Call" );
|
2011-02-28 04:12:41 +01:00
|
|
|
return $this->finalise($result);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else { return FALSE; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Lookup: LookupStep ("." LookupStep)* "." LastLookupStep | LastLookupStep */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_Lookup_typestack = array('Lookup');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_Lookup ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "Lookup"; $result = $this->construct($matchrule, $matchrule, null);
|
2012-04-16 07:37:57 +02:00
|
|
|
$_89 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2012-04-16 07:37:57 +02:00
|
|
|
$res_78 = $result;
|
|
|
|
$pos_78 = $this->pos;
|
|
|
|
$_86 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'LookupStep'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_86 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
while (true) {
|
2012-04-16 07:37:57 +02:00
|
|
|
$res_83 = $result;
|
|
|
|
$pos_83 = $this->pos;
|
|
|
|
$_82 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == '.') {
|
2011-02-09 05:31:16 +01:00
|
|
|
$this->pos += 1;
|
2011-02-28 04:12:41 +01:00
|
|
|
$result["text"] .= '.';
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_82 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'LookupStep'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_82 = FALSE; break; }
|
|
|
|
$_82 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_82 === FALSE) {
|
|
|
|
$result = $res_83;
|
|
|
|
$this->pos = $pos_83;
|
|
|
|
unset( $res_83 );
|
|
|
|
unset( $pos_83 );
|
2011-02-09 05:31:16 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == '.') {
|
2011-02-09 05:31:16 +01:00
|
|
|
$this->pos += 1;
|
2011-02-28 04:12:41 +01:00
|
|
|
$result["text"] .= '.';
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_86 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'LastLookupStep'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_86 = FALSE; break; }
|
|
|
|
$_86 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_86 === TRUE ) { $_89 = TRUE; break; }
|
|
|
|
$result = $res_78;
|
|
|
|
$this->pos = $pos_78;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'LastLookupStep'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2012-04-16 07:37:57 +02:00
|
|
|
$_89 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
$result = $res_78;
|
|
|
|
$this->pos = $pos_78;
|
|
|
|
$_89 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_89 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_89 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Lookup__construct(&$res) {
|
2013-06-25 07:35:16 +02:00
|
|
|
$res['php'] = '$scope->locally()';
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['LookupSteps'] = array();
|
|
|
|
}
|
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
/**
|
|
|
|
* The basic generated PHP of LookupStep and LastLookupStep is the same, except that LookupStep calls 'obj' to
|
|
|
|
* get the next ViewableData in the sequence, and LastLookupStep calls different methods (XML_val, hasValue, obj)
|
|
|
|
* depending on the context the lookup is used in.
|
|
|
|
*/
|
2012-09-26 23:34:00 +02:00
|
|
|
function Lookup_AddLookupStep(&$res, $sub, $method) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['LookupSteps'][] = $sub;
|
|
|
|
|
|
|
|
$property = $sub['Call']['Method']['text'];
|
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
if (isset($sub['Call']['CallArguments']) && $arguments = $sub['Call']['CallArguments']['php']) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['php'] .= "->$method('$property', array($arguments), true)";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$res['php'] .= "->$method('$property', null, true)";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Lookup_LookupStep(&$res, $sub) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$this->Lookup_AddLookupStep($res, $sub, 'obj');
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Lookup_LastLookupStep(&$res, $sub) {
|
2011-02-18 05:06:11 +01:00
|
|
|
$this->Lookup_AddLookupStep($res, $sub, '$$FINAL');
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
2012-04-16 06:59:56 +02:00
|
|
|
|
2013-02-14 08:31:40 +01:00
|
|
|
/* Translate: "<%t" < Entity < (Default:QuotedString)? < (!("is" "=") < "is" < Context:QuotedString)? <
|
|
|
|
(InjectionVariables)? > "%>" */
|
2012-04-16 06:59:56 +02:00
|
|
|
protected $match_Translate_typestack = array('Translate');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_Translate ($stack = array()) {
|
2012-04-16 06:59:56 +02:00
|
|
|
$matchrule = "Translate"; $result = $this->construct($matchrule, $matchrule, null);
|
2012-04-16 07:37:57 +02:00
|
|
|
$_115 = NULL;
|
2012-04-16 06:59:56 +02:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->literal( '<%t' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_115 = FALSE; break; }
|
2012-04-16 06:59:56 +02:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
$matcher = 'match_'.'Entity'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_115 = FALSE; break; }
|
2012-04-16 06:59:56 +02:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2012-04-16 07:37:57 +02:00
|
|
|
$res_97 = $result;
|
|
|
|
$pos_97 = $this->pos;
|
|
|
|
$_96 = NULL;
|
2012-04-16 06:59:56 +02:00
|
|
|
do {
|
|
|
|
$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Default" );
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_96 = FALSE; break; }
|
|
|
|
$_96 = TRUE; break;
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_96 === FALSE) {
|
|
|
|
$result = $res_97;
|
|
|
|
$this->pos = $pos_97;
|
|
|
|
unset( $res_97 );
|
|
|
|
unset( $pos_97 );
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2012-04-16 07:37:57 +02:00
|
|
|
$res_108 = $result;
|
|
|
|
$pos_108 = $this->pos;
|
|
|
|
$_107 = NULL;
|
2012-04-16 06:59:56 +02:00
|
|
|
do {
|
2012-04-16 07:37:57 +02:00
|
|
|
$res_102 = $result;
|
|
|
|
$pos_102 = $this->pos;
|
|
|
|
$_101 = NULL;
|
2012-04-16 06:59:56 +02:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->literal( 'is' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_101 = FALSE; break; }
|
2012-04-16 06:59:56 +02:00
|
|
|
if (substr($this->string,$this->pos,1) == '=') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '=';
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_101 = FALSE; break; }
|
|
|
|
$_101 = TRUE; break;
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_101 === TRUE ) {
|
|
|
|
$result = $res_102;
|
|
|
|
$this->pos = $pos_102;
|
|
|
|
$_107 = FALSE; break;
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_101 === FALSE) {
|
|
|
|
$result = $res_102;
|
|
|
|
$this->pos = $pos_102;
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (( $subres = $this->literal( 'is' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_107 = FALSE; break; }
|
2012-04-16 06:59:56 +02:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Context" );
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_107 = FALSE; break; }
|
|
|
|
$_107 = TRUE; break;
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_107 === FALSE) {
|
|
|
|
$result = $res_108;
|
|
|
|
$this->pos = $pos_108;
|
|
|
|
unset( $res_108 );
|
|
|
|
unset( $pos_108 );
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2012-04-16 07:37:57 +02:00
|
|
|
$res_112 = $result;
|
|
|
|
$pos_112 = $this->pos;
|
|
|
|
$_111 = NULL;
|
2012-04-16 06:59:56 +02:00
|
|
|
do {
|
|
|
|
$matcher = 'match_'.'InjectionVariables'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_111 = FALSE; break; }
|
|
|
|
$_111 = TRUE; break;
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_111 === FALSE) {
|
|
|
|
$result = $res_112;
|
|
|
|
$this->pos = $pos_112;
|
|
|
|
unset( $res_112 );
|
|
|
|
unset( $pos_112 );
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_115 = FALSE; break; }
|
|
|
|
$_115 = TRUE; break;
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_115 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_115 === FALSE) { return FALSE; }
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* InjectionVariables: (< InjectionName:Word "=" Argument)+ */
|
|
|
|
protected $match_InjectionVariables_typestack = array('InjectionVariables');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_InjectionVariables ($stack = array()) {
|
2012-04-16 06:59:56 +02:00
|
|
|
$matchrule = "InjectionVariables"; $result = $this->construct($matchrule, $matchrule, null);
|
|
|
|
$count = 0;
|
|
|
|
while (true) {
|
2012-04-16 07:37:57 +02:00
|
|
|
$res_122 = $result;
|
|
|
|
$pos_122 = $this->pos;
|
|
|
|
$_121 = NULL;
|
2012-04-16 06:59:56 +02:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "InjectionName" );
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_121 = FALSE; break; }
|
2012-04-16 06:59:56 +02:00
|
|
|
if (substr($this->string,$this->pos,1) == '=') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '=';
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_121 = FALSE; break; }
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_121 = FALSE; break; }
|
|
|
|
$_121 = TRUE; break;
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_121 === FALSE) {
|
|
|
|
$result = $res_122;
|
|
|
|
$this->pos = $pos_122;
|
|
|
|
unset( $res_122 );
|
|
|
|
unset( $pos_122 );
|
2012-04-16 06:59:56 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
$count += 1;
|
|
|
|
}
|
|
|
|
if ($count > 0) { return $this->finalise($result); }
|
|
|
|
else { return FALSE; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Entity: / [A-Za-z_] [\w\.]* / */
|
|
|
|
protected $match_Entity_typestack = array('Entity');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_Entity ($stack = array()) {
|
2012-04-16 06:59:56 +02:00
|
|
|
$matchrule = "Entity"; $result = $this->construct($matchrule, $matchrule, null);
|
|
|
|
if (( $subres = $this->rx( '/ [A-Za-z_] [\w\.]* /' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
|
|
|
return $this->finalise($result);
|
|
|
|
}
|
|
|
|
else { return FALSE; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Translate__construct(&$res) {
|
2012-04-16 06:59:56 +02:00
|
|
|
$res['php'] = '$val .= _t(';
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Translate_Entity(&$res, $sub) {
|
2012-04-16 06:59:56 +02:00
|
|
|
$res['php'] .= "'$sub[text]'";
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Translate_Default(&$res, $sub) {
|
2012-04-16 06:59:56 +02:00
|
|
|
$res['php'] .= ",$sub[text]";
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Translate_Context(&$res, $sub) {
|
2012-04-16 06:59:56 +02:00
|
|
|
$res['php'] .= ",$sub[text]";
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Translate_InjectionVariables(&$res, $sub) {
|
2012-04-16 06:59:56 +02:00
|
|
|
$res['php'] .= ",$sub[php]";
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Translate__finalise(&$res) {
|
2012-04-16 06:59:56 +02:00
|
|
|
$res['php'] .= ');';
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function InjectionVariables__construct(&$res) {
|
2012-04-16 06:59:56 +02:00
|
|
|
$res['php'] = "array(";
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function InjectionVariables_InjectionName(&$res, $sub) {
|
2012-04-16 06:59:56 +02:00
|
|
|
$res['php'] .= "'$sub[text]'=>";
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function InjectionVariables_Argument(&$res, $sub) {
|
2012-04-16 06:59:56 +02:00
|
|
|
$res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']) . ',';
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function InjectionVariables__finalise(&$res) {
|
2012-04-16 06:59:56 +02:00
|
|
|
if (substr($res['php'], -1) == ',') $res['php'] = substr($res['php'], 0, -1); //remove last comma in the array
|
|
|
|
$res['php'] .= ')';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-09 05:31:16 +01:00
|
|
|
/* SimpleInjection: '$' :Lookup */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_SimpleInjection_typestack = array('SimpleInjection');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_SimpleInjection ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "SimpleInjection"; $result = $this->construct($matchrule, $matchrule, null);
|
2012-04-16 07:37:57 +02:00
|
|
|
$_126 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
|
|
|
if (substr($this->string,$this->pos,1) == '$') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '$';
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_126 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Lookup" );
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_126 = FALSE; break; }
|
|
|
|
$_126 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_126 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_126 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* BracketInjection: '{$' :Lookup "}" */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_BracketInjection_typestack = array('BracketInjection');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_BracketInjection ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "BracketInjection"; $result = $this->construct($matchrule, $matchrule, null);
|
2012-04-16 07:37:57 +02:00
|
|
|
$_131 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '{$' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_131 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Lookup" );
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_131 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == '}') {
|
2011-02-09 05:31:16 +01:00
|
|
|
$this->pos += 1;
|
2011-02-28 04:12:41 +01:00
|
|
|
$result["text"] .= '}';
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_131 = FALSE; break; }
|
|
|
|
$_131 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_131 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_131 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Injection: BracketInjection | SimpleInjection */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_Injection_typestack = array('Injection');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_Injection ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "Injection"; $result = $this->construct($matchrule, $matchrule, null);
|
2012-04-16 07:37:57 +02:00
|
|
|
$_136 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2012-04-16 07:37:57 +02:00
|
|
|
$res_133 = $result;
|
|
|
|
$pos_133 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'BracketInjection'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2012-04-16 07:37:57 +02:00
|
|
|
$_136 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
$result = $res_133;
|
|
|
|
$this->pos = $pos_133;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'SimpleInjection'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2012-04-16 07:37:57 +02:00
|
|
|
$_136 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
$result = $res_133;
|
|
|
|
$this->pos = $pos_133;
|
|
|
|
$_136 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_136 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_136 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Injection_STR(&$res, $sub) {
|
2011-02-18 05:06:11 +01:00
|
|
|
$res['php'] = '$val .= '. str_replace('$$FINAL', 'XML_val', $sub['Lookup']['php']) . ';';
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
/* DollarMarkedLookup: SimpleInjection */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_DollarMarkedLookup_typestack = array('DollarMarkedLookup');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_DollarMarkedLookup ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "DollarMarkedLookup"; $result = $this->construct($matchrule, $matchrule, null);
|
|
|
|
$matcher = 'match_'.'SimpleInjection'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-14 22:03:42 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2011-02-28 04:12:41 +01:00
|
|
|
return $this->finalise($result);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2011-02-14 22:03:42 +01:00
|
|
|
else { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function DollarMarkedLookup_STR(&$res, $sub) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['Lookup'] = $sub['Lookup'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* QuotedString: q:/['"]/ String:/ (\\\\ | \\. | [^$q\\])* / '$q' */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_QuotedString_typestack = array('QuotedString');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_QuotedString ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "QuotedString"; $result = $this->construct($matchrule, $matchrule, null);
|
2012-04-16 07:37:57 +02:00
|
|
|
$_142 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "q" );
|
|
|
|
if (( $subres = $this->rx( '/[\'"]/' ) ) !== FALSE) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$result["text"] .= $subres;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = $result; $result = array_pop($stack);
|
2011-02-09 05:31:16 +01:00
|
|
|
$this->store( $result, $subres, 'q' );
|
|
|
|
}
|
|
|
|
else {
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = array_pop($stack);
|
2012-04-16 07:37:57 +02:00
|
|
|
$_142 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "String" );
|
|
|
|
if (( $subres = $this->rx( '/ (\\\\\\\\ | \\\\. | [^'.$this->expression($result, $stack, 'q').'\\\\])* /' ) ) !== FALSE) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$result["text"] .= $subres;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = $result; $result = array_pop($stack);
|
2011-02-09 05:31:16 +01:00
|
|
|
$this->store( $result, $subres, 'String' );
|
|
|
|
}
|
|
|
|
else {
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = array_pop($stack);
|
2012-04-16 07:37:57 +02:00
|
|
|
$_142 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( ''.$this->expression($result, $stack, 'q').'' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_142 = FALSE; break; }
|
|
|
|
$_142 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_142 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_142 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-07 09:46:50 +02:00
|
|
|
/* FreeString: /[^,)%!=><|&]+/ */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_FreeString_typestack = array('FreeString');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_FreeString ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "FreeString"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
if (( $subres = $this->rx( '/[^,)%!=><|&]+/' ) ) !== FALSE) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$result["text"] .= $subres;
|
2011-02-28 04:12:41 +01:00
|
|
|
return $this->finalise($result);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else { return FALSE; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Argument:
|
2011-02-28 04:12:41 +01:00
|
|
|
:DollarMarkedLookup |
|
|
|
|
:QuotedString |
|
|
|
|
:Lookup !(< FreeString)|
|
|
|
|
:FreeString */
|
|
|
|
protected $match_Argument_typestack = array('Argument');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_Argument ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "Argument"; $result = $this->construct($matchrule, $matchrule, null);
|
2012-04-16 07:37:57 +02:00
|
|
|
$_162 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2012-04-16 07:37:57 +02:00
|
|
|
$res_145 = $result;
|
|
|
|
$pos_145 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'DollarMarkedLookup'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "DollarMarkedLookup" );
|
2012-04-16 07:37:57 +02:00
|
|
|
$_162 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
$result = $res_145;
|
|
|
|
$this->pos = $pos_145;
|
|
|
|
$_160 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2012-04-16 07:37:57 +02:00
|
|
|
$res_147 = $result;
|
|
|
|
$pos_147 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "QuotedString" );
|
2012-04-16 07:37:57 +02:00
|
|
|
$_160 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
$result = $res_147;
|
|
|
|
$this->pos = $pos_147;
|
|
|
|
$_158 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2012-04-16 07:37:57 +02:00
|
|
|
$res_149 = $result;
|
|
|
|
$pos_149 = $this->pos;
|
|
|
|
$_155 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Lookup" );
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_155 = FALSE; break; }
|
|
|
|
$res_154 = $result;
|
|
|
|
$pos_154 = $this->pos;
|
|
|
|
$_153 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'FreeString'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
else { $_153 = FALSE; break; }
|
|
|
|
$_153 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_153 === TRUE ) {
|
|
|
|
$result = $res_154;
|
|
|
|
$this->pos = $pos_154;
|
|
|
|
$_155 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_153 === FALSE) {
|
|
|
|
$result = $res_154;
|
|
|
|
$this->pos = $pos_154;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
$_155 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_155 === TRUE ) { $_158 = TRUE; break; }
|
|
|
|
$result = $res_149;
|
|
|
|
$this->pos = $pos_149;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'FreeString'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "FreeString" );
|
2012-04-16 07:37:57 +02:00
|
|
|
$_158 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
$result = $res_149;
|
|
|
|
$this->pos = $pos_149;
|
|
|
|
$_158 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_158 === TRUE ) { $_160 = TRUE; break; }
|
|
|
|
$result = $res_147;
|
|
|
|
$this->pos = $pos_147;
|
|
|
|
$_160 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_160 === TRUE ) { $_162 = TRUE; break; }
|
|
|
|
$result = $res_145;
|
|
|
|
$this->pos = $pos_145;
|
|
|
|
$_162 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2012-04-16 07:37:57 +02:00
|
|
|
if( $_162 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_162 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If we get a bare value, we don't know enough to determine exactly what php would be the translation, because
|
|
|
|
* we don't know if the position of use indicates a lookup or a string argument.
|
|
|
|
*
|
|
|
|
* Instead, we record 'ArgumentMode' as a member of this matches results node, which can be:
|
|
|
|
* - lookup if this argument was unambiguously a lookup (marked as such)
|
|
|
|
* - string is this argument was unambiguously a string (marked as such, or impossible to parse as lookup)
|
|
|
|
* - default if this argument needs to be handled as per 2.4
|
|
|
|
*
|
|
|
|
* In the case of 'default', there is no php member of the results node, but instead 'lookup_php', which
|
|
|
|
* should be used by the parent if the context indicates a lookup, and 'string_php' which should be used
|
|
|
|
* if the context indicates a string
|
|
|
|
*/
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Argument_DollarMarkedLookup(&$res, $sub) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['ArgumentMode'] = 'lookup';
|
|
|
|
$res['php'] = $sub['Lookup']['php'];
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Argument_QuotedString(&$res, $sub) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['ArgumentMode'] = 'string';
|
2011-02-21 05:44:46 +01:00
|
|
|
$res['php'] = "'" . str_replace("'", "\\'", $sub['String']['text']) . "'";
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Argument_Lookup(&$res, $sub) {
|
2011-02-09 05:31:16 +01:00
|
|
|
if (count($sub['LookupSteps']) == 1 && !isset($sub['LookupSteps'][0]['Call']['Arguments'])) {
|
|
|
|
$res['ArgumentMode'] = 'default';
|
|
|
|
$res['lookup_php'] = $sub['php'];
|
|
|
|
$res['string_php'] = "'".$sub['LookupSteps'][0]['Call']['Method']['text']."'";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$res['ArgumentMode'] = 'lookup';
|
|
|
|
$res['php'] = $sub['php'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Argument_FreeString(&$res, $sub) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['ArgumentMode'] = 'string';
|
2012-07-23 01:56:44 +02:00
|
|
|
$res['php'] = "'" . str_replace("'", "\\'", trim($sub['text'])) . "'";
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
2013-04-07 09:46:50 +02:00
|
|
|
/* ComparisonOperator: "!=" | "==" | ">=" | ">" | "<=" | "<" | "=" */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_ComparisonOperator_typestack = array('ComparisonOperator');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_ComparisonOperator ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "ComparisonOperator"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_187 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2012-04-16 07:37:57 +02:00
|
|
|
$res_164 = $result;
|
|
|
|
$pos_164 = $this->pos;
|
2013-04-07 09:46:50 +02:00
|
|
|
if (( $subres = $this->literal( '!=' ) ) !== FALSE) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_187 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
$result = $res_164;
|
|
|
|
$this->pos = $pos_164;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_185 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2012-04-16 07:37:57 +02:00
|
|
|
$res_166 = $result;
|
|
|
|
$pos_166 = $this->pos;
|
2013-04-07 09:46:50 +02:00
|
|
|
if (( $subres = $this->literal( '==' ) ) !== FALSE) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_185 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
$result = $res_166;
|
|
|
|
$this->pos = $pos_166;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_183 = NULL;
|
|
|
|
do {
|
|
|
|
$res_168 = $result;
|
|
|
|
$pos_168 = $this->pos;
|
|
|
|
if (( $subres = $this->literal( '>=' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
|
|
|
$_183 = TRUE; break;
|
|
|
|
}
|
|
|
|
$result = $res_168;
|
|
|
|
$this->pos = $pos_168;
|
|
|
|
$_181 = NULL;
|
|
|
|
do {
|
|
|
|
$res_170 = $result;
|
|
|
|
$pos_170 = $this->pos;
|
|
|
|
if (substr($this->string,$this->pos,1) == '>') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '>';
|
|
|
|
$_181 = TRUE; break;
|
|
|
|
}
|
|
|
|
$result = $res_170;
|
|
|
|
$this->pos = $pos_170;
|
|
|
|
$_179 = NULL;
|
|
|
|
do {
|
|
|
|
$res_172 = $result;
|
|
|
|
$pos_172 = $this->pos;
|
|
|
|
if (( $subres = $this->literal( '<=' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
|
|
|
$_179 = TRUE; break;
|
|
|
|
}
|
|
|
|
$result = $res_172;
|
|
|
|
$this->pos = $pos_172;
|
|
|
|
$_177 = NULL;
|
|
|
|
do {
|
|
|
|
$res_174 = $result;
|
|
|
|
$pos_174 = $this->pos;
|
|
|
|
if (substr($this->string,$this->pos,1) == '<') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '<';
|
|
|
|
$_177 = TRUE; break;
|
|
|
|
}
|
|
|
|
$result = $res_174;
|
|
|
|
$this->pos = $pos_174;
|
|
|
|
if (substr($this->string,$this->pos,1) == '=') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '=';
|
|
|
|
$_177 = TRUE; break;
|
|
|
|
}
|
|
|
|
$result = $res_174;
|
|
|
|
$this->pos = $pos_174;
|
|
|
|
$_177 = FALSE; break;
|
|
|
|
}
|
|
|
|
while(0);
|
|
|
|
if( $_177 === TRUE ) { $_179 = TRUE; break; }
|
|
|
|
$result = $res_172;
|
|
|
|
$this->pos = $pos_172;
|
|
|
|
$_179 = FALSE; break;
|
|
|
|
}
|
|
|
|
while(0);
|
|
|
|
if( $_179 === TRUE ) { $_181 = TRUE; break; }
|
|
|
|
$result = $res_170;
|
|
|
|
$this->pos = $pos_170;
|
|
|
|
$_181 = FALSE; break;
|
|
|
|
}
|
|
|
|
while(0);
|
|
|
|
if( $_181 === TRUE ) { $_183 = TRUE; break; }
|
|
|
|
$result = $res_168;
|
|
|
|
$this->pos = $pos_168;
|
|
|
|
$_183 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
while(0);
|
|
|
|
if( $_183 === TRUE ) { $_185 = TRUE; break; }
|
2012-04-16 07:37:57 +02:00
|
|
|
$result = $res_166;
|
|
|
|
$this->pos = $pos_166;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_185 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_185 === TRUE ) { $_187 = TRUE; break; }
|
2012-04-16 07:37:57 +02:00
|
|
|
$result = $res_164;
|
|
|
|
$this->pos = $pos_164;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_187 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_187 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_187 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Comparison: Argument < ComparisonOperator > Argument */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_Comparison_typestack = array('Comparison');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_Comparison ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "Comparison"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_194 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_194 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'ComparisonOperator'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_194 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_194 = FALSE; break; }
|
|
|
|
$_194 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_194 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_194 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Comparison_Argument(&$res, $sub) {
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($sub['ArgumentMode'] == 'default') {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (!empty($res['php'])) $res['php'] .= $sub['string_php'];
|
2011-02-18 05:06:11 +01:00
|
|
|
else $res['php'] = str_replace('$$FINAL', 'XML_val', $sub['lookup_php']);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else {
|
2011-02-18 05:06:11 +01:00
|
|
|
$res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Comparison_ComparisonOperator(&$res, $sub) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['php'] .= ($sub['text'] == '=' ? '==' : $sub['text']);
|
|
|
|
}
|
|
|
|
|
2011-02-21 03:24:14 +01:00
|
|
|
/* PresenceCheck: (Not:'not' <)? Argument */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_PresenceCheck_typestack = array('PresenceCheck');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_PresenceCheck ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "PresenceCheck"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_201 = NULL;
|
2011-02-21 03:24:14 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_199 = $result;
|
|
|
|
$pos_199 = $this->pos;
|
|
|
|
$_198 = NULL;
|
2011-02-21 03:24:14 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Not" );
|
|
|
|
if (( $subres = $this->literal( 'not' ) ) !== FALSE) {
|
2011-02-21 03:24:14 +01:00
|
|
|
$result["text"] .= $subres;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = $result; $result = array_pop($stack);
|
2011-02-21 03:24:14 +01:00
|
|
|
$this->store( $result, $subres, 'Not' );
|
|
|
|
}
|
|
|
|
else {
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = array_pop($stack);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_198 = FALSE; break;
|
2011-02-21 03:24:14 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
$_198 = TRUE; break;
|
2011-02-21 03:24:14 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_198 === FALSE) {
|
|
|
|
$result = $res_199;
|
|
|
|
$this->pos = $pos_199;
|
|
|
|
unset( $res_199 );
|
|
|
|
unset( $pos_199 );
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-21 03:24:14 +01:00
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_201 = FALSE; break; }
|
|
|
|
$_201 = TRUE; break;
|
2011-02-21 03:24:14 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_201 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_201 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function PresenceCheck_Not(&$res, $sub) {
|
2011-02-21 03:24:14 +01:00
|
|
|
$res['php'] = '!';
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function PresenceCheck_Argument(&$res, $sub) {
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($sub['ArgumentMode'] == 'string') {
|
2011-02-21 03:24:14 +01:00
|
|
|
$res['php'] .= '((bool)'.$sub['php'].')';
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$php = ($sub['ArgumentMode'] == 'default' ? $sub['lookup_php'] : $sub['php']);
|
|
|
|
// TODO: kinda hacky - maybe we need a way to pass state down the parse chain so
|
|
|
|
// Lookup_LastLookupStep and Argument_BareWord can produce hasValue instead of XML_val
|
2011-02-21 03:24:14 +01:00
|
|
|
$res['php'] .= str_replace('$$FINAL', 'hasValue', $php);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* IfArgumentPortion: Comparison | PresenceCheck */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_IfArgumentPortion_typestack = array('IfArgumentPortion');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_IfArgumentPortion ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "IfArgumentPortion"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_206 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_203 = $result;
|
|
|
|
$pos_203 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Comparison'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_206 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_203;
|
|
|
|
$this->pos = $pos_203;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'PresenceCheck'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_206 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_203;
|
|
|
|
$this->pos = $pos_203;
|
|
|
|
$_206 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_206 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_206 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function IfArgumentPortion_STR(&$res, $sub) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['php'] = $sub['php'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* BooleanOperator: "||" | "&&" */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_BooleanOperator_typestack = array('BooleanOperator');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_BooleanOperator ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "BooleanOperator"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_211 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_208 = $result;
|
|
|
|
$pos_208 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '||' ) ) !== FALSE) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_211 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_208;
|
|
|
|
$this->pos = $pos_208;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '&&' ) ) !== FALSE) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_211 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_208;
|
|
|
|
$this->pos = $pos_208;
|
|
|
|
$_211 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_211 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_211 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* IfArgument: :IfArgumentPortion ( < :BooleanOperator < :IfArgumentPortion )* */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_IfArgument_typestack = array('IfArgument');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_IfArgument ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "IfArgument"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_220 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'IfArgumentPortion'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "IfArgumentPortion" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_220 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
while (true) {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_219 = $result;
|
|
|
|
$pos_219 = $this->pos;
|
|
|
|
$_218 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'BooleanOperator'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "BooleanOperator" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_218 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'IfArgumentPortion'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "IfArgumentPortion" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_218 = FALSE; break; }
|
|
|
|
$_218 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_218 === FALSE) {
|
|
|
|
$result = $res_219;
|
|
|
|
$this->pos = $pos_219;
|
|
|
|
unset( $res_219 );
|
|
|
|
unset( $pos_219 );
|
2011-02-09 05:31:16 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$_220 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_220 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_220 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function IfArgument_IfArgumentPortion(&$res, $sub) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['php'] .= $sub['php'];
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function IfArgument_BooleanOperator(&$res, $sub) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['php'] .= $sub['text'];
|
|
|
|
}
|
|
|
|
|
2011-02-28 04:12:41 +01:00
|
|
|
/* IfPart: '<%' < 'if' [ :IfArgument > '%>' Template:$TemplateMatcher? */
|
|
|
|
protected $match_IfPart_typestack = array('IfPart');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_IfPart ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "IfPart"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_230 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_230 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'if' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_230 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_230 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "IfArgument" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_230 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_230 = FALSE; break; }
|
|
|
|
$res_229 = $result;
|
|
|
|
$pos_229 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Template" );
|
|
|
|
}
|
|
|
|
else {
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_229;
|
|
|
|
$this->pos = $pos_229;
|
|
|
|
unset( $res_229 );
|
|
|
|
unset( $pos_229 );
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$_230 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_230 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_230 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-10 16:12:51 +02:00
|
|
|
/* ElseIfPart: '<%' < 'else_if' [ :IfArgument > '%>' Template:$TemplateMatcher? */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_ElseIfPart_typestack = array('ElseIfPart');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_ElseIfPart ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "ElseIfPart"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_240 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_240 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'else_if' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_240 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_240 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "IfArgument" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_240 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_240 = FALSE; break; }
|
2013-04-10 16:12:51 +02:00
|
|
|
$res_239 = $result;
|
|
|
|
$pos_239 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Template" );
|
|
|
|
}
|
2013-04-10 16:12:51 +02:00
|
|
|
else {
|
|
|
|
$result = $res_239;
|
|
|
|
$this->pos = $pos_239;
|
|
|
|
unset( $res_239 );
|
|
|
|
unset( $pos_239 );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$_240 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_240 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_240 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-10 16:12:51 +02:00
|
|
|
/* ElsePart: '<%' < 'else' > '%>' Template:$TemplateMatcher? */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_ElsePart_typestack = array('ElsePart');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_ElsePart ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "ElsePart"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_248 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_248 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'else' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_248 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_248 = FALSE; break; }
|
2013-04-10 16:12:51 +02:00
|
|
|
$res_247 = $result;
|
|
|
|
$pos_247 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Template" );
|
|
|
|
}
|
2013-04-10 16:12:51 +02:00
|
|
|
else {
|
|
|
|
$result = $res_247;
|
|
|
|
$this->pos = $pos_247;
|
|
|
|
unset( $res_247 );
|
|
|
|
unset( $pos_247 );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$_248 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_248 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_248 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* If: IfPart ElseIfPart* ElsePart? '<%' < 'end_if' > '%>' */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_If_typestack = array('If');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_If ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "If"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_258 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'IfPart'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_258 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
while (true) {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_251 = $result;
|
|
|
|
$pos_251 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'ElseIfPart'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
|
|
|
else {
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_251;
|
|
|
|
$this->pos = $pos_251;
|
|
|
|
unset( $res_251 );
|
|
|
|
unset( $pos_251 );
|
2011-02-09 05:31:16 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_252 = $result;
|
|
|
|
$pos_252 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'ElsePart'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
|
|
|
else {
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_252;
|
|
|
|
$this->pos = $pos_252;
|
|
|
|
unset( $res_252 );
|
|
|
|
unset( $pos_252 );
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_258 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'end_if' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_258 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_258 = FALSE; break; }
|
|
|
|
$_258 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_258 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_258 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function If_IfPart(&$res, $sub) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['php'] =
|
|
|
|
'if (' . $sub['IfArgument']['php'] . ') { ' . PHP_EOL .
|
2011-02-21 04:19:10 +01:00
|
|
|
(isset($sub['Template']) ? $sub['Template']['php'] : '') . PHP_EOL .
|
2011-02-09 05:31:16 +01:00
|
|
|
'}';
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function If_ElseIfPart(&$res, $sub) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['php'] .=
|
|
|
|
'else if (' . $sub['IfArgument']['php'] . ') { ' . PHP_EOL .
|
2013-04-05 20:00:33 +02:00
|
|
|
(isset($sub['Template']) ? $sub['Template']['php'] : '') . PHP_EOL .
|
2011-02-09 05:31:16 +01:00
|
|
|
'}';
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function If_ElsePart(&$res, $sub) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['php'] .=
|
|
|
|
'else { ' . PHP_EOL .
|
2013-04-05 20:00:33 +02:00
|
|
|
(isset($sub['Template']) ? $sub['Template']['php'] : '') . PHP_EOL .
|
2011-02-09 05:31:16 +01:00
|
|
|
'}';
|
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
|
|
|
|
/* Require: '<%' < 'require' [ Call:(Method:Word "(" < :CallArguments > ")") > '%>' */
|
|
|
|
protected $match_Require_typestack = array('Require');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_Require ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "Require"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_274 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_274 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (( $subres = $this->literal( 'require' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_274 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_274 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Call" );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_270 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Method" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_270 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == '(') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '(';
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_270 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
$matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "CallArguments" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_270 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (substr($this->string,$this->pos,1) == ')') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= ')';
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_270 = FALSE; break; }
|
|
|
|
$_270 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_270 === TRUE ) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = $result; $result = array_pop($stack);
|
|
|
|
$this->store( $result, $subres, 'Call' );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_270 === FALSE) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = array_pop($stack);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_274 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_274 = FALSE; break; }
|
|
|
|
$_274 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_274 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_274 === FALSE) { return FALSE; }
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Require_Call(&$res, $sub) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$res['php'] = "Requirements::".$sub['Method']['text'].'('.$sub['CallArguments']['php'].');';
|
|
|
|
}
|
2013-02-14 08:31:40 +01:00
|
|
|
|
2011-02-28 04:12:41 +01:00
|
|
|
|
|
|
|
/* CacheBlockArgument:
|
|
|
|
!( "if " | "unless " )
|
|
|
|
(
|
|
|
|
:DollarMarkedLookup |
|
|
|
|
:QuotedString |
|
|
|
|
:Lookup
|
|
|
|
) */
|
|
|
|
protected $match_CacheBlockArgument_typestack = array('CacheBlockArgument');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_CacheBlockArgument ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "CacheBlockArgument"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_294 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_282 = $result;
|
|
|
|
$pos_282 = $this->pos;
|
|
|
|
$_281 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$_279 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_276 = $result;
|
|
|
|
$pos_276 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'if ' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_279 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_276;
|
|
|
|
$this->pos = $pos_276;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'unless ' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_279 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_276;
|
|
|
|
$this->pos = $pos_276;
|
|
|
|
$_279 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_279 === FALSE) { $_281 = FALSE; break; }
|
|
|
|
$_281 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_281 === TRUE ) {
|
|
|
|
$result = $res_282;
|
|
|
|
$this->pos = $pos_282;
|
|
|
|
$_294 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_281 === FALSE) {
|
|
|
|
$result = $res_282;
|
|
|
|
$this->pos = $pos_282;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$_292 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$_290 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_283 = $result;
|
|
|
|
$pos_283 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'DollarMarkedLookup'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "DollarMarkedLookup" );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_290 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_283;
|
|
|
|
$this->pos = $pos_283;
|
|
|
|
$_288 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_285 = $result;
|
|
|
|
$pos_285 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "QuotedString" );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_288 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_285;
|
|
|
|
$this->pos = $pos_285;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Lookup" );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_288 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_285;
|
|
|
|
$this->pos = $pos_285;
|
|
|
|
$_288 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_288 === TRUE ) { $_290 = TRUE; break; }
|
|
|
|
$result = $res_283;
|
|
|
|
$this->pos = $pos_283;
|
|
|
|
$_290 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_290 === FALSE) { $_292 = FALSE; break; }
|
|
|
|
$_292 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_292 === FALSE) { $_294 = FALSE; break; }
|
|
|
|
$_294 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_294 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_294 === FALSE) { return FALSE; }
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function CacheBlockArgument_DollarMarkedLookup(&$res, $sub) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$res['php'] = $sub['Lookup']['php'];
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function CacheBlockArgument_QuotedString(&$res, $sub) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$res['php'] = "'" . str_replace("'", "\\'", $sub['String']['text']) . "'";
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function CacheBlockArgument_Lookup(&$res, $sub) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$res['php'] = $sub['php'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* CacheBlockArguments: CacheBlockArgument ( < "," < CacheBlockArgument )* */
|
|
|
|
protected $match_CacheBlockArguments_typestack = array('CacheBlockArguments');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_CacheBlockArguments ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "CacheBlockArguments"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_303 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
$matcher = 'match_'.'CacheBlockArgument'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_303 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
while (true) {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_302 = $result;
|
|
|
|
$pos_302 = $this->pos;
|
|
|
|
$_301 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (substr($this->string,$this->pos,1) == ',') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= ',';
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_301 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
$matcher = 'match_'.'CacheBlockArgument'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_301 = FALSE; break; }
|
|
|
|
$_301 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_301 === FALSE) {
|
|
|
|
$result = $res_302;
|
|
|
|
$this->pos = $pos_302;
|
|
|
|
unset( $res_302 );
|
|
|
|
unset( $pos_302 );
|
2011-02-28 04:12:41 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$_303 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_303 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_303 === FALSE) { return FALSE; }
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function CacheBlockArguments_CacheBlockArgument(&$res, $sub) {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (!empty($res['php'])) $res['php'] .= ".'_'.";
|
|
|
|
else $res['php'] = '';
|
|
|
|
|
|
|
|
$res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']);
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
/* CacheBlockTemplate: (Comment | Translate | If | Require | OldI18NTag | Include | ClosedBlock |
|
|
|
|
OpenBlock | MalformedBlock | Injection | Text)+ */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_CacheBlockTemplate_typestack = array('CacheBlockTemplate','Template');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_CacheBlockTemplate ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "CacheBlockTemplate"; $result = $this->construct($matchrule, $matchrule, array('TemplateMatcher' => 'CacheRestrictedTemplate'));
|
|
|
|
$count = 0;
|
|
|
|
while (true) {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_347 = $result;
|
|
|
|
$pos_347 = $this->pos;
|
|
|
|
$_346 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$_344 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_305 = $result;
|
|
|
|
$pos_305 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_344 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_305;
|
|
|
|
$this->pos = $pos_305;
|
|
|
|
$_342 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_307 = $result;
|
|
|
|
$pos_307 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_342 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_307;
|
|
|
|
$this->pos = $pos_307;
|
|
|
|
$_340 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_309 = $result;
|
|
|
|
$pos_309 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_340 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_309;
|
|
|
|
$this->pos = $pos_309;
|
|
|
|
$_338 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_311 = $result;
|
|
|
|
$pos_311 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_338 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_311;
|
|
|
|
$this->pos = $pos_311;
|
|
|
|
$_336 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_313 = $result;
|
|
|
|
$pos_313 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_336 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_313;
|
|
|
|
$this->pos = $pos_313;
|
|
|
|
$_334 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_315 = $result;
|
|
|
|
$pos_315 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_334 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_315;
|
|
|
|
$this->pos = $pos_315;
|
|
|
|
$_332 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_317 = $result;
|
|
|
|
$pos_317 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_332 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_317;
|
|
|
|
$this->pos = $pos_317;
|
|
|
|
$_330 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_319 = $result;
|
|
|
|
$pos_319 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_330 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_319;
|
|
|
|
$this->pos = $pos_319;
|
|
|
|
$_328 = NULL;
|
2012-04-11 11:34:27 +02:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_321 = $result;
|
|
|
|
$pos_321 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos;
|
2012-04-11 11:34:27 +02:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_328 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_321;
|
|
|
|
$this->pos = $pos_321;
|
|
|
|
$_326 = NULL;
|
2012-04-16 07:37:57 +02:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_323 = $result;
|
|
|
|
$pos_323 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_326 = TRUE; break;
|
2012-04-16 07:37:57 +02:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_323;
|
|
|
|
$this->pos = $pos_323;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_326 = TRUE; break;
|
2012-04-16 07:37:57 +02:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_323;
|
|
|
|
$this->pos = $pos_323;
|
|
|
|
$_326 = FALSE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_326 === TRUE ) { $_328 = TRUE; break; }
|
|
|
|
$result = $res_321;
|
|
|
|
$this->pos = $pos_321;
|
|
|
|
$_328 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2012-04-11 11:34:27 +02:00
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_328 === TRUE ) { $_330 = TRUE; break; }
|
|
|
|
$result = $res_319;
|
|
|
|
$this->pos = $pos_319;
|
|
|
|
$_330 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_330 === TRUE ) { $_332 = TRUE; break; }
|
|
|
|
$result = $res_317;
|
|
|
|
$this->pos = $pos_317;
|
|
|
|
$_332 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_332 === TRUE ) { $_334 = TRUE; break; }
|
|
|
|
$result = $res_315;
|
|
|
|
$this->pos = $pos_315;
|
|
|
|
$_334 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_334 === TRUE ) { $_336 = TRUE; break; }
|
|
|
|
$result = $res_313;
|
|
|
|
$this->pos = $pos_313;
|
|
|
|
$_336 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_336 === TRUE ) { $_338 = TRUE; break; }
|
|
|
|
$result = $res_311;
|
|
|
|
$this->pos = $pos_311;
|
|
|
|
$_338 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_338 === TRUE ) { $_340 = TRUE; break; }
|
|
|
|
$result = $res_309;
|
|
|
|
$this->pos = $pos_309;
|
|
|
|
$_340 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_340 === TRUE ) { $_342 = TRUE; break; }
|
|
|
|
$result = $res_307;
|
|
|
|
$this->pos = $pos_307;
|
|
|
|
$_342 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_342 === TRUE ) { $_344 = TRUE; break; }
|
|
|
|
$result = $res_305;
|
|
|
|
$this->pos = $pos_305;
|
|
|
|
$_344 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_344 === FALSE) { $_346 = FALSE; break; }
|
|
|
|
$_346 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_346 === FALSE) {
|
|
|
|
$result = $res_347;
|
|
|
|
$this->pos = $pos_347;
|
|
|
|
unset( $res_347 );
|
|
|
|
unset( $pos_347 );
|
2011-02-28 04:12:41 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
$count += 1;
|
|
|
|
}
|
|
|
|
if ($count > 0) { return $this->finalise($result); }
|
|
|
|
else { return FALSE; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* UncachedBlock:
|
|
|
|
'<%' < "uncached" < CacheBlockArguments? ( < Conditional:("if"|"unless") > Condition:IfArgument )? > '%>'
|
|
|
|
Template:$TemplateMatcher?
|
2012-09-26 23:34:00 +02:00
|
|
|
'<%' < 'end_' ("uncached"|"cached"|"cacheblock") > '%>' */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_UncachedBlock_typestack = array('UncachedBlock');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_UncachedBlock ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "UncachedBlock"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_384 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_384 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_384 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_352 = $result;
|
|
|
|
$pos_352 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'CacheBlockArguments'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
|
|
|
else {
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_352;
|
|
|
|
$this->pos = $pos_352;
|
|
|
|
unset( $res_352 );
|
|
|
|
unset( $pos_352 );
|
|
|
|
}
|
|
|
|
$res_364 = $result;
|
|
|
|
$pos_364 = $this->pos;
|
|
|
|
$_363 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Conditional" );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_359 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$_357 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_354 = $result;
|
|
|
|
$pos_354 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'if' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_357 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_354;
|
|
|
|
$this->pos = $pos_354;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'unless' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_357 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_354;
|
|
|
|
$this->pos = $pos_354;
|
|
|
|
$_357 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_357 === FALSE) { $_359 = FALSE; break; }
|
|
|
|
$_359 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_359 === TRUE ) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = $result; $result = array_pop($stack);
|
|
|
|
$this->store( $result, $subres, 'Conditional' );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_359 === FALSE) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = array_pop($stack);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_363 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
$matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Condition" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_363 = FALSE; break; }
|
|
|
|
$_363 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_363 === FALSE) {
|
|
|
|
$result = $res_364;
|
|
|
|
$this->pos = $pos_364;
|
|
|
|
unset( $res_364 );
|
|
|
|
unset( $pos_364 );
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_384 = FALSE; break; }
|
|
|
|
$res_367 = $result;
|
|
|
|
$pos_367 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Template" );
|
|
|
|
}
|
|
|
|
else {
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_367;
|
|
|
|
$this->pos = $pos_367;
|
|
|
|
unset( $res_367 );
|
|
|
|
unset( $pos_367 );
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_384 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_384 = FALSE; break; }
|
|
|
|
$_380 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$_378 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_371 = $result;
|
|
|
|
$pos_371 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_378 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_371;
|
|
|
|
$this->pos = $pos_371;
|
|
|
|
$_376 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_373 = $result;
|
|
|
|
$pos_373 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_376 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_373;
|
|
|
|
$this->pos = $pos_373;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_376 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_373;
|
|
|
|
$this->pos = $pos_373;
|
|
|
|
$_376 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_376 === TRUE ) { $_378 = TRUE; break; }
|
|
|
|
$result = $res_371;
|
|
|
|
$this->pos = $pos_371;
|
|
|
|
$_378 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_378 === FALSE) { $_380 = FALSE; break; }
|
|
|
|
$_380 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_380 === FALSE) { $_384 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_384 = FALSE; break; }
|
|
|
|
$_384 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_384 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_384 === FALSE) { return FALSE; }
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function UncachedBlock_Template(&$res, $sub){
|
2011-02-28 04:12:41 +01:00
|
|
|
$res['php'] = $sub['php'];
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
/* CacheRestrictedTemplate: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock |
|
|
|
|
OpenBlock | MalformedBlock | Injection | Text)+ */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_CacheRestrictedTemplate_typestack = array('CacheRestrictedTemplate','Template');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_CacheRestrictedTemplate ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "CacheRestrictedTemplate"; $result = $this->construct($matchrule, $matchrule, null);
|
|
|
|
$count = 0;
|
|
|
|
while (true) {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_436 = $result;
|
|
|
|
$pos_436 = $this->pos;
|
|
|
|
$_435 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$_433 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_386 = $result;
|
|
|
|
$pos_386 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_433 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_386;
|
|
|
|
$this->pos = $pos_386;
|
|
|
|
$_431 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_388 = $result;
|
|
|
|
$pos_388 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_431 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_388;
|
|
|
|
$this->pos = $pos_388;
|
|
|
|
$_429 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_390 = $result;
|
|
|
|
$pos_390 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_429 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_390;
|
|
|
|
$this->pos = $pos_390;
|
|
|
|
$_427 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_392 = $result;
|
|
|
|
$pos_392 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_427 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_392;
|
|
|
|
$this->pos = $pos_392;
|
|
|
|
$_425 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_394 = $result;
|
|
|
|
$pos_394 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_425 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_394;
|
|
|
|
$this->pos = $pos_394;
|
|
|
|
$_423 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_396 = $result;
|
|
|
|
$pos_396 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_423 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_396;
|
|
|
|
$this->pos = $pos_396;
|
|
|
|
$_421 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_398 = $result;
|
|
|
|
$pos_398 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_421 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_398;
|
|
|
|
$this->pos = $pos_398;
|
|
|
|
$_419 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_400 = $result;
|
|
|
|
$pos_400 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_419 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_400;
|
|
|
|
$this->pos = $pos_400;
|
|
|
|
$_417 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_402 = $result;
|
|
|
|
$pos_402 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_417 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_402;
|
|
|
|
$this->pos = $pos_402;
|
|
|
|
$_415 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_404 = $result;
|
|
|
|
$pos_404 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_415 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_404;
|
|
|
|
$this->pos = $pos_404;
|
|
|
|
$_413 = NULL;
|
2012-04-11 11:34:27 +02:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_406 = $result;
|
|
|
|
$pos_406 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos;
|
2012-04-11 11:34:27 +02:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_413 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_406;
|
|
|
|
$this->pos = $pos_406;
|
|
|
|
$_411 = NULL;
|
2012-04-16 07:37:57 +02:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_408 = $result;
|
|
|
|
$pos_408 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_411 = TRUE; break;
|
2012-04-16 07:37:57 +02:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_408;
|
|
|
|
$this->pos = $pos_408;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_411 = TRUE; break;
|
2012-04-16 07:37:57 +02:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_408;
|
|
|
|
$this->pos = $pos_408;
|
|
|
|
$_411 = FALSE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_411 === TRUE ) { $_413 = TRUE; break; }
|
|
|
|
$result = $res_406;
|
|
|
|
$this->pos = $pos_406;
|
|
|
|
$_413 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2012-04-11 11:34:27 +02:00
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_413 === TRUE ) { $_415 = TRUE; break; }
|
|
|
|
$result = $res_404;
|
|
|
|
$this->pos = $pos_404;
|
|
|
|
$_415 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_415 === TRUE ) { $_417 = TRUE; break; }
|
|
|
|
$result = $res_402;
|
|
|
|
$this->pos = $pos_402;
|
|
|
|
$_417 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_417 === TRUE ) { $_419 = TRUE; break; }
|
|
|
|
$result = $res_400;
|
|
|
|
$this->pos = $pos_400;
|
|
|
|
$_419 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_419 === TRUE ) { $_421 = TRUE; break; }
|
|
|
|
$result = $res_398;
|
|
|
|
$this->pos = $pos_398;
|
|
|
|
$_421 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_421 === TRUE ) { $_423 = TRUE; break; }
|
|
|
|
$result = $res_396;
|
|
|
|
$this->pos = $pos_396;
|
|
|
|
$_423 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_423 === TRUE ) { $_425 = TRUE; break; }
|
|
|
|
$result = $res_394;
|
|
|
|
$this->pos = $pos_394;
|
|
|
|
$_425 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_425 === TRUE ) { $_427 = TRUE; break; }
|
|
|
|
$result = $res_392;
|
|
|
|
$this->pos = $pos_392;
|
|
|
|
$_427 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_427 === TRUE ) { $_429 = TRUE; break; }
|
|
|
|
$result = $res_390;
|
|
|
|
$this->pos = $pos_390;
|
|
|
|
$_429 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_429 === TRUE ) { $_431 = TRUE; break; }
|
|
|
|
$result = $res_388;
|
|
|
|
$this->pos = $pos_388;
|
|
|
|
$_431 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_431 === TRUE ) { $_433 = TRUE; break; }
|
|
|
|
$result = $res_386;
|
|
|
|
$this->pos = $pos_386;
|
|
|
|
$_433 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_433 === FALSE) { $_435 = FALSE; break; }
|
|
|
|
$_435 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_435 === FALSE) {
|
|
|
|
$result = $res_436;
|
|
|
|
$this->pos = $pos_436;
|
|
|
|
unset( $res_436 );
|
|
|
|
unset( $pos_436 );
|
2011-02-28 04:12:41 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
$count += 1;
|
|
|
|
}
|
|
|
|
if ($count > 0) { return $this->finalise($result); }
|
|
|
|
else { return FALSE; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function CacheRestrictedTemplate_CacheBlock(&$res, $sub) {
|
|
|
|
throw new SSTemplateParseException('You cant have cache blocks nested within with, loop or control blocks ' .
|
|
|
|
'that are within cache blocks', $this);
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function CacheRestrictedTemplate_UncachedBlock(&$res, $sub) {
|
|
|
|
throw new SSTemplateParseException('You cant have uncache blocks nested within with, loop or control blocks ' .
|
|
|
|
'that are within cache blocks', $this);
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* CacheBlock:
|
2012-09-26 23:34:00 +02:00
|
|
|
'<%' < CacheTag:("cached"|"cacheblock") < (CacheBlockArguments)? ( < Conditional:("if"|"unless") >
|
|
|
|
Condition:IfArgument )? > '%>'
|
2011-02-28 04:12:41 +01:00
|
|
|
(CacheBlock | UncachedBlock | CacheBlockTemplate)*
|
|
|
|
'<%' < 'end_' ("cached"|"uncached"|"cacheblock") > '%>' */
|
|
|
|
protected $match_CacheBlock_typestack = array('CacheBlock');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_CacheBlock ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "CacheBlock"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_491 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_491 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "CacheTag" );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_444 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$_442 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_439 = $result;
|
|
|
|
$pos_439 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_442 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_439;
|
|
|
|
$this->pos = $pos_439;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_442 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_439;
|
|
|
|
$this->pos = $pos_439;
|
|
|
|
$_442 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_442 === FALSE) { $_444 = FALSE; break; }
|
|
|
|
$_444 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_444 === TRUE ) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = $result; $result = array_pop($stack);
|
|
|
|
$this->store( $result, $subres, 'CacheTag' );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_444 === FALSE) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = array_pop($stack);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_491 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_449 = $result;
|
|
|
|
$pos_449 = $this->pos;
|
|
|
|
$_448 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'CacheBlockArguments'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_448 = FALSE; break; }
|
|
|
|
$_448 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_448 === FALSE) {
|
|
|
|
$result = $res_449;
|
|
|
|
$this->pos = $pos_449;
|
|
|
|
unset( $res_449 );
|
|
|
|
unset( $pos_449 );
|
|
|
|
}
|
|
|
|
$res_461 = $result;
|
|
|
|
$pos_461 = $this->pos;
|
|
|
|
$_460 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Conditional" );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_456 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$_454 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_451 = $result;
|
|
|
|
$pos_451 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'if' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_454 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_451;
|
|
|
|
$this->pos = $pos_451;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'unless' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_454 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_451;
|
|
|
|
$this->pos = $pos_451;
|
|
|
|
$_454 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_454 === FALSE) { $_456 = FALSE; break; }
|
|
|
|
$_456 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_456 === TRUE ) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = $result; $result = array_pop($stack);
|
|
|
|
$this->store( $result, $subres, 'Conditional' );
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_456 === FALSE) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = array_pop($stack);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_460 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Condition" );
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_460 = FALSE; break; }
|
|
|
|
$_460 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_460 === FALSE) {
|
|
|
|
$result = $res_461;
|
|
|
|
$this->pos = $pos_461;
|
|
|
|
unset( $res_461 );
|
|
|
|
unset( $pos_461 );
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_491 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
while (true) {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_474 = $result;
|
|
|
|
$pos_474 = $this->pos;
|
|
|
|
$_473 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$_471 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_464 = $result;
|
|
|
|
$pos_464 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_471 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_464;
|
|
|
|
$this->pos = $pos_464;
|
|
|
|
$_469 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_466 = $result;
|
|
|
|
$pos_466 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_469 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_466;
|
|
|
|
$this->pos = $pos_466;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'CacheBlockTemplate'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_469 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_466;
|
|
|
|
$this->pos = $pos_466;
|
|
|
|
$_469 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_469 === TRUE ) { $_471 = TRUE; break; }
|
|
|
|
$result = $res_464;
|
|
|
|
$this->pos = $pos_464;
|
|
|
|
$_471 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_471 === FALSE) { $_473 = FALSE; break; }
|
|
|
|
$_473 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_473 === FALSE) {
|
|
|
|
$result = $res_474;
|
|
|
|
$this->pos = $pos_474;
|
|
|
|
unset( $res_474 );
|
|
|
|
unset( $pos_474 );
|
2011-02-28 04:12:41 +01:00
|
|
|
break;
|
|
|
|
}
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_491 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_491 = FALSE; break; }
|
|
|
|
$_487 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$_485 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_478 = $result;
|
|
|
|
$pos_478 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_485 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_478;
|
|
|
|
$this->pos = $pos_478;
|
|
|
|
$_483 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_480 = $result;
|
|
|
|
$pos_480 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_483 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_480;
|
|
|
|
$this->pos = $pos_480;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_483 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_480;
|
|
|
|
$this->pos = $pos_480;
|
|
|
|
$_483 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_483 === TRUE ) { $_485 = TRUE; break; }
|
|
|
|
$result = $res_478;
|
|
|
|
$this->pos = $pos_478;
|
|
|
|
$_485 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_485 === FALSE) { $_487 = FALSE; break; }
|
|
|
|
$_487 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_487 === FALSE) { $_491 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_491 = FALSE; break; }
|
|
|
|
$_491 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_491 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_491 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function CacheBlock__construct(&$res){
|
2011-02-28 04:12:41 +01:00
|
|
|
$res['subblocks'] = 0;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function CacheBlock_CacheBlockArguments(&$res, $sub){
|
2011-02-28 04:12:41 +01:00
|
|
|
$res['key'] = !empty($sub['php']) ? $sub['php'] : '';
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function CacheBlock_Condition(&$res, $sub){
|
2011-02-28 04:12:41 +01:00
|
|
|
$res['condition'] = ($res['Conditional']['text'] == 'if' ? '(' : '!(') . $sub['php'] . ') && ';
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function CacheBlock_CacheBlock(&$res, $sub){
|
2011-02-28 04:12:41 +01:00
|
|
|
$res['php'] .= $sub['php'];
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function CacheBlock_UncachedBlock(&$res, $sub){
|
2011-02-28 04:12:41 +01:00
|
|
|
$res['php'] .= $sub['php'];
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function CacheBlock_CacheBlockTemplate(&$res, $sub){
|
2011-02-28 04:12:41 +01:00
|
|
|
// Get the block counter
|
|
|
|
$block = ++$res['subblocks'];
|
2012-09-26 23:34:00 +02:00
|
|
|
// Build the key for this block from the passed cache key, the block index, and the sha hash of the template
|
|
|
|
// itself
|
|
|
|
$key = "'" . sha1($sub['php']) . (isset($res['key']) && $res['key'] ? "_'.sha1(".$res['key'].")" : "'") .
|
|
|
|
".'_$block'";
|
2011-02-28 04:12:41 +01:00
|
|
|
// Get any condition
|
|
|
|
$condition = isset($res['condition']) ? $res['condition'] : '';
|
|
|
|
|
|
|
|
$res['php'] .= 'if ('.$condition.'($partial = $cache->load('.$key.'))) $val .= $partial;' . PHP_EOL;
|
|
|
|
$res['php'] .= 'else { $oldval = $val; $val = "";' . PHP_EOL;
|
|
|
|
$res['php'] .= $sub['php'] . PHP_EOL;
|
|
|
|
$res['php'] .= $condition . ' $cache->save($val); $val = $oldval . $val;' . PHP_EOL;
|
|
|
|
$res['php'] .= '}';
|
|
|
|
}
|
|
|
|
|
2012-04-16 06:59:56 +02:00
|
|
|
/* OldTPart: "_t" N "(" N QuotedString (N "," N CallArguments)? N ")" N (";")? */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_OldTPart_typestack = array('OldTPart');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_OldTPart ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "OldTPart"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_510 = NULL;
|
2011-02-21 05:44:46 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '_t' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_510 = FALSE; break; }
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_510 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == '(') {
|
2011-02-21 05:44:46 +01:00
|
|
|
$this->pos += 1;
|
2011-02-28 04:12:41 +01:00
|
|
|
$result["text"] .= '(';
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_510 = FALSE; break; }
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_510 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-21 05:44:46 +01:00
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_510 = FALSE; break; }
|
|
|
|
$res_503 = $result;
|
|
|
|
$pos_503 = $this->pos;
|
|
|
|
$_502 = NULL;
|
2011-02-21 05:44:46 +01:00
|
|
|
do {
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_502 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == ',') {
|
2011-02-21 05:44:46 +01:00
|
|
|
$this->pos += 1;
|
2011-02-28 04:12:41 +01:00
|
|
|
$result["text"] .= ',';
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_502 = FALSE; break; }
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_502 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-21 05:44:46 +01:00
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_502 = FALSE; break; }
|
|
|
|
$_502 = TRUE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_502 === FALSE) {
|
|
|
|
$result = $res_503;
|
|
|
|
$this->pos = $pos_503;
|
|
|
|
unset( $res_503 );
|
|
|
|
unset( $pos_503 );
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_510 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == ')') {
|
2011-02-21 05:44:46 +01:00
|
|
|
$this->pos += 1;
|
2011-02-28 04:12:41 +01:00
|
|
|
$result["text"] .= ')';
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_510 = FALSE; break; }
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_510 = FALSE; break; }
|
|
|
|
$res_509 = $result;
|
|
|
|
$pos_509 = $this->pos;
|
|
|
|
$_508 = NULL;
|
2012-04-16 06:59:56 +02:00
|
|
|
do {
|
|
|
|
if (substr($this->string,$this->pos,1) == ';') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= ';';
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_508 = FALSE; break; }
|
|
|
|
$_508 = TRUE; break;
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_508 === FALSE) {
|
|
|
|
$result = $res_509;
|
|
|
|
$this->pos = $pos_509;
|
|
|
|
unset( $res_509 );
|
|
|
|
unset( $pos_509 );
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$_510 = TRUE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_510 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_510 === FALSE) { return FALSE; }
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* N: / [\s\n]* / */
|
|
|
|
protected $match_N_typestack = array('N');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_N ($stack = array()) {
|
2012-04-16 06:59:56 +02:00
|
|
|
$matchrule = "N"; $result = $this->construct($matchrule, $matchrule, null);
|
|
|
|
if (( $subres = $this->rx( '/ [\s\n]* /' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
|
|
|
return $this->finalise($result);
|
|
|
|
}
|
|
|
|
else { return FALSE; }
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function OldTPart__construct(&$res) {
|
2011-02-21 05:44:46 +01:00
|
|
|
$res['php'] = "_t(";
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function OldTPart_QuotedString(&$res, $sub) {
|
2011-02-21 05:44:46 +01:00
|
|
|
$entity = $sub['String']['text'];
|
|
|
|
if (strpos($entity, '.') === false) {
|
|
|
|
$res['php'] .= "\$scope->XML_val('I18NNamespace').'.$entity'";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$res['php'] .= "'$entity'";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function OldTPart_CallArguments(&$res, $sub) {
|
2011-02-21 05:44:46 +01:00
|
|
|
$res['php'] .= ',' . $sub['php'];
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function OldTPart__finalise(&$res) {
|
2011-02-21 05:44:46 +01:00
|
|
|
$res['php'] .= ')';
|
|
|
|
}
|
|
|
|
|
|
|
|
/* OldTTag: "<%" < OldTPart > "%>" */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_OldTTag_typestack = array('OldTTag');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_OldTTag ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "OldTTag"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_518 = NULL;
|
2011-02-21 05:44:46 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_518 = FALSE; break; }
|
2011-02-21 05:44:46 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'OldTPart'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-21 05:44:46 +01:00
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_518 = FALSE; break; }
|
2011-02-21 05:44:46 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_518 = FALSE; break; }
|
|
|
|
$_518 = TRUE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_518 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_518 === FALSE) { return FALSE; }
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function OldTTag_OldTPart(&$res, $sub) {
|
2011-02-21 05:44:46 +01:00
|
|
|
$res['php'] = $sub['php'];
|
|
|
|
}
|
2013-02-14 08:31:40 +01:00
|
|
|
|
2011-02-21 05:44:46 +01:00
|
|
|
/* OldSprintfTag: "<%" < "sprintf" < "(" < OldTPart < "," < CallArguments > ")" > "%>" */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_OldSprintfTag_typestack = array('OldSprintfTag');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_OldSprintfTag ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "OldSprintfTag"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_535 = NULL;
|
2011-02-21 05:44:46 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_535 = FALSE; break; }
|
2011-02-21 05:44:46 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'sprintf' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_535 = FALSE; break; }
|
2011-02-21 05:44:46 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == '(') {
|
2011-02-21 05:44:46 +01:00
|
|
|
$this->pos += 1;
|
2011-02-28 04:12:41 +01:00
|
|
|
$result["text"] .= '(';
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_535 = FALSE; break; }
|
2011-02-21 05:44:46 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'OldTPart'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-21 05:44:46 +01:00
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_535 = FALSE; break; }
|
2011-02-21 05:44:46 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == ',') {
|
2011-02-21 05:44:46 +01:00
|
|
|
$this->pos += 1;
|
2011-02-28 04:12:41 +01:00
|
|
|
$result["text"] .= ',';
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_535 = FALSE; break; }
|
2011-02-21 05:44:46 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-21 05:44:46 +01:00
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_535 = FALSE; break; }
|
2011-02-21 05:44:46 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == ')') {
|
2011-02-21 05:44:46 +01:00
|
|
|
$this->pos += 1;
|
2011-02-28 04:12:41 +01:00
|
|
|
$result["text"] .= ')';
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_535 = FALSE; break; }
|
2011-02-21 05:44:46 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_535 = FALSE; break; }
|
|
|
|
$_535 = TRUE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_535 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_535 === FALSE) { return FALSE; }
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function OldSprintfTag__construct(&$res) {
|
2011-02-21 05:44:46 +01:00
|
|
|
$res['php'] = "sprintf(";
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function OldSprintfTag_OldTPart(&$res, $sub) {
|
2011-02-21 05:44:46 +01:00
|
|
|
$res['php'] .= $sub['php'];
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function OldSprintfTag_CallArguments(&$res, $sub) {
|
2011-02-21 05:44:46 +01:00
|
|
|
$res['php'] .= ',' . $sub['php'] . ')';
|
|
|
|
}
|
|
|
|
|
|
|
|
/* OldI18NTag: OldSprintfTag | OldTTag */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_OldI18NTag_typestack = array('OldI18NTag');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_OldI18NTag ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "OldI18NTag"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_540 = NULL;
|
2011-02-21 05:44:46 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_537 = $result;
|
|
|
|
$pos_537 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'OldSprintfTag'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-21 05:44:46 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_540 = TRUE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_537;
|
|
|
|
$this->pos = $pos_537;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'OldTTag'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-21 05:44:46 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_540 = TRUE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_537;
|
|
|
|
$this->pos = $pos_537;
|
|
|
|
$_540 = FALSE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_540 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_540 === FALSE) { return FALSE; }
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function OldI18NTag_STR(&$res, $sub) {
|
2011-02-21 05:44:46 +01:00
|
|
|
$res['php'] = '$val .= ' . $sub['php'] . ';';
|
|
|
|
}
|
2012-04-11 11:34:27 +02:00
|
|
|
|
|
|
|
/* NamedArgument: Name:Word "=" Value:Argument */
|
|
|
|
protected $match_NamedArgument_typestack = array('NamedArgument');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_NamedArgument ($stack = array()) {
|
2012-04-11 11:34:27 +02:00
|
|
|
$matchrule = "NamedArgument"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_545 = NULL;
|
2012-04-11 11:34:27 +02:00
|
|
|
do {
|
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Name" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_545 = FALSE; break; }
|
2012-04-11 11:34:27 +02:00
|
|
|
if (substr($this->string,$this->pos,1) == '=') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '=';
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_545 = FALSE; break; }
|
2012-04-11 11:34:27 +02:00
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Value" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_545 = FALSE; break; }
|
|
|
|
$_545 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_545 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_545 === FALSE) { return FALSE; }
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function NamedArgument_Name(&$res, $sub) {
|
2012-04-11 11:34:27 +02:00
|
|
|
$res['php'] = "'" . $sub['text'] . "' => ";
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function NamedArgument_Value(&$res, $sub) {
|
2013-02-14 08:31:40 +01:00
|
|
|
switch($sub['ArgumentMode']) {
|
|
|
|
case 'string':
|
|
|
|
$res['php'] .= $sub['php'];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'default':
|
|
|
|
$res['php'] .= $sub['string_php'];
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
$res['php'] .= str_replace('$$FINAL', 'obj', $sub['php']) . '->self()';
|
|
|
|
break;
|
|
|
|
}
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Include: "<%" < "include" < Template:Word < (NamedArgument ( < "," < NamedArgument )*)? > "%>" */
|
|
|
|
protected $match_Include_typestack = array('Include');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_Include ($stack = array()) {
|
2012-04-11 11:34:27 +02:00
|
|
|
$matchrule = "Include"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_564 = NULL;
|
2012-04-11 11:34:27 +02:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_564 = FALSE; break; }
|
2012-04-11 11:34:27 +02:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (( $subres = $this->literal( 'include' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_564 = FALSE; break; }
|
2012-04-11 11:34:27 +02:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Template" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_564 = FALSE; break; }
|
2012-04-11 11:34:27 +02:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_561 = $result;
|
|
|
|
$pos_561 = $this->pos;
|
|
|
|
$_560 = NULL;
|
2012-04-11 11:34:27 +02:00
|
|
|
do {
|
|
|
|
$matcher = 'match_'.'NamedArgument'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) { $this->store( $result, $subres ); }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_560 = FALSE; break; }
|
2012-04-11 11:34:27 +02:00
|
|
|
while (true) {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_559 = $result;
|
|
|
|
$pos_559 = $this->pos;
|
|
|
|
$_558 = NULL;
|
2012-04-11 11:34:27 +02:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (substr($this->string,$this->pos,1) == ',') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= ',';
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_558 = FALSE; break; }
|
2012-04-11 11:34:27 +02:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
$matcher = 'match_'.'NamedArgument'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_558 = FALSE; break; }
|
|
|
|
$_558 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_558 === FALSE) {
|
|
|
|
$result = $res_559;
|
|
|
|
$this->pos = $pos_559;
|
|
|
|
unset( $res_559 );
|
|
|
|
unset( $pos_559 );
|
2012-04-11 11:34:27 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$_560 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_560 === FALSE) {
|
|
|
|
$result = $res_561;
|
|
|
|
$this->pos = $pos_561;
|
|
|
|
unset( $res_561 );
|
|
|
|
unset( $pos_561 );
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_564 = FALSE; break; }
|
|
|
|
$_564 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_564 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_564 === FALSE) { return FALSE; }
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Include__construct(&$res){
|
2012-04-11 11:34:27 +02:00
|
|
|
$res['arguments'] = array();
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Include_Template(&$res, $sub){
|
2012-04-11 11:34:27 +02:00
|
|
|
$res['template'] = "'" . $sub['text'] . "'";
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Include_NamedArgument(&$res, $sub){
|
2012-04-11 11:34:27 +02:00
|
|
|
$res['arguments'][] = $sub['php'];
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Include__finalise(&$res){
|
2012-04-11 11:34:27 +02:00
|
|
|
$template = $res['template'];
|
|
|
|
$arguments = $res['arguments'];
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
$res['php'] = '$val .= SSViewer::execute_template('.$template.', $scope->getItem(), array(' .
|
2013-06-26 14:57:53 +02:00
|
|
|
implode(',', $arguments)."), \$scope);\n";
|
2012-04-11 11:34:27 +02:00
|
|
|
|
|
|
|
if($this->includeDebuggingComments) { // Add include filename comments on dev sites
|
|
|
|
$res['php'] =
|
|
|
|
'$val .= \'<!-- include '.addslashes($template).' -->\';'. "\n".
|
|
|
|
$res['php'].
|
|
|
|
'$val .= \'<!-- end include '.addslashes($template).' -->\';'. "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-09 05:31:16 +01:00
|
|
|
/* BlockArguments: :Argument ( < "," < :Argument)* */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_BlockArguments_typestack = array('BlockArguments');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_BlockArguments ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "BlockArguments"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_573 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Argument" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_573 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
while (true) {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_572 = $result;
|
|
|
|
$pos_572 = $this->pos;
|
|
|
|
$_571 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == ',') {
|
2011-02-09 05:31:16 +01:00
|
|
|
$this->pos += 1;
|
2011-02-28 04:12:41 +01:00
|
|
|
$result["text"] .= ',';
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_571 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Argument" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_571 = FALSE; break; }
|
|
|
|
$_571 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_571 === FALSE) {
|
|
|
|
$result = $res_572;
|
|
|
|
$this->pos = $pos_572;
|
|
|
|
unset( $res_572 );
|
|
|
|
unset( $pos_572 );
|
2011-02-09 05:31:16 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$_573 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_573 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_573 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
/* NotBlockTag: "end_" | (("if" | "else_if" | "else" | "require" | "cached" | "uncached" | "cacheblock" | "include")]) */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_NotBlockTag_typestack = array('NotBlockTag');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_NotBlockTag ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "NotBlockTag"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_611 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_575 = $result;
|
|
|
|
$pos_575 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_611 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_575;
|
|
|
|
$this->pos = $pos_575;
|
|
|
|
$_609 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$_606 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$_604 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_577 = $result;
|
|
|
|
$pos_577 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'if' ) ) !== FALSE) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_604 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_577;
|
|
|
|
$this->pos = $pos_577;
|
|
|
|
$_602 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_579 = $result;
|
|
|
|
$pos_579 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'else_if' ) ) !== FALSE) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_602 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_579;
|
|
|
|
$this->pos = $pos_579;
|
|
|
|
$_600 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_581 = $result;
|
|
|
|
$pos_581 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'else' ) ) !== FALSE) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_600 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_581;
|
|
|
|
$this->pos = $pos_581;
|
|
|
|
$_598 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_583 = $result;
|
|
|
|
$pos_583 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'require' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_598 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_583;
|
|
|
|
$this->pos = $pos_583;
|
|
|
|
$_596 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_585 = $result;
|
|
|
|
$pos_585 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_596 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_585;
|
|
|
|
$this->pos = $pos_585;
|
|
|
|
$_594 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_587 = $result;
|
|
|
|
$pos_587 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_594 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_587;
|
|
|
|
$this->pos = $pos_587;
|
|
|
|
$_592 = NULL;
|
2012-04-11 11:34:27 +02:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_589 = $result;
|
|
|
|
$pos_589 = $this->pos;
|
2012-04-11 11:34:27 +02:00
|
|
|
if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_592 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_589;
|
|
|
|
$this->pos = $pos_589;
|
2012-04-11 11:34:27 +02:00
|
|
|
if (( $subres = $this->literal( 'include' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_592 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_589;
|
|
|
|
$this->pos = $pos_589;
|
|
|
|
$_592 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2012-04-11 11:34:27 +02:00
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_592 === TRUE ) { $_594 = TRUE; break; }
|
|
|
|
$result = $res_587;
|
|
|
|
$this->pos = $pos_587;
|
|
|
|
$_594 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_594 === TRUE ) { $_596 = TRUE; break; }
|
|
|
|
$result = $res_585;
|
|
|
|
$this->pos = $pos_585;
|
|
|
|
$_596 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_596 === TRUE ) { $_598 = TRUE; break; }
|
|
|
|
$result = $res_583;
|
|
|
|
$this->pos = $pos_583;
|
|
|
|
$_598 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_598 === TRUE ) { $_600 = TRUE; break; }
|
|
|
|
$result = $res_581;
|
|
|
|
$this->pos = $pos_581;
|
|
|
|
$_600 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_600 === TRUE ) { $_602 = TRUE; break; }
|
|
|
|
$result = $res_579;
|
|
|
|
$this->pos = $pos_579;
|
|
|
|
$_602 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_602 === TRUE ) { $_604 = TRUE; break; }
|
|
|
|
$result = $res_577;
|
|
|
|
$this->pos = $pos_577;
|
|
|
|
$_604 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_604 === FALSE) { $_606 = FALSE; break; }
|
|
|
|
$_606 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_606 === FALSE) { $_609 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_609 = FALSE; break; }
|
|
|
|
$_609 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_609 === TRUE ) { $_611 = TRUE; break; }
|
|
|
|
$result = $res_575;
|
|
|
|
$this->pos = $pos_575;
|
|
|
|
$_611 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_611 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_611 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
/* ClosedBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > Zap:'%>' Template:$TemplateMatcher?
|
|
|
|
'<%' < 'end_' '$BlockName' > '%>' */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_ClosedBlock_typestack = array('ClosedBlock');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_ClosedBlock ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "ClosedBlock"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_631 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_631 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_615 = $result;
|
|
|
|
$pos_615 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_615;
|
|
|
|
$this->pos = $pos_615;
|
|
|
|
$_631 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else {
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_615;
|
|
|
|
$this->pos = $pos_615;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "BlockName" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_631 = FALSE; break; }
|
|
|
|
$res_621 = $result;
|
|
|
|
$pos_621 = $this->pos;
|
|
|
|
$_620 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_620 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "BlockArguments" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_620 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_620 = FALSE; break; }
|
|
|
|
$_620 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_620 === FALSE) {
|
|
|
|
$result = $res_621;
|
|
|
|
$this->pos = $pos_621;
|
|
|
|
unset( $res_621 );
|
|
|
|
unset( $pos_621 );
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Zap" );
|
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$result["text"] .= $subres;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = $result; $result = array_pop($stack);
|
2011-02-09 05:31:16 +01:00
|
|
|
$this->store( $result, $subres, 'Zap' );
|
|
|
|
}
|
|
|
|
else {
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = array_pop($stack);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_631 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_624 = $result;
|
|
|
|
$pos_624 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Template" );
|
|
|
|
}
|
|
|
|
else {
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_624;
|
|
|
|
$this->pos = $pos_624;
|
|
|
|
unset( $res_624 );
|
|
|
|
unset( $pos_624 );
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_631 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_631 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( ''.$this->expression($result, $stack, 'BlockName').'' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_631 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_631 = FALSE; break; }
|
|
|
|
$_631 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_631 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_631 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* As mentioned in the parser comment, block handling is kept fairly generic for extensibility. The match rule
|
|
|
|
* builds up two important elements in the match result array:
|
|
|
|
* 'ArgumentCount' - how many arguments were passed in the opening tag
|
|
|
|
* 'Arguments' an array of the Argument match rule result arrays
|
|
|
|
*
|
|
|
|
* Once a block has successfully been matched against, it will then look for the actual handler, which should
|
2011-04-15 11:35:30 +02:00
|
|
|
* be on this class (either defined or extended on) as ClosedBlock_Handler_Name(&$res), where Name is the
|
2011-02-14 22:03:42 +01:00
|
|
|
* tag name, first letter captialized (i.e Control, Loop, With, etc).
|
|
|
|
*
|
|
|
|
* This function will be called with the match rule result array as it's first argument. It should return
|
|
|
|
* the php result of this block as it's return value, or throw an error if incorrect arguments were passed.
|
|
|
|
*/
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function ClosedBlock__construct(&$res) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['ArgumentCount'] = 0;
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function ClosedBlock_BlockArguments(&$res, $sub) {
|
2011-02-09 05:31:16 +01:00
|
|
|
if (isset($sub['Argument']['ArgumentMode'])) {
|
|
|
|
$res['Arguments'] = array($sub['Argument']);
|
|
|
|
$res['ArgumentCount'] = 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$res['Arguments'] = $sub['Argument'];
|
|
|
|
$res['ArgumentCount'] = count($res['Arguments']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function ClosedBlock__finalise(&$res) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$blockname = $res['BlockName']['text'];
|
|
|
|
|
2011-12-17 05:35:26 +01:00
|
|
|
$method = 'ClosedBlock_Handle_'.$blockname;
|
2011-02-09 05:31:16 +01:00
|
|
|
if (method_exists($this, $method)) $res['php'] = $this->$method($res);
|
|
|
|
else {
|
2012-09-26 23:34:00 +02:00
|
|
|
throw new SSTemplateParseException('Unknown closed block "'.$blockname.'" encountered. Perhaps you are ' .
|
|
|
|
'not supposed to close this block, or have mis-spelled it?', $this);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
/**
|
2011-02-18 05:06:11 +01:00
|
|
|
* This is an example of a block handler function. This one handles the loop tag.
|
2011-02-14 22:03:42 +01:00
|
|
|
*/
|
2012-09-26 23:34:00 +02:00
|
|
|
function ClosedBlock_Handle_Loop(&$res) {
|
2012-02-11 03:30:46 +01:00
|
|
|
if ($res['ArgumentCount'] > 1) {
|
2012-09-26 23:34:00 +02:00
|
|
|
throw new SSTemplateParseException('Either no or too many arguments in control block. Must be one ' .
|
|
|
|
'argument only.', $this);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-02-11 03:30:46 +01:00
|
|
|
|
|
|
|
//loop without arguments loops on the current scope
|
|
|
|
if ($res['ArgumentCount'] == 0) {
|
|
|
|
$on = '$scope->obj(\'Up\', null, true)->obj(\'Foo\', null, true)';
|
|
|
|
} else { //loop in the normal way
|
|
|
|
$arg = $res['Arguments'][0];
|
|
|
|
if ($arg['ArgumentMode'] == 'string') {
|
|
|
|
throw new SSTemplateParseException('Control block cant take string as argument.', $this);
|
|
|
|
}
|
2012-09-26 23:34:00 +02:00
|
|
|
$on = str_replace('$$FINAL', 'obj',
|
|
|
|
($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php']);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2012-02-11 03:30:46 +01:00
|
|
|
|
|
|
|
return
|
2011-02-18 05:06:11 +01:00
|
|
|
$on . '; $scope->pushScope(); while (($key = $scope->next()) !== false) {' . PHP_EOL .
|
|
|
|
$res['Template']['php'] . PHP_EOL .
|
|
|
|
'}; $scope->popScope(); ';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The deprecated closed block handler for control blocks
|
|
|
|
* @deprecated
|
|
|
|
*/
|
2012-09-26 23:34:00 +02:00
|
|
|
function ClosedBlock_Handle_Control(&$res) {
|
2013-03-19 11:43:23 +01:00
|
|
|
Deprecation::notice('3.1', '<% control %> is deprecated. Use <% with %> or <% loop %> instead.');
|
2011-02-18 05:06:11 +01:00
|
|
|
return $this->ClosedBlock_Handle_Loop($res);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The closed block handler for with blocks
|
|
|
|
*/
|
2012-09-26 23:34:00 +02:00
|
|
|
function ClosedBlock_Handle_With(&$res) {
|
2011-02-18 05:06:11 +01:00
|
|
|
if ($res['ArgumentCount'] != 1) {
|
2012-09-26 23:34:00 +02:00
|
|
|
throw new SSTemplateParseException('Either no or too many arguments in with block. Must be one ' .
|
|
|
|
'argument only.', $this);
|
2011-02-18 05:06:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$arg = $res['Arguments'][0];
|
|
|
|
if ($arg['ArgumentMode'] == 'string') {
|
|
|
|
throw new SSTemplateParseException('Control block cant take string as argument.', $this);
|
|
|
|
}
|
|
|
|
|
|
|
|
$on = str_replace('$$FINAL', 'obj', ($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php']);
|
2011-02-09 05:31:16 +01:00
|
|
|
return
|
2011-02-18 05:06:11 +01:00
|
|
|
$on . '; $scope->pushScope();' . PHP_EOL .
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['Template']['php'] . PHP_EOL .
|
2011-02-18 05:06:11 +01:00
|
|
|
'; $scope->popScope(); ';
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
2011-02-14 04:52:01 +01:00
|
|
|
/* OpenBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > '%>' */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_OpenBlock_typestack = array('OpenBlock');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_OpenBlock ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "OpenBlock"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_644 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_644 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_635 = $result;
|
|
|
|
$pos_635 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_635;
|
|
|
|
$this->pos = $pos_635;
|
|
|
|
$_644 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else {
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_635;
|
|
|
|
$this->pos = $pos_635;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
2011-02-14 04:52:01 +01:00
|
|
|
$this->store( $result, $subres, "BlockName" );
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_644 = FALSE; break; }
|
|
|
|
$res_641 = $result;
|
|
|
|
$pos_641 = $this->pos;
|
|
|
|
$_640 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_640 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "BlockArguments" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_640 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_640 = FALSE; break; }
|
|
|
|
$_640 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_640 === FALSE) {
|
|
|
|
$result = $res_641;
|
|
|
|
$this->pos = $pos_641;
|
|
|
|
unset( $res_641 );
|
|
|
|
unset( $pos_641 );
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_644 = FALSE; break; }
|
|
|
|
$_644 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_644 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_644 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function OpenBlock__construct(&$res) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['ArgumentCount'] = 0;
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function OpenBlock_BlockArguments(&$res, $sub) {
|
2011-02-09 05:31:16 +01:00
|
|
|
if (isset($sub['Argument']['ArgumentMode'])) {
|
|
|
|
$res['Arguments'] = array($sub['Argument']);
|
|
|
|
$res['ArgumentCount'] = 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$res['Arguments'] = $sub['Argument'];
|
|
|
|
$res['ArgumentCount'] = count($res['Arguments']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function OpenBlock__finalise(&$res) {
|
2011-02-14 04:52:01 +01:00
|
|
|
$blockname = $res['BlockName']['text'];
|
2011-02-09 05:31:16 +01:00
|
|
|
|
2011-12-17 05:35:26 +01:00
|
|
|
$method = 'OpenBlock_Handle_'.$blockname;
|
2011-02-09 05:31:16 +01:00
|
|
|
if (method_exists($this, $method)) $res['php'] = $this->$method($res);
|
|
|
|
else {
|
2013-02-14 08:31:40 +01:00
|
|
|
throw new SSTemplateParseException('Unknown open block "'.$blockname.'" encountered. Perhaps you missed ' .
|
|
|
|
' the closing tag or have mis-spelled it?', $this);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
}
|
2012-04-11 11:34:27 +02:00
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
/**
|
|
|
|
* This is an open block handler, for the <% debug %> utility tag
|
|
|
|
*/
|
2012-09-26 23:34:00 +02:00
|
|
|
function OpenBlock_Handle_Debug(&$res) {
|
2011-02-18 05:06:11 +01:00
|
|
|
if ($res['ArgumentCount'] == 0) return '$scope->debug();';
|
2011-02-09 05:31:16 +01:00
|
|
|
else if ($res['ArgumentCount'] == 1) {
|
|
|
|
$arg = $res['Arguments'][0];
|
|
|
|
|
|
|
|
if ($arg['ArgumentMode'] == 'string') return 'Debug::show('.$arg['php'].');';
|
|
|
|
|
|
|
|
$php = ($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php'];
|
|
|
|
return '$val .= Debug::show('.str_replace('FINALGET!', 'cachedCall', $php).');';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
throw new SSTemplateParseException('Debug takes 0 or 1 argument only.', $this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
/**
|
|
|
|
* This is an open block handler, for the <% base_tag %> tag
|
|
|
|
*/
|
2012-09-26 23:34:00 +02:00
|
|
|
function OpenBlock_Handle_Base_tag(&$res) {
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($res['ArgumentCount'] != 0) throw new SSTemplateParseException('Base_tag takes no arguments', $this);
|
|
|
|
return '$val .= SSViewer::get_base_tag($val);';
|
|
|
|
}
|
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
/**
|
|
|
|
* This is an open block handler, for the <% current_page %> tag
|
|
|
|
*/
|
2012-09-26 23:34:00 +02:00
|
|
|
function OpenBlock_Handle_Current_page(&$res) {
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($res['ArgumentCount'] != 0) throw new SSTemplateParseException('Current_page takes no arguments', $this);
|
|
|
|
return '$val .= $_SERVER[SCRIPT_URL];';
|
|
|
|
}
|
|
|
|
|
2011-02-28 04:12:41 +01:00
|
|
|
/* MismatchedEndBlock: '<%' < 'end_' :Word > '%>' */
|
|
|
|
protected $match_MismatchedEndBlock_typestack = array('MismatchedEndBlock');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_MismatchedEndBlock ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "MismatchedEndBlock"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_652 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_652 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_652 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Word" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_652 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_652 = FALSE; break; }
|
|
|
|
$_652 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_652 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_652 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function MismatchedEndBlock__finalise(&$res) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$blockname = $res['Word']['text'];
|
2013-02-14 08:31:40 +01:00
|
|
|
throw new SSTemplateParseException('Unexpected close tag end_' . $blockname .
|
|
|
|
' encountered. Perhaps you have mis-nested blocks, or have mis-spelled a tag?', $this);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* MalformedOpenTag: '<%' < !NotBlockTag Tag:Word !( ( [ :BlockArguments ] )? > '%>' ) */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_MalformedOpenTag_typestack = array('MalformedOpenTag');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_MalformedOpenTag ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "MalformedOpenTag"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_667 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_667 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_656 = $result;
|
|
|
|
$pos_656 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_656;
|
|
|
|
$this->pos = $pos_656;
|
|
|
|
$_667 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else {
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_656;
|
|
|
|
$this->pos = $pos_656;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Tag" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_667 = FALSE; break; }
|
|
|
|
$res_666 = $result;
|
|
|
|
$pos_666 = $this->pos;
|
|
|
|
$_665 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_662 = $result;
|
|
|
|
$pos_662 = $this->pos;
|
|
|
|
$_661 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_661 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "BlockArguments" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_661 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_661 = FALSE; break; }
|
|
|
|
$_661 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_661 === FALSE) {
|
|
|
|
$result = $res_662;
|
|
|
|
$this->pos = $pos_662;
|
|
|
|
unset( $res_662 );
|
|
|
|
unset( $pos_662 );
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_665 = FALSE; break; }
|
|
|
|
$_665 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_665 === TRUE ) {
|
|
|
|
$result = $res_666;
|
|
|
|
$this->pos = $pos_666;
|
|
|
|
$_667 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_665 === FALSE) {
|
|
|
|
$result = $res_666;
|
|
|
|
$this->pos = $pos_666;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$_667 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_667 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_667 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function MalformedOpenTag__finalise(&$res) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$tag = $res['Tag']['text'];
|
2013-02-14 08:31:40 +01:00
|
|
|
throw new SSTemplateParseException("Malformed opening block tag $tag. Perhaps you have tried to use operators?"
|
|
|
|
, $this);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* MalformedCloseTag: '<%' < Tag:('end_' :Word ) !( > '%>' ) */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_MalformedCloseTag_typestack = array('MalformedCloseTag');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_MalformedCloseTag ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "MalformedCloseTag"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_679 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_679 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Tag" );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_673 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_673 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres, "Word" );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_673 = FALSE; break; }
|
|
|
|
$_673 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_673 === TRUE ) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = $result; $result = array_pop($stack);
|
2011-02-09 05:31:16 +01:00
|
|
|
$this->store( $result, $subres, 'Tag' );
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_673 === FALSE) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = array_pop($stack);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_679 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_678 = $result;
|
|
|
|
$pos_678 = $this->pos;
|
|
|
|
$_677 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_677 = FALSE; break; }
|
|
|
|
$_677 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_677 === TRUE ) {
|
|
|
|
$result = $res_678;
|
|
|
|
$this->pos = $pos_678;
|
|
|
|
$_679 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_677 === FALSE) {
|
|
|
|
$result = $res_678;
|
|
|
|
$this->pos = $pos_678;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$_679 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_679 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_679 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function MalformedCloseTag__finalise(&$res) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$tag = $res['Tag']['text'];
|
2013-02-14 08:31:40 +01:00
|
|
|
throw new SSTemplateParseException("Malformed closing block tag $tag. Perhaps you have tried to pass an " .
|
|
|
|
"argument to one?", $this);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* MalformedBlock: MalformedOpenTag | MalformedCloseTag */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_MalformedBlock_typestack = array('MalformedBlock');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_MalformedBlock ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "MalformedBlock"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_684 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_681 = $result;
|
|
|
|
$pos_681 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'MalformedOpenTag'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_684 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_681;
|
|
|
|
$this->pos = $pos_681;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'MalformedCloseTag'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_684 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_681;
|
|
|
|
$this->pos = $pos_681;
|
|
|
|
$_684 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_684 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_684 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-05 19:12:54 +02:00
|
|
|
/* Comment: "<%--" (!"--%>" /(?s)./)+ "--%>" */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_Comment_typestack = array('Comment');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_Comment ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "Comment"; $result = $this->construct($matchrule, $matchrule, null);
|
2013-04-07 09:46:50 +02:00
|
|
|
$_692 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '<%--' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_692 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
$count = 0;
|
|
|
|
while (true) {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_690 = $result;
|
|
|
|
$pos_690 = $this->pos;
|
|
|
|
$_689 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_687 = $result;
|
|
|
|
$pos_687 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '--%>' ) ) !== FALSE) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_687;
|
|
|
|
$this->pos = $pos_687;
|
|
|
|
$_689 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else {
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_687;
|
|
|
|
$this->pos = $pos_687;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-03-05 16:22:09 +01:00
|
|
|
if (( $subres = $this->rx( '/(?s)./' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_689 = FALSE; break; }
|
|
|
|
$_689 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_689 === FALSE) {
|
|
|
|
$result = $res_690;
|
|
|
|
$this->pos = $pos_690;
|
|
|
|
unset( $res_690 );
|
|
|
|
unset( $pos_690 );
|
2011-02-09 05:31:16 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
$count += 1;
|
|
|
|
}
|
|
|
|
if ($count > 0) { }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_692 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '--%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_692 = FALSE; break; }
|
|
|
|
$_692 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_692 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_692 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function Comment__construct(&$res) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['php'] = '';
|
|
|
|
}
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
/* TopTemplate: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock |
|
|
|
|
OpenBlock | MalformedBlock | MismatchedEndBlock | Injection | Text)+ */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_TopTemplate_typestack = array('TopTemplate','Template');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_TopTemplate ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "TopTemplate"; $result = $this->construct($matchrule, $matchrule, array('TemplateMatcher' => 'Template'));
|
2011-02-09 05:31:16 +01:00
|
|
|
$count = 0;
|
|
|
|
while (true) {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_748 = $result;
|
|
|
|
$pos_748 = $this->pos;
|
|
|
|
$_747 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$_745 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_694 = $result;
|
|
|
|
$pos_694 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_745 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_694;
|
|
|
|
$this->pos = $pos_694;
|
|
|
|
$_743 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_696 = $result;
|
|
|
|
$pos_696 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_743 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_696;
|
|
|
|
$this->pos = $pos_696;
|
|
|
|
$_741 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_698 = $result;
|
|
|
|
$pos_698 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_741 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_698;
|
|
|
|
$this->pos = $pos_698;
|
|
|
|
$_739 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_700 = $result;
|
|
|
|
$pos_700 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_739 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_700;
|
|
|
|
$this->pos = $pos_700;
|
|
|
|
$_737 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_702 = $result;
|
|
|
|
$pos_702 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_737 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_702;
|
|
|
|
$this->pos = $pos_702;
|
|
|
|
$_735 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_704 = $result;
|
|
|
|
$pos_704 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_735 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_704;
|
|
|
|
$this->pos = $pos_704;
|
|
|
|
$_733 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_706 = $result;
|
|
|
|
$pos_706 = $this->pos;
|
2012-04-16 06:59:56 +02:00
|
|
|
$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_733 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_706;
|
|
|
|
$this->pos = $pos_706;
|
|
|
|
$_731 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_708 = $result;
|
|
|
|
$pos_708 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_731 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_708;
|
|
|
|
$this->pos = $pos_708;
|
|
|
|
$_729 = NULL;
|
2011-02-21 05:44:46 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_710 = $result;
|
|
|
|
$pos_710 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
2011-02-21 05:44:46 +01:00
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_729 = TRUE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_710;
|
|
|
|
$this->pos = $pos_710;
|
|
|
|
$_727 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_712 = $result;
|
|
|
|
$pos_712 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_727 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_712;
|
|
|
|
$this->pos = $pos_712;
|
|
|
|
$_725 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_714 = $result;
|
|
|
|
$pos_714 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_725 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_714;
|
|
|
|
$this->pos = $pos_714;
|
|
|
|
$_723 = NULL;
|
2012-04-11 11:34:27 +02:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_716 = $result;
|
|
|
|
$pos_716 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'MismatchedEndBlock'; $key = $matcher; $pos = $this->pos;
|
2012-04-11 11:34:27 +02:00
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_723 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_716;
|
|
|
|
$this->pos = $pos_716;
|
|
|
|
$_721 = NULL;
|
2012-04-16 07:37:57 +02:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_718 = $result;
|
|
|
|
$pos_718 = $this->pos;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_721 = TRUE; break;
|
2012-04-16 07:37:57 +02:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_718;
|
|
|
|
$this->pos = $pos_718;
|
2012-04-16 07:37:57 +02:00
|
|
|
$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos;
|
|
|
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
|
|
|
if ($subres !== FALSE) {
|
|
|
|
$this->store( $result, $subres );
|
2013-04-07 09:46:50 +02:00
|
|
|
$_721 = TRUE; break;
|
2012-04-16 07:37:57 +02:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_718;
|
|
|
|
$this->pos = $pos_718;
|
|
|
|
$_721 = FALSE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_721 === TRUE ) { $_723 = TRUE; break; }
|
|
|
|
$result = $res_716;
|
|
|
|
$this->pos = $pos_716;
|
|
|
|
$_723 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2012-04-11 11:34:27 +02:00
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_723 === TRUE ) { $_725 = TRUE; break; }
|
|
|
|
$result = $res_714;
|
|
|
|
$this->pos = $pos_714;
|
|
|
|
$_725 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_725 === TRUE ) { $_727 = TRUE; break; }
|
|
|
|
$result = $res_712;
|
|
|
|
$this->pos = $pos_712;
|
|
|
|
$_727 = FALSE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_727 === TRUE ) { $_729 = TRUE; break; }
|
|
|
|
$result = $res_710;
|
|
|
|
$this->pos = $pos_710;
|
|
|
|
$_729 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2011-02-21 05:44:46 +01:00
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_729 === TRUE ) { $_731 = TRUE; break; }
|
|
|
|
$result = $res_708;
|
|
|
|
$this->pos = $pos_708;
|
|
|
|
$_731 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_731 === TRUE ) { $_733 = TRUE; break; }
|
|
|
|
$result = $res_706;
|
|
|
|
$this->pos = $pos_706;
|
|
|
|
$_733 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_733 === TRUE ) { $_735 = TRUE; break; }
|
|
|
|
$result = $res_704;
|
|
|
|
$this->pos = $pos_704;
|
|
|
|
$_735 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_735 === TRUE ) { $_737 = TRUE; break; }
|
|
|
|
$result = $res_702;
|
|
|
|
$this->pos = $pos_702;
|
|
|
|
$_737 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_737 === TRUE ) { $_739 = TRUE; break; }
|
|
|
|
$result = $res_700;
|
|
|
|
$this->pos = $pos_700;
|
|
|
|
$_739 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_739 === TRUE ) { $_741 = TRUE; break; }
|
|
|
|
$result = $res_698;
|
|
|
|
$this->pos = $pos_698;
|
|
|
|
$_741 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_741 === TRUE ) { $_743 = TRUE; break; }
|
|
|
|
$result = $res_696;
|
|
|
|
$this->pos = $pos_696;
|
|
|
|
$_743 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_743 === TRUE ) { $_745 = TRUE; break; }
|
|
|
|
$result = $res_694;
|
|
|
|
$this->pos = $pos_694;
|
|
|
|
$_745 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_745 === FALSE) { $_747 = FALSE; break; }
|
|
|
|
$_747 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_747 === FALSE) {
|
|
|
|
$result = $res_748;
|
|
|
|
$this->pos = $pos_748;
|
|
|
|
unset( $res_748 );
|
|
|
|
unset( $pos_748 );
|
2011-02-09 05:31:16 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
$count += 1;
|
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
if ($count > 0) { return $this->finalise($result); }
|
2011-02-09 05:31:16 +01:00
|
|
|
else { return FALSE; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The TopTemplate also includes the opening stanza to start off the template
|
|
|
|
*/
|
2012-09-26 23:34:00 +02:00
|
|
|
function TopTemplate__construct(&$res) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['php'] = "<?php" . PHP_EOL;
|
|
|
|
}
|
|
|
|
|
2011-03-17 01:08:13 +01:00
|
|
|
/* Text: (
|
|
|
|
/ [^<${\\]+ / |
|
|
|
|
/ (\\.) / |
|
|
|
|
'<' !'%' |
|
|
|
|
'$' !(/[A-Za-z_]/) |
|
|
|
|
'{' !'$' |
|
|
|
|
'{$' !(/[A-Za-z_]/)
|
|
|
|
)+ */
|
2011-02-28 04:12:41 +01:00
|
|
|
protected $match_Text_typestack = array('Text');
|
2012-09-26 23:34:00 +02:00
|
|
|
function match_Text ($stack = array()) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$matchrule = "Text"; $result = $this->construct($matchrule, $matchrule, null);
|
2011-03-17 01:08:13 +01:00
|
|
|
$count = 0;
|
|
|
|
while (true) {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_787 = $result;
|
|
|
|
$pos_787 = $this->pos;
|
|
|
|
$_786 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$_784 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_749 = $result;
|
|
|
|
$pos_749 = $this->pos;
|
2011-03-17 01:08:13 +01:00
|
|
|
if (( $subres = $this->rx( '/ [^<${\\\\]+ /' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_784 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_749;
|
|
|
|
$this->pos = $pos_749;
|
|
|
|
$_782 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_751 = $result;
|
|
|
|
$pos_751 = $this->pos;
|
2011-03-17 01:08:13 +01:00
|
|
|
if (( $subres = $this->rx( '/ (\\\\.) /' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2013-04-07 09:46:50 +02:00
|
|
|
$_782 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_751;
|
|
|
|
$this->pos = $pos_751;
|
|
|
|
$_780 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_753 = $result;
|
|
|
|
$pos_753 = $this->pos;
|
|
|
|
$_756 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
|
|
|
if (substr($this->string,$this->pos,1) == '<') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '<';
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_756 = FALSE; break; }
|
|
|
|
$res_755 = $result;
|
|
|
|
$pos_755 = $this->pos;
|
2011-03-17 01:08:13 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == '%') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '%';
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_755;
|
|
|
|
$this->pos = $pos_755;
|
|
|
|
$_756 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
else {
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_755;
|
|
|
|
$this->pos = $pos_755;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$_756 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_756 === TRUE ) { $_780 = TRUE; break; }
|
|
|
|
$result = $res_753;
|
|
|
|
$this->pos = $pos_753;
|
|
|
|
$_778 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_758 = $result;
|
|
|
|
$pos_758 = $this->pos;
|
|
|
|
$_763 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
|
|
|
if (substr($this->string,$this->pos,1) == '$') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '$';
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_763 = FALSE; break; }
|
|
|
|
$res_762 = $result;
|
|
|
|
$pos_762 = $this->pos;
|
|
|
|
$_761 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->rx( '/[A-Za-z_]/' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_761 = FALSE; break; }
|
|
|
|
$_761 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_761 === TRUE ) {
|
|
|
|
$result = $res_762;
|
|
|
|
$this->pos = $pos_762;
|
|
|
|
$_763 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_761 === FALSE) {
|
|
|
|
$result = $res_762;
|
|
|
|
$this->pos = $pos_762;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$_763 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_763 === TRUE ) { $_778 = TRUE; break; }
|
|
|
|
$result = $res_758;
|
|
|
|
$this->pos = $pos_758;
|
|
|
|
$_776 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
2013-04-07 09:46:50 +02:00
|
|
|
$res_765 = $result;
|
|
|
|
$pos_765 = $this->pos;
|
|
|
|
$_768 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
|
|
|
if (substr($this->string,$this->pos,1) == '{') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '{';
|
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_768 = FALSE; break; }
|
|
|
|
$res_767 = $result;
|
|
|
|
$pos_767 = $this->pos;
|
2011-03-17 01:08:13 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == '$') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '$';
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_767;
|
|
|
|
$this->pos = $pos_767;
|
|
|
|
$_768 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
else {
|
2013-04-07 09:46:50 +02:00
|
|
|
$result = $res_767;
|
|
|
|
$this->pos = $pos_767;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$_768 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_768 === TRUE ) { $_776 = TRUE; break; }
|
|
|
|
$result = $res_765;
|
|
|
|
$this->pos = $pos_765;
|
|
|
|
$_774 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->literal( '{$' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_774 = FALSE; break; }
|
|
|
|
$res_773 = $result;
|
|
|
|
$pos_773 = $this->pos;
|
|
|
|
$_772 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->rx( '/[A-Za-z_]/' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2013-04-07 09:46:50 +02:00
|
|
|
else { $_772 = FALSE; break; }
|
|
|
|
$_772 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_772 === TRUE ) {
|
|
|
|
$result = $res_773;
|
|
|
|
$this->pos = $pos_773;
|
|
|
|
$_774 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_772 === FALSE) {
|
|
|
|
$result = $res_773;
|
|
|
|
$this->pos = $pos_773;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
$_774 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_774 === TRUE ) { $_776 = TRUE; break; }
|
|
|
|
$result = $res_765;
|
|
|
|
$this->pos = $pos_765;
|
|
|
|
$_776 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_776 === TRUE ) { $_778 = TRUE; break; }
|
|
|
|
$result = $res_758;
|
|
|
|
$this->pos = $pos_758;
|
|
|
|
$_778 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_778 === TRUE ) { $_780 = TRUE; break; }
|
|
|
|
$result = $res_753;
|
|
|
|
$this->pos = $pos_753;
|
|
|
|
$_780 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_780 === TRUE ) { $_782 = TRUE; break; }
|
|
|
|
$result = $res_751;
|
|
|
|
$this->pos = $pos_751;
|
|
|
|
$_782 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_782 === TRUE ) { $_784 = TRUE; break; }
|
|
|
|
$result = $res_749;
|
|
|
|
$this->pos = $pos_749;
|
|
|
|
$_784 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_784 === FALSE) { $_786 = FALSE; break; }
|
|
|
|
$_786 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2013-04-07 09:46:50 +02:00
|
|
|
if( $_786 === FALSE) {
|
|
|
|
$result = $res_787;
|
|
|
|
$this->pos = $pos_787;
|
|
|
|
unset( $res_787 );
|
|
|
|
unset( $pos_787 );
|
2011-03-17 01:08:13 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
$count += 1;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2011-03-17 01:08:13 +01:00
|
|
|
if ($count > 0) { return $this->finalise($result); }
|
2011-02-28 04:12:41 +01:00
|
|
|
else { return FALSE; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
/**
|
2011-02-28 04:12:41 +01:00
|
|
|
* We convert text
|
2011-02-14 22:03:42 +01:00
|
|
|
*/
|
2012-09-26 23:34:00 +02:00
|
|
|
function Text__finalise(&$res) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$text = $res['text'];
|
|
|
|
|
2011-03-17 01:08:13 +01:00
|
|
|
// Unescape any escaped characters in the text, then put back escapes for any single quotes and backslashes
|
|
|
|
$text = stripslashes($text);
|
|
|
|
$text = addcslashes($text, '\'\\');
|
|
|
|
|
2013-02-14 08:31:40 +01:00
|
|
|
// TODO: This is pretty ugly & gets applied on all files not just html. I wonder if we can make this
|
|
|
|
// non-dynamically calculated
|
2011-02-28 04:12:41 +01:00
|
|
|
$text = preg_replace(
|
|
|
|
'/href\s*\=\s*\"\#/',
|
2013-03-21 19:48:54 +01:00
|
|
|
'href="\' . (Config::inst()->get(\'SSViewer\', \'rewrite_hash_links\') ? strip_tags( $_SERVER[\'REQUEST_URI\'] ) : "") .
|
2013-02-14 08:31:40 +01:00
|
|
|
\'#',
|
2011-02-28 04:12:41 +01:00
|
|
|
$text
|
|
|
|
);
|
2011-02-09 05:31:16 +01:00
|
|
|
|
2011-03-17 01:08:13 +01:00
|
|
|
$res['php'] .= '$val .= \'' . $text . '\';' . PHP_EOL;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
/******************
|
|
|
|
* Here ends the parser itself. Below are utility methods to use the parser
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Compiles some passed template source code into the php code that will execute as per the template source.
|
|
|
|
*
|
|
|
|
* @static
|
|
|
|
* @throws SSTemplateParseException
|
2013-02-14 08:31:40 +01:00
|
|
|
* @param $string The source of the template
|
|
|
|
* @param string $templateName The name of the template, normally the filename the template source was loaded from
|
|
|
|
* @param bool $includeDebuggingComments True is debugging comments should be included in the output
|
|
|
|
* @return mixed|string The php that, when executed (via include or exec) will behave as per the template source
|
2011-02-14 22:03:42 +01:00
|
|
|
*/
|
2012-09-26 23:34:00 +02:00
|
|
|
static function compileString($string, $templateName = "", $includeDebuggingComments=false) {
|
2011-03-25 00:28:03 +01:00
|
|
|
if (!trim($string)) {
|
|
|
|
$code = '';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// Construct a parser instance
|
|
|
|
$parser = new SSTemplateParser($string);
|
|
|
|
$parser->includeDebuggingComments = $includeDebuggingComments;
|
|
|
|
|
2013-02-14 08:31:40 +01:00
|
|
|
// Ignore UTF8 BOM at begining of string. TODO: Confirm this is needed, make sure SSViewer handles UTF
|
|
|
|
// (and other encodings) properly
|
2011-03-25 00:28:03 +01:00
|
|
|
if(substr($string, 0,3) == pack("CCC", 0xef, 0xbb, 0xbf)) $parser->pos = 3;
|
|
|
|
|
|
|
|
// Match the source against the parser
|
|
|
|
$result = $parser->match_TopTemplate();
|
|
|
|
if(!$result) throw new SSTemplateParseException('Unexpected problem parsing template', $parser);
|
|
|
|
|
|
|
|
// Get the result
|
|
|
|
$code = $result['php'];
|
|
|
|
}
|
2013-04-22 15:53:20 +02:00
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
// Include top level debugging comments if desired
|
2011-02-09 05:31:16 +01:00
|
|
|
if($includeDebuggingComments && $templateName && stripos($code, "<?xml") === false) {
|
2013-04-22 16:12:43 +02:00
|
|
|
$code = $parser->includeDebuggingComments($code, $templateName);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return $code;
|
|
|
|
}
|
2013-04-22 16:12:43 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $code
|
|
|
|
* @return string $code
|
|
|
|
*/
|
|
|
|
protected function includeDebuggingComments($code, $templateName) {
|
|
|
|
// If this template contains a doctype, put it right after it,
|
|
|
|
// if not, put it after the <html> tag to avoid IE glitches
|
|
|
|
if(stripos($code, "<!doctype") !== false) {
|
|
|
|
$code = preg_replace('/(<!doctype[^>]*("[^"]")*[^>]*>)/im', "$1\r\n<!-- template $templateName -->", $code);
|
2013-04-22 20:16:09 +02:00
|
|
|
$code .= "\r\n" . '$val .= \'<!-- end template ' . $templateName . ' -->\';';
|
2013-04-22 16:12:43 +02:00
|
|
|
} elseif(stripos($code, "<html") !== false) {
|
2013-04-22 20:16:09 +02:00
|
|
|
$code = preg_replace_callback('/(.*)(<html[^>]*>)(.*)/i', function($matches) use ($templateName) {
|
|
|
|
if (stripos($matches[3], '<!--') === false && stripos($matches[3], '-->') !== false) {
|
|
|
|
// after this <html> tag there is a comment close but no comment has been opened
|
|
|
|
// this most likely means that this <html> tag is inside a comment
|
|
|
|
// we should not add a comment inside a comment (invalid html)
|
|
|
|
// lets append it at the end of the comment
|
|
|
|
// an example case for this is the html5boilerplate: <!--[if IE]><html class="ie"><![endif]-->
|
|
|
|
return $matches[0];
|
|
|
|
} else {
|
|
|
|
// all other cases, add the comment and return it
|
|
|
|
return "{$matches[1]}{$matches[2]}<!-- template $templateName -->{$matches[3]}";
|
|
|
|
}
|
|
|
|
}, $code);
|
|
|
|
$code = preg_replace('/(<\/html[^>]*>)/i', "<!-- end template $templateName -->$1", $code);
|
2013-04-22 16:12:43 +02:00
|
|
|
} else {
|
|
|
|
$code = str_replace('<?php' . PHP_EOL, '<?php' . PHP_EOL . '$val .= \'<!-- template ' . $templateName .
|
|
|
|
' -->\';' . "\r\n", $code);
|
2013-04-22 20:16:09 +02:00
|
|
|
$code .= "\r\n" . '$val .= \'<!-- end template ' . $templateName . ' -->\';';
|
2013-04-22 16:12:43 +02:00
|
|
|
}
|
|
|
|
return $code;
|
|
|
|
}
|
2011-02-09 05:31:16 +01:00
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
/**
|
|
|
|
* Compiles some file that contains template source code, and returns the php code that will execute as per that
|
|
|
|
* source
|
|
|
|
*
|
|
|
|
* @static
|
|
|
|
* @param $template - A file path that contains template source code
|
|
|
|
* @return mixed|string - The php that, when executed (via include or exec) will behave as per the template source
|
|
|
|
*/
|
2012-09-26 23:34:00 +02:00
|
|
|
static function compileFile($template) {
|
2011-02-14 22:03:42 +01:00
|
|
|
return self::compileString(file_get_contents($template), $template);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
}
|