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.
|
2013-11-29 05:12:47 +01:00
|
|
|
*
|
|
|
|
* @package framework
|
|
|
|
* @subpackage view
|
2012-09-26 23:34:00 +02:00
|
|
|
*/
|
2011-02-09 05:31:16 +01:00
|
|
|
class SSTemplateParseException extends Exception {
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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);
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-02-09 05:31:16 +01:00
|
|
|
preg_match_all('/\r\n|\r|\n/', $prior, $matches);
|
|
|
|
$line = count($matches[0])+1;
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-02-09 05:31:16 +01:00
|
|
|
parent::__construct("Parse error in template on line $line. Error was: $message");
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
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
|
2016-01-20 01:16:27 +01:00
|
|
|
*
|
2012-09-26 23:34:00 +02:00
|
|
|
* 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.
|
2016-01-20 01:16:27 +01:00
|
|
|
*
|
2012-09-26 23:34:00 +02:00
|
|
|
* Some match rules generate alternate php, or other variations, so check the per-match documentation too.
|
2016-01-20 01:16:27 +01:00
|
|
|
*
|
2012-09-26 23:34:00 +02:00
|
|
|
* Terms used:
|
2016-01-20 01:16:27 +01:00
|
|
|
*
|
2012-09-26 23:34:00 +02:00
|
|
|
* 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")
|
2016-01-20 01:16:27 +01:00
|
|
|
*
|
2012-09-26 23:34:00 +02:00
|
|
|
* Bare: The opposite of marked. An argument that has to has it's type inferred by usage and 2.4 defaults.
|
2016-01-20 01:16:27 +01:00
|
|
|
*
|
2012-09-26 23:34:00 +02:00
|
|
|
* Example of using a bare argument for a loop block: <% loop Foo %>
|
2016-01-20 01:16:27 +01:00
|
|
|
*
|
2012-09-26 23:34:00 +02:00
|
|
|
* 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.
|
2016-01-20 01:16:27 +01:00
|
|
|
*
|
2012-09-26 23:34:00 +02:00
|
|
|
* 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)
|
2016-01-20 01:16:27 +01:00
|
|
|
*
|
2012-09-26 23:34:00 +02:00
|
|
|
* Closed Block: An SS template block that wraps content, and requires a counterpart <% end_blockname %> tag
|
2016-01-20 01:16:27 +01:00
|
|
|
*
|
2012-09-26 23:34:00 +02:00
|
|
|
* Angle Bracket: angle brackets "<" and ">" are used to eat whitespace between template elements
|
|
|
|
* N: eats white space including newlines (using in legacy _t support)
|
2014-03-30 07:15:12 +02:00
|
|
|
*
|
2014-01-31 03:15:59 +01:00
|
|
|
* @package framework
|
|
|
|
* @subpackage view
|
2012-09-26 23:34:00 +02:00
|
|
|
*/
|
2013-10-17 10:28:12 +02:00
|
|
|
class SSTemplateParser extends Parser implements TemplateParser {
|
2011-02-09 05:31:16 +01:00
|
|
|
|
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;
|
2013-10-17 10:28:12 +02:00
|
|
|
|
|
|
|
/**
|
2013-10-24 01:43:20 +02:00
|
|
|
* Stores the user-supplied closed block extension rules in the form:
|
|
|
|
* array(
|
|
|
|
* 'name' => function (&$res) {}
|
|
|
|
* )
|
|
|
|
* See SSTemplateParser::ClosedBlock_Handle_Loop for an example of what the callable should look like
|
|
|
|
* @var array
|
2013-10-17 10:28:12 +02:00
|
|
|
*/
|
2013-10-24 01:43:20 +02:00
|
|
|
protected $closedBlocks = array();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stores the user-supplied open block extension rules in the form:
|
|
|
|
* array(
|
|
|
|
* 'name' => function (&$res) {}
|
|
|
|
* )
|
|
|
|
* See SSTemplateParser::OpenBlock_Handle_Base_tag for an example of what the callable should look like
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $openBlocks = array();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allow the injection of new closed & open block callables
|
|
|
|
* @param array $closedBlocks
|
|
|
|
* @param array $openBlocks
|
|
|
|
*/
|
|
|
|
public function __construct($closedBlocks = array(), $openBlocks = array()) {
|
|
|
|
$this->setClosedBlocks($closedBlocks);
|
|
|
|
$this->setOpenBlocks($openBlocks);
|
2013-10-17 10:28:12 +02:00
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
2013-10-24 01:43:20 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the closed blocks that the template parser should use
|
2016-01-20 01:16:27 +01:00
|
|
|
*
|
2013-10-24 01:43:20 +02:00
|
|
|
* This method will delete any existing closed blocks, please use addClosedBlock if you don't
|
|
|
|
* want to overwrite
|
|
|
|
* @param array $closedBlocks
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
public function setClosedBlocks($closedBlocks) {
|
|
|
|
$this->closedBlocks = array();
|
|
|
|
foreach ((array) $closedBlocks as $name => $callable) {
|
|
|
|
$this->addClosedBlock($name, $callable);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the open blocks that the template parser should use
|
|
|
|
*
|
|
|
|
* This method will delete any existing open blocks, please use addOpenBlock if you don't
|
|
|
|
* want to overwrite
|
|
|
|
* @param array $openBlocks
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
public function setOpenBlocks($openBlocks) {
|
|
|
|
$this->openBlocks = array();
|
|
|
|
foreach ((array) $openBlocks as $name => $callable) {
|
|
|
|
$this->addOpenBlock($name, $callable);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a closed block callable to allow <% name %><% end_name %> syntax
|
|
|
|
* @param string $name The name of the token to be used in the syntax <% name %><% end_name %>
|
|
|
|
* @param callable $callable The function that modifies the generation of template code
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
public function addClosedBlock($name, $callable) {
|
|
|
|
$this->validateExtensionBlock($name, $callable, 'Closed block');
|
|
|
|
$this->closedBlocks[$name] = $callable;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a closed block callable to allow <% name %> syntax
|
|
|
|
* @param string $name The name of the token to be used in the syntax <% name %>
|
|
|
|
* @param callable $callable The function that modifies the generation of template code
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
public function addOpenBlock($name, $callable) {
|
|
|
|
$this->validateExtensionBlock($name, $callable, 'Open block');
|
|
|
|
$this->openBlocks[$name] = $callable;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ensures that the arguments to addOpenBlock and addClosedBlock are valid
|
|
|
|
* @param $name
|
|
|
|
* @param $callable
|
|
|
|
* @param $type
|
|
|
|
* @throws InvalidArgumentException
|
|
|
|
*/
|
|
|
|
protected function validateExtensionBlock($name, $callable, $type) {
|
|
|
|
if (!is_string($name)) {
|
|
|
|
throw new InvalidArgumentException(
|
|
|
|
sprintf(
|
|
|
|
"Name argument for %s must be a string",
|
|
|
|
$type
|
|
|
|
)
|
|
|
|
);
|
|
|
|
} elseif (!is_callable($callable)) {
|
|
|
|
throw new InvalidArgumentException(
|
|
|
|
sprintf(
|
|
|
|
"Callable %s argument named '%s' is not callable",
|
|
|
|
$type,
|
|
|
|
$name
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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 ;
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-05-21 08:17:33 +02:00
|
|
|
/* NamespacedWord: / [A-Za-z_\/\\] [A-Za-z0-9_\/\\]* / */
|
|
|
|
protected $match_NamespacedWord_typestack = array('NamespacedWord');
|
|
|
|
function match_NamespacedWord ($stack = array()) {
|
|
|
|
$matchrule = "NamespacedWord"; $result = $this->construct($matchrule, $matchrule, null);
|
|
|
|
if (( $subres = $this->rx( '/ [A-Za-z_\/\\\\] [A-Za-z0-9_\/\\\\]* /' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
|
|
|
return $this->finalise($result);
|
|
|
|
}
|
|
|
|
else { return FALSE; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-09 05:31:16 +01:00
|
|
|
/* 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_62 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_62 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
while (true) {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_61 = $result;
|
|
|
|
$pos_61 = $this->pos;
|
|
|
|
$_60 = 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
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_60 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_60 = FALSE; break; }
|
|
|
|
$_60 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_60 === FALSE) {
|
|
|
|
$result = $res_61;
|
|
|
|
$this->pos = $pos_61;
|
|
|
|
unset( $res_61 );
|
|
|
|
unset( $pos_61 );
|
2011-02-09 05:31:16 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_62 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_62 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_62 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-20 01:16:27 +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'] .= ', ';
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2016-05-21 08:17:33 +02:00
|
|
|
$res['php'] .= ($sub['ArgumentMode'] == 'default') ? $sub['string_php'] :
|
2012-09-26 23:34:00 +02:00
|
|
|
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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_72 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_72 = FALSE; break; }
|
|
|
|
$res_71 = $result;
|
|
|
|
$pos_71 = $this->pos;
|
|
|
|
$_70 = 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
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_70 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_67 = $result;
|
|
|
|
$pos_67 = $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 {
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_67;
|
|
|
|
$this->pos = $pos_67;
|
|
|
|
unset( $res_67 );
|
|
|
|
unset( $pos_67 );
|
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
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_70 = FALSE; break; }
|
|
|
|
$_70 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_70 === FALSE) {
|
|
|
|
$result = $res_71;
|
|
|
|
$this->pos = $pos_71;
|
|
|
|
unset( $res_71 );
|
|
|
|
unset( $pos_71 );
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_72 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_72 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_72 === 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_76 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_76 = FALSE; break; }
|
|
|
|
$res_75 = $result;
|
|
|
|
$pos_75 = $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"] .= '.';
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_75;
|
|
|
|
$this->pos = $pos_75;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else {
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_75;
|
|
|
|
$this->pos = $pos_75;
|
|
|
|
$_76 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_76 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_76 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_76 === 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_90 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_79 = $result;
|
|
|
|
$pos_79 = $this->pos;
|
|
|
|
$_87 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_87 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
while (true) {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_84 = $result;
|
|
|
|
$pos_84 = $this->pos;
|
|
|
|
$_83 = 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
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_83 = 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 );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_83 = FALSE; break; }
|
|
|
|
$_83 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_83 === FALSE) {
|
|
|
|
$result = $res_84;
|
|
|
|
$this->pos = $pos_84;
|
|
|
|
unset( $res_84 );
|
|
|
|
unset( $pos_84 );
|
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
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_87 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_87 = FALSE; break; }
|
|
|
|
$_87 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_87 === TRUE ) { $_90 = TRUE; break; }
|
|
|
|
$result = $res_79;
|
|
|
|
$this->pos = $pos_79;
|
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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_90 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_79;
|
|
|
|
$this->pos = $pos_79;
|
|
|
|
$_90 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_90 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_90 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-20 01:16:27 +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();
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The basic generated PHP of LookupStep and LastLookupStep is the same, except that LookupStep calls 'obj' to
|
2011-02-14 22:03:42 +01:00
|
|
|
* 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;
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-02-09 05:31:16 +01:00
|
|
|
$property = $sub['Call']['Method']['text'];
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_116 = NULL;
|
2012-04-16 06:59:56 +02:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->literal( '<%t' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_116 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_116 = FALSE; break; }
|
2012-04-16 06:59:56 +02:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_98 = $result;
|
|
|
|
$pos_98 = $this->pos;
|
|
|
|
$_97 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_97 = FALSE; break; }
|
|
|
|
$_97 = TRUE; break;
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_97 === FALSE) {
|
|
|
|
$result = $res_98;
|
|
|
|
$this->pos = $pos_98;
|
|
|
|
unset( $res_98 );
|
|
|
|
unset( $pos_98 );
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_109 = $result;
|
|
|
|
$pos_109 = $this->pos;
|
|
|
|
$_108 = NULL;
|
2012-04-16 06:59:56 +02:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_103 = $result;
|
|
|
|
$pos_103 = $this->pos;
|
|
|
|
$_102 = NULL;
|
2012-04-16 06:59:56 +02:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->literal( 'is' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_102 = FALSE; break; }
|
2012-04-16 06:59:56 +02:00
|
|
|
if (substr($this->string,$this->pos,1) == '=') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '=';
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_102 = FALSE; break; }
|
|
|
|
$_102 = TRUE; break;
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_102 === TRUE ) {
|
|
|
|
$result = $res_103;
|
|
|
|
$this->pos = $pos_103;
|
|
|
|
$_108 = FALSE; break;
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_102 === FALSE) {
|
|
|
|
$result = $res_103;
|
|
|
|
$this->pos = $pos_103;
|
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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_108 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_108 = FALSE; break; }
|
|
|
|
$_108 = TRUE; break;
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_108 === FALSE) {
|
|
|
|
$result = $res_109;
|
|
|
|
$this->pos = $pos_109;
|
|
|
|
unset( $res_109 );
|
|
|
|
unset( $pos_109 );
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_113 = $result;
|
|
|
|
$pos_113 = $this->pos;
|
|
|
|
$_112 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_112 = FALSE; break; }
|
|
|
|
$_112 = TRUE; break;
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_112 === FALSE) {
|
|
|
|
$result = $res_113;
|
|
|
|
$this->pos = $pos_113;
|
|
|
|
unset( $res_113 );
|
|
|
|
unset( $pos_113 );
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_116 = FALSE; break; }
|
|
|
|
$_116 = TRUE; break;
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_116 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_116 === 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) {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_123 = $result;
|
|
|
|
$pos_123 = $this->pos;
|
|
|
|
$_122 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_122 = FALSE; break; }
|
2012-04-16 06:59:56 +02:00
|
|
|
if (substr($this->string,$this->pos,1) == '=') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '=';
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_122 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_122 = FALSE; break; }
|
|
|
|
$_122 = TRUE; break;
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_122 === FALSE) {
|
|
|
|
$result = $res_123;
|
|
|
|
$this->pos = $pos_123;
|
|
|
|
unset( $res_123 );
|
|
|
|
unset( $pos_123 );
|
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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_127 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
|
|
|
if (substr($this->string,$this->pos,1) == '$') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '$';
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_127 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_127 = FALSE; break; }
|
|
|
|
$_127 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_127 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_127 === 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_132 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_132 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_132 = 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
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_132 = FALSE; break; }
|
|
|
|
$_132 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_132 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_132 === 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_137 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_134 = $result;
|
|
|
|
$pos_134 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_137 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_134;
|
|
|
|
$this->pos = $pos_134;
|
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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_137 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_134;
|
|
|
|
$this->pos = $pos_134;
|
|
|
|
$_137 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_137 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_137 === 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_143 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "q" );
|
2011-02-28 04:12:41 +01: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
|
|
|
$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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_143 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "String" );
|
2011-02-28 04:12:41 +01:00
|
|
|
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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_143 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_143 = FALSE; break; }
|
|
|
|
$_143 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_143 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_143 === 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_163 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_146 = $result;
|
|
|
|
$pos_146 = $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" );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_163 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_146;
|
|
|
|
$this->pos = $pos_146;
|
|
|
|
$_161 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_148 = $result;
|
|
|
|
$pos_148 = $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" );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_161 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_148;
|
|
|
|
$this->pos = $pos_148;
|
|
|
|
$_159 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_150 = $result;
|
|
|
|
$pos_150 = $this->pos;
|
|
|
|
$_156 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_156 = FALSE; break; }
|
|
|
|
$res_155 = $result;
|
|
|
|
$pos_155 = $this->pos;
|
|
|
|
$_154 = 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 );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_154 = FALSE; break; }
|
|
|
|
$_154 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_154 === TRUE ) {
|
|
|
|
$result = $res_155;
|
|
|
|
$this->pos = $pos_155;
|
|
|
|
$_156 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_154 === FALSE) {
|
|
|
|
$result = $res_155;
|
|
|
|
$this->pos = $pos_155;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_156 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_156 === TRUE ) { $_159 = TRUE; break; }
|
|
|
|
$result = $res_150;
|
|
|
|
$this->pos = $pos_150;
|
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" );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_159 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_150;
|
|
|
|
$this->pos = $pos_150;
|
|
|
|
$_159 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_159 === TRUE ) { $_161 = TRUE; break; }
|
|
|
|
$result = $res_148;
|
|
|
|
$this->pos = $pos_148;
|
|
|
|
$_161 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_161 === TRUE ) { $_163 = TRUE; break; }
|
|
|
|
$result = $res_146;
|
|
|
|
$this->pos = $pos_146;
|
|
|
|
$_163 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_163 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_163 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-20 01:16:27 +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.
|
2016-01-20 01:16:27 +01:00
|
|
|
*
|
2011-02-14 22:03:42 +01:00
|
|
|
* 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
|
2016-01-20 01:16:27 +01:00
|
|
|
*
|
2011-02-14 22:03:42 +01:00
|
|
|
* 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
|
|
|
|
*/
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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'];
|
|
|
|
}
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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
|
|
|
}
|
2016-01-20 01:16:27 +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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_188 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_165 = $result;
|
|
|
|
$pos_165 = $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;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_188 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_165;
|
|
|
|
$this->pos = $pos_165;
|
|
|
|
$_186 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_167 = $result;
|
|
|
|
$pos_167 = $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;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_186 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_167;
|
|
|
|
$this->pos = $pos_167;
|
|
|
|
$_184 = NULL;
|
2013-04-07 09:46:50 +02:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_169 = $result;
|
|
|
|
$pos_169 = $this->pos;
|
2013-04-07 09:46:50 +02:00
|
|
|
if (( $subres = $this->literal( '>=' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_184 = TRUE; break;
|
2013-04-07 09:46:50 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_169;
|
|
|
|
$this->pos = $pos_169;
|
|
|
|
$_182 = NULL;
|
2013-04-07 09:46:50 +02:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_171 = $result;
|
|
|
|
$pos_171 = $this->pos;
|
2013-04-07 09:46:50 +02:00
|
|
|
if (substr($this->string,$this->pos,1) == '>') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '>';
|
2016-05-21 08:17:33 +02:00
|
|
|
$_182 = TRUE; break;
|
2013-04-07 09:46:50 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_171;
|
|
|
|
$this->pos = $pos_171;
|
|
|
|
$_180 = NULL;
|
2013-04-07 09:46:50 +02:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_173 = $result;
|
|
|
|
$pos_173 = $this->pos;
|
2013-04-07 09:46:50 +02:00
|
|
|
if (( $subres = $this->literal( '<=' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_180 = TRUE; break;
|
2013-04-07 09:46:50 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_173;
|
|
|
|
$this->pos = $pos_173;
|
|
|
|
$_178 = NULL;
|
2013-04-07 09:46:50 +02:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_175 = $result;
|
|
|
|
$pos_175 = $this->pos;
|
2013-04-07 09:46:50 +02:00
|
|
|
if (substr($this->string,$this->pos,1) == '<') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '<';
|
2016-05-21 08:17:33 +02:00
|
|
|
$_178 = TRUE; break;
|
2013-04-07 09:46:50 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_175;
|
|
|
|
$this->pos = $pos_175;
|
2013-04-07 09:46:50 +02:00
|
|
|
if (substr($this->string,$this->pos,1) == '=') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '=';
|
2016-05-21 08:17:33 +02:00
|
|
|
$_178 = TRUE; break;
|
2013-04-07 09:46:50 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_175;
|
|
|
|
$this->pos = $pos_175;
|
|
|
|
$_178 = FALSE; break;
|
2013-04-07 09:46:50 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_178 === TRUE ) { $_180 = TRUE; break; }
|
|
|
|
$result = $res_173;
|
|
|
|
$this->pos = $pos_173;
|
|
|
|
$_180 = FALSE; break;
|
2013-04-07 09:46:50 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_180 === TRUE ) { $_182 = TRUE; break; }
|
|
|
|
$result = $res_171;
|
|
|
|
$this->pos = $pos_171;
|
|
|
|
$_182 = FALSE; break;
|
2013-04-07 09:46:50 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_182 === TRUE ) { $_184 = TRUE; break; }
|
|
|
|
$result = $res_169;
|
|
|
|
$this->pos = $pos_169;
|
|
|
|
$_184 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2013-04-07 09:46:50 +02:00
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_184 === TRUE ) { $_186 = TRUE; break; }
|
|
|
|
$result = $res_167;
|
|
|
|
$this->pos = $pos_167;
|
|
|
|
$_186 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_186 === TRUE ) { $_188 = TRUE; break; }
|
|
|
|
$result = $res_165;
|
|
|
|
$this->pos = $pos_165;
|
|
|
|
$_188 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_188 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_188 === 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_195 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_195 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_195 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_195 = FALSE; break; }
|
|
|
|
$_195 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_195 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_195 === 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']);
|
2016-05-21 08:17:33 +02:00
|
|
|
}
|
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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_202 = NULL;
|
2011-02-21 03:24:14 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_200 = $result;
|
|
|
|
$pos_200 = $this->pos;
|
|
|
|
$_199 = NULL;
|
2011-02-21 03:24:14 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Not" );
|
2011-02-28 04:12:41 +01:00
|
|
|
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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_199 = FALSE; break;
|
2011-02-21 03:24:14 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
$_199 = TRUE; break;
|
2011-02-21 03:24:14 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_199 === FALSE) {
|
|
|
|
$result = $res_200;
|
|
|
|
$this->pos = $pos_200;
|
|
|
|
unset( $res_200 );
|
|
|
|
unset( $pos_200 );
|
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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_202 = FALSE; break; }
|
|
|
|
$_202 = TRUE; break;
|
2011-02-21 03:24:14 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_202 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_202 === 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'] = '!';
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_207 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_204 = $result;
|
|
|
|
$pos_204 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_207 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_204;
|
|
|
|
$this->pos = $pos_204;
|
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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_207 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_204;
|
|
|
|
$this->pos = $pos_204;
|
|
|
|
$_207 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_207 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_207 === 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_212 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_209 = $result;
|
|
|
|
$pos_209 = $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;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_212 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_209;
|
|
|
|
$this->pos = $pos_209;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '&&' ) ) !== FALSE) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_212 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_209;
|
|
|
|
$this->pos = $pos_209;
|
|
|
|
$_212 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_212 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_212 === 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_221 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_221 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
while (true) {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_220 = $result;
|
|
|
|
$pos_220 = $this->pos;
|
|
|
|
$_219 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_219 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_219 = FALSE; break; }
|
|
|
|
$_219 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_219 === FALSE) {
|
|
|
|
$result = $res_220;
|
|
|
|
$this->pos = $pos_220;
|
|
|
|
unset( $res_220 );
|
|
|
|
unset( $pos_220 );
|
2011-02-09 05:31:16 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_221 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_221 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_221 === 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_231 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_231 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_231 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_231 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_231 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_231 = FALSE; break; }
|
|
|
|
$res_230 = $result;
|
|
|
|
$pos_230 = $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 {
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_230;
|
|
|
|
$this->pos = $pos_230;
|
|
|
|
unset( $res_230 );
|
|
|
|
unset( $pos_230 );
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_231 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_231 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_231 === 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_241 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_241 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_241 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_241 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_241 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_241 = FALSE; break; }
|
|
|
|
$res_240 = $result;
|
|
|
|
$pos_240 = $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 {
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_240;
|
|
|
|
$this->pos = $pos_240;
|
|
|
|
unset( $res_240 );
|
|
|
|
unset( $pos_240 );
|
2013-04-10 16:12:51 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_241 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_241 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_241 === 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_249 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_249 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_249 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_249 = FALSE; break; }
|
|
|
|
$res_248 = $result;
|
|
|
|
$pos_248 = $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 {
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_248;
|
|
|
|
$this->pos = $pos_248;
|
|
|
|
unset( $res_248 );
|
|
|
|
unset( $pos_248 );
|
2013-04-10 16:12:51 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_249 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_249 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_249 === 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_259 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_259 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
while (true) {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_252 = $result;
|
|
|
|
$pos_252 = $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 {
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_252;
|
|
|
|
$this->pos = $pos_252;
|
|
|
|
unset( $res_252 );
|
|
|
|
unset( $pos_252 );
|
2011-02-09 05:31:16 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_253 = $result;
|
|
|
|
$pos_253 = $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 {
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_253;
|
|
|
|
$this->pos = $pos_253;
|
|
|
|
unset( $res_253 );
|
|
|
|
unset( $pos_253 );
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_259 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_259 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_259 = FALSE; break; }
|
|
|
|
$_259 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_259 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_259 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function If_IfPart(&$res, $sub) {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res['php'] =
|
2011-02-09 05:31:16 +01:00
|
|
|
'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
|
|
|
'}';
|
2016-05-21 08:17:33 +02:00
|
|
|
}
|
2011-02-09 05:31:16 +01:00
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function If_ElseIfPart(&$res, $sub) {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res['php'] .=
|
2011-02-09 05:31:16 +01:00
|
|
|
'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) {
|
2016-05-21 08:17:33 +02: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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_275 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_275 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_275 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_275 = FALSE; break; }
|
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Call" );
|
|
|
|
$_271 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_271 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == '(') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '(';
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_271 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_271 = 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"] .= ')';
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_271 = FALSE; break; }
|
|
|
|
$_271 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_271 === TRUE ) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = $result; $result = array_pop($stack);
|
|
|
|
$this->store( $result, $subres, 'Call' );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_271 === FALSE) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = array_pop($stack);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_275 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_275 = FALSE; break; }
|
|
|
|
$_275 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_275 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_275 === 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
|
|
|
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-02-28 04:12:41 +01:00
|
|
|
/* CacheBlockArgument:
|
|
|
|
!( "if " | "unless " )
|
2016-01-20 01:16:27 +01:00
|
|
|
(
|
2013-10-17 10:28:12 +02:00
|
|
|
:DollarMarkedLookup |
|
2011-02-28 04:12:41 +01:00
|
|
|
: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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_295 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_283 = $result;
|
|
|
|
$pos_283 = $this->pos;
|
|
|
|
$_282 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$_280 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_277 = $result;
|
|
|
|
$pos_277 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'if ' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_280 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_277;
|
|
|
|
$this->pos = $pos_277;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'unless ' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_280 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_277;
|
|
|
|
$this->pos = $pos_277;
|
|
|
|
$_280 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_280 === FALSE) { $_282 = FALSE; break; }
|
|
|
|
$_282 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_282 === TRUE ) {
|
|
|
|
$result = $res_283;
|
|
|
|
$this->pos = $pos_283;
|
|
|
|
$_295 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_282 === FALSE) {
|
|
|
|
$result = $res_283;
|
|
|
|
$this->pos = $pos_283;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_293 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$_291 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_284 = $result;
|
|
|
|
$pos_284 = $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" );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_291 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_284;
|
|
|
|
$this->pos = $pos_284;
|
|
|
|
$_289 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_286 = $result;
|
|
|
|
$pos_286 = $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" );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_289 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_286;
|
|
|
|
$this->pos = $pos_286;
|
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" );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_289 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_286;
|
|
|
|
$this->pos = $pos_286;
|
|
|
|
$_289 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_289 === TRUE ) { $_291 = TRUE; break; }
|
|
|
|
$result = $res_284;
|
|
|
|
$this->pos = $pos_284;
|
|
|
|
$_291 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_291 === FALSE) { $_293 = FALSE; break; }
|
|
|
|
$_293 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_293 === FALSE) { $_295 = FALSE; break; }
|
|
|
|
$_295 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_295 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_295 === 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'];
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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']) . "'";
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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'];
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-02-28 04:12:41 +01:00
|
|
|
/* 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_304 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_304 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
while (true) {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_303 = $result;
|
|
|
|
$pos_303 = $this->pos;
|
|
|
|
$_302 = 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"] .= ',';
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_302 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_302 = FALSE; break; }
|
|
|
|
$_302 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_302 === FALSE) {
|
|
|
|
$result = $res_303;
|
|
|
|
$this->pos = $pos_303;
|
|
|
|
unset( $res_303 );
|
|
|
|
unset( $pos_303 );
|
2011-02-28 04:12:41 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_304 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_304 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_304 === 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'] = '';
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-02-28 04:12:41 +01:00
|
|
|
$res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']);
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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) {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_348 = $result;
|
|
|
|
$pos_348 = $this->pos;
|
|
|
|
$_347 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$_345 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_306 = $result;
|
|
|
|
$pos_306 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_345 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_306;
|
|
|
|
$this->pos = $pos_306;
|
|
|
|
$_343 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_308 = $result;
|
|
|
|
$pos_308 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_343 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_308;
|
|
|
|
$this->pos = $pos_308;
|
|
|
|
$_341 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_310 = $result;
|
|
|
|
$pos_310 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_341 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_310;
|
|
|
|
$this->pos = $pos_310;
|
|
|
|
$_339 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_312 = $result;
|
|
|
|
$pos_312 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_339 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_312;
|
|
|
|
$this->pos = $pos_312;
|
|
|
|
$_337 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_314 = $result;
|
|
|
|
$pos_314 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_337 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_314;
|
|
|
|
$this->pos = $pos_314;
|
|
|
|
$_335 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_316 = $result;
|
|
|
|
$pos_316 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_335 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_316;
|
|
|
|
$this->pos = $pos_316;
|
|
|
|
$_333 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_318 = $result;
|
|
|
|
$pos_318 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_333 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_318;
|
|
|
|
$this->pos = $pos_318;
|
|
|
|
$_331 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_320 = $result;
|
|
|
|
$pos_320 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_331 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_320;
|
|
|
|
$this->pos = $pos_320;
|
|
|
|
$_329 = NULL;
|
2012-04-11 11:34:27 +02:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_322 = $result;
|
|
|
|
$pos_322 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_329 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_322;
|
|
|
|
$this->pos = $pos_322;
|
|
|
|
$_327 = NULL;
|
2012-04-16 07:37:57 +02:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_324 = $result;
|
|
|
|
$pos_324 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_327 = TRUE; break;
|
2012-04-16 07:37:57 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_324;
|
|
|
|
$this->pos = $pos_324;
|
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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_327 = TRUE; break;
|
2012-04-16 07:37:57 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_324;
|
|
|
|
$this->pos = $pos_324;
|
|
|
|
$_327 = FALSE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_327 === TRUE ) { $_329 = TRUE; break; }
|
|
|
|
$result = $res_322;
|
|
|
|
$this->pos = $pos_322;
|
|
|
|
$_329 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2012-04-11 11:34:27 +02:00
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_329 === TRUE ) { $_331 = TRUE; break; }
|
|
|
|
$result = $res_320;
|
|
|
|
$this->pos = $pos_320;
|
|
|
|
$_331 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_331 === TRUE ) { $_333 = TRUE; break; }
|
|
|
|
$result = $res_318;
|
|
|
|
$this->pos = $pos_318;
|
|
|
|
$_333 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_333 === TRUE ) { $_335 = TRUE; break; }
|
|
|
|
$result = $res_316;
|
|
|
|
$this->pos = $pos_316;
|
|
|
|
$_335 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_335 === TRUE ) { $_337 = TRUE; break; }
|
|
|
|
$result = $res_314;
|
|
|
|
$this->pos = $pos_314;
|
|
|
|
$_337 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_337 === TRUE ) { $_339 = TRUE; break; }
|
|
|
|
$result = $res_312;
|
|
|
|
$this->pos = $pos_312;
|
|
|
|
$_339 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_339 === TRUE ) { $_341 = TRUE; break; }
|
|
|
|
$result = $res_310;
|
|
|
|
$this->pos = $pos_310;
|
|
|
|
$_341 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_341 === TRUE ) { $_343 = TRUE; break; }
|
|
|
|
$result = $res_308;
|
|
|
|
$this->pos = $pos_308;
|
|
|
|
$_343 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_343 === TRUE ) { $_345 = TRUE; break; }
|
|
|
|
$result = $res_306;
|
|
|
|
$this->pos = $pos_306;
|
|
|
|
$_345 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_345 === FALSE) { $_347 = FALSE; break; }
|
|
|
|
$_347 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_347 === FALSE) {
|
|
|
|
$result = $res_348;
|
|
|
|
$this->pos = $pos_348;
|
|
|
|
unset( $res_348 );
|
|
|
|
unset( $pos_348 );
|
2011-02-28 04:12:41 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
$count += 1;
|
|
|
|
}
|
|
|
|
if ($count > 0) { return $this->finalise($result); }
|
|
|
|
else { return FALSE; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-20 01:16:27 +01:00
|
|
|
|
|
|
|
/* UncachedBlock:
|
2011-02-28 04:12:41 +01:00
|
|
|
'<%' < "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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_385 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_385 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_385 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_353 = $result;
|
|
|
|
$pos_353 = $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 {
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_353;
|
|
|
|
$this->pos = $pos_353;
|
|
|
|
unset( $res_353 );
|
|
|
|
unset( $pos_353 );
|
|
|
|
}
|
|
|
|
$res_365 = $result;
|
|
|
|
$pos_365 = $this->pos;
|
|
|
|
$_364 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Conditional" );
|
|
|
|
$_360 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$_358 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_355 = $result;
|
|
|
|
$pos_355 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'if' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_358 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_355;
|
|
|
|
$this->pos = $pos_355;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'unless' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_358 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_355;
|
|
|
|
$this->pos = $pos_355;
|
|
|
|
$_358 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_358 === FALSE) { $_360 = FALSE; break; }
|
|
|
|
$_360 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_360 === TRUE ) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = $result; $result = array_pop($stack);
|
|
|
|
$this->store( $result, $subres, 'Conditional' );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_360 === FALSE) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = array_pop($stack);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_364 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_364 = FALSE; break; }
|
|
|
|
$_364 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_364 === FALSE) {
|
|
|
|
$result = $res_365;
|
|
|
|
$this->pos = $pos_365;
|
|
|
|
unset( $res_365 );
|
|
|
|
unset( $pos_365 );
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_385 = FALSE; break; }
|
|
|
|
$res_368 = $result;
|
|
|
|
$pos_368 = $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 {
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_368;
|
|
|
|
$this->pos = $pos_368;
|
|
|
|
unset( $res_368 );
|
|
|
|
unset( $pos_368 );
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_385 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_385 = FALSE; break; }
|
|
|
|
$_381 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$_379 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_372 = $result;
|
|
|
|
$pos_372 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_379 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_372;
|
|
|
|
$this->pos = $pos_372;
|
|
|
|
$_377 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_374 = $result;
|
|
|
|
$pos_374 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_377 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_374;
|
|
|
|
$this->pos = $pos_374;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_377 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_374;
|
|
|
|
$this->pos = $pos_374;
|
|
|
|
$_377 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_377 === TRUE ) { $_379 = TRUE; break; }
|
|
|
|
$result = $res_372;
|
|
|
|
$this->pos = $pos_372;
|
|
|
|
$_379 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_379 === FALSE) { $_381 = FALSE; break; }
|
|
|
|
$_381 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_381 === FALSE) { $_385 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_385 = FALSE; break; }
|
|
|
|
$_385 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_385 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_385 === 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'];
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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) {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_437 = $result;
|
|
|
|
$pos_437 = $this->pos;
|
|
|
|
$_436 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$_434 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_387 = $result;
|
|
|
|
$pos_387 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_434 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_387;
|
|
|
|
$this->pos = $pos_387;
|
|
|
|
$_432 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_389 = $result;
|
|
|
|
$pos_389 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_432 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_389;
|
|
|
|
$this->pos = $pos_389;
|
|
|
|
$_430 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_391 = $result;
|
|
|
|
$pos_391 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_430 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_391;
|
|
|
|
$this->pos = $pos_391;
|
|
|
|
$_428 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_393 = $result;
|
|
|
|
$pos_393 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_428 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_393;
|
|
|
|
$this->pos = $pos_393;
|
|
|
|
$_426 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_395 = $result;
|
|
|
|
$pos_395 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_426 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_395;
|
|
|
|
$this->pos = $pos_395;
|
|
|
|
$_424 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_397 = $result;
|
|
|
|
$pos_397 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_424 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_397;
|
|
|
|
$this->pos = $pos_397;
|
|
|
|
$_422 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_399 = $result;
|
|
|
|
$pos_399 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_422 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_399;
|
|
|
|
$this->pos = $pos_399;
|
|
|
|
$_420 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_401 = $result;
|
|
|
|
$pos_401 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_420 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_401;
|
|
|
|
$this->pos = $pos_401;
|
|
|
|
$_418 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_403 = $result;
|
|
|
|
$pos_403 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_418 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_403;
|
|
|
|
$this->pos = $pos_403;
|
|
|
|
$_416 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_405 = $result;
|
|
|
|
$pos_405 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_416 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_405;
|
|
|
|
$this->pos = $pos_405;
|
|
|
|
$_414 = NULL;
|
2012-04-11 11:34:27 +02:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_407 = $result;
|
|
|
|
$pos_407 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_414 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_407;
|
|
|
|
$this->pos = $pos_407;
|
|
|
|
$_412 = NULL;
|
2012-04-16 07:37:57 +02:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_409 = $result;
|
|
|
|
$pos_409 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_412 = TRUE; break;
|
2012-04-16 07:37:57 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_409;
|
|
|
|
$this->pos = $pos_409;
|
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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_412 = TRUE; break;
|
2012-04-16 07:37:57 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_409;
|
|
|
|
$this->pos = $pos_409;
|
|
|
|
$_412 = FALSE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_412 === TRUE ) { $_414 = TRUE; break; }
|
|
|
|
$result = $res_407;
|
|
|
|
$this->pos = $pos_407;
|
|
|
|
$_414 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2012-04-11 11:34:27 +02:00
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_414 === TRUE ) { $_416 = TRUE; break; }
|
|
|
|
$result = $res_405;
|
|
|
|
$this->pos = $pos_405;
|
|
|
|
$_416 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_416 === TRUE ) { $_418 = TRUE; break; }
|
|
|
|
$result = $res_403;
|
|
|
|
$this->pos = $pos_403;
|
|
|
|
$_418 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_418 === TRUE ) { $_420 = TRUE; break; }
|
|
|
|
$result = $res_401;
|
|
|
|
$this->pos = $pos_401;
|
|
|
|
$_420 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_420 === TRUE ) { $_422 = TRUE; break; }
|
|
|
|
$result = $res_399;
|
|
|
|
$this->pos = $pos_399;
|
|
|
|
$_422 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_422 === TRUE ) { $_424 = TRUE; break; }
|
|
|
|
$result = $res_397;
|
|
|
|
$this->pos = $pos_397;
|
|
|
|
$_424 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_424 === TRUE ) { $_426 = TRUE; break; }
|
|
|
|
$result = $res_395;
|
|
|
|
$this->pos = $pos_395;
|
|
|
|
$_426 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_426 === TRUE ) { $_428 = TRUE; break; }
|
|
|
|
$result = $res_393;
|
|
|
|
$this->pos = $pos_393;
|
|
|
|
$_428 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_428 === TRUE ) { $_430 = TRUE; break; }
|
|
|
|
$result = $res_391;
|
|
|
|
$this->pos = $pos_391;
|
|
|
|
$_430 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_430 === TRUE ) { $_432 = TRUE; break; }
|
|
|
|
$result = $res_389;
|
|
|
|
$this->pos = $pos_389;
|
|
|
|
$_432 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_432 === TRUE ) { $_434 = TRUE; break; }
|
|
|
|
$result = $res_387;
|
|
|
|
$this->pos = $pos_387;
|
|
|
|
$_434 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_434 === FALSE) { $_436 = FALSE; break; }
|
|
|
|
$_436 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_436 === FALSE) {
|
|
|
|
$result = $res_437;
|
|
|
|
$this->pos = $pos_437;
|
|
|
|
unset( $res_437 );
|
|
|
|
unset( $pos_437 );
|
2011-02-28 04:12:41 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
$count += 1;
|
|
|
|
}
|
|
|
|
if ($count > 0) { return $this->finalise($result); }
|
|
|
|
else { return FALSE; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-21 08:17:33 +02:00
|
|
|
function CacheRestrictedTemplate_CacheBlock(&$res, $sub) {
|
2012-09-26 23:34:00 +02:00
|
|
|
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
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2016-05-21 08:17:33 +02:00
|
|
|
function CacheRestrictedTemplate_UncachedBlock(&$res, $sub) {
|
2012-09-26 23:34:00 +02:00
|
|
|
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
|
|
|
}
|
2016-01-20 01:16:27 +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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_492 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_492 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "CacheTag" );
|
|
|
|
$_445 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$_443 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_440 = $result;
|
|
|
|
$pos_440 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_443 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_440;
|
|
|
|
$this->pos = $pos_440;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_443 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_440;
|
|
|
|
$this->pos = $pos_440;
|
|
|
|
$_443 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_443 === FALSE) { $_445 = FALSE; break; }
|
|
|
|
$_445 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_445 === TRUE ) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$subres = $result; $result = array_pop($stack);
|
|
|
|
$this->store( $result, $subres, 'CacheTag' );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_445 === FALSE) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = array_pop($stack);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_492 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_450 = $result;
|
|
|
|
$pos_450 = $this->pos;
|
|
|
|
$_449 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_449 = FALSE; break; }
|
|
|
|
$_449 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_449 === FALSE) {
|
|
|
|
$result = $res_450;
|
|
|
|
$this->pos = $pos_450;
|
|
|
|
unset( $res_450 );
|
|
|
|
unset( $pos_450 );
|
|
|
|
}
|
|
|
|
$res_462 = $result;
|
|
|
|
$pos_462 = $this->pos;
|
|
|
|
$_461 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Conditional" );
|
|
|
|
$_457 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$_455 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_452 = $result;
|
|
|
|
$pos_452 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'if' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_455 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_452;
|
|
|
|
$this->pos = $pos_452;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'unless' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_455 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_452;
|
|
|
|
$this->pos = $pos_452;
|
|
|
|
$_455 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_455 === FALSE) { $_457 = FALSE; break; }
|
|
|
|
$_457 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_457 === 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
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_457 === FALSE) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = array_pop($stack);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_461 = 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
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_461 = FALSE; break; }
|
|
|
|
$_461 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_461 === FALSE) {
|
|
|
|
$result = $res_462;
|
|
|
|
$this->pos = $pos_462;
|
|
|
|
unset( $res_462 );
|
|
|
|
unset( $pos_462 );
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_492 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
while (true) {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_475 = $result;
|
|
|
|
$pos_475 = $this->pos;
|
|
|
|
$_474 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$_472 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_465 = $result;
|
|
|
|
$pos_465 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_472 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_465;
|
|
|
|
$this->pos = $pos_465;
|
|
|
|
$_470 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_467 = $result;
|
|
|
|
$pos_467 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_470 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_467;
|
|
|
|
$this->pos = $pos_467;
|
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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_470 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_467;
|
|
|
|
$this->pos = $pos_467;
|
|
|
|
$_470 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_470 === TRUE ) { $_472 = TRUE; break; }
|
|
|
|
$result = $res_465;
|
|
|
|
$this->pos = $pos_465;
|
|
|
|
$_472 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_472 === FALSE) { $_474 = FALSE; break; }
|
|
|
|
$_474 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_474 === FALSE) {
|
|
|
|
$result = $res_475;
|
|
|
|
$this->pos = $pos_475;
|
|
|
|
unset( $res_475 );
|
|
|
|
unset( $pos_475 );
|
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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_492 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_492 = FALSE; break; }
|
|
|
|
$_488 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$_486 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_479 = $result;
|
|
|
|
$pos_479 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_486 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_479;
|
|
|
|
$this->pos = $pos_479;
|
|
|
|
$_484 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_481 = $result;
|
|
|
|
$pos_481 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_484 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_481;
|
|
|
|
$this->pos = $pos_481;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_484 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_481;
|
|
|
|
$this->pos = $pos_481;
|
|
|
|
$_484 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_484 === TRUE ) { $_486 = TRUE; break; }
|
|
|
|
$result = $res_479;
|
|
|
|
$this->pos = $pos_479;
|
|
|
|
$_486 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_486 === FALSE) { $_488 = FALSE; break; }
|
|
|
|
$_488 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_488 === FALSE) { $_492 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_492 = FALSE; break; }
|
|
|
|
$_492 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_492 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_492 === 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
|
|
|
}
|
2016-01-20 01:16:27 +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'] : '';
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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'] . ') && ';
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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'];
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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'];
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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'];
|
2014-03-26 06:27:07 +01:00
|
|
|
// Build the key for this block from the global key (evaluated in a closure within the template),
|
|
|
|
// the passed cache key, the block index, and the sha hash of the template.
|
|
|
|
$res['php'] .= '$keyExpression = function() use ($scope, $cache) {' . PHP_EOL;
|
|
|
|
$res['php'] .= '$val = \'\';' . PHP_EOL;
|
|
|
|
if($globalKey = Config::inst()->get('SSViewer', 'global_key')) {
|
|
|
|
// Embed the code necessary to evaluate the globalKey directly into the template,
|
|
|
|
// so that SSTemplateParser only needs to be called during template regeneration.
|
|
|
|
// Warning: If the global key is changed, it's necessary to flush the template cache.
|
2014-03-30 07:55:44 +02:00
|
|
|
$parser = Injector::inst()->get('SSTemplateParser', false);
|
|
|
|
$result = $parser->compileString($globalKey, '', false, false);
|
2014-03-26 06:27:07 +01:00
|
|
|
if(!$result) throw new SSTemplateParseException('Unexpected problem parsing template', $parser);
|
2014-03-30 07:55:44 +02:00
|
|
|
$res['php'] .= $result . PHP_EOL;
|
2014-03-26 06:27:07 +01:00
|
|
|
}
|
|
|
|
$res['php'] .= 'return $val;' . PHP_EOL;
|
|
|
|
$res['php'] .= '};' . PHP_EOL;
|
|
|
|
$key = 'sha1($keyExpression())' // Global key
|
|
|
|
. '.\'_' . sha1($sub['php']) // sha of template
|
|
|
|
. (isset($res['key']) && $res['key'] ? "_'.sha1(".$res['key'].")" : "'") // Passed key
|
|
|
|
. ".'_$block'"; // block index
|
2011-02-28 04:12:41 +01:00
|
|
|
// Get any condition
|
|
|
|
$condition = isset($res['condition']) ? $res['condition'] : '';
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-02-28 04:12:41 +01:00
|
|
|
$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'] .= '}';
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_511 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_511 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_511 = 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
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_511 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_511 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_511 = FALSE; break; }
|
|
|
|
$res_504 = $result;
|
|
|
|
$pos_504 = $this->pos;
|
|
|
|
$_503 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_503 = 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
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_503 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_503 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_503 = FALSE; break; }
|
|
|
|
$_503 = TRUE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_503 === FALSE) {
|
|
|
|
$result = $res_504;
|
|
|
|
$this->pos = $pos_504;
|
|
|
|
unset( $res_504 );
|
|
|
|
unset( $pos_504 );
|
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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_511 = 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
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_511 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_511 = FALSE; break; }
|
|
|
|
$res_510 = $result;
|
|
|
|
$pos_510 = $this->pos;
|
|
|
|
$_509 = NULL;
|
2012-04-16 06:59:56 +02:00
|
|
|
do {
|
|
|
|
if (substr($this->string,$this->pos,1) == ';') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= ';';
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_509 = FALSE; break; }
|
|
|
|
$_509 = TRUE; break;
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_509 === FALSE) {
|
|
|
|
$result = $res_510;
|
|
|
|
$this->pos = $pos_510;
|
|
|
|
unset( $res_510 );
|
|
|
|
unset( $pos_510 );
|
2012-04-16 06:59:56 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_511 = TRUE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_511 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_511 === 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(";
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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'";
|
|
|
|
}
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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'] .= ')';
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-02-21 05:44:46 +01:00
|
|
|
/* 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_519 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_519 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_519 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_519 = FALSE; break; }
|
|
|
|
$_519 = TRUE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_519 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_519 === 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_536 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_536 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_536 = 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
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_536 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_536 = 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
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_536 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_536 = 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
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_536 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_536 = FALSE; break; }
|
|
|
|
$_536 = TRUE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_536 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_536 === 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(";
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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'] . ')';
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-02-21 05:44:46 +01:00
|
|
|
/* 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_541 = NULL;
|
2011-02-21 05:44:46 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_538 = $result;
|
|
|
|
$pos_538 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_541 = TRUE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_538;
|
|
|
|
$this->pos = $pos_538;
|
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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_541 = TRUE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_538;
|
|
|
|
$this->pos = $pos_538;
|
|
|
|
$_541 = FALSE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_541 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_541 === 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_546 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_546 = FALSE; break; }
|
2012-04-11 11:34:27 +02:00
|
|
|
if (substr($this->string,$this->pos,1) == '=') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '=';
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_546 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_546 = FALSE; break; }
|
|
|
|
$_546 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_546 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_546 === 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
|
|
|
}
|
|
|
|
|
2016-05-21 08:17:33 +02:00
|
|
|
/* Include: "<%" < "include" < Template:NamespacedWord < (NamedArgument ( < "," < NamedArgument )*)? > "%>" */
|
2012-04-11 11:34:27 +02:00
|
|
|
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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_565 = NULL;
|
2012-04-11 11:34:27 +02:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_565 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_565 = FALSE; break; }
|
2012-04-11 11:34:27 +02:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
$matcher = 'match_'.'NamespacedWord'; $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, "Template" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_565 = FALSE; break; }
|
2012-04-11 11:34:27 +02:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_562 = $result;
|
|
|
|
$pos_562 = $this->pos;
|
|
|
|
$_561 = 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 ); }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_561 = FALSE; break; }
|
2012-04-11 11:34:27 +02:00
|
|
|
while (true) {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_560 = $result;
|
|
|
|
$pos_560 = $this->pos;
|
|
|
|
$_559 = 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"] .= ',';
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_559 = 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 );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_559 = FALSE; break; }
|
|
|
|
$_559 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_559 === FALSE) {
|
|
|
|
$result = $res_560;
|
|
|
|
$this->pos = $pos_560;
|
|
|
|
unset( $res_560 );
|
|
|
|
unset( $pos_560 );
|
2012-04-11 11:34:27 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_561 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_561 === FALSE) {
|
|
|
|
$result = $res_562;
|
|
|
|
$this->pos = $pos_562;
|
|
|
|
unset( $res_562 );
|
|
|
|
unset( $pos_562 );
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
|
|
|
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_565 = FALSE; break; }
|
|
|
|
$_565 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_565 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_565 === 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'];
|
|
|
|
|
2016-05-21 08:17:33 +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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_574 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_574 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
while (true) {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_573 = $result;
|
|
|
|
$pos_573 = $this->pos;
|
|
|
|
$_572 = 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
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_572 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_572 = FALSE; break; }
|
|
|
|
$_572 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_572 === FALSE) {
|
|
|
|
$result = $res_573;
|
|
|
|
$this->pos = $pos_573;
|
|
|
|
unset( $res_573 );
|
|
|
|
unset( $pos_573 );
|
2011-02-09 05:31:16 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_574 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_574 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_574 === 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_612 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_576 = $result;
|
|
|
|
$pos_576 = $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;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_612 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_576;
|
|
|
|
$this->pos = $pos_576;
|
|
|
|
$_610 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$_607 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$_605 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_578 = $result;
|
|
|
|
$pos_578 = $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;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_605 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_578;
|
|
|
|
$this->pos = $pos_578;
|
|
|
|
$_603 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_580 = $result;
|
|
|
|
$pos_580 = $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;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_603 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_580;
|
|
|
|
$this->pos = $pos_580;
|
|
|
|
$_601 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_582 = $result;
|
|
|
|
$pos_582 = $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;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_601 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_582;
|
|
|
|
$this->pos = $pos_582;
|
|
|
|
$_599 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_584 = $result;
|
|
|
|
$pos_584 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'require' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_599 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_584;
|
|
|
|
$this->pos = $pos_584;
|
|
|
|
$_597 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_586 = $result;
|
|
|
|
$pos_586 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_597 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_586;
|
|
|
|
$this->pos = $pos_586;
|
|
|
|
$_595 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_588 = $result;
|
|
|
|
$pos_588 = $this->pos;
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_595 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_588;
|
|
|
|
$this->pos = $pos_588;
|
|
|
|
$_593 = NULL;
|
2012-04-11 11:34:27 +02:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_590 = $result;
|
|
|
|
$pos_590 = $this->pos;
|
2012-04-11 11:34:27 +02:00
|
|
|
if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_593 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_590;
|
|
|
|
$this->pos = $pos_590;
|
2012-04-11 11:34:27 +02:00
|
|
|
if (( $subres = $this->literal( 'include' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_593 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_590;
|
|
|
|
$this->pos = $pos_590;
|
|
|
|
$_593 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2012-04-11 11:34:27 +02:00
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_593 === TRUE ) { $_595 = TRUE; break; }
|
|
|
|
$result = $res_588;
|
|
|
|
$this->pos = $pos_588;
|
|
|
|
$_595 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_595 === TRUE ) { $_597 = TRUE; break; }
|
|
|
|
$result = $res_586;
|
|
|
|
$this->pos = $pos_586;
|
|
|
|
$_597 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_597 === TRUE ) { $_599 = TRUE; break; }
|
|
|
|
$result = $res_584;
|
|
|
|
$this->pos = $pos_584;
|
|
|
|
$_599 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_599 === TRUE ) { $_601 = TRUE; break; }
|
|
|
|
$result = $res_582;
|
|
|
|
$this->pos = $pos_582;
|
|
|
|
$_601 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_601 === TRUE ) { $_603 = TRUE; break; }
|
|
|
|
$result = $res_580;
|
|
|
|
$this->pos = $pos_580;
|
|
|
|
$_603 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_603 === TRUE ) { $_605 = TRUE; break; }
|
|
|
|
$result = $res_578;
|
|
|
|
$this->pos = $pos_578;
|
|
|
|
$_605 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_605 === FALSE) { $_607 = FALSE; break; }
|
|
|
|
$_607 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_607 === FALSE) { $_610 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_610 = FALSE; break; }
|
|
|
|
$_610 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_610 === TRUE ) { $_612 = TRUE; break; }
|
|
|
|
$result = $res_576;
|
|
|
|
$this->pos = $pos_576;
|
|
|
|
$_612 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_612 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_612 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-01-20 01:16:27 +01:00
|
|
|
/* ClosedBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > Zap:'%>' Template:$TemplateMatcher?
|
2012-09-26 23:34:00 +02:00
|
|
|
'<%' < '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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_632 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_632 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_616 = $result;
|
|
|
|
$pos_616 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_616;
|
|
|
|
$this->pos = $pos_616;
|
|
|
|
$_632 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else {
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_616;
|
|
|
|
$this->pos = $pos_616;
|
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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_632 = FALSE; break; }
|
|
|
|
$res_622 = $result;
|
|
|
|
$pos_622 = $this->pos;
|
|
|
|
$_621 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_621 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_621 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_621 = FALSE; break; }
|
|
|
|
$_621 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_621 === FALSE) {
|
|
|
|
$result = $res_622;
|
|
|
|
$this->pos = $pos_622;
|
|
|
|
unset( $res_622 );
|
|
|
|
unset( $pos_622 );
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Zap" );
|
2011-02-28 04:12:41 +01:00
|
|
|
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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_632 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_625 = $result;
|
|
|
|
$pos_625 = $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 {
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_625;
|
|
|
|
$this->pos = $pos_625;
|
|
|
|
unset( $res_625 );
|
|
|
|
unset( $pos_625 );
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_632 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_632 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( ''.$this->expression($result, $stack, 'BlockName').'' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_632 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_632 = FALSE; break; }
|
|
|
|
$_632 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_632 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_632 === FALSE) { return FALSE; }
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-20 01:16:27 +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).
|
2016-01-20 01:16:27 +01:00
|
|
|
*
|
2011-02-14 22:03:42 +01:00
|
|
|
* 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.
|
|
|
|
*/
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function ClosedBlock__construct(&$res) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$res['ArgumentCount'] = 0;
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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']);
|
|
|
|
}
|
|
|
|
}
|
2013-10-24 01:43:20 +02:00
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function ClosedBlock__finalise(&$res) {
|
2011-02-09 05:31:16 +01:00
|
|
|
$blockname = $res['BlockName']['text'];
|
2013-10-24 01:43:20 +02:00
|
|
|
|
2011-12-17 05:35:26 +01:00
|
|
|
$method = 'ClosedBlock_Handle_'.$blockname;
|
2013-10-24 01:43:20 +02:00
|
|
|
if (method_exists($this, $method)) {
|
|
|
|
$res['php'] = $this->$method($res);
|
|
|
|
} else if (isset($this->closedBlocks[$blockname])) {
|
|
|
|
$res['php'] = call_user_func($this->closedBlocks[$blockname], $res);
|
|
|
|
} else {
|
2012-09-26 23:34:00 +02:00
|
|
|
throw new SSTemplateParseException('Unknown closed block "'.$blockname.'" encountered. Perhaps you are ' .
|
2013-10-24 01:43:20 +02:00
|
|
|
'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);
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$on = str_replace('$$FINAL', 'obj',
|
2012-09-26 23:34:00 +02:00
|
|
|
($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 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
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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);
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-02-18 05:06:11 +01:00
|
|
|
$on = str_replace('$$FINAL', 'obj', ($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php']);
|
2016-05-21 08:17:33 +02: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
|
|
|
}
|
2016-01-20 01:16:27 +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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_645 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_645 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_636 = $result;
|
|
|
|
$pos_636 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_636;
|
|
|
|
$this->pos = $pos_636;
|
|
|
|
$_645 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else {
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_636;
|
|
|
|
$this->pos = $pos_636;
|
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
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_645 = FALSE; break; }
|
|
|
|
$res_642 = $result;
|
|
|
|
$pos_642 = $this->pos;
|
|
|
|
$_641 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_641 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_641 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_641 = FALSE; break; }
|
|
|
|
$_641 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_641 === FALSE) {
|
|
|
|
$result = $res_642;
|
|
|
|
$this->pos = $pos_642;
|
|
|
|
unset( $res_642 );
|
|
|
|
unset( $pos_642 );
|
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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_645 = FALSE; break; }
|
|
|
|
$_645 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_645 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_645 === 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;
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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']);
|
|
|
|
}
|
|
|
|
}
|
2013-10-24 01:43:20 +02:00
|
|
|
|
2012-09-26 23:34:00 +02:00
|
|
|
function OpenBlock__finalise(&$res) {
|
2011-02-14 04:52:01 +01:00
|
|
|
$blockname = $res['BlockName']['text'];
|
2013-10-24 01:43:20 +02:00
|
|
|
|
2011-12-17 05:35:26 +01:00
|
|
|
$method = 'OpenBlock_Handle_'.$blockname;
|
2013-10-24 01:43:20 +02:00
|
|
|
if (method_exists($this, $method)) {
|
|
|
|
$res['php'] = $this->$method($res);
|
|
|
|
} elseif (isset($this->openBlocks[$blockname])) {
|
|
|
|
$res['php'] = call_user_func($this->openBlocks[$blockname], $res);
|
|
|
|
} else {
|
2013-02-14 08:31:40 +01:00
|
|
|
throw new SSTemplateParseException('Unknown open block "'.$blockname.'" encountered. Perhaps you missed ' .
|
2013-10-24 01:43:20 +02:00
|
|
|
' 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];
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-02-09 05:31:16 +01:00
|
|
|
if ($arg['ArgumentMode'] == 'string') return 'Debug::show('.$arg['php'].');';
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-02-09 05:31:16 +01:00
|
|
|
$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];';
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_653 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_653 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_653 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_653 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_653 = FALSE; break; }
|
|
|
|
$_653 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_653 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_653 === 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'];
|
2016-05-21 08:17:33 +02:00
|
|
|
throw new SSTemplateParseException('Unexpected close tag end_' . $blockname .
|
2013-02-14 08:31:40 +01:00
|
|
|
' 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_668 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_668 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_657 = $result;
|
|
|
|
$pos_657 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_657;
|
|
|
|
$this->pos = $pos_657;
|
|
|
|
$_668 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else {
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_657;
|
|
|
|
$this->pos = $pos_657;
|
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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_668 = FALSE; break; }
|
|
|
|
$res_667 = $result;
|
|
|
|
$pos_667 = $this->pos;
|
|
|
|
$_666 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_663 = $result;
|
|
|
|
$pos_663 = $this->pos;
|
|
|
|
$_662 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_662 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_662 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_662 = FALSE; break; }
|
|
|
|
$_662 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_662 === FALSE) {
|
|
|
|
$result = $res_663;
|
|
|
|
$this->pos = $pos_663;
|
|
|
|
unset( $res_663 );
|
|
|
|
unset( $pos_663 );
|
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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_666 = FALSE; break; }
|
|
|
|
$_666 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_666 === TRUE ) {
|
|
|
|
$result = $res_667;
|
|
|
|
$this->pos = $pos_667;
|
|
|
|
$_668 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_666 === FALSE) {
|
|
|
|
$result = $res_667;
|
|
|
|
$this->pos = $pos_667;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_668 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_668 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_668 === 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
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_680 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_680 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
$stack[] = $result; $result = $this->construct( $matchrule, "Tag" );
|
|
|
|
$_674 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_674 = 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" );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_674 = FALSE; break; }
|
|
|
|
$_674 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_674 === 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' );
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_674 === FALSE) {
|
2011-02-28 04:12:41 +01:00
|
|
|
$result = array_pop($stack);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_680 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_679 = $result;
|
|
|
|
$pos_679 = $this->pos;
|
|
|
|
$_678 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_678 = FALSE; break; }
|
|
|
|
$_678 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_678 === TRUE ) {
|
|
|
|
$result = $res_679;
|
|
|
|
$this->pos = $pos_679;
|
|
|
|
$_680 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_678 === FALSE) {
|
|
|
|
$result = $res_679;
|
|
|
|
$this->pos = $pos_679;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_680 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_680 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_680 === 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
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_685 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_682 = $result;
|
|
|
|
$pos_682 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_685 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_682;
|
|
|
|
$this->pos = $pos_682;
|
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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_685 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_682;
|
|
|
|
$this->pos = $pos_682;
|
|
|
|
$_685 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_685 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_685 === 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);
|
2016-05-21 08:17:33 +02:00
|
|
|
$_693 = 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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_693 = FALSE; break; }
|
2011-02-09 05:31:16 +01:00
|
|
|
$count = 0;
|
|
|
|
while (true) {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_691 = $result;
|
|
|
|
$pos_691 = $this->pos;
|
|
|
|
$_690 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_688 = $result;
|
|
|
|
$pos_688 = $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;
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_688;
|
|
|
|
$this->pos = $pos_688;
|
|
|
|
$_690 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
else {
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_688;
|
|
|
|
$this->pos = $pos_688;
|
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; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_690 = FALSE; break; }
|
|
|
|
$_690 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_690 === FALSE) {
|
|
|
|
$result = $res_691;
|
|
|
|
$this->pos = $pos_691;
|
|
|
|
unset( $res_691 );
|
|
|
|
unset( $pos_691 );
|
2011-02-09 05:31:16 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
$count += 1;
|
|
|
|
}
|
|
|
|
if ($count > 0) { }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_693 = FALSE; break; }
|
2011-02-28 04:12:41 +01:00
|
|
|
if (( $subres = $this->literal( '--%>' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_693 = FALSE; break; }
|
|
|
|
$_693 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_693 === TRUE ) { return $this->finalise($result); }
|
|
|
|
if( $_693 === 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'] = '';
|
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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) {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_749 = $result;
|
|
|
|
$pos_749 = $this->pos;
|
|
|
|
$_748 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$_746 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_695 = $result;
|
|
|
|
$pos_695 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_746 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_695;
|
|
|
|
$this->pos = $pos_695;
|
|
|
|
$_744 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_697 = $result;
|
|
|
|
$pos_697 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_744 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_697;
|
|
|
|
$this->pos = $pos_697;
|
|
|
|
$_742 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_699 = $result;
|
|
|
|
$pos_699 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_742 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_699;
|
|
|
|
$this->pos = $pos_699;
|
|
|
|
$_740 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_701 = $result;
|
|
|
|
$pos_701 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_740 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_701;
|
|
|
|
$this->pos = $pos_701;
|
|
|
|
$_738 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_703 = $result;
|
|
|
|
$pos_703 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_738 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_703;
|
|
|
|
$this->pos = $pos_703;
|
|
|
|
$_736 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_705 = $result;
|
|
|
|
$pos_705 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_736 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_705;
|
|
|
|
$this->pos = $pos_705;
|
|
|
|
$_734 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_707 = $result;
|
|
|
|
$pos_707 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_734 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_707;
|
|
|
|
$this->pos = $pos_707;
|
|
|
|
$_732 = NULL;
|
2011-02-09 05:31:16 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_709 = $result;
|
|
|
|
$pos_709 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_732 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_709;
|
|
|
|
$this->pos = $pos_709;
|
|
|
|
$_730 = NULL;
|
2011-02-21 05:44:46 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_711 = $result;
|
|
|
|
$pos_711 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_730 = TRUE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_711;
|
|
|
|
$this->pos = $pos_711;
|
|
|
|
$_728 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_713 = $result;
|
|
|
|
$pos_713 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_728 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_713;
|
|
|
|
$this->pos = $pos_713;
|
|
|
|
$_726 = NULL;
|
2011-02-28 04:12:41 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_715 = $result;
|
|
|
|
$pos_715 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_726 = TRUE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_715;
|
|
|
|
$this->pos = $pos_715;
|
|
|
|
$_724 = NULL;
|
2012-04-11 11:34:27 +02:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_717 = $result;
|
|
|
|
$pos_717 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_724 = TRUE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_717;
|
|
|
|
$this->pos = $pos_717;
|
|
|
|
$_722 = NULL;
|
2012-04-16 07:37:57 +02:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_719 = $result;
|
|
|
|
$pos_719 = $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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_722 = TRUE; break;
|
2012-04-16 07:37:57 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_719;
|
|
|
|
$this->pos = $pos_719;
|
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 );
|
2016-05-21 08:17:33 +02:00
|
|
|
$_722 = TRUE; break;
|
2012-04-16 07:37:57 +02:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_719;
|
|
|
|
$this->pos = $pos_719;
|
|
|
|
$_722 = FALSE; break;
|
2012-04-11 11:34:27 +02:00
|
|
|
}
|
2012-04-16 07:37:57 +02:00
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_722 === TRUE ) { $_724 = TRUE; break; }
|
|
|
|
$result = $res_717;
|
|
|
|
$this->pos = $pos_717;
|
|
|
|
$_724 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
2012-04-11 11:34:27 +02:00
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_724 === TRUE ) { $_726 = TRUE; break; }
|
|
|
|
$result = $res_715;
|
|
|
|
$this->pos = $pos_715;
|
|
|
|
$_726 = FALSE; break;
|
2011-02-28 04:12:41 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_726 === TRUE ) { $_728 = TRUE; break; }
|
|
|
|
$result = $res_713;
|
|
|
|
$this->pos = $pos_713;
|
|
|
|
$_728 = FALSE; break;
|
2011-02-21 05:44:46 +01:00
|
|
|
}
|
2011-02-28 04:12:41 +01:00
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_728 === TRUE ) { $_730 = TRUE; break; }
|
|
|
|
$result = $res_711;
|
|
|
|
$this->pos = $pos_711;
|
|
|
|
$_730 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
2011-02-21 05:44:46 +01:00
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_730 === TRUE ) { $_732 = TRUE; break; }
|
|
|
|
$result = $res_709;
|
|
|
|
$this->pos = $pos_709;
|
|
|
|
$_732 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_732 === TRUE ) { $_734 = TRUE; break; }
|
|
|
|
$result = $res_707;
|
|
|
|
$this->pos = $pos_707;
|
|
|
|
$_734 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_734 === TRUE ) { $_736 = TRUE; break; }
|
|
|
|
$result = $res_705;
|
|
|
|
$this->pos = $pos_705;
|
|
|
|
$_736 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_736 === TRUE ) { $_738 = TRUE; break; }
|
|
|
|
$result = $res_703;
|
|
|
|
$this->pos = $pos_703;
|
|
|
|
$_738 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_738 === TRUE ) { $_740 = TRUE; break; }
|
|
|
|
$result = $res_701;
|
|
|
|
$this->pos = $pos_701;
|
|
|
|
$_740 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_740 === TRUE ) { $_742 = TRUE; break; }
|
|
|
|
$result = $res_699;
|
|
|
|
$this->pos = $pos_699;
|
|
|
|
$_742 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_742 === TRUE ) { $_744 = TRUE; break; }
|
|
|
|
$result = $res_697;
|
|
|
|
$this->pos = $pos_697;
|
|
|
|
$_744 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_744 === TRUE ) { $_746 = TRUE; break; }
|
|
|
|
$result = $res_695;
|
|
|
|
$this->pos = $pos_695;
|
|
|
|
$_746 = FALSE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_746 === FALSE) { $_748 = FALSE; break; }
|
|
|
|
$_748 = TRUE; break;
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_748 === FALSE) {
|
|
|
|
$result = $res_749;
|
|
|
|
$this->pos = $pos_749;
|
|
|
|
unset( $res_749 );
|
|
|
|
unset( $pos_749 );
|
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; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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) {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_788 = $result;
|
|
|
|
$pos_788 = $this->pos;
|
|
|
|
$_787 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$_785 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_750 = $result;
|
|
|
|
$pos_750 = $this->pos;
|
2011-03-17 01:08:13 +01:00
|
|
|
if (( $subres = $this->rx( '/ [^<${\\\\]+ /' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_785 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_750;
|
|
|
|
$this->pos = $pos_750;
|
|
|
|
$_783 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_752 = $result;
|
|
|
|
$pos_752 = $this->pos;
|
2011-03-17 01:08:13 +01:00
|
|
|
if (( $subres = $this->rx( '/ (\\\\.) /' ) ) !== FALSE) {
|
|
|
|
$result["text"] .= $subres;
|
2016-05-21 08:17:33 +02:00
|
|
|
$_783 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_752;
|
|
|
|
$this->pos = $pos_752;
|
|
|
|
$_781 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_754 = $result;
|
|
|
|
$pos_754 = $this->pos;
|
|
|
|
$_757 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
|
|
|
if (substr($this->string,$this->pos,1) == '<') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '<';
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_757 = FALSE; break; }
|
|
|
|
$res_756 = $result;
|
|
|
|
$pos_756 = $this->pos;
|
2011-03-17 01:08:13 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == '%') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '%';
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_756;
|
|
|
|
$this->pos = $pos_756;
|
|
|
|
$_757 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
else {
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_756;
|
|
|
|
$this->pos = $pos_756;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_757 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_757 === TRUE ) { $_781 = TRUE; break; }
|
|
|
|
$result = $res_754;
|
|
|
|
$this->pos = $pos_754;
|
|
|
|
$_779 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_759 = $result;
|
|
|
|
$pos_759 = $this->pos;
|
|
|
|
$_764 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
|
|
|
if (substr($this->string,$this->pos,1) == '$') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '$';
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_764 = FALSE; break; }
|
|
|
|
$res_763 = $result;
|
|
|
|
$pos_763 = $this->pos;
|
|
|
|
$_762 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->rx( '/[A-Za-z_]/' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_762 = FALSE; break; }
|
|
|
|
$_762 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_762 === TRUE ) {
|
|
|
|
$result = $res_763;
|
|
|
|
$this->pos = $pos_763;
|
|
|
|
$_764 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_762 === FALSE) {
|
|
|
|
$result = $res_763;
|
|
|
|
$this->pos = $pos_763;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_764 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_764 === TRUE ) { $_779 = TRUE; break; }
|
|
|
|
$result = $res_759;
|
|
|
|
$this->pos = $pos_759;
|
|
|
|
$_777 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
2016-05-21 08:17:33 +02:00
|
|
|
$res_766 = $result;
|
|
|
|
$pos_766 = $this->pos;
|
|
|
|
$_769 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
|
|
|
if (substr($this->string,$this->pos,1) == '{') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '{';
|
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_769 = FALSE; break; }
|
|
|
|
$res_768 = $result;
|
|
|
|
$pos_768 = $this->pos;
|
2011-03-17 01:08:13 +01:00
|
|
|
if (substr($this->string,$this->pos,1) == '$') {
|
|
|
|
$this->pos += 1;
|
|
|
|
$result["text"] .= '$';
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_768;
|
|
|
|
$this->pos = $pos_768;
|
|
|
|
$_769 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
else {
|
2016-05-21 08:17:33 +02:00
|
|
|
$result = $res_768;
|
|
|
|
$this->pos = $pos_768;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_769 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_769 === TRUE ) { $_777 = TRUE; break; }
|
|
|
|
$result = $res_766;
|
|
|
|
$this->pos = $pos_766;
|
|
|
|
$_775 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->literal( '{$' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_775 = FALSE; break; }
|
|
|
|
$res_774 = $result;
|
|
|
|
$pos_774 = $this->pos;
|
|
|
|
$_773 = NULL;
|
2011-03-17 01:08:13 +01:00
|
|
|
do {
|
|
|
|
if (( $subres = $this->rx( '/[A-Za-z_]/' ) ) !== FALSE) { $result["text"] .= $subres; }
|
2016-05-21 08:17:33 +02:00
|
|
|
else { $_773 = FALSE; break; }
|
|
|
|
$_773 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_773 === TRUE ) {
|
|
|
|
$result = $res_774;
|
|
|
|
$this->pos = $pos_774;
|
|
|
|
$_775 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_773 === FALSE) {
|
|
|
|
$result = $res_774;
|
|
|
|
$this->pos = $pos_774;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
2016-05-21 08:17:33 +02:00
|
|
|
$_775 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_775 === TRUE ) { $_777 = TRUE; break; }
|
|
|
|
$result = $res_766;
|
|
|
|
$this->pos = $pos_766;
|
|
|
|
$_777 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_777 === TRUE ) { $_779 = TRUE; break; }
|
|
|
|
$result = $res_759;
|
|
|
|
$this->pos = $pos_759;
|
|
|
|
$_779 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_779 === TRUE ) { $_781 = TRUE; break; }
|
|
|
|
$result = $res_754;
|
|
|
|
$this->pos = $pos_754;
|
|
|
|
$_781 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_781 === TRUE ) { $_783 = TRUE; break; }
|
|
|
|
$result = $res_752;
|
|
|
|
$this->pos = $pos_752;
|
|
|
|
$_783 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_783 === TRUE ) { $_785 = TRUE; break; }
|
|
|
|
$result = $res_750;
|
|
|
|
$this->pos = $pos_750;
|
|
|
|
$_785 = FALSE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_785 === FALSE) { $_787 = FALSE; break; }
|
|
|
|
$_787 = TRUE; break;
|
2011-03-17 01:08:13 +01:00
|
|
|
}
|
|
|
|
while(0);
|
2016-05-21 08:17:33 +02:00
|
|
|
if( $_787 === FALSE) {
|
|
|
|
$result = $res_788;
|
|
|
|
$this->pos = $pos_788;
|
|
|
|
unset( $res_788 );
|
|
|
|
unset( $pos_788 );
|
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; }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
/**
|
2016-01-20 01:16:27 +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'];
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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
|
2015-10-28 23:53:44 +01:00
|
|
|
$code = <<<'EOC'
|
|
|
|
(\Config::inst()->get('SSViewer', 'rewrite_hash_links')
|
|
|
|
? \Convert::raw2att( preg_replace("/^(\\/)+/", "/", $_SERVER['REQUEST_URI'] ) )
|
|
|
|
: "")
|
|
|
|
EOC;
|
|
|
|
// Because preg_replace replacement requires escaped slashes, addcslashes here
|
2011-02-28 04:12:41 +01:00
|
|
|
$text = preg_replace(
|
2014-09-02 05:16:20 +02:00
|
|
|
'/(<a[^>]+href *= *)"#/i',
|
2015-10-28 23:53:44 +01:00
|
|
|
'\\1"\' . ' . addcslashes($code, '\\') . ' . \'#',
|
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
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
/******************
|
|
|
|
* Here ends the parser itself. Below are utility methods to use the parser
|
|
|
|
*/
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-02-14 22:03:42 +01:00
|
|
|
/**
|
|
|
|
* Compiles some passed template source code into the php code that will execute as per the template source.
|
2016-01-20 01:16:27 +01:00
|
|
|
*
|
2011-02-14 22:03:42 +01:00
|
|
|
* @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
|
2014-03-30 07:55:44 +02:00
|
|
|
* @param bool $topTemplate True if this is a top template, false if it's just a template
|
2013-02-14 08:31:40 +01:00
|
|
|
* @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
|
|
|
*/
|
2014-03-30 07:55:44 +02:00
|
|
|
public function compileString($string, $templateName = "", $includeDebuggingComments=false, $topTemplate = true) {
|
2011-03-25 00:28:03 +01:00
|
|
|
if (!trim($string)) {
|
|
|
|
$code = '';
|
|
|
|
}
|
|
|
|
else {
|
2013-10-17 10:28:12 +02:00
|
|
|
parent::__construct($string);
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2013-10-17 10:28:12 +02:00
|
|
|
$this->includeDebuggingComments = $includeDebuggingComments;
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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
|
2013-10-17 10:28:12 +02:00
|
|
|
if(substr($string, 0,3) == pack("CCC", 0xef, 0xbb, 0xbf)) $this->pos = 3;
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-03-25 00:28:03 +01:00
|
|
|
// Match the source against the parser
|
2014-03-30 07:55:44 +02:00
|
|
|
if ($topTemplate) {
|
|
|
|
$result = $this->match_TopTemplate();
|
|
|
|
} else {
|
|
|
|
$result = $this->match_Template();
|
|
|
|
}
|
2013-10-17 10:28:12 +02:00
|
|
|
if(!$result) throw new SSTemplateParseException('Unexpected problem parsing template', $this);
|
2016-01-20 01:16:27 +01:00
|
|
|
|
2011-03-25 00:28:03 +01:00
|
|
|
// 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-10-17 10:28:12 +02:00
|
|
|
$code = $this->includeDebuggingComments($code, $templateName);
|
2016-05-21 08:17:33 +02:00
|
|
|
}
|
2016-01-20 01:16:27 +01:00
|
|
|
|
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;
|
|
|
|
}
|
2016-01-20 01:16:27 +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
|
2016-01-20 01:16:27 +01:00
|
|
|
*
|
2011-02-14 22:03:42 +01:00
|
|
|
* @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
|
|
|
|
*/
|
2013-10-17 10:28:12 +02:00
|
|
|
public function compileFile($template) {
|
|
|
|
return $this->compileString(file_get_contents($template), $template);
|
2011-02-09 05:31:16 +01:00
|
|
|
}
|
|
|
|
}
|