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
2012-04-16 06:59:56 +02:00
Angle Bracket : angle brackets " < " and " > " are used to eat whitespace between template elements
N : eats white space including newlines ( using in legacy _t support )
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-16 06:59:56 +02:00
/* Template: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | 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 ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'Translate' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-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 ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'If' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-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 ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'Require' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-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 ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'CacheBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-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 ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'UncachedBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-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-16 06:59:56 +02:00
$matcher = 'match_' . 'OldI18NTag' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-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
}
2012-04-16 06:59:56 +02:00
/* Translate: "<%t" < Entity < (Default:QuotedString)? < (!("is" "=") < "is" < Context:QuotedString)? < (InjectionVariables)? > "%>" */
protected $match_Translate_typestack = array ( 'Translate' );
function match_Translate ( $stack = array ()) {
$matchrule = " Translate " ; $result = $this -> construct ( $matchrule , $matchrule , null );
$_111 = NULL ;
do {
if (( $subres = $this -> literal ( '<%t' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
else { $_111 = FALSE ; break ; }
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
$matcher = 'match_' . 'Entity' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
else { $_111 = FALSE ; break ; }
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
$res_93 = $result ;
$pos_93 = $this -> pos ;
$_92 = NULL ;
do {
$matcher = 'match_' . 'QuotedString' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Default " );
}
else { $_92 = FALSE ; break ; }
$_92 = TRUE ; break ;
}
while ( 0 );
if ( $_92 === FALSE ) {
$result = $res_93 ;
$this -> pos = $pos_93 ;
unset ( $res_93 );
unset ( $pos_93 );
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
$res_104 = $result ;
$pos_104 = $this -> pos ;
$_103 = NULL ;
do {
$res_98 = $result ;
$pos_98 = $this -> pos ;
$_97 = NULL ;
do {
if (( $subres = $this -> literal ( 'is' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
else { $_97 = FALSE ; break ; }
if ( substr ( $this -> string , $this -> pos , 1 ) == '=' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '=' ;
}
else { $_97 = FALSE ; break ; }
$_97 = TRUE ; break ;
}
while ( 0 );
if ( $_97 === TRUE ) {
$result = $res_98 ;
$this -> pos = $pos_98 ;
$_103 = FALSE ; break ;
}
if ( $_97 === FALSE ) {
$result = $res_98 ;
$this -> pos = $pos_98 ;
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
if (( $subres = $this -> literal ( 'is' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
else { $_103 = FALSE ; break ; }
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
$matcher = 'match_' . 'QuotedString' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Context " );
}
else { $_103 = FALSE ; break ; }
$_103 = TRUE ; break ;
}
while ( 0 );
if ( $_103 === FALSE ) {
$result = $res_104 ;
$this -> pos = $pos_104 ;
unset ( $res_104 );
unset ( $pos_104 );
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
$res_108 = $result ;
$pos_108 = $this -> pos ;
$_107 = NULL ;
do {
$matcher = 'match_' . 'InjectionVariables' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
else { $_107 = FALSE ; break ; }
$_107 = TRUE ; break ;
}
while ( 0 );
if ( $_107 === FALSE ) {
$result = $res_108 ;
$this -> pos = $pos_108 ;
unset ( $res_108 );
unset ( $pos_108 );
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
if (( $subres = $this -> literal ( '%>' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
else { $_111 = FALSE ; break ; }
$_111 = TRUE ; break ;
}
while ( 0 );
if ( $_111 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_111 === FALSE ) { return FALSE ; }
}
/* InjectionVariables: (< InjectionName:Word "=" Argument)+ */
protected $match_InjectionVariables_typestack = array ( 'InjectionVariables' );
function match_InjectionVariables ( $stack = array ()) {
$matchrule = " InjectionVariables " ; $result = $this -> construct ( $matchrule , $matchrule , null );
$count = 0 ;
while ( true ) {
$res_118 = $result ;
$pos_118 = $this -> pos ;
$_117 = NULL ;
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
$matcher = 'match_' . 'Word' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " InjectionName " );
}
else { $_117 = FALSE ; break ; }
if ( substr ( $this -> string , $this -> pos , 1 ) == '=' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '=' ;
}
else { $_117 = 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 ); }
else { $_117 = FALSE ; break ; }
$_117 = TRUE ; break ;
}
while ( 0 );
if ( $_117 === FALSE ) {
$result = $res_118 ;
$this -> pos = $pos_118 ;
unset ( $res_118 );
unset ( $pos_118 );
break ;
}
$count += 1 ;
}
if ( $count > 0 ) { return $this -> finalise ( $result ); }
else { return FALSE ; }
}
/* Entity: / [A-Za-z_] [\w\.]* / */
protected $match_Entity_typestack = array ( 'Entity' );
function match_Entity ( $stack = array ()) {
$matchrule = " Entity " ; $result = $this -> construct ( $matchrule , $matchrule , null );
if (( $subres = $this -> rx ( '/ [A-Za-z_] [\w\.]* /' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
return $this -> finalise ( $result );
}
else { return FALSE ; }
}
function Translate__construct ( & $res ) {
$res [ 'php' ] = '$val .= _t(' ;
}
function Translate_Entity ( & $res , $sub ) {
$res [ 'php' ] .= " ' $sub[text] ' " ;
}
function Translate_Default ( & $res , $sub ) {
$res [ 'php' ] .= " , $sub[text] " ;
}
function Translate_Context ( & $res , $sub ) {
$res [ 'php' ] .= " , $sub[text] " ;
}
function Translate_InjectionVariables ( & $res , $sub ) {
$res [ 'php' ] .= " , $sub[php] " ;
}
function Translate__finalise ( & $res ) {
$res [ 'php' ] .= ');' ;
}
function InjectionVariables__construct ( & $res ) {
$res [ 'php' ] = " array( " ;
}
function InjectionVariables_InjectionName ( & $res , $sub ) {
$res [ 'php' ] .= " ' $sub[text] '=> " ;
}
function InjectionVariables_Argument ( & $res , $sub ) {
$res [ 'php' ] .= str_replace ( '$$FINAL' , 'XML_val' , $sub [ 'php' ]) . ',' ;
}
function InjectionVariables__finalise ( & $res ) {
if ( substr ( $res [ 'php' ], - 1 ) == ',' ) $res [ 'php' ] = substr ( $res [ 'php' ], 0 , - 1 ); //remove last comma in the array
$res [ 'php' ] .= ')' ;
}
2011-02-09 05:31:16 +01:00
/* SimpleInjection: '$' :Lookup */
2011-02-28 04:12:41 +01:00
protected $match_SimpleInjection_typestack = array ( 'SimpleInjection' );
function match_SimpleInjection ( $stack = array ()) {
$matchrule = " SimpleInjection " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 06:59:56 +02:00
$_122 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if ( substr ( $this -> string , $this -> pos , 1 ) == '$' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '$' ;
}
2012-04-16 06:59:56 +02:00
else { $_122 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Lookup' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Lookup " );
}
2012-04-16 06:59:56 +02:00
else { $_122 = FALSE ; break ; }
$_122 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_122 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_122 === 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-16 06:59:56 +02:00
$_127 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '{$' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_127 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Lookup' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Lookup " );
}
2012-04-16 06:59:56 +02:00
else { $_127 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '}' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= '}' ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
else { $_127 = FALSE ; break ; }
$_127 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_127 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_127 === 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-16 06:59:56 +02:00
$_132 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_129 = $result ;
$pos_129 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'BracketInjection' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_132 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_129 ;
$this -> pos = $pos_129 ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'SimpleInjection' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_132 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_129 ;
$this -> pos = $pos_129 ;
$_132 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_132 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_132 === 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-16 06:59:56 +02:00
$_138 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
$stack [] = $result ; $result = $this -> construct ( $matchrule , " q " );
if (( $subres = $this -> rx ( '/[\'"]/' ) ) !== FALSE ) {
2011-02-09 05:31:16 +01:00
$result [ " text " ] .= $subres ;
2011-02-28 04:12:41 +01:00
$subres = $result ; $result = array_pop ( $stack );
2011-02-09 05:31:16 +01:00
$this -> store ( $result , $subres , 'q' );
}
else {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-16 06:59:56 +02:00
$_138 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
$stack [] = $result ; $result = $this -> construct ( $matchrule , " String " );
if (( $subres = $this -> rx ( '/ (\\\\\\\\ | \\\\. | [^' . $this -> expression ( $result , $stack , 'q' ) . '\\\\])* /' ) ) !== FALSE ) {
2011-02-09 05:31:16 +01:00
$result [ " text " ] .= $subres ;
2011-02-28 04:12:41 +01:00
$subres = $result ; $result = array_pop ( $stack );
2011-02-09 05:31:16 +01:00
$this -> store ( $result , $subres , 'String' );
}
else {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-16 06:59:56 +02:00
$_138 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '' . $this -> expression ( $result , $stack , 'q' ) . '' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_138 = FALSE ; break ; }
$_138 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_138 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_138 === 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-16 06:59:56 +02:00
$_158 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_141 = $result ;
$pos_141 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'DollarMarkedLookup' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " DollarMarkedLookup " );
2012-04-16 06:59:56 +02:00
$_158 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_141 ;
$this -> pos = $pos_141 ;
$_156 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_143 = $result ;
$pos_143 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'QuotedString' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " QuotedString " );
2012-04-16 06:59:56 +02:00
$_156 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_143 ;
$this -> pos = $pos_143 ;
$_154 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_145 = $result ;
$pos_145 = $this -> pos ;
$_151 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Lookup' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Lookup " );
}
2012-04-16 06:59:56 +02:00
else { $_151 = FALSE ; break ; }
$res_150 = $result ;
$pos_150 = $this -> pos ;
$_149 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'FreeString' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
}
2012-04-16 06:59:56 +02:00
else { $_149 = FALSE ; break ; }
$_149 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_149 === TRUE ) {
$result = $res_150 ;
$this -> pos = $pos_150 ;
$_151 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
if ( $_149 === FALSE ) {
$result = $res_150 ;
$this -> pos = $pos_150 ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$_151 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_151 === TRUE ) { $_154 = TRUE ; break ; }
$result = $res_145 ;
$this -> pos = $pos_145 ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'FreeString' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " FreeString " );
2012-04-16 06:59:56 +02:00
$_154 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_145 ;
$this -> pos = $pos_145 ;
$_154 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_154 === TRUE ) { $_156 = TRUE ; break ; }
$result = $res_143 ;
$this -> pos = $pos_143 ;
$_156 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_156 === TRUE ) { $_158 = TRUE ; break ; }
$result = $res_141 ;
$this -> pos = $pos_141 ;
$_158 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_158 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_158 === 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-16 06:59:56 +02:00
$res [ 'php' ] = " ' " . str_replace ( " ' " , " \\ ' " , $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-16 06:59:56 +02:00
$_167 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_160 = $result ;
$pos_160 = $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-16 06:59:56 +02:00
$_167 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_160 ;
$this -> pos = $pos_160 ;
$_165 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_162 = $result ;
$pos_162 = $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-16 06:59:56 +02:00
$_165 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_162 ;
$this -> pos = $pos_162 ;
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '=' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= '=' ;
2012-04-16 06:59:56 +02:00
$_165 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_162 ;
$this -> pos = $pos_162 ;
$_165 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_165 === TRUE ) { $_167 = TRUE ; break ; }
$result = $res_160 ;
$this -> pos = $pos_160 ;
$_167 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_167 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_167 === 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-16 06:59:56 +02:00
$_174 = 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-16 06:59:56 +02:00
else { $_174 = 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-16 06:59:56 +02:00
else { $_174 = 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-16 06:59:56 +02:00
else { $_174 = FALSE ; break ; }
$_174 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_174 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_174 === 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-16 06:59:56 +02:00
$_181 = NULL ;
2011-02-21 03:24:14 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_179 = $result ;
$pos_179 = $this -> pos ;
$_178 = 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-16 06:59:56 +02:00
$_178 = FALSE ; break ;
2011-02-21 03:24:14 +01:00
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
$_178 = TRUE ; break ;
2011-02-21 03:24:14 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_178 === FALSE ) {
$result = $res_179 ;
$this -> pos = $pos_179 ;
unset ( $res_179 );
unset ( $pos_179 );
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-16 06:59:56 +02:00
else { $_181 = FALSE ; break ; }
$_181 = TRUE ; break ;
2011-02-21 03:24:14 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_181 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_181 === 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-16 06:59:56 +02:00
$_186 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_183 = $result ;
$pos_183 = $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-16 06:59:56 +02:00
$_186 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_183 ;
$this -> pos = $pos_183 ;
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-16 06:59:56 +02:00
$_186 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_183 ;
$this -> pos = $pos_183 ;
$_186 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_186 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_186 === 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-16 06:59:56 +02:00
$_191 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_188 = $result ;
$pos_188 = $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-16 06:59:56 +02:00
$_191 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_188 ;
$this -> pos = $pos_188 ;
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-16 06:59:56 +02:00
$_191 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_188 ;
$this -> pos = $pos_188 ;
$_191 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_191 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_191 === 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-16 06:59:56 +02:00
$_200 = 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-16 06:59:56 +02:00
else { $_200 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
while ( true ) {
2012-04-16 06:59:56 +02:00
$res_199 = $result ;
$pos_199 = $this -> pos ;
$_198 = 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-16 06:59:56 +02:00
else { $_198 = 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-16 06:59:56 +02:00
else { $_198 = FALSE ; break ; }
$_198 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_198 === FALSE ) {
$result = $res_199 ;
$this -> pos = $pos_199 ;
unset ( $res_199 );
unset ( $pos_199 );
2011-02-09 05:31:16 +01:00
break ;
}
}
2012-04-16 06:59:56 +02:00
$_200 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_200 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_200 === 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-16 06:59:56 +02:00
$_210 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_210 = 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-16 06:59:56 +02:00
else { $_210 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_210 = 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-16 06:59:56 +02:00
else { $_210 = 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-16 06:59:56 +02:00
else { $_210 = FALSE ; break ; }
$res_209 = $result ;
$pos_209 = $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-16 06:59:56 +02:00
$result = $res_209 ;
$this -> pos = $pos_209 ;
unset ( $res_209 );
unset ( $pos_209 );
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$_210 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_210 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_210 === 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-16 06:59:56 +02:00
$_220 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_220 = 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-16 06:59:56 +02:00
else { $_220 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_220 = 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-16 06:59:56 +02:00
else { $_220 = 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-16 06:59:56 +02:00
else { $_220 = 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-16 06:59:56 +02:00
else { $_220 = FALSE ; break ; }
$_220 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_220 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_220 === 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-16 06:59:56 +02:00
$_228 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_228 = 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-16 06:59:56 +02:00
else { $_228 = 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-16 06:59:56 +02:00
else { $_228 = 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-16 06:59:56 +02:00
else { $_228 = FALSE ; break ; }
$_228 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_228 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_228 === 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-16 06:59:56 +02:00
$_238 = 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-16 06:59:56 +02:00
else { $_238 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
while ( true ) {
2012-04-16 06:59:56 +02:00
$res_231 = $result ;
$pos_231 = $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-16 06:59:56 +02:00
$result = $res_231 ;
$this -> pos = $pos_231 ;
unset ( $res_231 );
unset ( $pos_231 );
2011-02-09 05:31:16 +01:00
break ;
}
}
2012-04-16 06:59:56 +02:00
$res_232 = $result ;
$pos_232 = $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-16 06:59:56 +02:00
$result = $res_232 ;
$this -> pos = $pos_232 ;
unset ( $res_232 );
unset ( $pos_232 );
2011-02-28 04:12:41 +01:00
}
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_238 = 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-16 06:59:56 +02:00
else { $_238 = 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-16 06:59:56 +02:00
else { $_238 = FALSE ; break ; }
$_238 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_238 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_238 === 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-16 06:59:56 +02:00
$_254 = NULL ;
2011-02-28 04:12:41 +01:00
do {
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_254 = 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-16 06:59:56 +02:00
else { $_254 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_254 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
$stack [] = $result ; $result = $this -> construct ( $matchrule , " Call " );
2012-04-16 06:59:56 +02:00
$_250 = 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-16 06:59:56 +02:00
else { $_250 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '(' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '(' ;
}
2012-04-16 06:59:56 +02:00
else { $_250 = 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-16 06:59:56 +02:00
else { $_250 = 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-16 06:59:56 +02:00
else { $_250 = FALSE ; break ; }
$_250 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_250 === TRUE ) {
2011-02-28 04:12:41 +01:00
$subres = $result ; $result = array_pop ( $stack );
$this -> store ( $result , $subres , 'Call' );
}
2012-04-16 06:59:56 +02:00
if ( $_250 === FALSE ) {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-16 06:59:56 +02:00
$_254 = 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-16 06:59:56 +02:00
else { $_254 = FALSE ; break ; }
$_254 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_254 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_254 === 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-16 06:59:56 +02:00
$_274 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_262 = $result ;
$pos_262 = $this -> pos ;
$_261 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$_259 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_256 = $result ;
$pos_256 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'if ' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_259 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_256 ;
$this -> pos = $pos_256 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'unless ' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_259 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_256 ;
$this -> pos = $pos_256 ;
$_259 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_259 === FALSE ) { $_261 = FALSE ; break ; }
$_261 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_261 === TRUE ) {
$result = $res_262 ;
$this -> pos = $pos_262 ;
$_274 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
if ( $_261 === FALSE ) {
$result = $res_262 ;
$this -> pos = $pos_262 ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$_272 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$_270 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_263 = $result ;
$pos_263 = $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-16 06:59:56 +02:00
$_270 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_263 ;
$this -> pos = $pos_263 ;
$_268 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_265 = $result ;
$pos_265 = $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-16 06:59:56 +02:00
$_268 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_265 ;
$this -> pos = $pos_265 ;
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-16 06:59:56 +02:00
$_268 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_265 ;
$this -> pos = $pos_265 ;
$_268 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_268 === TRUE ) { $_270 = TRUE ; break ; }
$result = $res_263 ;
$this -> pos = $pos_263 ;
$_270 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_270 === FALSE ) { $_272 = FALSE ; break ; }
$_272 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_272 === FALSE ) { $_274 = FALSE ; break ; }
$_274 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_274 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_274 === 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-16 06:59:56 +02:00
$_283 = 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-16 06:59:56 +02:00
else { $_283 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
while ( true ) {
2012-04-16 06:59:56 +02:00
$res_282 = $result ;
$pos_282 = $this -> pos ;
$_281 = 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-16 06:59:56 +02:00
else { $_281 = 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-16 06:59:56 +02:00
else { $_281 = FALSE ; break ; }
$_281 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_281 === FALSE ) {
$result = $res_282 ;
$this -> pos = $pos_282 ;
unset ( $res_282 );
unset ( $pos_282 );
2011-02-28 04:12:41 +01:00
break ;
}
}
2012-04-16 06:59:56 +02:00
$_283 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_283 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_283 === 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-16 06:59:56 +02:00
/* CacheBlockTemplate: (Comment | Translate | If | Require | OldI18NTag | 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-16 06:59:56 +02:00
$res_323 = $result ;
$pos_323 = $this -> pos ;
$_322 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$_320 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_285 = $result ;
$pos_285 = $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-16 06:59:56 +02:00
$_320 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_285 ;
$this -> pos = $pos_285 ;
$_318 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_287 = $result ;
$pos_287 = $this -> pos ;
$matcher = 'match_' . 'Translate' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_318 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_287 ;
$this -> pos = $pos_287 ;
$_316 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_289 = $result ;
$pos_289 = $this -> pos ;
$matcher = 'match_' . 'If' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_316 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_289 ;
$this -> pos = $pos_289 ;
$_314 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_291 = $result ;
$pos_291 = $this -> pos ;
$matcher = 'match_' . 'Require' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_314 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_291 ;
$this -> pos = $pos_291 ;
$_312 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_293 = $result ;
$pos_293 = $this -> pos ;
$matcher = 'match_' . 'OldI18NTag' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_312 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_293 ;
$this -> pos = $pos_293 ;
$_310 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_295 = $result ;
$pos_295 = $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-16 06:59:56 +02:00
$_310 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_295 ;
$this -> pos = $pos_295 ;
$_308 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_297 = $result ;
$pos_297 = $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-16 06:59:56 +02:00
$_308 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_297 ;
$this -> pos = $pos_297 ;
$_306 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_299 = $result ;
$pos_299 = $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-16 06:59:56 +02:00
$_306 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_299 ;
$this -> pos = $pos_299 ;
$_304 = NULL ;
2012-04-11 11:34:27 +02:00
do {
2012-04-16 06:59:56 +02:00
$res_301 = $result ;
$pos_301 = $this -> pos ;
2012-04-11 11:34:27 +02:00
$matcher = 'match_' . 'Injection' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_304 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
2012-04-16 06:59:56 +02:00
$result = $res_301 ;
$this -> pos = $pos_301 ;
2012-04-11 11:34:27 +02:00
$matcher = 'match_' . 'Text' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_304 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
2012-04-16 06:59:56 +02:00
$result = $res_301 ;
$this -> pos = $pos_301 ;
$_304 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_304 === TRUE ) { $_306 = TRUE ; break ; }
$result = $res_299 ;
$this -> pos = $pos_299 ;
$_306 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_306 === TRUE ) { $_308 = TRUE ; break ; }
$result = $res_297 ;
$this -> pos = $pos_297 ;
$_308 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_308 === TRUE ) { $_310 = TRUE ; break ; }
$result = $res_295 ;
$this -> pos = $pos_295 ;
$_310 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_310 === TRUE ) { $_312 = TRUE ; break ; }
$result = $res_293 ;
$this -> pos = $pos_293 ;
$_312 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_312 === TRUE ) { $_314 = TRUE ; break ; }
$result = $res_291 ;
$this -> pos = $pos_291 ;
$_314 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_314 === TRUE ) { $_316 = TRUE ; break ; }
$result = $res_289 ;
$this -> pos = $pos_289 ;
$_316 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_316 === TRUE ) { $_318 = TRUE ; break ; }
$result = $res_287 ;
$this -> pos = $pos_287 ;
$_318 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_318 === TRUE ) { $_320 = TRUE ; break ; }
$result = $res_285 ;
$this -> pos = $pos_285 ;
$_320 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_320 === FALSE ) { $_322 = FALSE ; break ; }
$_322 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_322 === FALSE ) {
$result = $res_323 ;
$this -> pos = $pos_323 ;
unset ( $res_323 );
unset ( $pos_323 );
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-16 06:59:56 +02:00
$_360 = NULL ;
2011-02-28 04:12:41 +01:00
do {
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_360 = 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-16 06:59:56 +02:00
else { $_360 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
$res_328 = $result ;
$pos_328 = $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-16 06:59:56 +02:00
$result = $res_328 ;
$this -> pos = $pos_328 ;
unset ( $res_328 );
unset ( $pos_328 );
}
$res_340 = $result ;
$pos_340 = $this -> pos ;
$_339 = 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-16 06:59:56 +02:00
$_335 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$_333 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_330 = $result ;
$pos_330 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'if' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_333 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_330 ;
$this -> pos = $pos_330 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'unless' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_333 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_330 ;
$this -> pos = $pos_330 ;
$_333 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_333 === FALSE ) { $_335 = FALSE ; break ; }
$_335 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_335 === TRUE ) {
2011-02-28 04:12:41 +01:00
$subres = $result ; $result = array_pop ( $stack );
$this -> store ( $result , $subres , 'Conditional' );
}
2012-04-16 06:59:56 +02:00
if ( $_335 === FALSE ) {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-16 06:59:56 +02:00
$_339 = 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-16 06:59:56 +02:00
else { $_339 = FALSE ; break ; }
$_339 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_339 === FALSE ) {
$result = $res_340 ;
$this -> pos = $pos_340 ;
unset ( $res_340 );
unset ( $pos_340 );
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-16 06:59:56 +02:00
else { $_360 = FALSE ; break ; }
$res_343 = $result ;
$pos_343 = $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-16 06:59:56 +02:00
$result = $res_343 ;
$this -> pos = $pos_343 ;
unset ( $res_343 );
unset ( $pos_343 );
2011-02-28 04:12:41 +01:00
}
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_360 = 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-16 06:59:56 +02:00
else { $_360 = FALSE ; break ; }
$_356 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$_354 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_347 = $result ;
$pos_347 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'uncached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_354 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_347 ;
$this -> pos = $pos_347 ;
$_352 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_349 = $result ;
$pos_349 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_352 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_349 ;
$this -> pos = $pos_349 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cacheblock' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_352 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_349 ;
$this -> pos = $pos_349 ;
$_352 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
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-16 06:59:56 +02:00
if ( $_354 === FALSE ) { $_356 = FALSE ; break ; }
$_356 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_356 === FALSE ) { $_360 = 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-16 06:59:56 +02:00
else { $_360 = FALSE ; break ; }
$_360 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_360 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_360 === FALSE ) { return FALSE ; }
2011-02-28 04:12:41 +01:00
}
function UncachedBlock_Template ( & $res , $sub ){
$res [ 'php' ] = $sub [ 'php' ];
}
2012-04-16 06:59:56 +02:00
/* CacheRestrictedTemplate: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | 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-16 06:59:56 +02:00
$res_408 = $result ;
$pos_408 = $this -> pos ;
$_407 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$_405 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_362 = $result ;
$pos_362 = $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-16 06:59:56 +02:00
$_405 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_362 ;
$this -> pos = $pos_362 ;
$_403 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_364 = $result ;
$pos_364 = $this -> pos ;
$matcher = 'match_' . 'Translate' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_403 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_364 ;
$this -> pos = $pos_364 ;
$_401 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_366 = $result ;
$pos_366 = $this -> pos ;
$matcher = 'match_' . 'If' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_401 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_366 ;
$this -> pos = $pos_366 ;
$_399 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_368 = $result ;
$pos_368 = $this -> pos ;
$matcher = 'match_' . 'Require' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_399 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_368 ;
$this -> pos = $pos_368 ;
$_397 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_370 = $result ;
$pos_370 = $this -> pos ;
$matcher = 'match_' . 'CacheBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_397 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_370 ;
$this -> pos = $pos_370 ;
$_395 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_372 = $result ;
$pos_372 = $this -> pos ;
$matcher = 'match_' . 'UncachedBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_395 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_372 ;
$this -> pos = $pos_372 ;
$_393 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_374 = $result ;
$pos_374 = $this -> pos ;
$matcher = 'match_' . 'OldI18NTag' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_393 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_374 ;
$this -> pos = $pos_374 ;
$_391 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_376 = $result ;
$pos_376 = $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-16 06:59:56 +02:00
$_391 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_376 ;
$this -> pos = $pos_376 ;
$_389 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_378 = $result ;
$pos_378 = $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-16 06:59:56 +02:00
$_389 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_378 ;
$this -> pos = $pos_378 ;
$_387 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_380 = $result ;
$pos_380 = $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-16 06:59:56 +02:00
$_387 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_380 ;
$this -> pos = $pos_380 ;
$_385 = NULL ;
2012-04-11 11:34:27 +02:00
do {
2012-04-16 06:59:56 +02:00
$res_382 = $result ;
$pos_382 = $this -> pos ;
2012-04-11 11:34:27 +02:00
$matcher = 'match_' . 'Injection' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_385 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
2012-04-16 06:59:56 +02:00
$result = $res_382 ;
$this -> pos = $pos_382 ;
2012-04-11 11:34:27 +02:00
$matcher = 'match_' . 'Text' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_385 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
2012-04-16 06:59:56 +02:00
$result = $res_382 ;
$this -> pos = $pos_382 ;
$_385 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_385 === TRUE ) { $_387 = TRUE ; break ; }
$result = $res_380 ;
$this -> pos = $pos_380 ;
$_387 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_387 === TRUE ) { $_389 = TRUE ; break ; }
$result = $res_378 ;
$this -> pos = $pos_378 ;
$_389 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_389 === TRUE ) { $_391 = TRUE ; break ; }
$result = $res_376 ;
$this -> pos = $pos_376 ;
$_391 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_391 === TRUE ) { $_393 = TRUE ; break ; }
$result = $res_374 ;
$this -> pos = $pos_374 ;
$_393 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_393 === TRUE ) { $_395 = TRUE ; break ; }
$result = $res_372 ;
$this -> pos = $pos_372 ;
$_395 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_395 === TRUE ) { $_397 = TRUE ; break ; }
$result = $res_370 ;
$this -> pos = $pos_370 ;
$_397 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_397 === TRUE ) { $_399 = TRUE ; break ; }
$result = $res_368 ;
$this -> pos = $pos_368 ;
$_399 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_399 === TRUE ) { $_401 = TRUE ; break ; }
$result = $res_366 ;
$this -> pos = $pos_366 ;
$_401 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_401 === TRUE ) { $_403 = TRUE ; break ; }
$result = $res_364 ;
$this -> pos = $pos_364 ;
$_403 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_403 === TRUE ) { $_405 = TRUE ; break ; }
$result = $res_362 ;
$this -> pos = $pos_362 ;
$_405 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_405 === FALSE ) { $_407 = FALSE ; break ; }
$_407 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_407 === FALSE ) {
$result = $res_408 ;
$this -> pos = $pos_408 ;
unset ( $res_408 );
unset ( $pos_408 );
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-16 06:59:56 +02:00
$_463 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_463 = 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-16 06:59:56 +02:00
$_416 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$_414 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_411 = $result ;
$pos_411 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_414 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_411 ;
$this -> pos = $pos_411 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cacheblock' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_414 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_411 ;
$this -> pos = $pos_411 ;
$_414 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_414 === FALSE ) { $_416 = FALSE ; break ; }
$_416 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_416 === TRUE ) {
2011-02-28 04:12:41 +01:00
$subres = $result ; $result = array_pop ( $stack );
$this -> store ( $result , $subres , 'CacheTag' );
}
2012-04-16 06:59:56 +02:00
if ( $_416 === FALSE ) {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-16 06:59:56 +02:00
$_463 = 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-16 06:59:56 +02:00
$res_421 = $result ;
$pos_421 = $this -> pos ;
$_420 = 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-16 06:59:56 +02:00
else { $_420 = FALSE ; break ; }
$_420 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_420 === FALSE ) {
$result = $res_421 ;
$this -> pos = $pos_421 ;
unset ( $res_421 );
unset ( $pos_421 );
}
$res_433 = $result ;
$pos_433 = $this -> pos ;
$_432 = 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-16 06:59:56 +02:00
$_428 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$_426 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_423 = $result ;
$pos_423 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'if' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_426 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_423 ;
$this -> pos = $pos_423 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'unless' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_426 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_423 ;
$this -> pos = $pos_423 ;
$_426 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_426 === FALSE ) { $_428 = FALSE ; break ; }
$_428 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_428 === 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-16 06:59:56 +02:00
if ( $_428 === FALSE ) {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-16 06:59:56 +02:00
$_432 = 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-16 06:59:56 +02:00
else { $_432 = FALSE ; break ; }
$_432 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_432 === FALSE ) {
$result = $res_433 ;
$this -> pos = $pos_433 ;
unset ( $res_433 );
unset ( $pos_433 );
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-16 06:59:56 +02:00
else { $_463 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
while ( true ) {
2012-04-16 06:59:56 +02:00
$res_446 = $result ;
$pos_446 = $this -> pos ;
$_445 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$_443 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_436 = $result ;
$pos_436 = $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-16 06:59:56 +02:00
$_443 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_436 ;
$this -> pos = $pos_436 ;
$_441 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_438 = $result ;
$pos_438 = $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-16 06:59:56 +02:00
$_441 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_438 ;
$this -> pos = $pos_438 ;
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-16 06:59:56 +02:00
$_441 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_438 ;
$this -> pos = $pos_438 ;
$_441 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_441 === TRUE ) { $_443 = TRUE ; break ; }
$result = $res_436 ;
$this -> pos = $pos_436 ;
$_443 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_443 === FALSE ) { $_445 = FALSE ; break ; }
$_445 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_445 === FALSE ) {
$result = $res_446 ;
$this -> pos = $pos_446 ;
unset ( $res_446 );
unset ( $pos_446 );
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-16 06:59:56 +02:00
else { $_463 = 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-16 06:59:56 +02:00
else { $_463 = FALSE ; break ; }
$_459 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$_457 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_450 = $result ;
$pos_450 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_457 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_450 ;
$this -> pos = $pos_450 ;
$_455 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_452 = $result ;
$pos_452 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'uncached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_455 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_452 ;
$this -> pos = $pos_452 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cacheblock' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_455 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_452 ;
$this -> pos = $pos_452 ;
$_455 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_455 === TRUE ) { $_457 = TRUE ; break ; }
$result = $res_450 ;
$this -> pos = $pos_450 ;
$_457 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_457 === FALSE ) { $_459 = FALSE ; break ; }
$_459 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_459 === FALSE ) { $_463 = 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-16 06:59:56 +02:00
else { $_463 = FALSE ; break ; }
$_463 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_463 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_463 === 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' ] .= '}' ;
}
2012-04-16 06:59:56 +02:00
/* OldTPart: "_t" N "(" N QuotedString (N "," N CallArguments)? N ")" N (";")? */
2011-02-28 04:12:41 +01:00
protected $match_OldTPart_typestack = array ( 'OldTPart' );
function match_OldTPart ( $stack = array ()) {
$matchrule = " OldTPart " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 06:59:56 +02:00
$_482 = 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-16 06:59:56 +02:00
else { $_482 = FALSE ; break ; }
$matcher = 'match_' . 'N' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
else { $_482 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '(' ) {
2011-02-21 05:44:46 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= '(' ;
2011-02-21 05:44:46 +01:00
}
2012-04-16 06:59:56 +02:00
else { $_482 = FALSE ; break ; }
$matcher = 'match_' . 'N' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
else { $_482 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'QuotedString' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-21 05:44:46 +01:00
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
2012-04-16 06:59:56 +02:00
else { $_482 = FALSE ; break ; }
$res_475 = $result ;
$pos_475 = $this -> pos ;
$_474 = NULL ;
2011-02-21 05:44:46 +01:00
do {
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'N' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
else { $_474 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == ',' ) {
2011-02-21 05:44:46 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= ',' ;
2011-02-21 05:44:46 +01:00
}
2012-04-16 06:59:56 +02:00
else { $_474 = FALSE ; break ; }
$matcher = 'match_' . 'N' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
else { $_474 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'CallArguments' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-21 05:44:46 +01:00
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
2012-04-16 06:59:56 +02:00
else { $_474 = FALSE ; break ; }
$_474 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_474 === FALSE ) {
$result = $res_475 ;
$this -> pos = $pos_475 ;
unset ( $res_475 );
unset ( $pos_475 );
2011-02-21 05:44:46 +01:00
}
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'N' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
else { $_482 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == ')' ) {
2011-02-21 05:44:46 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= ')' ;
2011-02-21 05:44:46 +01:00
}
2012-04-16 06:59:56 +02:00
else { $_482 = FALSE ; break ; }
$matcher = 'match_' . 'N' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
else { $_482 = FALSE ; break ; }
$res_481 = $result ;
$pos_481 = $this -> pos ;
$_480 = NULL ;
do {
if ( substr ( $this -> string , $this -> pos , 1 ) == ';' ) {
$this -> pos += 1 ;
$result [ " text " ] .= ';' ;
}
else { $_480 = FALSE ; break ; }
$_480 = TRUE ; break ;
}
while ( 0 );
if ( $_480 === FALSE ) {
$result = $res_481 ;
$this -> pos = $pos_481 ;
unset ( $res_481 );
unset ( $pos_481 );
}
$_482 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_482 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_482 === FALSE ) { return FALSE ; }
}
/* N: / [\s\n]* / */
protected $match_N_typestack = array ( 'N' );
function match_N ( $stack = array ()) {
$matchrule = " N " ; $result = $this -> construct ( $matchrule , $matchrule , null );
if (( $subres = $this -> rx ( '/ [\s\n]* /' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
return $this -> finalise ( $result );
}
else { return FALSE ; }
2011-02-21 05:44:46 +01:00
}
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-16 06:59:56 +02:00
$_490 = 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-16 06:59:56 +02:00
else { $_490 = 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-16 06:59:56 +02:00
else { $_490 = 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-16 06:59:56 +02:00
else { $_490 = FALSE ; break ; }
$_490 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_490 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_490 === 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-16 06:59:56 +02:00
$_507 = 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-16 06:59:56 +02:00
else { $_507 = 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-16 06:59:56 +02:00
else { $_507 = 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-16 06:59:56 +02:00
else { $_507 = 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-16 06:59:56 +02:00
else { $_507 = 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-16 06:59:56 +02:00
else { $_507 = 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-16 06:59:56 +02:00
else { $_507 = 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-16 06:59:56 +02:00
else { $_507 = 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-16 06:59:56 +02:00
else { $_507 = FALSE ; break ; }
$_507 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_507 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_507 === 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-16 06:59:56 +02:00
$_512 = NULL ;
2011-02-21 05:44:46 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_509 = $result ;
$pos_509 = $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-16 06:59:56 +02:00
$_512 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_509 ;
$this -> pos = $pos_509 ;
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-16 06:59:56 +02:00
$_512 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_509 ;
$this -> pos = $pos_509 ;
$_512 = FALSE ; break ;
2011-02-21 05:44:46 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_512 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_512 === 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 );
2012-04-16 06:59:56 +02:00
$_517 = NULL ;
2012-04-11 11:34:27 +02:00
do {
$matcher = 'match_' . 'Word' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Name " );
}
2012-04-16 06:59:56 +02:00
else { $_517 = FALSE ; break ; }
2012-04-11 11:34:27 +02:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '=' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '=' ;
}
2012-04-16 06:59:56 +02:00
else { $_517 = FALSE ; break ; }
2012-04-11 11:34:27 +02:00
$matcher = 'match_' . 'Argument' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Value " );
}
2012-04-16 06:59:56 +02:00
else { $_517 = FALSE ; break ; }
$_517 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_517 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_517 === FALSE ) { return FALSE ; }
2012-04-11 11:34:27 +02:00
}
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 );
2012-04-16 06:59:56 +02:00
$_536 = NULL ;
2012-04-11 11:34:27 +02:00
do {
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_536 = FALSE ; break ; }
2012-04-11 11:34:27 +02:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
if (( $subres = $this -> literal ( 'include' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_536 = FALSE ; break ; }
2012-04-11 11:34:27 +02:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
$matcher = 'match_' . 'Word' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Template " );
}
2012-04-16 06:59:56 +02:00
else { $_536 = FALSE ; break ; }
2012-04-11 11:34:27 +02:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
$res_533 = $result ;
$pos_533 = $this -> pos ;
$_532 = NULL ;
2012-04-11 11:34:27 +02:00
do {
$matcher = 'match_' . 'NamedArgument' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
2012-04-16 06:59:56 +02:00
else { $_532 = FALSE ; break ; }
2012-04-11 11:34:27 +02:00
while ( true ) {
2012-04-16 06:59:56 +02:00
$res_531 = $result ;
$pos_531 = $this -> pos ;
$_530 = NULL ;
2012-04-11 11:34:27 +02:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
if ( substr ( $this -> string , $this -> pos , 1 ) == ',' ) {
$this -> pos += 1 ;
$result [ " text " ] .= ',' ;
}
2012-04-16 06:59:56 +02:00
else { $_530 = FALSE ; break ; }
2012-04-11 11:34:27 +02:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
$matcher = 'match_' . 'NamedArgument' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
}
2012-04-16 06:59:56 +02:00
else { $_530 = FALSE ; break ; }
$_530 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_530 === FALSE ) {
$result = $res_531 ;
$this -> pos = $pos_531 ;
unset ( $res_531 );
unset ( $pos_531 );
2012-04-11 11:34:27 +02:00
break ;
}
}
2012-04-16 06:59:56 +02:00
$_532 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_532 === FALSE ) {
$result = $res_533 ;
$this -> pos = $pos_533 ;
unset ( $res_533 );
unset ( $pos_533 );
2012-04-11 11:34:27 +02:00
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
if (( $subres = $this -> literal ( '%>' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_536 = FALSE ; break ; }
$_536 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_536 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_536 === FALSE ) { return FALSE ; }
2012-04-11 11:34:27 +02:00
}
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-16 06:59:56 +02:00
$_545 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Argument' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Argument " );
}
2012-04-16 06:59:56 +02:00
else { $_545 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
while ( true ) {
2012-04-16 06:59:56 +02:00
$res_544 = $result ;
$pos_544 = $this -> pos ;
$_543 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == ',' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= ',' ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
else { $_543 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Argument' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Argument " );
}
2012-04-16 06:59:56 +02:00
else { $_543 = FALSE ; break ; }
$_543 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_543 === FALSE ) {
$result = $res_544 ;
$this -> pos = $pos_544 ;
unset ( $res_544 );
unset ( $pos_544 );
2011-02-09 05:31:16 +01:00
break ;
}
}
2012-04-16 06:59:56 +02:00
$_545 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_545 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_545 === 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-16 06:59:56 +02:00
$_583 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_547 = $result ;
$pos_547 = $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-16 06:59:56 +02:00
$_583 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_547 ;
$this -> pos = $pos_547 ;
$_581 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$_578 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$_576 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_549 = $result ;
$pos_549 = $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-16 06:59:56 +02:00
$_576 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_549 ;
$this -> pos = $pos_549 ;
$_574 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_551 = $result ;
$pos_551 = $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-16 06:59:56 +02:00
$_574 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_551 ;
$this -> pos = $pos_551 ;
$_572 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_553 = $result ;
$pos_553 = $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-16 06:59:56 +02:00
$_572 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_553 ;
$this -> pos = $pos_553 ;
$_570 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_555 = $result ;
$pos_555 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'require' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_570 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_555 ;
$this -> pos = $pos_555 ;
$_568 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_557 = $result ;
$pos_557 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_568 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_557 ;
$this -> pos = $pos_557 ;
$_566 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_559 = $result ;
$pos_559 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'uncached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_566 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_559 ;
$this -> pos = $pos_559 ;
$_564 = NULL ;
2012-04-11 11:34:27 +02:00
do {
2012-04-16 06:59:56 +02:00
$res_561 = $result ;
$pos_561 = $this -> pos ;
2012-04-11 11:34:27 +02:00
if (( $subres = $this -> literal ( 'cacheblock' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_564 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
2012-04-16 06:59:56 +02:00
$result = $res_561 ;
$this -> pos = $pos_561 ;
2012-04-11 11:34:27 +02:00
if (( $subres = $this -> literal ( 'include' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_564 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
2012-04-16 06:59:56 +02:00
$result = $res_561 ;
$this -> pos = $pos_561 ;
$_564 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_564 === TRUE ) { $_566 = TRUE ; break ; }
$result = $res_559 ;
$this -> pos = $pos_559 ;
$_566 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_566 === TRUE ) { $_568 = TRUE ; break ; }
$result = $res_557 ;
$this -> pos = $pos_557 ;
$_568 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_568 === TRUE ) { $_570 = TRUE ; break ; }
$result = $res_555 ;
$this -> pos = $pos_555 ;
$_570 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_570 === TRUE ) { $_572 = TRUE ; break ; }
$result = $res_553 ;
$this -> pos = $pos_553 ;
$_572 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_572 === TRUE ) { $_574 = TRUE ; break ; }
$result = $res_551 ;
$this -> pos = $pos_551 ;
$_574 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_574 === TRUE ) { $_576 = TRUE ; break ; }
$result = $res_549 ;
$this -> pos = $pos_549 ;
$_576 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_576 === FALSE ) { $_578 = FALSE ; break ; }
$_578 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_578 === FALSE ) { $_581 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_581 = FALSE ; break ; }
$_581 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_581 === TRUE ) { $_583 = TRUE ; break ; }
$result = $res_547 ;
$this -> pos = $pos_547 ;
$_583 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_583 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_583 === 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-16 06:59:56 +02:00
$_603 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_603 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
$res_587 = $result ;
$pos_587 = $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-16 06:59:56 +02:00
$result = $res_587 ;
$this -> pos = $pos_587 ;
$_603 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
else {
2012-04-16 06:59:56 +02:00
$result = $res_587 ;
$this -> pos = $pos_587 ;
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-16 06:59:56 +02:00
else { $_603 = FALSE ; break ; }
$res_593 = $result ;
$pos_593 = $this -> pos ;
$_592 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_592 = 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-16 06:59:56 +02:00
else { $_592 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_592 = FALSE ; break ; }
$_592 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_592 === FALSE ) {
$result = $res_593 ;
$this -> pos = $pos_593 ;
unset ( $res_593 );
unset ( $pos_593 );
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-16 06:59:56 +02:00
$_603 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$res_596 = $result ;
$pos_596 = $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-16 06:59:56 +02:00
$result = $res_596 ;
$this -> pos = $pos_596 ;
unset ( $res_596 );
unset ( $pos_596 );
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-16 06:59:56 +02:00
else { $_603 = 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-16 06:59:56 +02:00
else { $_603 = 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-16 06:59:56 +02:00
else { $_603 = 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-16 06:59:56 +02:00
else { $_603 = FALSE ; break ; }
$_603 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_603 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_603 === 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-16 06:59:56 +02:00
$_616 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_616 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
$res_607 = $result ;
$pos_607 = $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-16 06:59:56 +02:00
$result = $res_607 ;
$this -> pos = $pos_607 ;
$_616 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
else {
2012-04-16 06:59:56 +02:00
$result = $res_607 ;
$this -> pos = $pos_607 ;
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-16 06:59:56 +02:00
else { $_616 = FALSE ; break ; }
$res_613 = $result ;
$pos_613 = $this -> pos ;
$_612 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_612 = 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-16 06:59:56 +02:00
else { $_612 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_612 = FALSE ; break ; }
$_612 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_612 === FALSE ) {
$result = $res_613 ;
$this -> pos = $pos_613 ;
unset ( $res_613 );
unset ( $pos_613 );
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-16 06:59:56 +02:00
else { $_616 = FALSE ; break ; }
$_616 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_616 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_616 === 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-16 06:59:56 +02:00
$_624 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_624 = 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-16 06:59:56 +02:00
else { $_624 = 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-16 06:59:56 +02:00
else { $_624 = 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-16 06:59:56 +02:00
else { $_624 = FALSE ; break ; }
$_624 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_624 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_624 === 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-16 06:59:56 +02:00
$_639 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_639 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
$res_628 = $result ;
$pos_628 = $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-16 06:59:56 +02:00
$result = $res_628 ;
$this -> pos = $pos_628 ;
$_639 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
else {
2012-04-16 06:59:56 +02:00
$result = $res_628 ;
$this -> pos = $pos_628 ;
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-16 06:59:56 +02:00
else { $_639 = FALSE ; break ; }
$res_638 = $result ;
$pos_638 = $this -> pos ;
$_637 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_634 = $result ;
$pos_634 = $this -> pos ;
$_633 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_633 = 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-16 06:59:56 +02:00
else { $_633 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_633 = FALSE ; break ; }
$_633 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_633 === FALSE ) {
$result = $res_634 ;
$this -> pos = $pos_634 ;
unset ( $res_634 );
unset ( $pos_634 );
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-16 06:59:56 +02:00
else { $_637 = FALSE ; break ; }
$_637 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_637 === TRUE ) {
$result = $res_638 ;
$this -> pos = $pos_638 ;
$_639 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
if ( $_637 === FALSE ) {
$result = $res_638 ;
$this -> pos = $pos_638 ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$_639 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_639 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_639 === 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-16 06:59:56 +02:00
$_651 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_651 = 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-16 06:59:56 +02:00
$_645 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'end_' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_645 = 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-16 06:59:56 +02:00
else { $_645 = FALSE ; break ; }
$_645 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_645 === 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-16 06:59:56 +02:00
if ( $_645 === FALSE ) {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-16 06:59:56 +02:00
$_651 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$res_650 = $result ;
$pos_650 = $this -> pos ;
$_649 = 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-16 06:59:56 +02:00
else { $_649 = FALSE ; break ; }
$_649 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_649 === TRUE ) {
$result = $res_650 ;
$this -> pos = $pos_650 ;
$_651 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
if ( $_649 === FALSE ) {
$result = $res_650 ;
$this -> pos = $pos_650 ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$_651 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_651 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_651 === 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-16 06:59:56 +02:00
$_656 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_653 = $result ;
$pos_653 = $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-16 06:59:56 +02:00
$_656 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_653 ;
$this -> pos = $pos_653 ;
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-16 06:59:56 +02:00
$_656 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_653 ;
$this -> pos = $pos_653 ;
$_656 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_656 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_656 === 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-16 06:59:56 +02:00
$_664 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%--' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_664 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
$count = 0 ;
while ( true ) {
2012-04-16 06:59:56 +02:00
$res_662 = $result ;
$pos_662 = $this -> pos ;
$_661 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_659 = $result ;
$pos_659 = $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-16 06:59:56 +02:00
$result = $res_659 ;
$this -> pos = $pos_659 ;
$_661 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
else {
2012-04-16 06:59:56 +02:00
$result = $res_659 ;
$this -> pos = $pos_659 ;
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-16 06:59:56 +02:00
else { $_661 = FALSE ; break ; }
$_661 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_661 === FALSE ) {
$result = $res_662 ;
$this -> pos = $pos_662 ;
unset ( $res_662 );
unset ( $pos_662 );
2011-02-09 05:31:16 +01:00
break ;
}
$count += 1 ;
}
if ( $count > 0 ) { }
2012-04-16 06:59:56 +02:00
else { $_664 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '--%>' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_664 = FALSE ; break ; }
$_664 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_664 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_664 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
function Comment__construct ( & $res ) {
$res [ 'php' ] = '' ;
}
2012-04-16 06:59:56 +02:00
/* TopTemplate: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | 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-16 06:59:56 +02:00
$res_716 = $result ;
$pos_716 = $this -> pos ;
$_715 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$_713 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_666 = $result ;
$pos_666 = $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-16 06:59:56 +02:00
$_713 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_666 ;
$this -> pos = $pos_666 ;
$_711 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_668 = $result ;
$pos_668 = $this -> pos ;
$matcher = 'match_' . 'Translate' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_711 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_668 ;
$this -> pos = $pos_668 ;
$_709 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_670 = $result ;
$pos_670 = $this -> pos ;
$matcher = 'match_' . 'If' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_709 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_670 ;
$this -> pos = $pos_670 ;
$_707 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_672 = $result ;
$pos_672 = $this -> pos ;
$matcher = 'match_' . 'Require' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_707 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_672 ;
$this -> pos = $pos_672 ;
$_705 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_674 = $result ;
$pos_674 = $this -> pos ;
$matcher = 'match_' . 'CacheBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_705 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_674 ;
$this -> pos = $pos_674 ;
$_703 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_676 = $result ;
$pos_676 = $this -> pos ;
$matcher = 'match_' . 'UncachedBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_703 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_676 ;
$this -> pos = $pos_676 ;
$_701 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_678 = $result ;
$pos_678 = $this -> pos ;
$matcher = 'match_' . 'OldI18NTag' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_701 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_678 ;
$this -> pos = $pos_678 ;
$_699 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_680 = $result ;
$pos_680 = $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 ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_699 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_680 ;
$this -> pos = $pos_680 ;
$_697 = NULL ;
2011-02-21 05:44:46 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_682 = $result ;
$pos_682 = $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 ))) ) );
2011-02-21 05:44:46 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_697 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_682 ;
$this -> pos = $pos_682 ;
$_695 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_684 = $result ;
$pos_684 = $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-16 06:59:56 +02:00
$_695 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_684 ;
$this -> pos = $pos_684 ;
$_693 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_686 = $result ;
$pos_686 = $this -> pos ;
2012-04-11 11:34:27 +02:00
$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-16 06:59:56 +02:00
$_693 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_686 ;
$this -> pos = $pos_686 ;
$_691 = NULL ;
2012-04-11 11:34:27 +02:00
do {
2012-04-16 06:59:56 +02:00
$res_688 = $result ;
$pos_688 = $this -> pos ;
2012-04-11 11:34:27 +02:00
$matcher = 'match_' . 'Injection' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_691 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
2012-04-16 06:59:56 +02:00
$result = $res_688 ;
$this -> pos = $pos_688 ;
2012-04-11 11:34:27 +02:00
$matcher = 'match_' . 'Text' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 06:59:56 +02:00
$_691 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
2012-04-16 06:59:56 +02:00
$result = $res_688 ;
$this -> pos = $pos_688 ;
$_691 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_691 === TRUE ) { $_693 = TRUE ; break ; }
$result = $res_686 ;
$this -> pos = $pos_686 ;
$_693 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_693 === TRUE ) { $_695 = TRUE ; break ; }
$result = $res_684 ;
$this -> pos = $pos_684 ;
$_695 = FALSE ; break ;
2011-02-21 05:44:46 +01:00
}
2011-02-28 04:12:41 +01:00
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_695 === TRUE ) { $_697 = TRUE ; break ; }
$result = $res_682 ;
$this -> pos = $pos_682 ;
$_697 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-21 05:44:46 +01:00
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_697 === TRUE ) { $_699 = TRUE ; break ; }
$result = $res_680 ;
$this -> pos = $pos_680 ;
$_699 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_699 === TRUE ) { $_701 = TRUE ; break ; }
$result = $res_678 ;
$this -> pos = $pos_678 ;
$_701 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_701 === TRUE ) { $_703 = TRUE ; break ; }
$result = $res_676 ;
$this -> pos = $pos_676 ;
$_703 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_703 === TRUE ) { $_705 = TRUE ; break ; }
$result = $res_674 ;
$this -> pos = $pos_674 ;
$_705 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_705 === TRUE ) { $_707 = TRUE ; break ; }
$result = $res_672 ;
$this -> pos = $pos_672 ;
$_707 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_707 === TRUE ) { $_709 = TRUE ; break ; }
$result = $res_670 ;
$this -> pos = $pos_670 ;
$_709 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_709 === TRUE ) { $_711 = TRUE ; break ; }
$result = $res_668 ;
$this -> pos = $pos_668 ;
$_711 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_711 === TRUE ) { $_713 = TRUE ; break ; }
$result = $res_666 ;
$this -> pos = $pos_666 ;
$_713 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_713 === FALSE ) { $_715 = FALSE ; break ; }
$_715 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_715 === FALSE ) {
$result = $res_716 ;
$this -> pos = $pos_716 ;
unset ( $res_716 );
unset ( $pos_716 );
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-16 06:59:56 +02:00
$res_755 = $result ;
$pos_755 = $this -> pos ;
$_754 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-16 06:59:56 +02:00
$_752 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_717 = $result ;
$pos_717 = $this -> pos ;
2011-03-17 01:08:13 +01:00
if (( $subres = $this -> rx ( '/ [^<${\\\\]+ /' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_752 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_717 ;
$this -> pos = $pos_717 ;
$_750 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_719 = $result ;
$pos_719 = $this -> pos ;
2011-03-17 01:08:13 +01:00
if (( $subres = $this -> rx ( '/ (\\\\.) /' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 06:59:56 +02:00
$_750 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
2012-04-16 06:59:56 +02:00
$result = $res_719 ;
$this -> pos = $pos_719 ;
$_748 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_721 = $result ;
$pos_721 = $this -> pos ;
$_724 = NULL ;
2011-03-17 01:08:13 +01:00
do {
if ( substr ( $this -> string , $this -> pos , 1 ) == '<' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '<' ;
}
2012-04-16 06:59:56 +02:00
else { $_724 = FALSE ; break ; }
$res_723 = $result ;
$pos_723 = $this -> pos ;
2011-03-17 01:08:13 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '%' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '%' ;
2012-04-16 06:59:56 +02:00
$result = $res_723 ;
$this -> pos = $pos_723 ;
$_724 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
else {
2012-04-16 06:59:56 +02:00
$result = $res_723 ;
$this -> pos = $pos_723 ;
2011-03-17 01:08:13 +01:00
}
2012-04-16 06:59:56 +02:00
$_724 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_724 === TRUE ) { $_748 = TRUE ; break ; }
$result = $res_721 ;
$this -> pos = $pos_721 ;
$_746 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_726 = $result ;
$pos_726 = $this -> pos ;
$_731 = NULL ;
2011-03-17 01:08:13 +01:00
do {
if ( substr ( $this -> string , $this -> pos , 1 ) == '$' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '$' ;
}
2012-04-16 06:59:56 +02:00
else { $_731 = FALSE ; break ; }
$res_730 = $result ;
$pos_730 = $this -> pos ;
$_729 = NULL ;
2011-03-17 01:08:13 +01:00
do {
if (( $subres = $this -> rx ( '/[A-Za-z_]/' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_729 = FALSE ; break ; }
$_729 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_729 === TRUE ) {
$result = $res_730 ;
$this -> pos = $pos_730 ;
$_731 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
2012-04-16 06:59:56 +02:00
if ( $_729 === FALSE ) {
$result = $res_730 ;
$this -> pos = $pos_730 ;
2011-03-17 01:08:13 +01:00
}
2012-04-16 06:59:56 +02:00
$_731 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_731 === TRUE ) { $_746 = TRUE ; break ; }
$result = $res_726 ;
$this -> pos = $pos_726 ;
$_744 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-16 06:59:56 +02:00
$res_733 = $result ;
$pos_733 = $this -> pos ;
$_736 = NULL ;
2011-03-17 01:08:13 +01:00
do {
if ( substr ( $this -> string , $this -> pos , 1 ) == '{' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '{' ;
}
2012-04-16 06:59:56 +02:00
else { $_736 = FALSE ; break ; }
$res_735 = $result ;
$pos_735 = $this -> pos ;
2011-03-17 01:08:13 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '$' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '$' ;
2012-04-16 06:59:56 +02:00
$result = $res_735 ;
$this -> pos = $pos_735 ;
$_736 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
else {
2012-04-16 06:59:56 +02:00
$result = $res_735 ;
$this -> pos = $pos_735 ;
2011-03-17 01:08:13 +01:00
}
2012-04-16 06:59:56 +02:00
$_736 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_736 === TRUE ) { $_744 = TRUE ; break ; }
$result = $res_733 ;
$this -> pos = $pos_733 ;
$_742 = NULL ;
2011-03-17 01:08:13 +01:00
do {
if (( $subres = $this -> literal ( '{$' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_742 = FALSE ; break ; }
$res_741 = $result ;
$pos_741 = $this -> pos ;
$_740 = NULL ;
2011-03-17 01:08:13 +01:00
do {
if (( $subres = $this -> rx ( '/[A-Za-z_]/' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 06:59:56 +02:00
else { $_740 = FALSE ; break ; }
$_740 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_740 === TRUE ) {
$result = $res_741 ;
$this -> pos = $pos_741 ;
$_742 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
2012-04-16 06:59:56 +02:00
if ( $_740 === FALSE ) {
$result = $res_741 ;
$this -> pos = $pos_741 ;
2011-03-17 01:08:13 +01:00
}
2012-04-16 06:59:56 +02:00
$_742 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_742 === TRUE ) { $_744 = TRUE ; break ; }
$result = $res_733 ;
$this -> pos = $pos_733 ;
$_744 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_744 === TRUE ) { $_746 = TRUE ; break ; }
$result = $res_726 ;
$this -> pos = $pos_726 ;
$_746 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_746 === TRUE ) { $_748 = TRUE ; break ; }
$result = $res_721 ;
$this -> pos = $pos_721 ;
$_748 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_748 === TRUE ) { $_750 = TRUE ; break ; }
$result = $res_719 ;
$this -> pos = $pos_719 ;
$_750 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_750 === TRUE ) { $_752 = TRUE ; break ; }
$result = $res_717 ;
$this -> pos = $pos_717 ;
$_752 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_752 === FALSE ) { $_754 = FALSE ; break ; }
$_754 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 06:59:56 +02:00
if ( $_754 === FALSE ) {
$result = $res_755 ;
$this -> pos = $pos_755 ;
unset ( $res_755 );
unset ( $pos_755 );
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
}
}