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
}
/**
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 .
*/
class SSTemplateParseException extends Exception {
function __construct ( $message , $parser ) {
$prior = substr ( $parser -> string , 0 , $parser -> pos );
preg_match_all ( '/\r\n|\r|\n/' , $prior , $matches );
$line = count ( $matches [ 0 ]) + 1 ;
parent :: __construct ( " Parse error in template on line $line . Error was: $message " );
}
}
/**
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
2011-02-14 22:03:42 +01: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 .
Some match rules generate alternate php , or other variations , so check the per - match documentation too .
Terms used :
Marked : A string or lookup in the template that has been explictly marked as such - lookups by prepending with " $ "
( like $Foo . Bar ), strings by wrapping with single or double quotes ( 'Foo' or " Foo " )
Bare : The opposite of marked . An argument that has to has it ' s type inferred by usage and 2.4 defaults .
Example of using a bare argument for a loop block : <% loop Foo %>
Block : One of two SS template structures . The special characters " <% " and " %> " are used to wrap the opening and
( required or forbidden depending on which block exactly ) closing block marks .
Open Block : An SS template block that doesn ' t wrap any content or have a closing end tag ( in fact , a closing end tag is
forbidden )
Closed Block : An SS template block that wraps content , and requires a counterpart <% end_blockname %> tag
2011-02-09 05:31:16 +01:00
*/
class SSTemplateParser extends Parser {
2011-02-14 22:03:42 +01:00
/**
* @ var bool - Set true by SSTemplateParser :: compileString if the template should include comments intended
* for debugging ( template source , included files , etc )
*/
2011-02-09 05:31:16 +01:00
protected $includeDebuggingComments = false ;
2011-02-28 04:12:41 +01:00
/**
* Override the function that constructs the result arrays to also prepare a 'php' item in the array
*/
function construct ( $matchrule , $name , $arguments = null ) {
$res = parent :: construct ( $matchrule , $name , $arguments );
if ( ! isset ( $res [ 'php' ])) $res [ 'php' ] = '' ;
return $res ;
}
2012-04-11 11:34:27 +02:00
/* Template: (Comment | 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' );
function match_Template ( $stack = array ()) {
$matchrule = " Template " ; $result = $this -> construct ( $matchrule , $matchrule , null );
$count = 0 ;
while ( true ) {
2012-04-11 11:34:27 +02:00
$res_46 = $result ;
$pos_46 = $this -> pos ;
$_45 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$_43 = 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-11 11:34:27 +02:00
$_43 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_0 ;
$this -> pos = $pos_0 ;
2012-04-11 11:34:27 +02:00
$_41 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_2 = $result ;
$pos_2 = $this -> pos ;
$matcher = 'match_' . 'If' ; $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-11 11:34:27 +02:00
$_41 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_2 ;
$this -> pos = $pos_2 ;
2012-04-11 11:34:27 +02:00
$_39 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_4 = $result ;
$pos_4 = $this -> pos ;
$matcher = 'match_' . 'Require' ; $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-11 11:34:27 +02:00
$_39 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_4 ;
$this -> pos = $pos_4 ;
2012-04-11 11:34:27 +02:00
$_37 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_6 = $result ;
$pos_6 = $this -> pos ;
$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 );
2012-04-11 11:34:27 +02:00
$_37 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_6 ;
$this -> pos = $pos_6 ;
2012-04-11 11:34:27 +02:00
$_35 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_8 = $result ;
$pos_8 = $this -> pos ;
$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 );
2012-04-11 11:34:27 +02:00
$_35 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_8 ;
$this -> pos = $pos_8 ;
2012-04-11 11:34:27 +02:00
$_33 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_10 = $result ;
$pos_10 = $this -> pos ;
$matcher = 'match_' . 'OldI18NTag' ; $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-11 11:34:27 +02:00
$_33 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_10 ;
$this -> pos = $pos_10 ;
2012-04-11 11:34:27 +02:00
$_31 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_12 = $result ;
$pos_12 = $this -> pos ;
2012-04-11 11:34:27 +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-11 11:34:27 +02:00
$_31 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_12 ;
$this -> pos = $pos_12 ;
2012-04-11 11:34:27 +02:00
$_29 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_14 = $result ;
$pos_14 = $this -> pos ;
2012-04-11 11:34:27 +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-11 11:34:27 +02:00
$_29 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_14 ;
$this -> pos = $pos_14 ;
2012-04-11 11:34:27 +02:00
$_27 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_16 = $result ;
$pos_16 = $this -> pos ;
2012-04-11 11:34:27 +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-11 11:34:27 +02:00
$_27 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_16 ;
$this -> pos = $pos_16 ;
2012-04-11 11:34:27 +02:00
$_25 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_18 = $result ;
$pos_18 = $this -> pos ;
2012-04-11 11:34:27 +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 );
2012-04-11 11:34:27 +02:00
$_25 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_18 ;
$this -> pos = $pos_18 ;
2012-04-11 11:34:27 +02:00
$_23 = NULL ;
do {
$res_20 = $result ;
$pos_20 = $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 );
$_23 = TRUE ; break ;
}
$result = $res_20 ;
$this -> pos = $pos_20 ;
$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 );
$_23 = TRUE ; break ;
}
$result = $res_20 ;
$this -> pos = $pos_20 ;
$_23 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
while ( 0 );
if ( $_23 === TRUE ) { $_25 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_18 ;
$this -> pos = $pos_18 ;
2012-04-11 11:34:27 +02:00
$_25 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_25 === TRUE ) { $_27 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_16 ;
$this -> pos = $pos_16 ;
2012-04-11 11:34:27 +02:00
$_27 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_27 === TRUE ) { $_29 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_14 ;
$this -> pos = $pos_14 ;
2012-04-11 11:34:27 +02:00
$_29 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_29 === TRUE ) { $_31 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_12 ;
$this -> pos = $pos_12 ;
2012-04-11 11:34:27 +02:00
$_31 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_31 === TRUE ) { $_33 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_10 ;
$this -> pos = $pos_10 ;
2012-04-11 11:34:27 +02:00
$_33 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_33 === TRUE ) { $_35 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_8 ;
$this -> pos = $pos_8 ;
2012-04-11 11:34:27 +02:00
$_35 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_35 === TRUE ) { $_37 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_6 ;
$this -> pos = $pos_6 ;
2012-04-11 11:34:27 +02:00
$_37 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_37 === TRUE ) { $_39 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_4 ;
$this -> pos = $pos_4 ;
2012-04-11 11:34:27 +02:00
$_39 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_39 === TRUE ) { $_41 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_2 ;
$this -> pos = $pos_2 ;
2012-04-11 11:34:27 +02:00
$_41 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_41 === TRUE ) { $_43 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_0 ;
$this -> pos = $pos_0 ;
2012-04-11 11:34:27 +02:00
$_43 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_43 === FALSE ) { $_45 = FALSE ; break ; }
$_45 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_45 === FALSE ) {
$result = $res_46 ;
$this -> pos = $pos_46 ;
unset ( $res_46 );
unset ( $pos_46 );
2011-02-28 04:12:41 +01:00
break ;
}
$count += 1 ;
}
if ( $count > 0 ) { return $this -> finalise ( $result ); }
else { return FALSE ; }
}
function Template_STR ( & $res , $sub ) {
$res [ 'php' ] .= $sub [ 'php' ] . PHP_EOL ;
}
2011-02-09 05:31:16 +01:00
/* Word: / [A-Za-z_] [A-Za-z0-9_]* / */
2011-02-28 04:12:41 +01:00
protected $match_Word_typestack = array ( 'Word' );
function match_Word ( $stack = array ()) {
$matchrule = " Word " ; $result = $this -> construct ( $matchrule , $matchrule , null );
if (( $subres = $this -> rx ( '/ [A-Za-z_] [A-Za-z0-9_]* /' ) ) !== FALSE ) {
2011-02-09 05:31:16 +01:00
$result [ " text " ] .= $subres ;
2011-02-28 04:12:41 +01:00
return $this -> finalise ( $result );
2011-02-09 05:31:16 +01:00
}
else { return FALSE ; }
}
/* Number: / [0-9]+ / */
2011-02-28 04:12:41 +01:00
protected $match_Number_typestack = array ( 'Number' );
function match_Number ( $stack = array ()) {
$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' );
function match_Value ( $stack = array ()) {
$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' );
function match_CallArguments ( $stack = array ()) {
$matchrule = " CallArguments " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_57 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Argument' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Argument " );
}
2012-04-11 11:34:27 +02:00
else { $_57 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
while ( true ) {
2012-04-11 11:34:27 +02:00
$res_56 = $result ;
$pos_56 = $this -> pos ;
$_55 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == ',' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= ',' ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
else { $_55 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Argument' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Argument " );
}
2012-04-11 11:34:27 +02:00
else { $_55 = FALSE ; break ; }
$_55 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_55 === FALSE ) {
$result = $res_56 ;
$this -> pos = $pos_56 ;
unset ( $res_56 );
unset ( $pos_56 );
2011-02-09 05:31:16 +01:00
break ;
}
}
2012-04-11 11:34:27 +02:00
$_57 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_57 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_57 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2011-02-14 22:03:42 +01: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 .
*/
function CallArguments_Argument ( & $res , $sub ) {
2011-02-28 04:12:41 +01:00
if ( ! empty ( $res [ 'php' ])) $res [ 'php' ] .= ', ' ;
2011-02-09 05:31:16 +01:00
2011-02-18 05:06:11 +01:00
$res [ 'php' ] .= ( $sub [ 'ArgumentMode' ] == 'default' ) ? $sub [ 'string_php' ] : str_replace ( '$$FINAL' , 'XML_val' , $sub [ 'php' ]);
2011-02-09 05:31:16 +01:00
}
2011-02-14 22:03:42 +01:00
/* Call: Method:Word ( "(" < :CallArguments? > ")" )? */
2011-02-28 04:12:41 +01:00
protected $match_Call_typestack = array ( 'Call' );
function match_Call ( $stack = array ()) {
$matchrule = " Call " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_67 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Word' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Method " );
}
2012-04-11 11:34:27 +02:00
else { $_67 = FALSE ; break ; }
$res_66 = $result ;
$pos_66 = $this -> pos ;
$_65 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '(' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= '(' ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
else { $_65 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
$res_62 = $result ;
$pos_62 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'CallArguments' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
2011-02-14 22:03:42 +01:00
$this -> store ( $result , $subres , " CallArguments " );
2011-02-09 05:31:16 +01:00
}
else {
2012-04-11 11:34:27 +02:00
$result = $res_62 ;
$this -> pos = $pos_62 ;
unset ( $res_62 );
unset ( $pos_62 );
2011-02-09 05:31:16 +01:00
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == ')' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= ')' ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
else { $_65 = FALSE ; break ; }
$_65 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_65 === FALSE ) {
$result = $res_66 ;
$this -> pos = $pos_66 ;
unset ( $res_66 );
unset ( $pos_66 );
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$_67 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_67 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_67 === 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' );
function match_LookupStep ( $stack = array ()) {
$matchrule = " LookupStep " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_71 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Call' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Call " );
}
2012-04-11 11:34:27 +02:00
else { $_71 = FALSE ; break ; }
$res_70 = $result ;
$pos_70 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '.' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= '.' ;
2012-04-11 11:34:27 +02:00
$result = $res_70 ;
$this -> pos = $pos_70 ;
2011-02-09 05:31:16 +01:00
}
else {
2012-04-11 11:34:27 +02:00
$result = $res_70 ;
$this -> pos = $pos_70 ;
$_71 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$_71 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_71 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_71 === 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' );
function match_LastLookupStep ( $stack = array ()) {
$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' );
function match_Lookup ( $stack = array ()) {
$matchrule = " Lookup " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_85 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_74 = $result ;
$pos_74 = $this -> pos ;
$_82 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'LookupStep' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
2012-04-11 11:34:27 +02:00
else { $_82 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
while ( true ) {
2012-04-11 11:34:27 +02:00
$res_79 = $result ;
$pos_79 = $this -> pos ;
$_78 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '.' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= '.' ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
else { $_78 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'LookupStep' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
}
2012-04-11 11:34:27 +02:00
else { $_78 = FALSE ; break ; }
$_78 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_78 === FALSE ) {
$result = $res_79 ;
$this -> pos = $pos_79 ;
unset ( $res_79 );
unset ( $pos_79 );
2011-02-09 05:31:16 +01:00
break ;
}
}
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '.' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= '.' ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
else { $_82 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'LastLookupStep' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
2012-04-11 11:34:27 +02:00
else { $_82 = FALSE ; break ; }
$_82 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_82 === TRUE ) { $_85 = TRUE ; break ; }
$result = $res_74 ;
$this -> pos = $pos_74 ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'LastLookupStep' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-11 11:34:27 +02:00
$_85 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_74 ;
$this -> pos = $pos_74 ;
$_85 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_85 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_85 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
function Lookup__construct ( & $res ) {
2011-02-18 05:06:11 +01:00
$res [ 'php' ] = '$scope' ;
2011-02-09 05:31:16 +01:00
$res [ 'LookupSteps' ] = array ();
}
2011-02-14 22:03:42 +01:00
/**
* The basic generated PHP of LookupStep and LastLookupStep is the same , except that LookupStep calls 'obj' to
* get the next ViewableData in the sequence , and LastLookupStep calls different methods ( XML_val , hasValue , obj )
* depending on the context the lookup is used in .
*/
2011-02-09 05:31:16 +01:00
function Lookup_AddLookupStep ( & $res , $sub , $method ) {
$res [ 'LookupSteps' ][] = $sub ;
$property = $sub [ 'Call' ][ 'Method' ][ 'text' ];
2011-02-14 22:03:42 +01:00
if ( isset ( $sub [ 'Call' ][ 'CallArguments' ]) && $arguments = $sub [ 'Call' ][ 'CallArguments' ][ 'php' ]) {
2011-02-09 05:31:16 +01:00
$res [ 'php' ] .= " -> $method (' $property ', array( $arguments ), true) " ;
}
else {
$res [ 'php' ] .= " -> $method (' $property ', null, true) " ;
}
}
function Lookup_LookupStep ( & $res , $sub ) {
$this -> Lookup_AddLookupStep ( $res , $sub , 'obj' );
}
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
}
/* SimpleInjection: '$' :Lookup */
2011-02-28 04:12:41 +01:00
protected $match_SimpleInjection_typestack = array ( 'SimpleInjection' );
function match_SimpleInjection ( $stack = array ()) {
$matchrule = " SimpleInjection " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_89 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if ( substr ( $this -> string , $this -> pos , 1 ) == '$' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '$' ;
}
2012-04-11 11:34:27 +02:00
else { $_89 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Lookup' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Lookup " );
}
2012-04-11 11:34:27 +02:00
else { $_89 = FALSE ; break ; }
$_89 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_89 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_89 === 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' );
function match_BracketInjection ( $stack = array ()) {
$matchrule = " BracketInjection " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_94 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '{$' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_94 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Lookup' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Lookup " );
}
2012-04-11 11:34:27 +02:00
else { $_94 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '}' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= '}' ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
else { $_94 = FALSE ; break ; }
$_94 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_94 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_94 === 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' );
function match_Injection ( $stack = array ()) {
$matchrule = " Injection " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_99 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_96 = $result ;
$pos_96 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'BracketInjection' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-11 11:34:27 +02:00
$_99 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_96 ;
$this -> pos = $pos_96 ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'SimpleInjection' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-11 11:34:27 +02:00
$_99 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_96 ;
$this -> pos = $pos_96 ;
$_99 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_99 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_99 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01: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' );
function match_DollarMarkedLookup ( $stack = array ()) {
$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
}
function DollarMarkedLookup_STR ( & $res , $sub ) {
$res [ 'Lookup' ] = $sub [ 'Lookup' ];
}
/* QuotedString: q:/['"]/ String:/ (\\\\ | \\. | [^$q\\])* / '$q' */
2011-02-28 04:12:41 +01:00
protected $match_QuotedString_typestack = array ( 'QuotedString' );
function match_QuotedString ( $stack = array ()) {
$matchrule = " QuotedString " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_105 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
$stack [] = $result ; $result = $this -> construct ( $matchrule , " q " );
if (( $subres = $this -> rx ( '/[\'"]/' ) ) !== FALSE ) {
2011-02-09 05:31:16 +01:00
$result [ " text " ] .= $subres ;
2011-02-28 04:12:41 +01:00
$subres = $result ; $result = array_pop ( $stack );
2011-02-09 05:31:16 +01:00
$this -> store ( $result , $subres , 'q' );
}
else {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-11 11:34:27 +02:00
$_105 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
$stack [] = $result ; $result = $this -> construct ( $matchrule , " String " );
if (( $subres = $this -> rx ( '/ (\\\\\\\\ | \\\\. | [^' . $this -> expression ( $result , $stack , 'q' ) . '\\\\])* /' ) ) !== FALSE ) {
2011-02-09 05:31:16 +01:00
$result [ " text " ] .= $subres ;
2011-02-28 04:12:41 +01:00
$subres = $result ; $result = array_pop ( $stack );
2011-02-09 05:31:16 +01:00
$this -> store ( $result , $subres , 'String' );
}
else {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-11 11:34:27 +02:00
$_105 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '' . $this -> expression ( $result , $stack , 'q' ) . '' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_105 = FALSE ; break ; }
$_105 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_105 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_105 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
/* FreeString: /[^,)%!=|&]+/ */
2011-02-28 04:12:41 +01:00
protected $match_FreeString_typestack = array ( 'FreeString' );
function match_FreeString ( $stack = array ()) {
$matchrule = " FreeString " ; $result = $this -> construct ( $matchrule , $matchrule , null );
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' );
function match_Argument ( $stack = array ()) {
$matchrule = " Argument " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_125 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_108 = $result ;
$pos_108 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'DollarMarkedLookup' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " DollarMarkedLookup " );
2012-04-11 11:34:27 +02:00
$_125 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_108 ;
$this -> pos = $pos_108 ;
$_123 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_110 = $result ;
$pos_110 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'QuotedString' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " QuotedString " );
2012-04-11 11:34:27 +02:00
$_123 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_110 ;
$this -> pos = $pos_110 ;
$_121 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_112 = $result ;
$pos_112 = $this -> pos ;
$_118 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Lookup' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Lookup " );
}
2012-04-11 11:34:27 +02:00
else { $_118 = FALSE ; break ; }
$res_117 = $result ;
$pos_117 = $this -> pos ;
$_116 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'FreeString' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
}
2012-04-11 11:34:27 +02:00
else { $_116 = FALSE ; break ; }
$_116 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_116 === TRUE ) {
$result = $res_117 ;
$this -> pos = $pos_117 ;
$_118 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
if ( $_116 === FALSE ) {
$result = $res_117 ;
$this -> pos = $pos_117 ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$_118 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_118 === TRUE ) { $_121 = TRUE ; break ; }
$result = $res_112 ;
$this -> pos = $pos_112 ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'FreeString' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " FreeString " );
2012-04-11 11:34:27 +02:00
$_121 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_112 ;
$this -> pos = $pos_112 ;
$_121 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_121 === TRUE ) { $_123 = TRUE ; break ; }
$result = $res_110 ;
$this -> pos = $pos_110 ;
$_123 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_123 === TRUE ) { $_125 = TRUE ; break ; }
$result = $res_108 ;
$this -> pos = $pos_108 ;
$_125 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_125 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_125 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2011-02-14 22:03:42 +01:00
/**
* If we get a bare value , we don ' t know enough to determine exactly what php would be the translation , because
* we don ' t know if the position of use indicates a lookup or a string argument .
*
* Instead , we record 'ArgumentMode' as a member of this matches results node , which can be :
* - lookup if this argument was unambiguously a lookup ( marked as such )
* - string is this argument was unambiguously a string ( marked as such , or impossible to parse as lookup )
* - default if this argument needs to be handled as per 2.4
*
* In the case of 'default' , there is no php member of the results node , but instead 'lookup_php' , which
* should be used by the parent if the context indicates a lookup , and 'string_php' which should be used
* if the context indicates a string
*/
2011-02-09 05:31:16 +01:00
function Argument_DollarMarkedLookup ( & $res , $sub ) {
$res [ 'ArgumentMode' ] = 'lookup' ;
$res [ 'php' ] = $sub [ 'Lookup' ][ 'php' ];
}
function Argument_QuotedString ( & $res , $sub ) {
$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
}
function Argument_Lookup ( & $res , $sub ) {
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' ];
}
}
function Argument_FreeString ( & $res , $sub ) {
$res [ 'ArgumentMode' ] = 'string' ;
2012-04-11 11:34:27 +02:00
$res [ 'php' ] = " ' " . str_replace ( " ' " , " \\ ' " , rtrim ( $sub [ 'text' ])) . " ' " ;
2011-02-09 05:31:16 +01:00
}
/* ComparisonOperator: "==" | "!=" | "=" */
2011-02-28 04:12:41 +01:00
protected $match_ComparisonOperator_typestack = array ( 'ComparisonOperator' );
function match_ComparisonOperator ( $stack = array ()) {
$matchrule = " ComparisonOperator " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_134 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_127 = $result ;
$pos_127 = $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 ;
2012-04-11 11:34:27 +02:00
$_134 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_127 ;
$this -> pos = $pos_127 ;
$_132 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_129 = $result ;
$pos_129 = $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 ;
2012-04-11 11:34:27 +02:00
$_132 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_129 ;
$this -> pos = $pos_129 ;
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '=' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= '=' ;
2012-04-11 11:34:27 +02:00
$_132 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_129 ;
$this -> pos = $pos_129 ;
$_132 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_132 === TRUE ) { $_134 = TRUE ; break ; }
$result = $res_127 ;
$this -> pos = $pos_127 ;
$_134 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_134 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_134 === 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' );
function match_Comparison ( $stack = array ()) {
$matchrule = " Comparison " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_141 = 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 ); }
2012-04-11 11:34:27 +02:00
else { $_141 = 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 ); }
2012-04-11 11:34:27 +02:00
else { $_141 = 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 ); }
2012-04-11 11:34:27 +02:00
else { $_141 = FALSE ; break ; }
$_141 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_141 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_141 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
function Comparison_Argument ( & $res , $sub ) {
if ( $sub [ 'ArgumentMode' ] == 'default' ) {
2011-02-28 04:12:41 +01:00
if ( ! empty ( $res [ 'php' ])) $res [ 'php' ] .= $sub [ 'string_php' ];
2011-02-18 05:06:11 +01:00
else $res [ 'php' ] = str_replace ( '$$FINAL' , 'XML_val' , $sub [ 'lookup_php' ]);
2011-02-09 05:31:16 +01:00
}
else {
2011-02-18 05:06:11 +01:00
$res [ 'php' ] .= str_replace ( '$$FINAL' , 'XML_val' , $sub [ 'php' ]);
2011-02-09 05:31:16 +01:00
}
}
function Comparison_ComparisonOperator ( & $res , $sub ) {
$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' );
function match_PresenceCheck ( $stack = array ()) {
$matchrule = " PresenceCheck " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_148 = NULL ;
2011-02-21 03:24:14 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_146 = $result ;
$pos_146 = $this -> pos ;
$_145 = NULL ;
2011-02-21 03:24:14 +01:00
do {
2011-02-28 04:12:41 +01:00
$stack [] = $result ; $result = $this -> construct ( $matchrule , " Not " );
if (( $subres = $this -> literal ( 'not' ) ) !== FALSE ) {
2011-02-21 03:24:14 +01:00
$result [ " text " ] .= $subres ;
2011-02-28 04:12:41 +01:00
$subres = $result ; $result = array_pop ( $stack );
2011-02-21 03:24:14 +01:00
$this -> store ( $result , $subres , 'Not' );
}
else {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-11 11:34:27 +02:00
$_145 = FALSE ; break ;
2011-02-21 03:24:14 +01:00
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
$_145 = TRUE ; break ;
2011-02-21 03:24:14 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_145 === FALSE ) {
$result = $res_146 ;
$this -> pos = $pos_146 ;
unset ( $res_146 );
unset ( $pos_146 );
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 ); }
2012-04-11 11:34:27 +02:00
else { $_148 = FALSE ; break ; }
$_148 = TRUE ; break ;
2011-02-21 03:24:14 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_148 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_148 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2011-02-21 03:24:14 +01:00
function PresenceCheck_Not ( & $res , $sub ) {
$res [ 'php' ] = '!' ;
}
2011-02-09 05:31:16 +01:00
function PresenceCheck_Argument ( & $res , $sub ) {
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' );
function match_IfArgumentPortion ( $stack = array ()) {
$matchrule = " IfArgumentPortion " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_153 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_150 = $result ;
$pos_150 = $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 );
2012-04-11 11:34:27 +02:00
$_153 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_150 ;
$this -> pos = $pos_150 ;
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 );
2012-04-11 11:34:27 +02:00
$_153 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_150 ;
$this -> pos = $pos_150 ;
$_153 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_153 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_153 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
function IfArgumentPortion_STR ( & $res , $sub ) {
$res [ 'php' ] = $sub [ 'php' ];
}
/* BooleanOperator: "||" | "&&" */
2011-02-28 04:12:41 +01:00
protected $match_BooleanOperator_typestack = array ( 'BooleanOperator' );
function match_BooleanOperator ( $stack = array ()) {
$matchrule = " BooleanOperator " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_158 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_155 = $result ;
$pos_155 = $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 ;
2012-04-11 11:34:27 +02:00
$_158 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_155 ;
$this -> pos = $pos_155 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '&&' ) ) !== FALSE ) {
2011-02-09 05:31:16 +01:00
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_158 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_155 ;
$this -> pos = $pos_155 ;
$_158 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_158 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_158 === 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' );
function match_IfArgument ( $stack = array ()) {
$matchrule = " IfArgument " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_167 = 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 " );
}
2012-04-11 11:34:27 +02:00
else { $_167 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
while ( true ) {
2012-04-11 11:34:27 +02:00
$res_166 = $result ;
$pos_166 = $this -> pos ;
$_165 = 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 " );
}
2012-04-11 11:34:27 +02:00
else { $_165 = 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 " );
}
2012-04-11 11:34:27 +02:00
else { $_165 = FALSE ; break ; }
$_165 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_165 === FALSE ) {
$result = $res_166 ;
$this -> pos = $pos_166 ;
unset ( $res_166 );
unset ( $pos_166 );
2011-02-09 05:31:16 +01:00
break ;
}
}
2012-04-11 11:34:27 +02:00
$_167 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_167 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_167 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
function IfArgument_IfArgumentPortion ( & $res , $sub ) {
$res [ 'php' ] .= $sub [ 'php' ];
}
function IfArgument_BooleanOperator ( & $res , $sub ) {
$res [ 'php' ] .= $sub [ 'text' ];
}
2011-02-28 04:12:41 +01:00
/* IfPart: '<%' < 'if' [ :IfArgument > '%>' Template:$TemplateMatcher? */
protected $match_IfPart_typestack = array ( 'IfPart' );
function match_IfPart ( $stack = array ()) {
$matchrule = " IfPart " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_177 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_177 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_177 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_177 = 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 " );
}
2012-04-11 11:34:27 +02:00
else { $_177 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_177 = FALSE ; break ; }
$res_176 = $result ;
$pos_176 = $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 {
2012-04-11 11:34:27 +02:00
$result = $res_176 ;
$this -> pos = $pos_176 ;
unset ( $res_176 );
unset ( $pos_176 );
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$_177 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_177 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_177 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
/* ElseIfPart: '<%' < 'else_if' [ :IfArgument > '%>' Template:$TemplateMatcher */
protected $match_ElseIfPart_typestack = array ( 'ElseIfPart' );
function match_ElseIfPart ( $stack = array ()) {
$matchrule = " ElseIfPart " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_187 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_187 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_187 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_187 = 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 " );
}
2012-04-11 11:34:27 +02:00
else { $_187 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_187 = FALSE ; break ; }
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 " );
}
2012-04-11 11:34:27 +02:00
else { $_187 = FALSE ; break ; }
$_187 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_187 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_187 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
/* ElsePart: '<%' < 'else' > '%>' Template:$TemplateMatcher */
protected $match_ElsePart_typestack = array ( 'ElsePart' );
function match_ElsePart ( $stack = array ()) {
$matchrule = " ElsePart " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_195 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +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
if (( $subres = $this -> literal ( 'else' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +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
if (( $subres = $this -> literal ( '%>' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_195 = FALSE ; break ; }
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 " );
}
2012-04-11 11:34:27 +02:00
else { $_195 = FALSE ; break ; }
$_195 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_195 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_195 === 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' );
function match_If ( $stack = array ()) {
$matchrule = " If " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_205 = 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 ); }
2012-04-11 11:34:27 +02:00
else { $_205 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
while ( true ) {
2012-04-11 11:34:27 +02:00
$res_198 = $result ;
$pos_198 = $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 {
2012-04-11 11:34:27 +02:00
$result = $res_198 ;
$this -> pos = $pos_198 ;
unset ( $res_198 );
unset ( $pos_198 );
2011-02-09 05:31:16 +01:00
break ;
}
}
2012-04-11 11:34:27 +02:00
$res_199 = $result ;
$pos_199 = $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 {
2012-04-11 11:34:27 +02:00
$result = $res_199 ;
$this -> pos = $pos_199 ;
unset ( $res_199 );
unset ( $pos_199 );
2011-02-28 04:12:41 +01:00
}
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_205 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_205 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_205 = FALSE ; break ; }
$_205 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_205 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_205 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
function If_IfPart ( & $res , $sub ) {
$res [ 'php' ] =
'if (' . $sub [ 'IfArgument' ][ 'php' ] . ') { ' . PHP_EOL .
2011-02-21 04:19:10 +01:00
( isset ( $sub [ 'Template' ]) ? $sub [ 'Template' ][ 'php' ] : '' ) . PHP_EOL .
2011-02-09 05:31:16 +01:00
'}' ;
}
function If_ElseIfPart ( & $res , $sub ) {
$res [ 'php' ] .=
'else if (' . $sub [ 'IfArgument' ][ 'php' ] . ') { ' . PHP_EOL .
2011-02-21 04:19:10 +01:00
$sub [ 'Template' ][ 'php' ] . PHP_EOL .
2011-02-09 05:31:16 +01:00
'}' ;
}
function If_ElsePart ( & $res , $sub ) {
$res [ 'php' ] .=
'else { ' . PHP_EOL .
$sub [ 'Template' ][ 'php' ] . PHP_EOL .
'}' ;
}
2011-02-28 04:12:41 +01:00
/* Require: '<%' < 'require' [ Call:(Method:Word "(" < :CallArguments > ")") > '%>' */
protected $match_Require_typestack = array ( 'Require' );
function match_Require ( $stack = array ()) {
$matchrule = " Require " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_221 = NULL ;
2011-02-28 04:12:41 +01:00
do {
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_221 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_221 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_221 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
$stack [] = $result ; $result = $this -> construct ( $matchrule , " Call " );
2012-04-11 11:34:27 +02:00
$_217 = 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 " );
}
2012-04-11 11:34:27 +02:00
else { $_217 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '(' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '(' ;
}
2012-04-11 11:34:27 +02:00
else { $_217 = 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 " );
}
2012-04-11 11:34:27 +02:00
else { $_217 = 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 " ] .= ')' ;
}
2012-04-11 11:34:27 +02:00
else { $_217 = FALSE ; break ; }
$_217 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_217 === TRUE ) {
2011-02-28 04:12:41 +01:00
$subres = $result ; $result = array_pop ( $stack );
$this -> store ( $result , $subres , 'Call' );
}
2012-04-11 11:34:27 +02:00
if ( $_217 === FALSE ) {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-11 11:34:27 +02:00
$_221 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_221 = FALSE ; break ; }
$_221 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_221 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_221 === FALSE ) { return FALSE ; }
2011-02-28 04:12:41 +01:00
}
function Require_Call ( & $res , $sub ) {
$res [ 'php' ] = " Requirements:: " . $sub [ 'Method' ][ 'text' ] . '(' . $sub [ 'CallArguments' ][ 'php' ] . ');' ;
}
/* CacheBlockArgument :
! ( " if " | " unless " )
(
: DollarMarkedLookup |
: QuotedString |
: Lookup
) */
protected $match_CacheBlockArgument_typestack = array ( 'CacheBlockArgument' );
function match_CacheBlockArgument ( $stack = array ()) {
$matchrule = " CacheBlockArgument " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_241 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_229 = $result ;
$pos_229 = $this -> pos ;
$_228 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$_226 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_223 = $result ;
$pos_223 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'if ' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_226 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_223 ;
$this -> pos = $pos_223 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'unless ' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_226 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_223 ;
$this -> pos = $pos_223 ;
$_226 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_226 === FALSE ) { $_228 = FALSE ; break ; }
$_228 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_228 === TRUE ) {
$result = $res_229 ;
$this -> pos = $pos_229 ;
$_241 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
if ( $_228 === FALSE ) {
$result = $res_229 ;
$this -> pos = $pos_229 ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$_239 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$_237 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_230 = $result ;
$pos_230 = $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 " );
2012-04-11 11:34:27 +02:00
$_237 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_230 ;
$this -> pos = $pos_230 ;
$_235 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_232 = $result ;
$pos_232 = $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 " );
2012-04-11 11:34:27 +02:00
$_235 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_232 ;
$this -> pos = $pos_232 ;
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 " );
2012-04-11 11:34:27 +02:00
$_235 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_232 ;
$this -> pos = $pos_232 ;
$_235 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_235 === TRUE ) { $_237 = TRUE ; break ; }
$result = $res_230 ;
$this -> pos = $pos_230 ;
$_237 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_237 === FALSE ) { $_239 = FALSE ; break ; }
$_239 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_239 === FALSE ) { $_241 = FALSE ; break ; }
$_241 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_241 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_241 === FALSE ) { return FALSE ; }
2011-02-28 04:12:41 +01:00
}
function CacheBlockArgument_DollarMarkedLookup ( & $res , $sub ) {
$res [ 'php' ] = $sub [ 'Lookup' ][ 'php' ];
}
function CacheBlockArgument_QuotedString ( & $res , $sub ) {
$res [ 'php' ] = " ' " . str_replace ( " ' " , " \\ ' " , $sub [ 'String' ][ 'text' ]) . " ' " ;
}
function CacheBlockArgument_Lookup ( & $res , $sub ) {
$res [ 'php' ] = $sub [ 'php' ];
}
/* CacheBlockArguments: CacheBlockArgument ( < "," < CacheBlockArgument )* */
protected $match_CacheBlockArguments_typestack = array ( 'CacheBlockArguments' );
function match_CacheBlockArguments ( $stack = array ()) {
$matchrule = " CacheBlockArguments " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_250 = 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 ); }
2012-04-11 11:34:27 +02:00
else { $_250 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
while ( true ) {
2012-04-11 11:34:27 +02:00
$res_249 = $result ;
$pos_249 = $this -> pos ;
$_248 = 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 " ] .= ',' ;
}
2012-04-11 11:34:27 +02:00
else { $_248 = 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 ); }
2012-04-11 11:34:27 +02:00
else { $_248 = FALSE ; break ; }
$_248 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_248 === FALSE ) {
$result = $res_249 ;
$this -> pos = $pos_249 ;
unset ( $res_249 );
unset ( $pos_249 );
2011-02-28 04:12:41 +01:00
break ;
}
}
2012-04-11 11:34:27 +02:00
$_250 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_250 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_250 === FALSE ) { return FALSE ; }
2011-02-28 04:12:41 +01:00
}
function CacheBlockArguments_CacheBlockArgument ( & $res , $sub ) {
if ( ! empty ( $res [ 'php' ])) $res [ 'php' ] .= " .'_'. " ;
else $res [ 'php' ] = '' ;
$res [ 'php' ] .= str_replace ( '$$FINAL' , 'XML_val' , $sub [ 'php' ]);
}
2012-04-11 11:34:27 +02:00
/* CacheBlockTemplate: (Comment | If | Require | OldI18NTag | Include | ClosedBlock | OpenBlock | MalformedBlock | Injection | Text)+ */
2011-02-28 04:12:41 +01:00
protected $match_CacheBlockTemplate_typestack = array ( 'CacheBlockTemplate' , 'Template' );
function match_CacheBlockTemplate ( $stack = array ()) {
$matchrule = " CacheBlockTemplate " ; $result = $this -> construct ( $matchrule , $matchrule , array ( 'TemplateMatcher' => 'CacheRestrictedTemplate' ));
$count = 0 ;
while ( true ) {
2012-04-11 11:34:27 +02:00
$res_290 = $result ;
$pos_290 = $this -> pos ;
$_289 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$_287 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_252 = $result ;
$pos_252 = $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 );
2012-04-11 11:34:27 +02:00
$_287 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_252 ;
$this -> pos = $pos_252 ;
$_285 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_254 = $result ;
$pos_254 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'If' ; $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-11 11:34:27 +02:00
$_285 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_254 ;
$this -> pos = $pos_254 ;
$_283 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_256 = $result ;
$pos_256 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Require' ; $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-11 11:34:27 +02:00
$_283 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_256 ;
$this -> pos = $pos_256 ;
$_281 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_258 = $result ;
$pos_258 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'OldI18NTag' ; $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-11 11:34:27 +02:00
$_281 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_258 ;
$this -> pos = $pos_258 ;
$_279 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_260 = $result ;
$pos_260 = $this -> pos ;
$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-11 11:34:27 +02:00
$_279 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_260 ;
$this -> pos = $pos_260 ;
$_277 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_262 = $result ;
$pos_262 = $this -> pos ;
$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-11 11:34:27 +02:00
$_277 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_262 ;
$this -> pos = $pos_262 ;
$_275 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_264 = $result ;
$pos_264 = $this -> pos ;
$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-11 11:34:27 +02:00
$_275 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_264 ;
$this -> pos = $pos_264 ;
$_273 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_266 = $result ;
$pos_266 = $this -> pos ;
$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 );
2012-04-11 11:34:27 +02:00
$_273 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_266 ;
$this -> pos = $pos_266 ;
$_271 = NULL ;
do {
$res_268 = $result ;
$pos_268 = $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 );
$_271 = TRUE ; break ;
}
$result = $res_268 ;
$this -> pos = $pos_268 ;
$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 );
$_271 = TRUE ; break ;
}
$result = $res_268 ;
$this -> pos = $pos_268 ;
$_271 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
while ( 0 );
if ( $_271 === TRUE ) { $_273 = TRUE ; break ; }
$result = $res_266 ;
$this -> pos = $pos_266 ;
$_273 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_273 === TRUE ) { $_275 = TRUE ; break ; }
$result = $res_264 ;
$this -> pos = $pos_264 ;
$_275 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_275 === TRUE ) { $_277 = TRUE ; break ; }
$result = $res_262 ;
$this -> pos = $pos_262 ;
$_277 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_277 === TRUE ) { $_279 = TRUE ; break ; }
$result = $res_260 ;
$this -> pos = $pos_260 ;
$_279 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_279 === TRUE ) { $_281 = TRUE ; break ; }
$result = $res_258 ;
$this -> pos = $pos_258 ;
$_281 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_281 === TRUE ) { $_283 = TRUE ; break ; }
$result = $res_256 ;
$this -> pos = $pos_256 ;
$_283 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_283 === TRUE ) { $_285 = TRUE ; break ; }
$result = $res_254 ;
$this -> pos = $pos_254 ;
$_285 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_285 === TRUE ) { $_287 = TRUE ; break ; }
$result = $res_252 ;
$this -> pos = $pos_252 ;
$_287 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_287 === FALSE ) { $_289 = FALSE ; break ; }
$_289 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_289 === FALSE ) {
$result = $res_290 ;
$this -> pos = $pos_290 ;
unset ( $res_290 );
unset ( $pos_290 );
2011-02-28 04:12:41 +01:00
break ;
}
$count += 1 ;
}
if ( $count > 0 ) { return $this -> finalise ( $result ); }
else { return FALSE ; }
}
/* UncachedBlock :
'<%' < " uncached " < CacheBlockArguments ? ( < Conditional : ( " if " | " unless " ) > Condition : IfArgument ) ? > '%>'
Template : $TemplateMatcher ?
'<%' < 'end_' ( " uncached " | " cached " | " cacheblock " ) > '%>' */
protected $match_UncachedBlock_typestack = array ( 'UncachedBlock' );
function match_UncachedBlock ( $stack = array ()) {
$matchrule = " UncachedBlock " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_327 = NULL ;
2011-02-28 04:12:41 +01:00
do {
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_327 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_327 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
$res_295 = $result ;
$pos_295 = $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 {
2012-04-11 11:34:27 +02:00
$result = $res_295 ;
$this -> pos = $pos_295 ;
unset ( $res_295 );
unset ( $pos_295 );
}
$res_307 = $result ;
$pos_307 = $this -> pos ;
$_306 = NULL ;
2011-02-28 04:12:41 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
$stack [] = $result ; $result = $this -> construct ( $matchrule , " Conditional " );
2012-04-11 11:34:27 +02:00
$_302 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$_300 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_297 = $result ;
$pos_297 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'if' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_300 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_297 ;
$this -> pos = $pos_297 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'unless' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_300 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_297 ;
$this -> pos = $pos_297 ;
$_300 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_300 === FALSE ) { $_302 = FALSE ; break ; }
$_302 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_302 === TRUE ) {
2011-02-28 04:12:41 +01:00
$subres = $result ; $result = array_pop ( $stack );
$this -> store ( $result , $subres , 'Conditional' );
}
2012-04-11 11:34:27 +02:00
if ( $_302 === FALSE ) {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-11 11:34:27 +02:00
$_306 = 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 " );
}
2012-04-11 11:34:27 +02:00
else { $_306 = FALSE ; break ; }
$_306 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_306 === FALSE ) {
$result = $res_307 ;
$this -> pos = $pos_307 ;
unset ( $res_307 );
unset ( $pos_307 );
2011-02-28 04:12:41 +01:00
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
if (( $subres = $this -> literal ( '%>' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_327 = FALSE ; break ; }
$res_310 = $result ;
$pos_310 = $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 {
2012-04-11 11:34:27 +02:00
$result = $res_310 ;
$this -> pos = $pos_310 ;
unset ( $res_310 );
unset ( $pos_310 );
2011-02-28 04:12:41 +01:00
}
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_327 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_327 = FALSE ; break ; }
$_323 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$_321 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_314 = $result ;
$pos_314 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'uncached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_321 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_314 ;
$this -> pos = $pos_314 ;
$_319 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_316 = $result ;
$pos_316 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_319 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_316 ;
$this -> pos = $pos_316 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cacheblock' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_319 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_316 ;
$this -> pos = $pos_316 ;
$_319 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_319 === TRUE ) { $_321 = TRUE ; break ; }
$result = $res_314 ;
$this -> pos = $pos_314 ;
$_321 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_321 === FALSE ) { $_323 = FALSE ; break ; }
$_323 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_323 === FALSE ) { $_327 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_327 = FALSE ; break ; }
$_327 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_327 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_327 === FALSE ) { return FALSE ; }
2011-02-28 04:12:41 +01:00
}
function UncachedBlock_Template ( & $res , $sub ){
$res [ 'php' ] = $sub [ 'php' ];
}
2012-04-11 11:34:27 +02:00
/* CacheRestrictedTemplate: (Comment | 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' );
function match_CacheRestrictedTemplate ( $stack = array ()) {
$matchrule = " CacheRestrictedTemplate " ; $result = $this -> construct ( $matchrule , $matchrule , null );
$count = 0 ;
while ( true ) {
2012-04-11 11:34:27 +02:00
$res_375 = $result ;
$pos_375 = $this -> pos ;
$_374 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$_372 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_329 = $result ;
$pos_329 = $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 );
2012-04-11 11:34:27 +02:00
$_372 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_329 ;
$this -> pos = $pos_329 ;
$_370 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_331 = $result ;
$pos_331 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'If' ; $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-11 11:34:27 +02:00
$_370 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_331 ;
$this -> pos = $pos_331 ;
$_368 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_333 = $result ;
$pos_333 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Require' ; $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-11 11:34:27 +02:00
$_368 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_333 ;
$this -> pos = $pos_333 ;
$_366 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_335 = $result ;
$pos_335 = $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 );
2012-04-11 11:34:27 +02:00
$_366 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_335 ;
$this -> pos = $pos_335 ;
$_364 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_337 = $result ;
$pos_337 = $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 );
2012-04-11 11:34:27 +02:00
$_364 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_337 ;
$this -> pos = $pos_337 ;
$_362 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_339 = $result ;
$pos_339 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'OldI18NTag' ; $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-11 11:34:27 +02:00
$_362 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_339 ;
$this -> pos = $pos_339 ;
$_360 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_341 = $result ;
$pos_341 = $this -> pos ;
$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-11 11:34:27 +02:00
$_360 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_341 ;
$this -> pos = $pos_341 ;
$_358 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_343 = $result ;
$pos_343 = $this -> pos ;
$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-11 11:34:27 +02:00
$_358 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_343 ;
$this -> pos = $pos_343 ;
$_356 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_345 = $result ;
$pos_345 = $this -> pos ;
$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-11 11:34:27 +02:00
$_356 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_345 ;
$this -> pos = $pos_345 ;
$_354 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_347 = $result ;
$pos_347 = $this -> pos ;
$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 );
2012-04-11 11:34:27 +02:00
$_354 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_347 ;
$this -> pos = $pos_347 ;
$_352 = NULL ;
do {
$res_349 = $result ;
$pos_349 = $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 );
$_352 = TRUE ; break ;
}
$result = $res_349 ;
$this -> pos = $pos_349 ;
$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 );
$_352 = TRUE ; break ;
}
$result = $res_349 ;
$this -> pos = $pos_349 ;
$_352 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
while ( 0 );
if ( $_352 === TRUE ) { $_354 = TRUE ; break ; }
$result = $res_347 ;
$this -> pos = $pos_347 ;
$_354 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_354 === TRUE ) { $_356 = TRUE ; break ; }
$result = $res_345 ;
$this -> pos = $pos_345 ;
$_356 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_356 === TRUE ) { $_358 = TRUE ; break ; }
$result = $res_343 ;
$this -> pos = $pos_343 ;
$_358 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_358 === TRUE ) { $_360 = TRUE ; break ; }
$result = $res_341 ;
$this -> pos = $pos_341 ;
$_360 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_360 === TRUE ) { $_362 = TRUE ; break ; }
$result = $res_339 ;
$this -> pos = $pos_339 ;
$_362 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_362 === TRUE ) { $_364 = TRUE ; break ; }
$result = $res_337 ;
$this -> pos = $pos_337 ;
$_364 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_364 === TRUE ) { $_366 = TRUE ; break ; }
$result = $res_335 ;
$this -> pos = $pos_335 ;
$_366 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_366 === TRUE ) { $_368 = TRUE ; break ; }
$result = $res_333 ;
$this -> pos = $pos_333 ;
$_368 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_368 === TRUE ) { $_370 = TRUE ; break ; }
$result = $res_331 ;
$this -> pos = $pos_331 ;
$_370 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_370 === TRUE ) { $_372 = TRUE ; break ; }
$result = $res_329 ;
$this -> pos = $pos_329 ;
$_372 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_372 === FALSE ) { $_374 = FALSE ; break ; }
$_374 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_374 === FALSE ) {
$result = $res_375 ;
$this -> pos = $pos_375 ;
unset ( $res_375 );
unset ( $pos_375 );
2011-02-28 04:12:41 +01:00
break ;
}
$count += 1 ;
}
if ( $count > 0 ) { return $this -> finalise ( $result ); }
else { return FALSE ; }
}
function CacheRestrictedTemplate_CacheBlock ( & $res , $sub ) {
throw new SSTemplateParseException ( 'You cant have cache blocks nested within with, loop or control blocks that are within cache blocks' , $this );
}
function CacheRestrictedTemplate_UncachedBlock ( & $res , $sub ) {
throw new SSTemplateParseException ( 'You cant have uncache blocks nested within with, loop or control blocks that are within cache blocks' , $this );
}
/* CacheBlock :
'<%' < CacheTag : ( " cached " | " cacheblock " ) < ( CacheBlockArguments ) ? ( < Conditional : ( " if " | " unless " ) > Condition : IfArgument ) ? > '%>'
( CacheBlock | UncachedBlock | CacheBlockTemplate ) *
'<%' < 'end_' ( " cached " | " uncached " | " cacheblock " ) > '%>' */
protected $match_CacheBlock_typestack = array ( 'CacheBlock' );
function match_CacheBlock ( $stack = array ()) {
$matchrule = " CacheBlock " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_430 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_430 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
$stack [] = $result ; $result = $this -> construct ( $matchrule , " CacheTag " );
2012-04-11 11:34:27 +02:00
$_383 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$_381 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_378 = $result ;
$pos_378 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_381 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_378 ;
$this -> pos = $pos_378 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cacheblock' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_381 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_378 ;
$this -> pos = $pos_378 ;
$_381 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_381 === FALSE ) { $_383 = FALSE ; break ; }
$_383 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_383 === TRUE ) {
2011-02-28 04:12:41 +01:00
$subres = $result ; $result = array_pop ( $stack );
$this -> store ( $result , $subres , 'CacheTag' );
}
2012-04-11 11:34:27 +02:00
if ( $_383 === FALSE ) {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-11 11:34:27 +02:00
$_430 = 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 ; }
2012-04-11 11:34:27 +02:00
$res_388 = $result ;
$pos_388 = $this -> pos ;
$_387 = 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 ); }
2012-04-11 11:34:27 +02:00
else { $_387 = FALSE ; break ; }
$_387 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_387 === FALSE ) {
$result = $res_388 ;
$this -> pos = $pos_388 ;
unset ( $res_388 );
unset ( $pos_388 );
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$res_400 = $result ;
$pos_400 = $this -> pos ;
$_399 = NULL ;
2011-02-28 04:12:41 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
$stack [] = $result ; $result = $this -> construct ( $matchrule , " Conditional " );
2012-04-11 11:34:27 +02:00
$_395 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$_393 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_390 = $result ;
$pos_390 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'if' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_393 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_390 ;
$this -> pos = $pos_390 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'unless' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_393 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_390 ;
$this -> pos = $pos_390 ;
$_393 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_393 === FALSE ) { $_395 = FALSE ; break ; }
$_395 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_395 === 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
}
2012-04-11 11:34:27 +02:00
if ( $_395 === FALSE ) {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-11 11:34:27 +02:00
$_399 = 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
}
2012-04-11 11:34:27 +02:00
else { $_399 = FALSE ; break ; }
$_399 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_399 === FALSE ) {
$result = $res_400 ;
$this -> pos = $pos_400 ;
unset ( $res_400 );
unset ( $pos_400 );
2011-02-28 04:12:41 +01:00
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
if (( $subres = $this -> literal ( '%>' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_430 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
while ( true ) {
2012-04-11 11:34:27 +02:00
$res_413 = $result ;
$pos_413 = $this -> pos ;
$_412 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$_410 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_403 = $result ;
$pos_403 = $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 );
2012-04-11 11:34:27 +02:00
$_410 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_403 ;
$this -> pos = $pos_403 ;
$_408 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_405 = $result ;
$pos_405 = $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 );
2012-04-11 11:34:27 +02:00
$_408 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_405 ;
$this -> pos = $pos_405 ;
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 );
2012-04-11 11:34:27 +02:00
$_408 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_405 ;
$this -> pos = $pos_405 ;
$_408 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_408 === TRUE ) { $_410 = TRUE ; break ; }
$result = $res_403 ;
$this -> pos = $pos_403 ;
$_410 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_410 === FALSE ) { $_412 = FALSE ; break ; }
$_412 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_412 === FALSE ) {
$result = $res_413 ;
$this -> pos = $pos_413 ;
unset ( $res_413 );
unset ( $pos_413 );
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 ; }
2012-04-11 11:34:27 +02:00
else { $_430 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_430 = FALSE ; break ; }
$_426 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$_424 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_417 = $result ;
$pos_417 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_424 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_417 ;
$this -> pos = $pos_417 ;
$_422 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_419 = $result ;
$pos_419 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'uncached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_422 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_419 ;
$this -> pos = $pos_419 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cacheblock' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_422 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_419 ;
$this -> pos = $pos_419 ;
$_422 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_422 === TRUE ) { $_424 = TRUE ; break ; }
$result = $res_417 ;
$this -> pos = $pos_417 ;
$_424 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_424 === FALSE ) { $_426 = FALSE ; break ; }
$_426 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_426 === FALSE ) { $_430 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_430 = FALSE ; break ; }
$_430 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_430 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_430 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
function CacheBlock__construct ( & $res ){
$res [ 'subblocks' ] = 0 ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
function CacheBlock_CacheBlockArguments ( & $res , $sub ){
$res [ 'key' ] = ! empty ( $sub [ 'php' ]) ? $sub [ 'php' ] : '' ;
}
function CacheBlock_Condition ( & $res , $sub ){
$res [ 'condition' ] = ( $res [ 'Conditional' ][ 'text' ] == 'if' ? '(' : '!(' ) . $sub [ 'php' ] . ') && ' ;
}
function CacheBlock_CacheBlock ( & $res , $sub ){
$res [ 'php' ] .= $sub [ 'php' ];
}
function CacheBlock_UncachedBlock ( & $res , $sub ){
$res [ 'php' ] .= $sub [ 'php' ];
}
function CacheBlock_CacheBlockTemplate ( & $res , $sub ){
// Get the block counter
$block = ++ $res [ 'subblocks' ];
// Build the key for this block from the passed cache key, the block index, and the sha hash of the template itself
$key = " ' " . sha1 ( $sub [ 'php' ]) . ( isset ( $res [ 'key' ]) && $res [ 'key' ] ? " _'.sha1( " . $res [ 'key' ] . " ) " : " ' " ) . " .'_ $block ' " ;
// Get any condition
$condition = isset ( $res [ 'condition' ]) ? $res [ 'condition' ] : '' ;
$res [ 'php' ] .= 'if (' . $condition . '($partial = $cache->load(' . $key . '))) $val .= $partial;' . PHP_EOL ;
$res [ 'php' ] .= 'else { $oldval = $val; $val = "";' . PHP_EOL ;
$res [ 'php' ] .= $sub [ 'php' ] . PHP_EOL ;
$res [ 'php' ] .= $condition . ' $cache->save($val); $val = $oldval . $val;' . PHP_EOL ;
$res [ 'php' ] .= '}' ;
}
2011-02-21 05:44:46 +01:00
/* OldTPart: "_t" < "(" < QuotedString (< "," < CallArguments)? > ")" */
2011-02-28 04:12:41 +01:00
protected $match_OldTPart_typestack = array ( 'OldTPart' );
function match_OldTPart ( $stack = array ()) {
$matchrule = " OldTPart " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_445 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_445 = 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
}
2012-04-11 11:34:27 +02:00
else { $_445 = 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_' . '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 ); }
2012-04-11 11:34:27 +02:00
else { $_445 = FALSE ; break ; }
$res_442 = $result ;
$pos_442 = $this -> pos ;
$_441 = NULL ;
2011-02-21 05:44:46 +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-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
}
2012-04-11 11:34:27 +02:00
else { $_441 = 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 ); }
2012-04-11 11:34:27 +02:00
else { $_441 = FALSE ; break ; }
$_441 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_441 === FALSE ) {
$result = $res_442 ;
$this -> pos = $pos_442 ;
unset ( $res_442 );
unset ( $pos_442 );
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
}
2012-04-11 11:34:27 +02:00
else { $_445 = FALSE ; break ; }
$_445 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_445 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_445 === FALSE ) { return FALSE ; }
2011-02-21 05:44:46 +01:00
}
function OldTPart__construct ( & $res ) {
$res [ 'php' ] = " _t( " ;
}
function OldTPart_QuotedString ( & $res , $sub ) {
$entity = $sub [ 'String' ][ 'text' ];
if ( strpos ( $entity , '.' ) === false ) {
$res [ 'php' ] .= " \$ scope->XML_val('I18NNamespace').'. $entity ' " ;
}
else {
$res [ 'php' ] .= " ' $entity ' " ;
}
}
function OldTPart_CallArguments ( & $res , $sub ) {
$res [ 'php' ] .= ',' . $sub [ 'php' ];
}
function OldTPart__finalise ( & $res ) {
$res [ 'php' ] .= ')' ;
}
/* OldTTag: "<%" < OldTPart > "%>" */
2011-02-28 04:12:41 +01:00
protected $match_OldTTag_typestack = array ( 'OldTTag' );
function match_OldTTag ( $stack = array ()) {
$matchrule = " OldTTag " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_452 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_452 = 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 ); }
2012-04-11 11:34:27 +02:00
else { $_452 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_452 = FALSE ; break ; }
$_452 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_452 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_452 === FALSE ) { return FALSE ; }
2011-02-21 05:44:46 +01:00
}
function OldTTag_OldTPart ( & $res , $sub ) {
$res [ 'php' ] = $sub [ 'php' ];
}
/* OldSprintfTag: "<%" < "sprintf" < "(" < OldTPart < "," < CallArguments > ")" > "%>" */
2011-02-28 04:12:41 +01:00
protected $match_OldSprintfTag_typestack = array ( 'OldSprintfTag' );
function match_OldSprintfTag ( $stack = array ()) {
$matchrule = " OldSprintfTag " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_469 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_469 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_469 = 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
}
2012-04-11 11:34:27 +02:00
else { $_469 = 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 ); }
2012-04-11 11:34:27 +02:00
else { $_469 = 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
}
2012-04-11 11:34:27 +02:00
else { $_469 = 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 ); }
2012-04-11 11:34:27 +02:00
else { $_469 = 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
}
2012-04-11 11:34:27 +02:00
else { $_469 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_469 = FALSE ; break ; }
$_469 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_469 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_469 === FALSE ) { return FALSE ; }
2011-02-21 05:44:46 +01:00
}
function OldSprintfTag__construct ( & $res ) {
$res [ 'php' ] = " sprintf( " ;
}
function OldSprintfTag_OldTPart ( & $res , $sub ) {
$res [ 'php' ] .= $sub [ 'php' ];
}
function OldSprintfTag_CallArguments ( & $res , $sub ) {
$res [ 'php' ] .= ',' . $sub [ 'php' ] . ')' ;
}
/* OldI18NTag: OldSprintfTag | OldTTag */
2011-02-28 04:12:41 +01:00
protected $match_OldI18NTag_typestack = array ( 'OldI18NTag' );
function match_OldI18NTag ( $stack = array ()) {
$matchrule = " OldI18NTag " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_474 = NULL ;
2011-02-21 05:44:46 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_471 = $result ;
$pos_471 = $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 );
2012-04-11 11:34:27 +02:00
$_474 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_471 ;
$this -> pos = $pos_471 ;
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 );
2012-04-11 11:34:27 +02:00
$_474 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_471 ;
$this -> pos = $pos_471 ;
$_474 = FALSE ; break ;
2011-02-21 05:44:46 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_474 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_474 === FALSE ) { return FALSE ; }
2011-02-21 05:44:46 +01:00
}
function OldI18NTag_STR ( & $res , $sub ) {
$res [ 'php' ] = '$val .= ' . $sub [ 'php' ] . ';' ;
}
2012-04-11 11:34:27 +02:00
/* NamedArgument: Name:Word "=" Value:Argument */
protected $match_NamedArgument_typestack = array ( 'NamedArgument' );
function match_NamedArgument ( $stack = array ()) {
$matchrule = " NamedArgument " ; $result = $this -> construct ( $matchrule , $matchrule , null );
$_479 = NULL ;
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 " );
}
else { $_479 = FALSE ; break ; }
if ( substr ( $this -> string , $this -> pos , 1 ) == '=' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '=' ;
}
else { $_479 = FALSE ; break ; }
$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 " );
}
else { $_479 = FALSE ; break ; }
$_479 = TRUE ; break ;
}
while ( 0 );
if ( $_479 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_479 === FALSE ) { return FALSE ; }
}
function NamedArgument_Name ( & $res , $sub ) {
$res [ 'php' ] = " ' " . $sub [ 'text' ] . " ' => " ;
}
function NamedArgument_Value ( & $res , $sub ) {
$res [ 'php' ] .= ( $sub [ 'ArgumentMode' ] == 'default' ) ? $sub [ 'string_php' ] : str_replace ( '$$FINAL' , 'XML_val' , $sub [ 'php' ]);
}
/* Include: "<%" < "include" < Template:Word < (NamedArgument ( < "," < NamedArgument )*)? > "%>" */
protected $match_Include_typestack = array ( 'Include' );
function match_Include ( $stack = array ()) {
$matchrule = " Include " ; $result = $this -> construct ( $matchrule , $matchrule , null );
$_498 = NULL ;
do {
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
else { $_498 = FALSE ; break ; }
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
if (( $subres = $this -> literal ( 'include' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
else { $_498 = FALSE ; break ; }
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
$matcher = 'match_' . 'Word' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Template " );
}
else { $_498 = FALSE ; break ; }
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
$res_495 = $result ;
$pos_495 = $this -> pos ;
$_494 = NULL ;
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 ); }
else { $_494 = FALSE ; break ; }
while ( true ) {
$res_493 = $result ;
$pos_493 = $this -> pos ;
$_492 = NULL ;
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
if ( substr ( $this -> string , $this -> pos , 1 ) == ',' ) {
$this -> pos += 1 ;
$result [ " text " ] .= ',' ;
}
else { $_492 = FALSE ; break ; }
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 );
}
else { $_492 = FALSE ; break ; }
$_492 = TRUE ; break ;
}
while ( 0 );
if ( $_492 === FALSE ) {
$result = $res_493 ;
$this -> pos = $pos_493 ;
unset ( $res_493 );
unset ( $pos_493 );
break ;
}
}
$_494 = TRUE ; break ;
}
while ( 0 );
if ( $_494 === FALSE ) {
$result = $res_495 ;
$this -> pos = $pos_495 ;
unset ( $res_495 );
unset ( $pos_495 );
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
if (( $subres = $this -> literal ( '%>' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
else { $_498 = FALSE ; break ; }
$_498 = TRUE ; break ;
}
while ( 0 );
if ( $_498 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_498 === FALSE ) { return FALSE ; }
}
function Include__construct ( & $res ){
$res [ 'arguments' ] = array ();
}
function Include_Template ( & $res , $sub ){
$res [ 'template' ] = " ' " . $sub [ 'text' ] . " ' " ;
}
function Include_NamedArgument ( & $res , $sub ){
$res [ 'arguments' ][] = $sub [ 'php' ];
}
function Include__finalise ( & $res ){
$template = $res [ 'template' ];
$arguments = $res [ 'arguments' ];
$res [ 'php' ] = '$val .= SSViewer::execute_template(' . $template . ', $scope->getItem(), array(' . implode ( ',' , $arguments ) . " )); \n " ;
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' );
function match_BlockArguments ( $stack = array ()) {
$matchrule = " BlockArguments " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_507 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Argument' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Argument " );
}
2012-04-11 11:34:27 +02:00
else { $_507 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
while ( true ) {
2012-04-11 11:34:27 +02:00
$res_506 = $result ;
$pos_506 = $this -> pos ;
$_505 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == ',' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= ',' ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
else { $_505 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Argument' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Argument " );
}
2012-04-11 11:34:27 +02:00
else { $_505 = FALSE ; break ; }
$_505 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_505 === FALSE ) {
$result = $res_506 ;
$this -> pos = $pos_506 ;
unset ( $res_506 );
unset ( $pos_506 );
2011-02-09 05:31:16 +01:00
break ;
}
}
2012-04-11 11:34:27 +02:00
$_507 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_507 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_507 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +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' );
function match_NotBlockTag ( $stack = array ()) {
$matchrule = " NotBlockTag " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_545 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_509 = $result ;
$pos_509 = $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 ;
2012-04-11 11:34:27 +02:00
$_545 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_509 ;
$this -> pos = $pos_509 ;
$_543 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$_540 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$_538 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_511 = $result ;
$pos_511 = $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 ;
2012-04-11 11:34:27 +02:00
$_538 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_511 ;
$this -> pos = $pos_511 ;
$_536 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_513 = $result ;
$pos_513 = $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 ;
2012-04-11 11:34:27 +02:00
$_536 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_513 ;
$this -> pos = $pos_513 ;
$_534 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_515 = $result ;
$pos_515 = $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 ;
2012-04-11 11:34:27 +02:00
$_534 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_515 ;
$this -> pos = $pos_515 ;
$_532 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_517 = $result ;
$pos_517 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'require' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_532 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_517 ;
$this -> pos = $pos_517 ;
$_530 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_519 = $result ;
$pos_519 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_530 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_519 ;
$this -> pos = $pos_519 ;
$_528 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_521 = $result ;
$pos_521 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'uncached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_528 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_521 ;
$this -> pos = $pos_521 ;
$_526 = NULL ;
do {
$res_523 = $result ;
$pos_523 = $this -> pos ;
if (( $subres = $this -> literal ( 'cacheblock' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
$_526 = TRUE ; break ;
}
$result = $res_523 ;
$this -> pos = $pos_523 ;
if (( $subres = $this -> literal ( 'include' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
$_526 = TRUE ; break ;
}
$result = $res_523 ;
$this -> pos = $pos_523 ;
$_526 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
while ( 0 );
if ( $_526 === TRUE ) { $_528 = TRUE ; break ; }
$result = $res_521 ;
$this -> pos = $pos_521 ;
$_528 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_528 === TRUE ) { $_530 = TRUE ; break ; }
$result = $res_519 ;
$this -> pos = $pos_519 ;
$_530 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_530 === TRUE ) { $_532 = TRUE ; break ; }
$result = $res_517 ;
$this -> pos = $pos_517 ;
$_532 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_532 === TRUE ) { $_534 = TRUE ; break ; }
$result = $res_515 ;
$this -> pos = $pos_515 ;
$_534 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_534 === TRUE ) { $_536 = TRUE ; break ; }
$result = $res_513 ;
$this -> pos = $pos_513 ;
$_536 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_536 === TRUE ) { $_538 = TRUE ; break ; }
$result = $res_511 ;
$this -> pos = $pos_511 ;
$_538 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_538 === FALSE ) { $_540 = FALSE ; break ; }
$_540 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_540 === FALSE ) { $_543 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_543 = FALSE ; break ; }
$_543 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_543 === TRUE ) { $_545 = TRUE ; break ; }
$result = $res_509 ;
$this -> pos = $pos_509 ;
$_545 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_545 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_545 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
/* ClosedBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > Zap:'%>' Template:$TemplateMatcher? '<%' < 'end_' '$BlockName' > '%>' */
protected $match_ClosedBlock_typestack = array ( 'ClosedBlock' );
function match_ClosedBlock ( $stack = array ()) {
$matchrule = " ClosedBlock " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_565 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_565 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
$res_549 = $result ;
$pos_549 = $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 );
2012-04-11 11:34:27 +02:00
$result = $res_549 ;
$this -> pos = $pos_549 ;
$_565 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
else {
2012-04-11 11:34:27 +02:00
$result = $res_549 ;
$this -> pos = $pos_549 ;
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 " );
}
2012-04-11 11:34:27 +02:00
else { $_565 = FALSE ; break ; }
$res_555 = $result ;
$pos_555 = $this -> pos ;
$_554 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_554 = 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 " );
}
2012-04-11 11:34:27 +02:00
else { $_554 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_554 = FALSE ; break ; }
$_554 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_554 === FALSE ) {
$result = $res_555 ;
$this -> pos = $pos_555 ;
unset ( $res_555 );
unset ( $pos_555 );
2011-02-09 05:31:16 +01:00
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
$stack [] = $result ; $result = $this -> construct ( $matchrule , " Zap " );
if (( $subres = $this -> literal ( '%>' ) ) !== FALSE ) {
2011-02-09 05:31:16 +01:00
$result [ " text " ] .= $subres ;
2011-02-28 04:12:41 +01:00
$subres = $result ; $result = array_pop ( $stack );
2011-02-09 05:31:16 +01:00
$this -> store ( $result , $subres , 'Zap' );
}
else {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-11 11:34:27 +02:00
$_565 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$res_558 = $result ;
$pos_558 = $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 {
2012-04-11 11:34:27 +02:00
$result = $res_558 ;
$this -> pos = $pos_558 ;
unset ( $res_558 );
unset ( $pos_558 );
2011-02-21 05:44:46 +01:00
}
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_565 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_565 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '' . $this -> expression ( $result , $stack , 'BlockName' ) . '' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_565 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_565 = FALSE ; break ; }
$_565 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_565 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_565 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2011-02-14 22:03:42 +01:00
/**
* As mentioned in the parser comment , block handling is kept fairly generic for extensibility . The match rule
* builds up two important elements in the match result array :
* 'ArgumentCount' - how many arguments were passed in the opening tag
* 'Arguments' an array of the Argument match rule result arrays
*
* Once a block has successfully been matched against , it will then look for the actual handler , which should
2011-04-15 11:35:30 +02:00
* be on this class ( either defined or extended on ) as ClosedBlock_Handler_Name ( & $res ), where Name is the
2011-02-14 22:03:42 +01:00
* tag name , first letter captialized ( i . e Control , Loop , With , etc ) .
*
* This function will be called with the match rule result array as it ' s first argument . It should return
* the php result of this block as it ' s return value , or throw an error if incorrect arguments were passed .
*/
2011-02-09 05:31:16 +01:00
function ClosedBlock__construct ( & $res ) {
$res [ 'ArgumentCount' ] = 0 ;
}
function ClosedBlock_BlockArguments ( & $res , $sub ) {
if ( isset ( $sub [ 'Argument' ][ 'ArgumentMode' ])) {
$res [ 'Arguments' ] = array ( $sub [ 'Argument' ]);
$res [ 'ArgumentCount' ] = 1 ;
}
else {
$res [ 'Arguments' ] = $sub [ 'Argument' ];
$res [ 'ArgumentCount' ] = count ( $res [ 'Arguments' ]);
}
}
function ClosedBlock__finalise ( & $res ) {
$blockname = $res [ 'BlockName' ][ 'text' ];
2011-12-17 05:35:26 +01:00
$method = 'ClosedBlock_Handle_' . $blockname ;
2011-02-09 05:31:16 +01:00
if ( method_exists ( $this , $method )) $res [ 'php' ] = $this -> $method ( $res );
else {
throw new SSTemplateParseException ( 'Unknown closed block "' . $blockname . '" encountered. Perhaps you are not supposed to close this block, or have mis-spelled it?' , $this );
}
}
2011-02-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
*/
2011-02-18 05:06:11 +01:00
function ClosedBlock_Handle_Loop ( & $res ) {
2012-02-11 03:30:46 +01:00
if ( $res [ 'ArgumentCount' ] > 1 ) {
2011-02-09 05:31:16 +01:00
throw new SSTemplateParseException ( 'Either no or too many arguments in control block. Must be one argument only.' , $this );
}
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 );
}
$on = str_replace ( '$$FINAL' , 'obj' , ( $arg [ 'ArgumentMode' ] == 'default' ) ? $arg [ 'lookup_php' ] : $arg [ 'php' ]);
2011-02-09 05:31:16 +01:00
}
2012-02-11 03:30:46 +01:00
return
2011-02-18 05:06:11 +01:00
$on . '; $scope->pushScope(); while (($key = $scope->next()) !== false) {' . PHP_EOL .
$res [ 'Template' ][ 'php' ] . PHP_EOL .
'}; $scope->popScope(); ' ;
}
/**
* The deprecated closed block handler for control blocks
* @ deprecated
*/
function ClosedBlock_Handle_Control ( & $res ) {
2011-12-17 05:35:26 +01:00
Deprecation :: notice ( '3.1' , 'Use <% with %> or <% loop %> instead.' );
2011-02-18 05:06:11 +01:00
return $this -> ClosedBlock_Handle_Loop ( $res );
}
/**
* The closed block handler for with blocks
*/
function ClosedBlock_Handle_With ( & $res ) {
if ( $res [ 'ArgumentCount' ] != 1 ) {
throw new SSTemplateParseException ( 'Either no or too many arguments in with block. Must be one argument only.' , $this );
}
$arg = $res [ 'Arguments' ][ 0 ];
if ( $arg [ 'ArgumentMode' ] == 'string' ) {
throw new SSTemplateParseException ( 'Control block cant take string as argument.' , $this );
}
$on = str_replace ( '$$FINAL' , 'obj' , ( $arg [ 'ArgumentMode' ] == 'default' ) ? $arg [ 'lookup_php' ] : $arg [ 'php' ]);
2011-02-09 05:31:16 +01:00
return
2011-02-18 05:06:11 +01:00
$on . '; $scope->pushScope();' . PHP_EOL .
2011-02-09 05:31:16 +01:00
$res [ 'Template' ][ 'php' ] . PHP_EOL .
2011-02-18 05:06:11 +01:00
'; $scope->popScope(); ' ;
2011-02-09 05:31:16 +01:00
}
2011-02-14 04:52:01 +01:00
/* OpenBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > '%>' */
2011-02-28 04:12:41 +01:00
protected $match_OpenBlock_typestack = array ( 'OpenBlock' );
function match_OpenBlock ( $stack = array ()) {
$matchrule = " OpenBlock " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_578 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_578 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
$res_569 = $result ;
$pos_569 = $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 );
2012-04-11 11:34:27 +02:00
$result = $res_569 ;
$this -> pos = $pos_569 ;
$_578 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
else {
2012-04-11 11:34:27 +02:00
$result = $res_569 ;
$this -> pos = $pos_569 ;
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
}
2012-04-11 11:34:27 +02:00
else { $_578 = FALSE ; break ; }
$res_575 = $result ;
$pos_575 = $this -> pos ;
$_574 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_574 = 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 " );
}
2012-04-11 11:34:27 +02:00
else { $_574 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_574 = FALSE ; break ; }
$_574 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_574 === FALSE ) {
$result = $res_575 ;
$this -> pos = $pos_575 ;
unset ( $res_575 );
unset ( $pos_575 );
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 ; }
2012-04-11 11:34:27 +02:00
else { $_578 = FALSE ; break ; }
$_578 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_578 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_578 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
function OpenBlock__construct ( & $res ) {
$res [ 'ArgumentCount' ] = 0 ;
}
function OpenBlock_BlockArguments ( & $res , $sub ) {
if ( isset ( $sub [ 'Argument' ][ 'ArgumentMode' ])) {
$res [ 'Arguments' ] = array ( $sub [ 'Argument' ]);
$res [ 'ArgumentCount' ] = 1 ;
}
else {
$res [ 'Arguments' ] = $sub [ 'Argument' ];
$res [ 'ArgumentCount' ] = count ( $res [ 'Arguments' ]);
}
}
function OpenBlock__finalise ( & $res ) {
2011-02-14 04:52:01 +01:00
$blockname = $res [ 'BlockName' ][ 'text' ];
2011-02-09 05:31:16 +01:00
2011-12-17 05:35:26 +01:00
$method = 'OpenBlock_Handle_' . $blockname ;
2011-02-09 05:31:16 +01:00
if ( method_exists ( $this , $method )) $res [ 'php' ] = $this -> $method ( $res );
else {
throw new SSTemplateParseException ( 'Unknown open block "' . $blockname . '" encountered. Perhaps you missed the closing tag or have mis-spelled it?' , $this );
}
}
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
*/
2011-02-09 05:31:16 +01:00
function OpenBlock_Handle_Debug ( & $res ) {
2011-02-18 05:06:11 +01:00
if ( $res [ 'ArgumentCount' ] == 0 ) return '$scope->debug();' ;
2011-02-09 05:31:16 +01:00
else if ( $res [ 'ArgumentCount' ] == 1 ) {
$arg = $res [ 'Arguments' ][ 0 ];
if ( $arg [ 'ArgumentMode' ] == 'string' ) return 'Debug::show(' . $arg [ 'php' ] . ');' ;
$php = ( $arg [ 'ArgumentMode' ] == 'default' ) ? $arg [ 'lookup_php' ] : $arg [ 'php' ];
return '$val .= Debug::show(' . str_replace ( 'FINALGET!' , 'cachedCall' , $php ) . ');' ;
}
else {
throw new SSTemplateParseException ( 'Debug takes 0 or 1 argument only.' , $this );
}
}
2011-02-14 22:03:42 +01:00
/**
* This is an open block handler , for the <% base_tag %> tag
*/
2011-02-09 05:31:16 +01:00
function OpenBlock_Handle_Base_tag ( & $res ) {
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
*/
2011-02-09 05:31:16 +01:00
function OpenBlock_Handle_Current_page ( & $res ) {
if ( $res [ 'ArgumentCount' ] != 0 ) throw new SSTemplateParseException ( 'Current_page takes no arguments' , $this );
return '$val .= $_SERVER[SCRIPT_URL];' ;
}
2011-02-28 04:12:41 +01:00
/* MismatchedEndBlock: '<%' < 'end_' :Word > '%>' */
protected $match_MismatchedEndBlock_typestack = array ( 'MismatchedEndBlock' );
function match_MismatchedEndBlock ( $stack = array ()) {
$matchrule = " MismatchedEndBlock " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_586 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_586 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_586 = 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 " );
}
2012-04-11 11:34:27 +02:00
else { $_586 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_586 = FALSE ; break ; }
$_586 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_586 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_586 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
function MismatchedEndBlock__finalise ( & $res ) {
$blockname = $res [ 'Word' ][ 'text' ];
throw new SSTemplateParseException ( 'Unexpected close tag end_' . $blockname . ' encountered. Perhaps you have mis-nested blocks, or have mis-spelled a tag?' , $this );
}
/* MalformedOpenTag: '<%' < !NotBlockTag Tag:Word !( ( [ :BlockArguments ] )? > '%>' ) */
2011-02-28 04:12:41 +01:00
protected $match_MalformedOpenTag_typestack = array ( 'MalformedOpenTag' );
function match_MalformedOpenTag ( $stack = array ()) {
$matchrule = " MalformedOpenTag " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_601 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_601 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
$res_590 = $result ;
$pos_590 = $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 );
2012-04-11 11:34:27 +02:00
$result = $res_590 ;
$this -> pos = $pos_590 ;
$_601 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
else {
2012-04-11 11:34:27 +02:00
$result = $res_590 ;
$this -> pos = $pos_590 ;
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 " );
}
2012-04-11 11:34:27 +02:00
else { $_601 = FALSE ; break ; }
$res_600 = $result ;
$pos_600 = $this -> pos ;
$_599 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_596 = $result ;
$pos_596 = $this -> pos ;
$_595 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_595 = 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 " );
}
2012-04-11 11:34:27 +02:00
else { $_595 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_595 = FALSE ; break ; }
$_595 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_595 === FALSE ) {
$result = $res_596 ;
$this -> pos = $pos_596 ;
unset ( $res_596 );
unset ( $pos_596 );
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 ; }
2012-04-11 11:34:27 +02:00
else { $_599 = FALSE ; break ; }
$_599 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_599 === TRUE ) {
$result = $res_600 ;
$this -> pos = $pos_600 ;
$_601 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
if ( $_599 === FALSE ) {
$result = $res_600 ;
$this -> pos = $pos_600 ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$_601 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_601 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_601 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
function MalformedOpenTag__finalise ( & $res ) {
$tag = $res [ 'Tag' ][ 'text' ];
throw new SSTemplateParseException ( " Malformed opening block tag $tag . Perhaps you have tried to use operators? " , $this );
}
/* MalformedCloseTag: '<%' < Tag:('end_' :Word ) !( > '%>' ) */
2011-02-28 04:12:41 +01:00
protected $match_MalformedCloseTag_typestack = array ( 'MalformedCloseTag' );
function match_MalformedCloseTag ( $stack = array ()) {
$matchrule = " MalformedCloseTag " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_613 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_613 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
$stack [] = $result ; $result = $this -> construct ( $matchrule , " Tag " );
2012-04-11 11:34:27 +02:00
$_607 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_607 = 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 " );
}
2012-04-11 11:34:27 +02:00
else { $_607 = FALSE ; break ; }
$_607 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_607 === 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' );
}
2012-04-11 11:34:27 +02:00
if ( $_607 === FALSE ) {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-11 11:34:27 +02:00
$_613 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$res_612 = $result ;
$pos_612 = $this -> pos ;
$_611 = 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 ; }
2012-04-11 11:34:27 +02:00
else { $_611 = FALSE ; break ; }
$_611 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_611 === TRUE ) {
$result = $res_612 ;
$this -> pos = $pos_612 ;
$_613 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
if ( $_611 === FALSE ) {
$result = $res_612 ;
$this -> pos = $pos_612 ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$_613 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_613 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_613 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
function MalformedCloseTag__finalise ( & $res ) {
$tag = $res [ 'Tag' ][ 'text' ];
throw new SSTemplateParseException ( " Malformed closing block tag $tag . Perhaps you have tried to pass an argument to one? " , $this );
}
/* MalformedBlock: MalformedOpenTag | MalformedCloseTag */
2011-02-28 04:12:41 +01:00
protected $match_MalformedBlock_typestack = array ( 'MalformedBlock' );
function match_MalformedBlock ( $stack = array ()) {
$matchrule = " MalformedBlock " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_618 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_615 = $result ;
$pos_615 = $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 );
2012-04-11 11:34:27 +02:00
$_618 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_615 ;
$this -> pos = $pos_615 ;
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 );
2012-04-11 11:34:27 +02:00
$_618 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_615 ;
$this -> pos = $pos_615 ;
$_618 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_618 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_618 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
/* Comment: "<%--" (!"--%>" /./)+ "--%>" */
2011-02-28 04:12:41 +01:00
protected $match_Comment_typestack = array ( 'Comment' );
function match_Comment ( $stack = array ()) {
$matchrule = " Comment " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-11 11:34:27 +02:00
$_626 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%--' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_626 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
$count = 0 ;
while ( true ) {
2012-04-11 11:34:27 +02:00
$res_624 = $result ;
$pos_624 = $this -> pos ;
$_623 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_621 = $result ;
$pos_621 = $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 ;
2012-04-11 11:34:27 +02:00
$result = $res_621 ;
$this -> pos = $pos_621 ;
$_623 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
else {
2012-04-11 11:34:27 +02:00
$result = $res_621 ;
$this -> pos = $pos_621 ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> rx ( '/./' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_623 = FALSE ; break ; }
$_623 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_623 === FALSE ) {
$result = $res_624 ;
$this -> pos = $pos_624 ;
unset ( $res_624 );
unset ( $pos_624 );
2011-02-09 05:31:16 +01:00
break ;
}
$count += 1 ;
}
if ( $count > 0 ) { }
2012-04-11 11:34:27 +02:00
else { $_626 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '--%>' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_626 = FALSE ; break ; }
$_626 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_626 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_626 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
function Comment__construct ( & $res ) {
$res [ 'php' ] = '' ;
}
2012-04-11 11:34:27 +02:00
/* TopTemplate: (Comment | 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' );
function match_TopTemplate ( $stack = array ()) {
$matchrule = " TopTemplate " ; $result = $this -> construct ( $matchrule , $matchrule , array ( 'TemplateMatcher' => 'Template' ));
2011-02-09 05:31:16 +01:00
$count = 0 ;
while ( true ) {
2012-04-11 11:34:27 +02:00
$res_678 = $result ;
$pos_678 = $this -> pos ;
$_677 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$_675 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_628 = $result ;
$pos_628 = $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 );
2012-04-11 11:34:27 +02:00
$_675 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_628 ;
$this -> pos = $pos_628 ;
$_673 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_630 = $result ;
$pos_630 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'If' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-11 11:34:27 +02:00
$_673 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_630 ;
$this -> pos = $pos_630 ;
$_671 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_632 = $result ;
$pos_632 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Require' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-11 11:34:27 +02:00
$_671 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_632 ;
$this -> pos = $pos_632 ;
$_669 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_634 = $result ;
$pos_634 = $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 ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-11 11:34:27 +02:00
$_669 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_634 ;
$this -> pos = $pos_634 ;
$_667 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_636 = $result ;
$pos_636 = $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 ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-11 11:34:27 +02:00
$_667 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_636 ;
$this -> pos = $pos_636 ;
$_665 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_638 = $result ;
$pos_638 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'OldI18NTag' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-11 11:34:27 +02:00
$_665 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_638 ;
$this -> pos = $pos_638 ;
$_663 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_640 = $result ;
$pos_640 = $this -> pos ;
$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 );
2012-04-11 11:34:27 +02:00
$_663 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_640 ;
$this -> pos = $pos_640 ;
$_661 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_642 = $result ;
$pos_642 = $this -> pos ;
$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-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-11 11:34:27 +02:00
$_661 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_642 ;
$this -> pos = $pos_642 ;
$_659 = NULL ;
2011-02-21 05:44:46 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_644 = $result ;
$pos_644 = $this -> pos ;
$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 ))) ) );
2011-02-21 05:44:46 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-11 11:34:27 +02:00
$_659 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_644 ;
$this -> pos = $pos_644 ;
$_657 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_646 = $result ;
$pos_646 = $this -> pos ;
$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 );
2012-04-11 11:34:27 +02:00
$_657 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_646 ;
$this -> pos = $pos_646 ;
$_655 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_648 = $result ;
$pos_648 = $this -> pos ;
$matcher = 'match_' . 'MismatchedEndBlock' ; $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-11 11:34:27 +02:00
$_655 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_648 ;
$this -> pos = $pos_648 ;
$_653 = NULL ;
do {
$res_650 = $result ;
$pos_650 = $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 );
$_653 = TRUE ; break ;
}
$result = $res_650 ;
$this -> pos = $pos_650 ;
$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 );
$_653 = TRUE ; break ;
}
$result = $res_650 ;
$this -> pos = $pos_650 ;
$_653 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
while ( 0 );
if ( $_653 === TRUE ) { $_655 = TRUE ; break ; }
$result = $res_648 ;
$this -> pos = $pos_648 ;
$_655 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_655 === TRUE ) { $_657 = TRUE ; break ; }
$result = $res_646 ;
$this -> pos = $pos_646 ;
$_657 = FALSE ; break ;
2011-02-21 05:44:46 +01:00
}
2011-02-28 04:12:41 +01:00
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_657 === TRUE ) { $_659 = TRUE ; break ; }
$result = $res_644 ;
$this -> pos = $pos_644 ;
$_659 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-21 05:44:46 +01:00
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_659 === TRUE ) { $_661 = TRUE ; break ; }
$result = $res_642 ;
$this -> pos = $pos_642 ;
$_661 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_661 === TRUE ) { $_663 = TRUE ; break ; }
$result = $res_640 ;
$this -> pos = $pos_640 ;
$_663 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_663 === TRUE ) { $_665 = TRUE ; break ; }
$result = $res_638 ;
$this -> pos = $pos_638 ;
$_665 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_665 === TRUE ) { $_667 = TRUE ; break ; }
$result = $res_636 ;
$this -> pos = $pos_636 ;
$_667 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_667 === TRUE ) { $_669 = TRUE ; break ; }
$result = $res_634 ;
$this -> pos = $pos_634 ;
$_669 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_669 === TRUE ) { $_671 = TRUE ; break ; }
$result = $res_632 ;
$this -> pos = $pos_632 ;
$_671 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_671 === TRUE ) { $_673 = TRUE ; break ; }
$result = $res_630 ;
$this -> pos = $pos_630 ;
$_673 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_673 === TRUE ) { $_675 = TRUE ; break ; }
$result = $res_628 ;
$this -> pos = $pos_628 ;
$_675 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_675 === FALSE ) { $_677 = FALSE ; break ; }
$_677 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_677 === FALSE ) {
$result = $res_678 ;
$this -> pos = $pos_678 ;
unset ( $res_678 );
unset ( $pos_678 );
2011-02-09 05:31:16 +01:00
break ;
}
$count += 1 ;
}
2011-02-28 04:12:41 +01:00
if ( $count > 0 ) { return $this -> finalise ( $result ); }
2011-02-09 05:31:16 +01:00
else { return FALSE ; }
}
2011-02-14 22:03:42 +01:00
/**
* The TopTemplate also includes the opening stanza to start off the template
*/
2011-02-09 05:31:16 +01:00
function TopTemplate__construct ( & $res ) {
$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' );
function match_Text ( $stack = array ()) {
$matchrule = " Text " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2011-03-17 01:08:13 +01:00
$count = 0 ;
while ( true ) {
2012-04-11 11:34:27 +02:00
$res_717 = $result ;
$pos_717 = $this -> pos ;
$_716 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-11 11:34:27 +02:00
$_714 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_679 = $result ;
$pos_679 = $this -> pos ;
2011-03-17 01:08:13 +01:00
if (( $subres = $this -> rx ( '/ [^<${\\\\]+ /' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_714 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_679 ;
$this -> pos = $pos_679 ;
$_712 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_681 = $result ;
$pos_681 = $this -> pos ;
2011-03-17 01:08:13 +01:00
if (( $subres = $this -> rx ( '/ (\\\\.) /' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-11 11:34:27 +02:00
$_712 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
2012-04-11 11:34:27 +02:00
$result = $res_681 ;
$this -> pos = $pos_681 ;
$_710 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_683 = $result ;
$pos_683 = $this -> pos ;
$_686 = NULL ;
2011-03-17 01:08:13 +01:00
do {
if ( substr ( $this -> string , $this -> pos , 1 ) == '<' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '<' ;
}
2012-04-11 11:34:27 +02:00
else { $_686 = FALSE ; break ; }
$res_685 = $result ;
$pos_685 = $this -> pos ;
2011-03-17 01:08:13 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '%' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '%' ;
2012-04-11 11:34:27 +02:00
$result = $res_685 ;
$this -> pos = $pos_685 ;
$_686 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
else {
2012-04-11 11:34:27 +02:00
$result = $res_685 ;
$this -> pos = $pos_685 ;
2011-03-17 01:08:13 +01:00
}
2012-04-11 11:34:27 +02:00
$_686 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_686 === TRUE ) { $_710 = TRUE ; break ; }
$result = $res_683 ;
$this -> pos = $pos_683 ;
$_708 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_688 = $result ;
$pos_688 = $this -> pos ;
$_693 = NULL ;
2011-03-17 01:08:13 +01:00
do {
if ( substr ( $this -> string , $this -> pos , 1 ) == '$' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '$' ;
}
2012-04-11 11:34:27 +02:00
else { $_693 = FALSE ; break ; }
$res_692 = $result ;
$pos_692 = $this -> pos ;
$_691 = NULL ;
2011-03-17 01:08:13 +01:00
do {
if (( $subres = $this -> rx ( '/[A-Za-z_]/' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_691 = FALSE ; break ; }
$_691 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_691 === TRUE ) {
$result = $res_692 ;
$this -> pos = $pos_692 ;
$_693 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
2012-04-11 11:34:27 +02:00
if ( $_691 === FALSE ) {
$result = $res_692 ;
$this -> pos = $pos_692 ;
2011-03-17 01:08:13 +01:00
}
2012-04-11 11:34:27 +02:00
$_693 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_693 === TRUE ) { $_708 = TRUE ; break ; }
$result = $res_688 ;
$this -> pos = $pos_688 ;
$_706 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-11 11:34:27 +02:00
$res_695 = $result ;
$pos_695 = $this -> pos ;
$_698 = NULL ;
2011-03-17 01:08:13 +01:00
do {
if ( substr ( $this -> string , $this -> pos , 1 ) == '{' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '{' ;
}
2012-04-11 11:34:27 +02:00
else { $_698 = FALSE ; break ; }
$res_697 = $result ;
$pos_697 = $this -> pos ;
2011-03-17 01:08:13 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '$' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '$' ;
2012-04-11 11:34:27 +02:00
$result = $res_697 ;
$this -> pos = $pos_697 ;
$_698 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
else {
2012-04-11 11:34:27 +02:00
$result = $res_697 ;
$this -> pos = $pos_697 ;
2011-03-17 01:08:13 +01:00
}
2012-04-11 11:34:27 +02:00
$_698 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_698 === TRUE ) { $_706 = TRUE ; break ; }
$result = $res_695 ;
$this -> pos = $pos_695 ;
$_704 = NULL ;
2011-03-17 01:08:13 +01:00
do {
if (( $subres = $this -> literal ( '{$' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_704 = FALSE ; break ; }
$res_703 = $result ;
$pos_703 = $this -> pos ;
$_702 = NULL ;
2011-03-17 01:08:13 +01:00
do {
if (( $subres = $this -> rx ( '/[A-Za-z_]/' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-11 11:34:27 +02:00
else { $_702 = FALSE ; break ; }
$_702 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_702 === TRUE ) {
$result = $res_703 ;
$this -> pos = $pos_703 ;
$_704 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
2012-04-11 11:34:27 +02:00
if ( $_702 === FALSE ) {
$result = $res_703 ;
$this -> pos = $pos_703 ;
2011-03-17 01:08:13 +01:00
}
2012-04-11 11:34:27 +02:00
$_704 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_704 === TRUE ) { $_706 = TRUE ; break ; }
$result = $res_695 ;
$this -> pos = $pos_695 ;
$_706 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_706 === TRUE ) { $_708 = TRUE ; break ; }
$result = $res_688 ;
$this -> pos = $pos_688 ;
$_708 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_708 === TRUE ) { $_710 = TRUE ; break ; }
$result = $res_683 ;
$this -> pos = $pos_683 ;
$_710 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_710 === TRUE ) { $_712 = TRUE ; break ; }
$result = $res_681 ;
$this -> pos = $pos_681 ;
$_712 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_712 === TRUE ) { $_714 = TRUE ; break ; }
$result = $res_679 ;
$this -> pos = $pos_679 ;
$_714 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_714 === FALSE ) { $_716 = FALSE ; break ; }
$_716 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-11 11:34:27 +02:00
if ( $_716 === FALSE ) {
$result = $res_717 ;
$this -> pos = $pos_717 ;
unset ( $res_717 );
unset ( $pos_717 );
2011-03-17 01:08:13 +01:00
break ;
}
$count += 1 ;
2011-02-28 04:12:41 +01:00
}
2011-03-17 01:08:13 +01:00
if ( $count > 0 ) { return $this -> finalise ( $result ); }
2011-02-28 04:12:41 +01:00
else { return FALSE ; }
}
2011-02-14 22:03:42 +01:00
/**
2011-02-28 04:12:41 +01:00
* We convert text
2011-02-14 22:03:42 +01:00
*/
2011-02-28 04:12:41 +01:00
function Text__finalise ( & $res ) {
$text = $res [ 'text' ];
2011-03-17 01:08:13 +01:00
// Unescape any escaped characters in the text, then put back escapes for any single quotes and backslashes
$text = stripslashes ( $text );
$text = addcslashes ( $text , '\'\\' );
// TODO: This is pretty ugly & gets applied on all files not just html. I wonder if we can make this non-dynamically calculated
2011-02-28 04:12:41 +01:00
$text = preg_replace (
'/href\s*\=\s*\"\#/' ,
2011-10-18 11:42:55 +02:00
'href="\' . (SSViewer::$options[\'rewriteHashlinks\'] ? strip_tags( $_SERVER[\'REQUEST_URI\'] ) : "") . \'#' ,
2011-02-28 04:12:41 +01:00
$text
);
2011-02-09 05:31:16 +01:00
2011-03-17 01:08:13 +01:00
$res [ 'php' ] .= '$val .= \'' . $text . '\';' . PHP_EOL ;
2011-02-28 04:12:41 +01:00
}
2011-02-14 22:03:42 +01:00
/******************
* Here ends the parser itself . Below are utility methods to use the parser
*/
/**
* Compiles some passed template source code into the php code that will execute as per the template source .
*
* @ static
* @ throws SSTemplateParseException
* @ param $string - The source of the template
* @ param string $templateName - The name of the template , normally the filename the template source was loaded from
* @ param bool $includeDebuggingComments - True is debugging comments should be included in the output
* @ return mixed | string - The php that , when executed ( via include or exec ) will behave as per the template source
*/
2011-02-09 05:31:16 +01:00
static function compileString ( $string , $templateName = " " , $includeDebuggingComments = false ) {
2011-03-25 00:28:03 +01:00
if ( ! trim ( $string )) {
$code = '' ;
}
else {
// Construct a parser instance
$parser = new SSTemplateParser ( $string );
$parser -> includeDebuggingComments = $includeDebuggingComments ;
// Ignore UTF8 BOM at begining of string. TODO: Confirm this is needed, make sure SSViewer handles UTF (and other encodings) properly
if ( substr ( $string , 0 , 3 ) == pack ( " CCC " , 0xef , 0xbb , 0xbf )) $parser -> pos = 3 ;
// Match the source against the parser
$result = $parser -> match_TopTemplate ();
if ( ! $result ) throw new SSTemplateParseException ( 'Unexpected problem parsing template' , $parser );
// Get the result
$code = $result [ 'php' ];
}
2011-02-09 05:31:16 +01: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 ) {
// If this template is a full HTML page, then put the comments just inside the HTML tag to prevent any IE glitches
if ( stripos ( $code , " <html " ) !== false ) {
$code = preg_replace ( '/(<html[^>]*>)/i' , " \\ 1<!-- template $templateName --> " , $code );
$code = preg_replace ( '/(<\/html[^>]*>)/i' , " <!-- end template $templateName --> \\ 1 " , $code );
} else {
2011-12-17 05:35:26 +01:00
$code = str_replace ( '<?php' . PHP_EOL , '<?php' . PHP_EOL . '$val .= \'<!-- template ' . $templateName . ' -->\';' . " \n " , $code );
$code .= " \n " . '$val .= \'<!-- end template ' . $templateName . ' -->\';' ;
2011-02-09 05:31:16 +01:00
}
}
return $code ;
}
2011-02-14 22:03:42 +01:00
/**
* Compiles some file that contains template source code , and returns the php code that will execute as per that
* source
*
* @ static
* @ param $template - A file path that contains template source code
* @ return mixed | string - The php that , when executed ( via include or exec ) will behave as per the template source
*/
2011-02-09 05:31:16 +01:00
static function compileFile ( $template ) {
2011-02-14 22:03:42 +01:00
return self :: compileString ( file_get_contents ( $template ), $template );
2011-02-09 05:31:16 +01:00
}
}